Principal declarations
theorem Bypass.diff_of_transition
Module Bypass
(lean/phase6/Bypass.lean, lines 197–210) · file SHA-256 d2e3ef2e71220448… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
ONE-LEGAL-TRANSITION FORM: when consecutive supplied boards differ by one legal move,
the threshold controller reports exactly that heap's XOR difference.
Statement as elaborated and printed by Lean 4.26.0
∀ {B N : ℕ} {Q Q' : List ℕ},
N < 2 ^ NimAudit.WholeGame.rIdx N →
Q.length = N →
Q'.length = N →
NimAudit.Game.Width B Q →
NimAudit.Game.Width B Q' →
NimAudit.Game.Move Q Q' →
∃ pre x post z,
Q = pre ++ x :: post ∧
Q' = pre ++ z :: post ∧
(NimAudit.ThresholdInst.trun B (NimAudit.WholeGame.rIdx N)
(NimAudit.ControllerBits.sbits B (NimAudit.WholeGame.rIdx N)
NimAudit.Controller.cinit)
(NimAudit.Controller.stream [Q, Q'])).2[2]? =
some (NimAudit.Controller.COut.summary (NimAudit.nimSum Q') (some (x ^^^ z)))
Exact source text, lines 197–210
197/-- ONE-LEGAL-TRANSITION FORM: when consecutive supplied boards differ by one legal move,198 the threshold controller reports exactly that heap's XOR difference. -/199theorem diff_of_transition {B N : Nat} {Q Q' : List Nat} (hN : N < 2 ^ rIdx N) (hQ : Q.length = N)200 (hQ' : Q'.length = N) (hw : Width B Q) (hw' : Width B Q') (hm : Move Q Q') :201 ∃ pre x post z, Q = pre ++ x :: post ∧ Q' = pre ++ z :: post ∧202 (trun B (rIdx N) (sbits B (rIdx N) cinit) (stream [Q, Q'])).2[2]? =203 some (COut.summary (nimSum Q') (some (x ^^^ z))) := by204 obtain ⟨pre, x, post, z, h1, h2, _, h4⟩ := one_transition_diff hm205 refine ⟨pre, x, post, z, h1, h2, ?_⟩206 rw [trun_stream hN [Q, Q'] (by207 intro P hP; simp only [List.mem_cons, List.mem_nil_iff, or_false] at hP208 rcases hP with rfl | rfl209 · exact ⟨hQ, hw⟩210 · exact ⟨hQ', hw'⟩), ctrlOuts_two, h4]
Project declarations in the statement: Controller.COut, Controller.COut.summary, Controller.cinit, Controller.stream, ControllerBits.sbits, Game.Move, Game.Width, ThresholdInst.trun, WholeGame.rIdx, nimSum
Project declarations used by the proof or definition body
Bypass.ctrlOuts_two, Bypass.one_transition_diff, Controller.COut, Controller.COut.summary, Controller.cinit, Controller.ctrlOuts, Controller.stream, ControllerBits.sbits, Game.Move, Game.Width, ThresholdInst.trun, ThresholdInst.trun_stream, WholeGame.rIdx, nimSum
theorem Bypass.diff_with_postMove
Module Bypass
(lean/phase6/Bypass.lean, lines 212–229) · file SHA-256 d2e3ef2e71220448… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
POST-MOVE BOARD SUPPLIED: if the protocol also supplies the player's own post-move
board R (nim(R) = 0) before the opponent's board P', the reported difference at P'
is the opponent's one-heap delta x ⊕ z, which equals nim(P') (the restoration target).
Statement as elaborated and printed by Lean 4.26.0
∀ {B N : ℕ} {P0 R P' : List ℕ},
N < 2 ^ NimAudit.WholeGame.rIdx N →
P0.length = N ∧ NimAudit.Game.Width B P0 →
R.length = N ∧ NimAudit.Game.Width B R →
P'.length = N ∧ NimAudit.Game.Width B P' →
NimAudit.nimSum R = 0 →
NimAudit.Game.Move R P' →
∃ pre x post z,
R = pre ++ x :: post ∧
P' = pre ++ z :: post ∧
(NimAudit.ThresholdInst.trun B (NimAudit.WholeGame.rIdx N)
(NimAudit.ControllerBits.sbits B (NimAudit.WholeGame.rIdx N)
NimAudit.Controller.cinit)
(NimAudit.Controller.stream [P0, R, P'])).2[4]? =
some
(NimAudit.Controller.COut.summary (NimAudit.nimSum P') (some (x ^^^ z))) ∧
x ^^^ z = NimAudit.nimSum P'
Exact source text, lines 212–229
212/-- POST-MOVE BOARD SUPPLIED: if the protocol also supplies the player's own post-move213 board R (nim(R) = 0) before the opponent's board P', the reported difference at P'214 is the opponent's one-heap delta x ⊕ z, which equals nim(P') (the restoration target). -/215theorem diff_with_postMove {B N : Nat} {P0 R P' : List Nat} (hN : N < 2 ^ rIdx N)216 (h0 : P0.length = N ∧ Width B P0) (h1 : R.length = N ∧ Width B R) (h2 : P'.length = N ∧ Width B P')217 (hz : nimSum R = 0) (hm : Move R P') :218 ∃ pre x post z, R = pre ++ x :: post ∧ P' = pre ++ z :: post ∧219 (trun B (rIdx N) (sbits B (rIdx N) cinit) (stream [P0, R, P'])).2[4]? =220 some (COut.summary (nimSum P') (some (x ^^^ z))) ∧ x ^^^ z = nimSum P' := by221 obtain ⟨pre, x, post, z, e1, e2, _, e4⟩ := one_transition_diff hm222 refine ⟨pre, x, post, z, e1, e2, ?_, by rw [← e4, hz, Nat.zero_xor]⟩223 rw [trun_stream hN [P0, R, P'] (by224 intro P hP; simp only [List.mem_cons, List.mem_nil_iff, or_false] at hP225 rcases hP with rfl | rfl | rfl226 · exact h0227 · exact h1228 · exact h2), ← e4]229 simp [ctrlOuts]
Project declarations in the statement: Controller.COut, Controller.COut.summary, Controller.cinit, Controller.stream, ControllerBits.sbits, Game.Move, Game.Width, ThresholdInst.trun, WholeGame.rIdx, nimSum
Project declarations used by the proof or definition body
Bypass.one_transition_diff, Controller.COut, Controller.COut.move, Controller.COut.summary, Controller.cinit, Controller.ctrlOuts, Controller.stream, ControllerBits.sbits, Game.Move, Game.Width, Recurrent.replayMove, ThresholdInst.trun, ThresholdInst.trun_stream, WholeGame.rIdx, nimSum
theorem Bypass.diff_decision_only
Module Bypass
(lean/phase6/Bypass.lean, lines 231–245) · file SHA-256 d2e3ef2e71220448… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
DECISION-TIME BOARDS ONLY: the reported difference spans two moves and is in general
NOT the opponent's delta. Concretely: P0 = [1,2] (player to move), the player moves to
R = [1,1] (nim 0), the opponent moves to P1 = [0,1] (delta 1); supplying only P0 and P1,
the threshold controller reports difference 2.
Statement as elaborated and printed by Lean 4.26.0
NimAudit.Game.Move [1, 2] [1, 1] ∧
NimAudit.nimSum [1, 1] = 0 ∧
NimAudit.Game.Move [1, 1] [0, 1] ∧
1 ^^^ 0 = 1 ∧
(NimAudit.ThresholdInst.trun 2 (NimAudit.WholeGame.rIdx 2)
(NimAudit.ControllerBits.sbits 2 (NimAudit.WholeGame.rIdx 2)
NimAudit.Controller.cinit)
(NimAudit.Controller.stream [[1, 2], [0, 1]])).2[2]? =
some (NimAudit.Controller.COut.summary 1 (some 2))
Exact source text, lines 231–245
231/-- DECISION-TIME BOARDS ONLY: the reported difference spans two moves and is in general232 NOT the opponent's delta. Concretely: P0 = [1,2] (player to move), the player moves to233 R = [1,1] (nim 0), the opponent moves to P1 = [0,1] (delta 1); supplying only P0 and P1,234 the threshold controller reports difference 2. -/235theorem diff_decision_only :236 Move [1, 2] [1, 1] ∧ nimSum [1, 1] = 0 ∧ Move [1, 1] [0, 1] ∧ (1 ^^^ 0 : Nat) = 1 ∧237 (trun 2 (rIdx 2) (sbits 2 (rIdx 2) cinit) (stream [[1, 2], [0, 1]])).2[2]? =238 some (COut.summary 1 (some 2)) := by239 refine ⟨⟨[1], 2, [], 1, rfl, rfl, by decide⟩, by decide, ⟨[], 1, [1], 0, rfl, rfl, by decide⟩, by decide, ?_⟩240 rw [trun_stream (rIdx_counter 2) _ (by241 intro P hP; simp only [List.mem_cons, List.mem_nil_iff, or_false] at hP242 rcases hP with rfl | rfl243 · exact ⟨rfl, by intro x hx; simp at hx; omega⟩244 · exact ⟨rfl, by intro x hx; simp at hx; omega⟩), ctrlOuts_two]245 rfl
Project declarations in the statement: Controller.COut, Controller.COut.summary, Controller.cinit, Controller.stream, ControllerBits.sbits, Game.Move, ThresholdInst.trun, WholeGame.rIdx, nimSum
Project declarations used by the proof or definition body
Bypass.ctrlOuts_two, Controller.COut, Controller.COut.summary, Controller.cinit, Controller.ctrlOuts, Controller.stream, ControllerBits.sbits, Family.rIdx_counter, Game.Move, Game.Width, ThresholdInst.trun, ThresholdInst.trun_stream, WholeGame.rIdx, nimSum
theorem Recurrent.stream_reports_delta
Module NimRecurrent
(lean/phase3/NimRecurrent.lean, lines 173–177) · file SHA-256 1f2994aefc75e7f5… Axioms reported by the fresh build: propext
Statement as elaborated and printed by Lean 4.26.0
∀ (Q Q' : List ℕ) (Ps : List (List ℕ)),
NimAudit.Recurrent.expectedOuts false 0 (Q :: Q' :: Ps) =
{ summary := NimAudit.nimSum Q, diff := none } ::
{ summary := NimAudit.nimSum Q', diff := some (NimAudit.nimSum Q ^^^ NimAudit.nimSum Q') } ::
NimAudit.Recurrent.expectedOuts true (NimAudit.nimSum Q') Ps
Exact source text, lines 173–177
173theorem stream_reports_delta (Q Q' : List Nat) (Ps : List (List Nat)) :174 expectedOuts false 0 (Q :: Q' :: Ps) =175 ⟨nimSum Q, none⟩ :: ⟨nimSum Q', some (nimSum Q ^^^ nimSum Q')⟩ ::176 expectedOuts true (nimSum Q') Ps := by177 simp [expectedOuts]
Project declarations in the statement: Recurrent.Out, Recurrent.Out.mk, Recurrent.expectedOuts, nimSum
Project declarations used by the proof or definition body
Recurrent.Out, Recurrent.Out.mk, Recurrent.expectedOuts, nimSum
Definitions these statements use
inductive Controller.COut
Module Controller
(lean/phase4/Controller.lean, lines 44–46) · file SHA-256 63d0e09c002db91e…
Statement as elaborated and printed by Lean 4.26.0
Type
Exact source text, lines 44–46
44inductive COut where45 | summary (s : Nat) (diff : Option Nat)46 | move (m : Option (Nat × Nat))
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
def Controller.cinit
Module Controller
(lean/phase4/Controller.lean, lines 48–48) · file SHA-256 63d0e09c002db91e…
Statement as elaborated and printed by Lean 4.26.0
NimAudit.Controller.CState
Exact source text, lines 48–48
48def cinit : CState := ⟨false, 0, 0, false, 0, 0, none, none⟩
Project declarations in the statement: Controller.CState
Project declarations used by the proof or definition body
Controller.CState.mk
def Controller.stream
Module Controller
(lean/phase4/Controller.lean, lines 78–78) · file SHA-256 63d0e09c002db91e…
Statement as elaborated and printed by Lean 4.26.0
List (List ℕ) → List NimAudit.Controller.Tok
Exact source text, lines 78–78
78def stream (Ps : List (List Nat)) : List Tok := Ps.flatMap dtoks
Project declarations in the statement: Controller.Tok
Project declarations used by the proof or definition body
Controller.Tok, Controller.dtoks
def ControllerBits.sbits
Module ControllerBits
(lean/phase4/ControllerBits.lean, lines 104–108) · file SHA-256 4e23680da471fd69…
The canonical state vector (4 + 5B + 3r bits; false beyond).
Statement as elaborated and printed by Lean 4.26.0
ℕ → ℕ → NimAudit.Controller.CState → ℕ → Bool
Exact source text, lines 104–108
104/-- The canonical state vector (4 + 5B + 3r bits; false beyond). -/105def sbits (B r : Nat) (s : CState) : Nat → Bool :=106 layout B r false s.replayMode s.acc.testBit s.prev.testBit s.valid s.sig.testBit s.idx.testBit107 s.sel.isSome (optI s.sel).testBit (optV s.sel).testBit s.fnz.isSome (optI s.fnz).testBit108 (optV s.fnz).testBit
Project declarations in the statement: Controller.CState
Project declarations used by the proof or definition body
Controller.CState, Controller.CState.acc, Controller.CState.fnz, Controller.CState.idx, Controller.CState.prev, Controller.CState.replayMode, Controller.CState.sel, Controller.CState.sig, Controller.CState.valid, ControllerBits.layout, ControllerBits.optI, ControllerBits.optV
def Game.Move
Module NimGame
(lean/phase2/NimGame.lean, lines 24–26) · file SHA-256 23df6bb87ecfd344…
An ordinary legal Nim move: exactly one heap strictly decreases.
Statement as elaborated and printed by Lean 4.26.0
List ℕ → List ℕ → Prop
Exact source text, lines 24–26
24/-- An ordinary legal Nim move: exactly one heap strictly decreases. -/25def Move (p q : List Nat) : Prop :=26 ∃ pre x post y, p = pre ++ x :: post ∧ q = pre ++ y :: post ∧ y < x
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
def Game.Width
Module NimGame
(lean/phase2/NimGame.lean, lines 31–32) · file SHA-256 23df6bb87ecfd344…
B-bit board: every heap is below 2^B.
Statement as elaborated and printed by Lean 4.26.0
ℕ → List ℕ → Prop
Exact source text, lines 31–32
31/-- B-bit board: every heap is below 2^B. -/32def Width (B : Nat) (p : List Nat) : Prop := ∀ x ∈ p, x < 2 ^ B
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
def ThresholdInst.trun
Module ThresholdInst
(lean/phase5/ThresholdInst.lean, lines 155–158) · file SHA-256 c8c66599c8e24804…
Runs of the threshold controller.
Statement as elaborated and printed by Lean 4.26.0
ℕ → ℕ → (ℕ → Bool) → List NimAudit.Controller.Tok → (ℕ → Bool) × List NimAudit.Controller.COut
Exact source text, lines 155–158
155/-- Runs of the threshold controller. -/156def trun (B r : Nat) : (Nat → Bool) → List Tok → (Nat → Bool) × List COut157 | v, [] => (v, [])158 | v, t :: ts => ((trun B r (tstep B r v t).1 ts).1, (tstep B r v t).2.toList ++ (trun B r (tstep B r v t).1 ts).2)
Project declarations in the statement: Controller.COut, Controller.Tok
Project declarations used by the proof or definition body
Controller.COut, Controller.Tok, ThresholdInst.tstep
def WholeGame.rIdx
Module WholeGame
(lean/phase5/WholeGame.lean, lines 108–109) · file SHA-256 809a74ad589db609…
Index width used for N heaps.
Statement as elaborated and printed by Lean 4.26.0
ℕ → ℕ
Exact source text, lines 108–109
108/-- Index width used for N heaps. -/109def rIdx (N : Nat) : Nat := N.log2 + 1
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
def nimSum
Module NimCore
(lean/NimCore.lean, lines 7–9) · file SHA-256 b07db6c505210d5a…
Statement as elaborated and printed by Lean 4.26.0
List ℕ → ℕ
Exact source text, lines 7–9
7def nimSum : List Nat → Nat8 | [] => 09 | h :: t => h ^^^ nimSum t
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
inductive Recurrent.Out
Module NimRecurrent
(lean/phase3/NimRecurrent.lean, lines 41–43) · file SHA-256 1f2994aefc75e7f5…
Statement as elaborated and printed by Lean 4.26.0
Type
Exact source text, lines 41–43
41structure Out where42 summary : Nat43 diff : Option Nat
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
def Recurrent.expectedOuts
Module NimRecurrent
(lean/phase3/NimRecurrent.lean, lines 84–88) · file SHA-256 1f2994aefc75e7f5…
Expected outputs for a sequence of positions from a state with empty accumulator.
Statement as elaborated and printed by Lean 4.26.0
Bool → ℕ → List (List ℕ) → List NimAudit.Recurrent.Out
Exact source text, lines 84–88
84/-- Expected outputs for a sequence of positions from a state with empty accumulator. -/85def expectedOuts : Bool → Nat → List (List Nat) → List Out86 | _, _, [] => []87 | v, q, P :: Ps =>88 ⟨nimSum P, if v then some (q ^^^ nimSum P) else none⟩ :: expectedOuts true (nimSum P) Ps
Project declarations in the statement: Recurrent.Out
Project declarations used by the proof or definition body
Recurrent.Out, Recurrent.Out.mk, nimSum
Full modules
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).