def nimSum
Statement as elaborated and printed by Lean 4.26.0
List ℕ → ℕProject declarations in the statement: none
Project declarations used by the proof or definition body
none
Checked definition or construction Lean contains the definition or construction, with checked properties.
Definition 4.3 (Nim-sum) For heap sizes , define where denotes bitwise XOR.
Generated from paper_jmlr.tex, lines 424–431.
The nim-sum of heap sizes is their bitwise XOR: write each size in binary and, in each bit position, count the ones; the result has a 1 exactly where that count is odd. Example: : $011\oplus101\oplus110 = 0000$.
Each bit of the nim-sum is therefore a parity over all heaps, which is what makes it hard for shallow circuits.
nimSum folds Lean's bitwise XOR over the list of heaps (empty board: ).
nimSum_append proves that the nim-sum of two concatenated lists is the XOR of their nim-sums, the
basic tool for local reasoning about one changed heap.
| Paper anchor | def:nimsum (manuscript label) |
|---|---|
| Displayed as | Definition 4.3 |
| Claim | The nim-sum is the bitwise XOR of the heap sizes |
| Coverage category | Checked definition or construction |
| Statement source | paper_jmlr.tex lines 424–431; SHA-256 of the normalised block source c868301621191346… |
| Lean declarations |
|
| Audited correspondence rows | def:nimsum |
| Explanations | explain/def:nimsum, formal/def:nimsum |
| Build evidence | fresh isolated rebuild, audit report |
nimSumStatement as elaborated and printed by Lean 4.26.0
List ℕ → ℕProject declarations in the statement: none
none
nimSum_appendStatement as elaborated and printed by Lean 4.26.0
∀ (xs ys : List ℕ), NimAudit.nimSum (xs ++ ys) = NimAudit.nimSum xs ^^^ NimAudit.nimSum ys20theorem nimSum_append (xs ys : List Nat) :21 nimSum (xs ++ ys) = nimSum xs ^^^ nimSum ys := by22 induction xs with23 | nil => simp [nimSum]24 | cons h t ih => simp [nimSum, ih, Nat.xor_assoc]Project declarations in the statement: nimSum
| Module | File | Lines | Imports |
|---|---|---|---|
| NimCore | lean/NimCore.lean | 139 | Std |
Build evidence: fresh isolated rebuild of all 38 bundled modules with Lean (version 4.26.0, started 2026-10-10T15:21:56Z, finished 2026-10-10T15:27:00Z: 38/38 modules compiled, 1588 axiom reports, no errors. See Build for the commands and the independent audit of 2026-10-10 (dated evidence).