版本比较
学习笔记——Nim 积
标题
增加 1 行删除 1 行
11Nim 积学习笔记学习笔记——Nim 积正文
增加 90 行删除 2 行
1234567821 行未改动303132333435363337383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913043131132133134135112 行未改动全部展开太难了!!!
了解更多:《On Numbers and Games》——J. H. Conway
## 定义两数 $x,y$ 的 Nim 积定义为:$$x \otimes y = \operatorname{mex}\{ (x \otimes j) \oplus (y \otimes i) \oplus (i \otimes j) \mid 0 \le i < x,0 \le j < y \}21 行未改动证明等我学会了再补 ~~(可能这辈子都学不会)~~。
### 运算性质由表可以看出来,$x \otimes 0 = 0,x \otimes 1 = x$。:::info[证明]当 $y=0$ 时,不存在 $j$ 满足 $0 \le j <y$,所以 $\{ (x \otimes j) \oplus (y \otimes i) \oplus (i \otimes j) \mid 0 \le i < x,0 \le j < y \} =\varnothing$,所以 $x \otimes 0 = \operatorname{mex} \varnothing =0$。
Nim 积和异或运算满足交换律和结合律,即:当 $y=1$ 时,$j$ 只能取 $0$,即:$$\begin{aligned}&x \otimes 1 \\=& \operatorname{mex}\{(x \otimes 0) \oplus (1 \otimes i) \oplus (0 \otimes i) \mid 0 \le i <x \} \\=& \operatorname{mex}\{0 \oplus (1 \otimes i) \oplus 0 \mid 0 \le i <x \} \\=& \operatorname{mex}\{(1 \otimes i) \mid 0 \le i <x \} \\\end{aligned}$$依据归纳法可得 $x \otimes 1 = \operatorname{mex}\{ i\mid 0 \le i <x \} = x$。:::
Nim 积和异或运算满足交换律、结合律和分配律,即:$$\begin{aligned}
x \otimes y &= y \otimes x \\x \otimes (y \otimes z) &= (x \otimes y) \otimes z \\x \otimes (y \oplus z) &= (x \otimes y) \oplus (x \otimes z)\end{aligned}$$::::info[证明]#### 交换律显然。。。。。。#### 结合律咕咕咕...#### 分配律对 $x$ 进行强归纳。假设对所有 $x'<x$ 分配律成立。再对 $y,z$ 进行双重归纳,假设对更小的 $y',z'$ 分配律成立(即 $y'<y$ 或 $z'<z$ 时命题成立)。
令 $w = y \oplus z$。\由定义,$x \otimes w = \operatorname{mex} S$。\其中,$S = \{ (x'\otimes w)\oplus(x\otimes w')\oplus(x'\otimes w') \mid 0 \le x'< x,0 \le w'<w \}$。\要证明 $(x \otimes y) \oplus (x \otimes z) = \operatorname{mex} S$。
根据归纳假设,对于 $x' < x$,有 $x' \otimes w = (x' \otimes y) \oplus (x' \otimes z)$。\将 $S$ 改写成:$$S = \{ ((x' \otimes y) \oplus (x' \otimes z)) \oplus (x \otimes w') \oplus (x' \otimes w') \mid 0 \le x' < x,0 \le w' < w \}$$然后来证两个东西。:::info[$( x \otimes y) \oplus (x \otimes z) \notin S$]若存在 $0 \le x' <x,0 \le w' < w$,使得 $( x \otimes y) \oplus (x \otimes z) = ((x' \otimes y) \oplus (x' \otimes z)) \oplus (x \otimes w') \oplus (x' \otimes w')$,则可以通过归纳证明某个更小三元组违背分配律,与假设矛盾,故上述结论成立。
这一步的详细证明咕咕咕啦。::::::info[所有小于 $( x \otimes y) \oplus (x \otimes z)$ 的数都属于 $S$]令 $u = ( x \otimes y) \oplus (x \otimes z)$。\对任意 $t < u$,要构造 $0 \le x' < x,0 \le w' < w$,使得 $$t = (x' \otimes w) \oplus (x \otimes w') \oplus (x' \otimes w')\tag{1}$$记 $p = x \otimes y,q = x \otimes z$。\$u=p \oplus q$,因为 $t < u$,所以存在一个最高位二进制 $k$,使得 $t_k = 0,u_k = 1$ 且对任何更高位 $j > k$,都有 $t_j = u_j$。\由此,$p$ 和 $q$ 在第 $k$ 位恰有一个为 $1$。\不妨设 $p_k = 1,q_k = 0$(若相反,则交换 $y,z$,论证对称)。
现在利用 Nim 积的定义作用于 $p = x \otimes y$。\根据定义,$p$ 是集合 $A=\{ (a \otimes y) \oplus (x \otimes b) \oplus (a \otimes b) \mid 0 \le a < x,0 \le b < y\}$ 的 **mex**,因此所有小于 $p$ 的数都属于 $A$。\特别地,可以选取一个数 $r \in A$,使得 $r$ 满足以下条件:- $r<p$。- $r$ 与 $p$ 在高于 $k$ 的所有位上完全相同。- $r$ 的第 $k$ 位为 $0$。- 此外,通过适当选择 $r$ 低于 $k$ 的位,可以确保 $$t \oplus r < q \tag{2}$$
为什么这样的 $r$ 存在?因为 $A$ 包含了所有小于 $p$ 的数,而我们可以自由选择任何小于 $p$ 且具有指定高位模式的数(高位模式由 $p$ 固定,第 $k$ 位为 $0$,低位任意)。这些数都小于 $p$,所以都在 $A$ 中。我们只需从这些数中选一个,使得 (2) 成立即可。由于 (2) 只依赖于低位,而低位可以任意调整(因为 $A$ 包含了所有这样的数),所以这样的选择总是可行的。
既然 $r \in A$,存在 $a < x$ 和 $b < y$,使得$$r = (a \otimes y) \oplus (x \otimes b) \oplus (a \otimes b) \tag{3}$$接下来,令 $t' = t \oplus r$。由 (2) 知 $t' < q = x \otimes z$。由于 $q$ 是集合 $B = \{ (a' \otimes z) \oplus (x \otimes z') \oplus (a' \otimes z') \mid 0 \le a' < x,0 \le z' < z \}$ 的 mex,而 $t' < q$,所以 $t' \in B$,即存在 $a' < x$ 和 $z' < z$,使得$$t' = (a' \otimes z) \oplus (x \otimes z') \oplus (a' \otimes z') \tag{4}$$现在,将 (3) 和 (4) 结合起来。由 $t = t' \oplus r$,有$$t = \bigl( (a' \otimes z) \oplus (x \otimes z') \oplus (a' \otimes z') \bigr)\oplus\bigl( (a \otimes y) \oplus (x \otimes b) \oplus (a \otimes b) \bigr) \tag{5}$$现在希望将 (5) 化为形如 (1) 的表达式,其中 $x'$ 和 $w'$ 待定。利用归纳假设,分配律对更小的 $x$ 项成立(因为 $a < x$ 和 $a' < x$),我们有$$a \otimes w = (a \otimes y) \oplus (a \otimes z) \\a' \otimes w = (a' \otimes y) \oplus (a' \otimes z)$$其中 $w = y \oplus z$。于是可以重排 (5) 中的各项,并利用异或的交换律和结合律,将其合并。\具体地,令 $x' = a \oplus a'$(这里的 $\oplus$ 是异或,但注意 $x'$ 必须小于 $x$,这需要验证,但由归纳构造可保证)以及 $w' = b \oplus z' \oplus (a \otimes b) \oplus (a' \otimes z') \oplus \dots$。\注意到 (5) 是若干项的异或,其中每一项形如 $u_1 \otimes v_1$。我们利用归纳假设(分配律)将 $a \otimes y$ 和 $a \otimes z$ 合并为 $a \otimes w$,将 $a' \otimes y$ 和 $a' \otimes z$ 合并为 $a' \otimes w$。为此,在 (5) 中,将 $a \otimes y$ 和 $a' \otimes z$ 等项配对,利用异或的消去律和分配律的归纳形式,可以证明存在某个 $x' < x$ 和某个 $w' < w$ 使得 (5) 右侧等于 $(x' \otimes w) \oplus (x \otimes w') \oplus (x' \otimes w')$。
经过一系列合法的项重组,总能得到 (1) 的形式。因此,$t \in S$。:::经过上述证明可以得到 $x \otimes (y \oplus z) = (x \otimes y) \oplus (x \otimes z)$。::::
### 有关费马数的性质~~经过数学家的艰苦卓绝的努力~~,我们有两个十分强大的运算法则。~~经过数学家的艰苦卓绝的努力~~,有两个十分强大的运算法则。
定义 **Fermat 2-power** $x = 2^{2^n}$,其中 $n \in \mathbb{N}$。
1. 一个 Fermat 2-power 与任意**小于**它的数的 Nim 积为一般意义下乘法的积,$x \otimes y = x (x>y)$。112 行未改动全部展开