Principal declarations
theorem Misc.shootout_spec
Module Misc
(lean/phase6/Misc.lean, lines 456–466) · file SHA-256 07766c03566dbfca… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
SHOOTOUT CONTROLLER THEOREM: started at head 0 with fuel B + 1 it outputs the OR of the
B outcome bits, using at most B queries (one query if head 0 reports 1).
Statement as elaborated and printed by Lean 4.26.0
∀ {B : ℕ},
1 ≤ B →
∀ (o : ℕ → Bool),
((NimAudit.Misc.shootout B).run o (B + 1) 0).1 = some ((List.range B).any o) ∧
((NimAudit.Misc.shootout B).run o (B + 1) 0).2 ≤ B ∧
(o 0 = true → ((NimAudit.Misc.shootout B).run o (B + 1) 0).2 = 1)
Exact source text, lines 456–466
456/-- SHOOTOUT CONTROLLER THEOREM: started at head 0 with fuel B + 1 it outputs the OR of the457 B outcome bits, using at most B queries (one query if head 0 reports 1). -/458theorem shootout_spec {B : Nat} (hB : 1 ≤ B) (o : Nat → Bool) :459 ((shootout B).run o (B + 1) 0).1 = some ((List.range B).any o) ∧460 ((shootout B).run o (B + 1) 0).2 ≤ B ∧461 (o 0 = true → ((shootout B).run o (B + 1) 0).2 = 1) := by462 obtain ⟨k, rfl⟩ : ∃ k, B = k + 1 := ⟨B - 1, by omega⟩463 have h := shootout_from (B := k + 1) o k 0 (by omega)464 rw [show k + 1 + 1 = k + 2 by omega, h, List.range_eq_range']465 refine ⟨rfl, by simp; omega, fun h0 => ?_⟩466 simp [firstHit_hit (show 0 < k + 1 by omega) h0]
Project declarations in the statement: Misc.FSM.run, Misc.shootout
Project declarations used by the proof or definition body
Misc.FSM.run, Misc.firstHit, Misc.firstHit_hit, Misc.shootout, Misc.shootout_from
theorem Misc.channels_or
Module Misc
(lean/phase6/Misc.lean, lines 468–483) · file SHA-256 07766c03566dbfca… Axioms reported by the fresh build: propext, Quot.sound
With the exact structured heads, the OR of the channel bits is (nim(P) ≠ 0).
Statement as elaborated and printed by Lean 4.26.0
∀ {B : ℕ},
1 ≤ B →
∀ {P : List ℕ},
NimAudit.Game.Width B P →
((List.range B).any fun j => NimAudit.Game.rolloutWinner j P) =
decide (NimAudit.nimSum P ≠ 0)
Exact source text, lines 468–483
468/-- With the exact structured heads, the OR of the channel bits is (nim(P) ≠ 0). -/469theorem channels_or {B : Nat} (hB : 1 ≤ B) {P : List Nat} (hw : Width B P) :470 (List.range B).any (fun j => rolloutWinner j P) = decide (nimSum P ≠ 0) := by471 have hσ := nimSum_lt hw472 apply Bool.eq_iff_iff.mpr473 simp only [List.any_eq_true, List.mem_range, decide_eq_true_iff, rolloutWinner_channel, channel]474 constructor475 · rintro ⟨j, hj, h⟩ h0476 rw [h0] at h; split at h <;> simp at h477 · intro h0478 by_cases h1 : (nimSum P).testBit 0 = true479 · exact ⟨0, by omega, by simp [h1]⟩480 · obtain ⟨k, hk, hbit⟩ := (pos_iff_bitLE hσ).1 (by omega)481 have hk0 : k ≠ 0 := by intro e; subst e; exact h1 hbit482 refine ⟨k, hk, ?_⟩483 simp [hk0, hbit, show (nimSum P).testBit 0 = false by simpa using h1]
Project declarations in the statement: Game.Width, Game.rolloutWinner, nimSum
Project declarations used by the proof or definition body
ControllerBits.pos_iff_bitLE, Game.Width, Game.nimSum_lt, Game.rolloutWinner, Game.rolloutWinner_channel, channel, nimSum
theorem Shootout.ee_spec
Module Shootout
(lean/phase7/Shootout.lean, lines 709–733) · file SHA-256 1abd814426d345b9… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
EARLY-EXIT SEMANTIC THEOREM (B ≥ 1): after the reset, the controller stops after exactly
T = eeT ticks (running at every earlier tick), with decision dec = [nim(P) ≠ 0]; the
decision and the number of queries are those of Misc.shootout run on the actual
rollout outcomes; T ≤ Tmax.
Statement as elaborated and printed by Lean 4.26.0
∀ {B : ℕ},
1 ≤ B →
∀ {P : List ℕ},
NimAudit.Game.Width B P →
(NimAudit.Shootout.arun true B P (NimAudit.Shootout.eeT B P (B - 1) 0)
(NimAudit.Shootout.initOS B P)).run =
false ∧
(NimAudit.Shootout.arun true B P (NimAudit.Shootout.eeT B P (B - 1) 0)
(NimAudit.Shootout.initOS B P)).dec =
decide (NimAudit.nimSum P ≠ 0) ∧
(∀ u < NimAudit.Shootout.eeT B P (B - 1) 0,
(NimAudit.Shootout.arun true B P u (NimAudit.Shootout.initOS B P)).run = true) ∧
some
(NimAudit.Shootout.arun true B P (NimAudit.Shootout.eeT B P (B - 1) 0)
(NimAudit.Shootout.initOS B P)).dec =
((NimAudit.Misc.shootout B).run (fun h => NimAudit.Game.rolloutWinner h P) (B + 1)
0).1 ∧
NimAudit.Shootout.eeR P (B - 1) 0 =
((NimAudit.Misc.shootout B).run (fun h => NimAudit.Game.rolloutWinner h P)
(B + 1) 0).2 ∧
NimAudit.Shootout.eeR P (B - 1) 0 ≤ B ∧
NimAudit.Shootout.eeT B P (B - 1) 0 ≤ NimAudit.Shootout.Tmax B P.length ∧
(NimAudit.Shootout.arun true B P (NimAudit.Shootout.eeT B P (B - 1) 0)
(NimAudit.Shootout.initOS B P)).j +
1 =
NimAudit.Shootout.eeR P (B - 1) 0
Exact source text, lines 709–733
709/-- EARLY-EXIT SEMANTIC THEOREM (B ≥ 1): after the reset, the controller stops after exactly710 T = eeT ticks (running at every earlier tick), with decision dec = [nim(P) ≠ 0]; the711 decision and the number of queries are those of Misc.shootout run on the actual712 rollout outcomes; T ≤ Tmax. -/713theorem ee_spec {B : Nat} (hB : 1 ≤ B) {P : List Nat} (hw : Width B P) :714 (arun true B P (eeT B P (B - 1) 0) (initOS B P)).run = false ∧715 (arun true B P (eeT B P (B - 1) 0) (initOS B P)).dec = decide (nimSum P ≠ 0) ∧716 (∀ u, u < eeT B P (B - 1) 0 → (arun true B P u (initOS B P)).run = true) ∧717 some (arun true B P (eeT B P (B - 1) 0) (initOS B P)).dec =718 ((Misc.shootout B).run (fun h => rolloutWinner h P) (B + 1) 0).1 ∧719 eeR P (B - 1) 0 = ((Misc.shootout B).run (fun h => rolloutWinner h P) (B + 1) 0).2 ∧720 eeR P (B - 1) 0 ≤ B ∧ eeT B P (B - 1) 0 ≤ Tmax B P.length ∧721 (arun true B P (eeT B P (B - 1) 0) (initOS B P)).j + 1 = eeR P (B - 1) 0 := by722 have hinit : initOS B P = ld P 0 false (fun _ => false) := by723 simp [initOS, ld]; omega724 rw [hinit]725 obtain ⟨h1, h2, h3, h4⟩ := ee_run B P (B - 1) 0 (by omega) (fun _ => false)726 have hsh := Misc.shootout_from (B := B) (fun h => rolloutWinner h P) (B - 1) 0 (by omega)727 rw [show B - 1 + 2 = B + 1 by omega] at hsh728 have hR := eeR_shootout B P (B - 1) 0 (by omega)729 rw [show B - 1 + 2 = B + 1 by omega] at hR730 refine ⟨h1, ?_, h3, ?_, hR, by have := eeR_le P (B - 1) 0; omega, ?_, by rw [h4]; omega⟩731 · rw [h2, show B - 1 + 1 = B by omega, ← List.range_eq_range']; exact Misc.channels_or hB hw732 · rw [hsh, h2]733 · have := eeT_le B hw (B - 1) 0; unfold Tmax; rw [show B - 1 + 1 = B by omega] at this; exact this
Project declarations in the statement: Game.Width, Game.rolloutWinner, Misc.FSM.run, Misc.shootout, Shootout.OS.dec, Shootout.OS.j, Shootout.OS.run, Shootout.Tmax, Shootout.arun, Shootout.eeR, Shootout.eeT, Shootout.initOS, nimSum
Project declarations used by the proof or definition body
Game.Width, Game.rolloutWinner, Misc.FSM.run, Misc.channels_or, Misc.firstHit, Misc.shootout, Misc.shootout_from, RolloutExec.RS, RolloutExec.RS.mk, RolloutExec.clockBound, Shootout.OS, Shootout.OS.dec, Shootout.OS.j, Shootout.OS.mk, Shootout.OS.noConfusion, Shootout.OS.run, Shootout.Tmax, Shootout.arun, Shootout.eeR, Shootout.eeR_le, Shootout.eeR_shootout, Shootout.eeT, Shootout.eeT_le, Shootout.ee_run, Shootout.initOS, Shootout.ld, nimSum
Definitions these statements use
def Misc.FSM.run
Module Misc
(lean/phase6/Misc.lean, lines 371–376) · file SHA-256 07766c03566dbfca…
Run with fuel against outcome oracle o: decision and number of queries.
Statement as elaborated and printed by Lean 4.26.0
NimAudit.Misc.FSM → (ℕ → Bool) → ℕ → ℕ → Option Bool × ℕ
Exact source text, lines 371–376
371/-- Run with fuel against outcome oracle o: decision and number of queries. -/372def FSM.run (C : FSM) (o : Nat → Bool) : Nat → Nat → Option Bool × Nat373 | 0, _ => (none, 0)374 | f + 1, s => match C.out s with375 | some d => (some d, 0)376 | none => ((C.run o f (C.next s (o (C.head s)))).1, (C.run o f (C.next s (o (C.head s)))).2 + 1)
Project declarations in the statement: Misc.FSM
Project declarations used by the proof or definition body
Misc.FSM, Misc.FSM.head, Misc.FSM.next, Misc.FSM.out
def Misc.shootout
Module Misc
(lean/phase6/Misc.lean, lines 378–382) · file SHA-256 07766c03566dbfca…
The controller of the figure: states 0..B−1 query heads 0..B−1 in turn; state B
declares σ ≠ 0 (N-position), state B+1 declares σ = 0 (P-position).
Statement as elaborated and printed by Lean 4.26.0
ℕ → NimAudit.Misc.FSM
Exact source text, lines 378–382
378/-- The controller of the figure: states 0..B−1 query heads 0..B−1 in turn; state B379 declares σ ≠ 0 (N-position), state B+1 declares σ = 0 (P-position). -/380def shootout (B : Nat) : FSM :=381 ⟨0, id, fun s b => if b then B else if s + 1 < B then s + 1 else B + 1,382 fun s => if s = B then some true else if s = B + 1 then some false else none⟩
Project declarations in the statement: Misc.FSM
Project declarations used by the proof or definition body
Misc.FSM.mk
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 Game.rolloutWinner
Module NimGame
(lean/phase2/NimGame.lean, lines 142–152) · file SHA-256 23df6bb87ecfd344…
Rollout outcome RO_{pi_j}(P) as a game: both players follow pi_j; the result is
`true` iff the player to move at P (the first player) wins under normal play.
At a terminal start it is `false`.
Statement as elaborated and printed by Lean 4.26.0
ℕ → List ℕ → Bool
Exact source text, lines 142–152
142/-- Rollout outcome RO_{pi_j}(P) as a game: both players follow pi_j; the result is143 `true` iff the player to move at P (the first player) wins under normal play.144 At a terminal start it is `false`. -/145def rolloutWinner (j : Nat) (p : List Nat) : Bool :=146 match h : policyStep j p with147 | none => false148 | some q => !rolloutWinner j q149termination_by rolloutCount j p150decreasing_by151 have := policyMove_count (policyStep_some h)152 omega
Project declarations in the statement: none
Project declarations used by the proof or definition body
Rollout.policyMove_count, Rollout.policyStep, Rollout.policyStep_some, rolloutCount
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 Shootout.OS.dec
Module Shootout
(lean/phase7/Shootout.lean, lines 38–38) · file SHA-256 1abd814426d345b9…
Statement as elaborated and printed by Lean 4.26.0
NimAudit.Shootout.OS → Bool
Exact source text, lines 38–38
38 dec : Bool
Project declarations in the statement: Shootout.OS
Project declarations used by the proof or definition body
Shootout.OS
def Shootout.OS.j
Module Shootout
(lean/phase7/Shootout.lean, lines 39–39) · file SHA-256 1abd814426d345b9…
Statement as elaborated and printed by Lean 4.26.0
NimAudit.Shootout.OS → ℕ
Exact source text, lines 39–39
39 j : Nat
Project declarations in the statement: Shootout.OS
Project declarations used by the proof or definition body
Shootout.OS
def Shootout.OS.run
Module Shootout
(lean/phase7/Shootout.lean, lines 37–37) · file SHA-256 1abd814426d345b9…
Statement as elaborated and printed by Lean 4.26.0
NimAudit.Shootout.OS → Bool
Exact source text, lines 37–37
37 run : Bool
Project declarations in the statement: Shootout.OS
Project declarations used by the proof or definition body
Shootout.OS
def Shootout.Tmax
Module Shootout
(lean/phase7/Shootout.lean, lines 706–707) · file SHA-256 1abd814426d345b9…
The fixed padded clock (ticks after the reset tick): B·(N(2^B − 1) + 2).
Statement as elaborated and printed by Lean 4.26.0
ℕ → ℕ → ℕ
Exact source text, lines 706–707
706/-- The fixed padded clock (ticks after the reset tick): B·(N(2^B − 1) + 2). -/707def Tmax (B N : Nat) : Nat := B * (clockBound B N + 1)
Project declarations in the statement: none
Project declarations used by the proof or definition body
RolloutExec.clockBound
def Shootout.arun
Module Shootout
(lean/phase7/Shootout.lean, lines 503–506) · file SHA-256 1abd814426d345b9…
Semantic run of k ticks (no reset).
Statement as elaborated and printed by Lean 4.26.0
Bool → ℕ → List ℕ → ℕ → NimAudit.Shootout.OS → NimAudit.Shootout.OS
Exact source text, lines 503–506
503/-- Semantic run of k ticks (no reset). -/504def arun (early : Bool) (B : Nat) (P : List Nat) : Nat → OS → OS505 | 0, s => s506 | k + 1, s => arun early B P k (ostep early B P false s)
Project declarations in the statement: Shootout.OS
Project declarations used by the proof or definition body
Shootout.OS, Shootout.ostep
def Shootout.eeR
Module Shootout
(lean/phase7/Shootout.lean, lines 617–620) · file SHA-256 1abd814426d345b9…
Rollouts (head queries) executed by the early-exit schedule.
Statement as elaborated and printed by Lean 4.26.0
List ℕ → ℕ → ℕ → ℕ
Exact source text, lines 617–620
617/-- Rollouts (head queries) executed by the early-exit schedule. -/618def eeR (P : List Nat) : Nat → Nat → Nat619 | 0, _ => 1620 | k + 1, j => if rolloutWinner j P then 1 else eeR P k (j + 1) + 1
Project declarations in the statement: none
Project declarations used by the proof or definition body
Game.rolloutWinner
def Shootout.eeT
Module Shootout
(lean/phase7/Shootout.lean, lines 612–615) · file SHA-256 1abd814426d345b9…
Ticks used by the early-exit schedule from head j with k + 1 heads left.
Statement as elaborated and printed by Lean 4.26.0
ℕ → List ℕ → ℕ → ℕ → ℕ
Exact source text, lines 612–615
612/-- Ticks used by the early-exit schedule from head j with k + 1 heads left. -/613def eeT (B : Nat) (P : List Nat) : Nat → Nat → Nat614 | 0, j => rolloutMoves j P + 2615 | k + 1, j => if rolloutWinner j P then rolloutMoves j P + 2 else rolloutMoves j P + 2 + eeT B P k (j + 1)
Project declarations in the statement: none
Project declarations used by the proof or definition body
Game.rolloutWinner, Rollout.rolloutMoves
def Shootout.initOS
Module Shootout
(lean/phase7/Shootout.lean, lines 42–44) · file SHA-256 1abd814426d345b9…
Total reset (from any register contents): load the board, head 0, nothing stored.
Convention B = 0: there are no heads, run = 0 at once and dec = 0.
Statement as elaborated and printed by Lean 4.26.0
ℕ → List ℕ → NimAudit.Shootout.OS
Exact source text, lines 42–44
42/-- Total reset (from any register contents): load the board, head 0, nothing stored.43 Convention B = 0: there are no heads, run = 0 at once and dec = 0. -/44def initOS (B : Nat) (P : List Nat) : OS := ⟨⟨P, false, false⟩, decide (1 ≤ B), false, 0, fun _ => false⟩
Project declarations in the statement: Shootout.OS
Project declarations used by the proof or definition body
RolloutExec.RS.mk, Shootout.OS.mk
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).