Principal declarations
theorem Game.agent_wins
Module NimGame
(lean/phase2/NimGame.lean, lines 376–388) · file SHA-256 23df6bb87ecfd344… Axioms reported by the fresh build: propext, Quot.sound
END-TO-END STRATEGY GUARANTEE (Target 1C): on B-bit boards, the agent that
queries the B structured rollouts, reconstructs the nim-sum and plays the
selected move wins from every nonzero-nim-sum position against every legal
opponent.
Statement as elaborated and printed by Lean 4.26.0
∀ {B : ℕ} (p : List ℕ),
NimAudit.Game.Width B p → NimAudit.nimSum p ≠ 0 → NimAudit.Game.Wins (NimAudit.Game.agent B) p
Exact source text, lines 376–388
376/-- END-TO-END STRATEGY GUARANTEE (Target 1C): on B-bit boards, the agent that377 queries the B structured rollouts, reconstructs the nim-sum and plays the378 selected move wins from every nonzero-nim-sum position against every legal379 opponent. -/380theorem agent_wins {B : Nat} (p : List Nat) (hw : Width B p) (h : nimSum p ≠ 0) :381 Wins (agent B) p := by382 obtain ⟨q, hsel, hm, hq⟩ := selectMove_zero h383 refine Wins.intro p q (by rw [agent_eq hw]; exact hsel) hm ?_384 intro r hr385 have h1 := move_sum_lt hm386 have h2 := move_sum_lt hr387 exact agent_wins r (width_move (width_move hw hm) hr) (move_from_zero hr hq)388termination_by p.sum
Project declarations in the statement: Game.Width, Game.Wins, Game.agent, nimSum
Project declarations used by the proof or definition body
Game.Move, Game.Width, Game.Wins, Game.Wins.intro, Game.agent, Game.agent_eq, Game.move_from_zero, Game.move_sum_lt, Game.selectMove, Game.selectMove_zero, Game.width_move, nimSum
theorem RolloutExec.mhExec_wins
Module RolloutExec
(lean/phase6/RolloutExec.lean, lines 517–520) · file SHA-256 c7b63a6e02d1d425… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
WHOLE-GAME THEOREM FOR THE FULLY EXECUTED MULTI-HEAD PLAYER: from every nonzero board
of width B it wins against every legal opponent; no outcome bit is supplied for free.
Statement as elaborated and printed by Lean 4.26.0
∀ {B : ℕ} {P : List ℕ},
NimAudit.Game.Width B P →
NimAudit.nimSum P ≠ 0 → NimAudit.Game.Wins (NimAudit.RolloutExec.mhExecSel B) P
Exact source text, lines 517–520
517/-- WHOLE-GAME THEOREM FOR THE FULLY EXECUTED MULTI-HEAD PLAYER: from every nonzero board518 of width B it wins against every legal opponent; no outcome bit is supplied for free. -/519theorem mhExec_wins {B : Nat} {P : List Nat} (hw : Width B P) (h : nimSum P ≠ 0) : Wins (mhExecSel B) P :=520 wins_congr (fun Q hQ => mhExecSel_eq hQ) hw (ctrl_wins P h)
Project declarations in the statement: Game.Width, Game.Wins, RolloutExec.mhExecSel, nimSum
Project declarations used by the proof or definition body
Controller.ctrlSel, Controller.ctrl_wins, Game.Width, RolloutExec.mhExecSel, RolloutExec.mhExecSel_eq, WholeGame.wins_congr, nimSum
theorem Game.totalRolloutMoves_le
Module NimGame
(lean/phase2/NimGame.lean, lines 454–467) · file SHA-256 23df6bb87ecfd344… Axioms reported by the fresh build: propext, Quot.sound
Statement as elaborated and printed by Lean 4.26.0
∀ {B : ℕ} {p : List ℕ},
NimAudit.Game.Width B p → NimAudit.Game.totalRolloutMoves B p ≤ B * (p.length * (2 ^ B - 1))
Exact source text, lines 454–467
454theorem totalRolloutMoves_le {B : Nat} {p : List Nat} (hw : Width B p) :455 totalRolloutMoves B p ≤ B * (p.length * (2 ^ B - 1)) := by456 unfold totalRolloutMoves457 have key : ∀ k, ((List.range k).map (fun j => rolloutMoves j p)).sum ≤458 k * (p.length * (2 ^ B - 1)) := by459 intro k460 induction k with461 | zero => simp462 | succ k ih =>463 rw [List.range_succ, List.map_append, List.sum_append_nat, Nat.succ_mul]464 simp only [List.map_cons, List.map_nil, List.sum_cons, List.sum_nil, Nat.add_zero]465 have := rolloutMoves_le (j := k) hw466 omega467 exact key B
Project declarations in the statement: Game.Width, Game.totalRolloutMoves
Project declarations used by the proof or definition body
Game.Width, Game.rolloutMoves_le, Game.totalRolloutMoves, Rollout.rolloutMoves
Definitions these statements use
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
inductive Game.Wins
Module NimGame
(lean/phase2/NimGame.lean, lines 125–132) · file SHA-256 23df6bb87ecfd344…
`Wins sel p`: the player to move at `p`, always playing the successor chosen by
`sel`, wins against EVERY legal opponent. The selected move is legal, and after
every legal opponent reply the player is again in a `Wins` position. Because
the predicate is inductive, every such play is finite and ends with the
opponent facing a terminal board (normal play: the opponent loses).
Statement as elaborated and printed by Lean 4.26.0
(List ℕ → Option (List ℕ)) → List ℕ → Prop
Exact source text, lines 125–132
125/-- `Wins sel p`: the player to move at `p`, always playing the successor chosen by126 `sel`, wins against EVERY legal opponent. The selected move is legal, and after127 every legal opponent reply the player is again in a `Wins` position. Because128 the predicate is inductive, every such play is finite and ends with the129 opponent facing a terminal board (normal play: the opponent loses). -/130inductive Wins (sel : List Nat → Option (List Nat)) : List Nat → Prop131 | intro (p q : List Nat) : sel p = some q → Move p q →132 (∀ r, Move q r → Wins sel r) → Wins sel p
Project declarations in the statement: none
Project declarations used by the proof or definition body
Game.Move
def Game.agent
Module NimGame
(lean/phase2/NimGame.lean, lines 257–259) · file SHA-256 23df6bb87ecfd344…
The agent: reconstruct the nim-sum from the B root rollouts, then select.
Statement as elaborated and printed by Lean 4.26.0
ℕ → List ℕ → Option (List ℕ)
Exact source text, lines 257–259
257/-- The agent: reconstruct the nim-sum from the B root rollouts, then select. -/258def agent (B : Nat) (p : List Nat) : Option (List Nat) :=259 selectMove (reconstruct B (outcomes p)) p
Project declarations in the statement: none
Project declarations used by the proof or definition body
Game.outcomes, Game.reconstruct, Game.selectMove
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
def RolloutExec.mhExecSel
Module RolloutExec
(lean/phase6/RolloutExec.lean, lines 501–501) · file SHA-256 c7b63a6e02d1d425…
Statement as elaborated and printed by Lean 4.26.0
ℕ → List ℕ → Option (List ℕ)
Exact source text, lines 501–501
501def mhExecSel (B : Nat) (P : List Nat) : Option (List Nat) := applyM P (mhExec B P)
Project declarations in the statement: none
Project declarations used by the proof or definition body
RolloutExec.mhExec, SelectCircuit.applyM
def Game.totalRolloutMoves
Module NimGame
(lean/phase2/NimGame.lean, lines 450–452) · file SHA-256 23df6bb87ecfd344…
Total simulated moves of the B root rollouts.
Statement as elaborated and printed by Lean 4.26.0
ℕ → List ℕ → ℕ
Exact source text, lines 450–452
450/-- Total simulated moves of the B root rollouts. -/451def totalRolloutMoves (B : Nat) (p : List Nat) : Nat :=452 ((List.range B).map (fun j => rolloutMoves j p)).sum
Project declarations in the statement: none
Project declarations used by the proof or definition body
Rollout.rolloutMoves
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).