Principal declarations
def Mastery.StrongMastery
Module WeakMastery
(lean/phase8/WeakMastery.lean, lines 812–817) · file SHA-256 4c83e573f527989c…
Strong mastery (Definition def:mastery, first clause) relative to F and r: at EVERY
legal history (arbitrary actions by both players) with the agent to move at an
N-position, σ plays a move to a P-position.
Statement as elaborated and printed by Lean 4.26.0
(List ℕ → Prop) → NimAudit.Mastery.Role → NimAudit.Mastery.Strat → Prop
Exact source text, lines 812–817
812/-- Strong mastery (Definition def:mastery, first clause) relative to F and r: at EVERY813 legal history (arbitrary actions by both players) with the agent to move at an814 N-position, σ plays a move to a P-position. -/815def StrongMastery (F : List Nat → Prop) (r : Role) (σ : Strat) : Prop :=816 ∀ P0, F P0 → ∀ h, Legal P0 h → mover h = r → nimSum (cur h) ≠ 0 →817 ∃ Q, σ h = some Q ∧ Move (cur h) Q ∧ nimSum Q = 0
Project declarations in the statement: Mastery.Role, Mastery.Strat
Project declarations used by the proof or definition body
Game.Move, Mastery.Hist, Mastery.Legal, Mastery.Role, Mastery.Strat, Mastery.cur, Mastery.mover, nimSum
def Mastery.WeakMastery
Module WeakMastery
(lean/phase8/WeakMastery.lean, lines 614–618) · file SHA-256 4c83e573f527989c…
WEAK MASTERY of policy σ for the family F of initial boards and the designated role r:
from every initial board of the family from which the role has SOME winning strategy,
σ itself wins against every legal opponent strategy.
Statement as elaborated and printed by Lean 4.26.0
(List ℕ → Prop) → NimAudit.Mastery.Role → NimAudit.Mastery.Strat → Prop
Exact source text, lines 614–618
614/-- WEAK MASTERY of policy σ for the family F of initial boards and the designated role r:615 from every initial board of the family from which the role has SOME winning strategy,616 σ itself wins against every legal opponent strategy. -/617def WeakMastery (F : List Nat → Prop) (r : Role) (σ : Strat) : Prop :=618 ∀ P0, F P0 → RoleWinnable r P0 → Guarantee r σ P0
Project declarations in the statement: Mastery.Role, Mastery.Strat
Project declarations used by the proof or definition body
Mastery.Guarantee, Mastery.Role, Mastery.RoleWinnable, Mastery.Strat
def Mastery.Guarantee
Module WeakMastery
(lean/phase8/WeakMastery.lean, lines 287–288) · file SHA-256 4c83e573f527989c…
σ wins from P₀ in role r against EVERY legal opponent strategy.
Statement as elaborated and printed by Lean 4.26.0
NimAudit.Mastery.Role → NimAudit.Mastery.Strat → List ℕ → Prop
Exact source text, lines 287–288
287/-- σ wins from P₀ in role r against EVERY legal opponent strategy. -/288def Guarantee (r : Role) (σ : Strat) (P0 : List Nat) : Prop := ∀ τ, LegalOpp τ → Beats r σ τ P0
Project declarations in the statement: Mastery.Role, Mastery.Strat
Project declarations used by the proof or definition body
Mastery.Beats, Mastery.LegalOpp, Mastery.Role, Mastery.Strat
inductive Mastery.Cons
Module WeakMastery
(lean/phase8/WeakMastery.lean, lines 123–129) · file SHA-256 4c83e573f527989c…
Policy-consistent legal histories for the agent in role r using σ: on the agent's turns
only its own prescribed legal action occurs; on the opponent's turns any legal move.
Statement as elaborated and printed by Lean 4.26.0
NimAudit.Mastery.Role → NimAudit.Mastery.Strat → List ℕ → NimAudit.Mastery.Hist → Prop
Exact source text, lines 123–129
123/-- Policy-consistent legal histories for the agent in role r using σ: on the agent's turns124 only its own prescribed legal action occurs; on the opponent's turns any legal move. -/125inductive Cons (r : Role) (σ : Strat) (P0 : List Nat) : Hist → Prop126 | init : Cons r σ P0 [P0]127 | opp {h : Hist} {Q : List Nat} : Cons r σ P0 h → mover h ≠ r → Move (cur h) Q → Cons r σ P0 (Q :: h)128 | own {h : Hist} {Q : List Nat} : Cons r σ P0 h → mover h = r → σ h = some Q → Move (cur h) Q →129 Cons r σ P0 (Q :: h)
Project declarations in the statement: Mastery.Hist, Mastery.Role, Mastery.Strat
Project declarations used by the proof or definition body
Game.Move, Mastery.Hist, Mastery.Role, Mastery.Strat, Mastery.cur, Mastery.mover
theorem Mastery.weakMastery_vacuous
Module WeakMastery
(lean/phase8/WeakMastery.lean, lines 636–642) · file SHA-256 4c83e573f527989c… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
THE CONDITIONAL CASE MADE EXPLICIT: at an initial board from which the role is losing
there is nothing to check, so on a family of losing boards EVERY policy (even one that
never moves) is weakly masterful. Weak mastery is informative only where the role is
winnable.
Statement as elaborated and printed by Lean 4.26.0
∀ {F : List ℕ → Prop} {r : NimAudit.Mastery.Role},
(∀ (P0 : List ℕ), F P0 → ¬NimAudit.Mastery.RoleWinnable r P0) →
∀ (σ : NimAudit.Mastery.Strat), NimAudit.Mastery.WeakMastery F r σ
Exact source text, lines 636–642
636/-- THE CONDITIONAL CASE MADE EXPLICIT: at an initial board from which the role is losing637 there is nothing to check, so on a family of losing boards EVERY policy (even one that638 never moves) is weakly masterful. Weak mastery is informative only where the role is639 winnable. -/640theorem weakMastery_vacuous {F : List Nat → Prop} {r : Role} (hF : ∀ P0, F P0 → ¬ RoleWinnable r P0)641 (σ : Strat) : WeakMastery F r σ :=642 fun P0 h1 h2 => absurd h2 (hF P0 h1)
Project declarations in the statement: Mastery.Role, Mastery.RoleWinnable, Mastery.Strat, Mastery.WeakMastery
Project declarations used by the proof or definition body
Mastery.Guarantee, Mastery.Role, Mastery.RoleWinnable, Mastery.Strat
theorem Game.restore_correct
Module NimGame
(lean/phase2/NimGame.lean, lines 412–425) · file SHA-256 23df6bb87ecfd344… Axioms reported by the fresh build: propext, Quot.sound
Statement as elaborated and printed by Lean 4.26.0
∀ {Q Q' : List ℕ},
NimAudit.nimSum Q = 0 →
NimAudit.Game.Move Q Q' →
∃ R, NimAudit.Game.restore Q Q' = some R ∧ NimAudit.Game.Move Q' R ∧ NimAudit.nimSum R = 0
Exact source text, lines 412–425
412theorem restore_correct {Q Q' : List Nat} (h0 : nimSum Q = 0) (hm : Move Q Q') :413 ∃ R, restore Q Q' = some R ∧ Move Q' R ∧ nimSum R = 0 := by414 have hne := move_from_zero hm h0415 have hd : nimSum Q ^^^ nimSum Q' = nimSum Q' := by rw [h0, Nat.zero_xor]416 obtain ⟨R, hsel, hmR, hR⟩ := selectMove_zero hne417 refine ⟨R, ?_, hmR, hR⟩418 unfold restore419 rw [hd]420 simp only [selectMove, hne, if_false] at hsel421 split at hsel422 · next q' hq' => cases hsel; exact hq'423 · next _ hnone =>424 obtain ⟨pre, x, post, hp, hlt, _⟩ := exists_decreasing_heap Q' hne425 exact absurd hlt (cancelFirst_none hnone x (by rw [hp]; simp))
Project declarations in the statement: Game.Move, Game.restore, nimSum
Project declarations used by the proof or definition body
Game.Move, Game.cancelFirst, Game.cancelFirst_none, Game.move_from_zero, Game.restore, Game.selectMove, Game.selectMove_zero, Rollout.exists_decreasing_heap, Rollout.subFirstPos, nimSum
Definitions these statements use
def Mastery.Hist
Module WeakMastery
(lean/phase8/WeakMastery.lean, lines 51–52) · file SHA-256 4c83e573f527989c…
A history: the boards so far, MOST RECENT FIRST; its last entry is the initial board.
Statement as elaborated and printed by Lean 4.26.0
Type
Exact source text, lines 51–52
51/-- A history: the boards so far, MOST RECENT FIRST; its last entry is the initial board. -/52abbrev Hist := List (List Nat)
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
def Mastery.Strat
Module WeakMastery
(lean/phase8/WeakMastery.lean, lines 54–55) · file SHA-256 4c83e573f527989c…
A (history-dependent) strategy proposes the next board; `none` means no action.
Statement as elaborated and printed by Lean 4.26.0
Type
Exact source text, lines 54–55
54/-- A (history-dependent) strategy proposes the next board; `none` means no action. -/55abbrev Strat := Hist → Option (List Nat)
Project declarations in the statement: none
Project declarations used by the proof or definition body
Mastery.Hist
def Mastery.RoleWinnable
Module WeakMastery
(lean/phase8/WeakMastery.lean, lines 419–420) · file SHA-256 4c83e573f527989c…
The role r has a winning strategy from P₀ (existence, separate from any policy).
Statement as elaborated and printed by Lean 4.26.0
NimAudit.Mastery.Role → List ℕ → Prop
Exact source text, lines 419–420
419/-- The role r has a winning strategy from P₀ (existence, separate from any policy). -/420def RoleWinnable (r : Role) (P0 : List Nat) : Prop := ∃ σ : Strat, Guarantee r σ P0
Project declarations in the statement: Mastery.Role
Project declarations used by the proof or definition body
Mastery.Guarantee, Mastery.Role, Mastery.Strat
inductive Mastery.Role
Module WeakMastery
(lean/phase8/WeakMastery.lean, lines 37–40) · file SHA-256 4c83e573f527989c…
Statement as elaborated and printed by Lean 4.26.0
Type
Exact source text, lines 37–40
37inductive Role where38 | first39 | second40 deriving DecidableEq
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
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.restore
Module NimGame
(lean/phase2/NimGame.lean, lines 407–410) · file SHA-256 23df6bb87ecfd344…
Two-frame restoration selector (paper Prop. restore / Thm search-gap (iii)):
from the predecessor Q and current board Q', cancel delta = nim(Q) XOR nim(Q').
Statement as elaborated and printed by Lean 4.26.0
List ℕ → List ℕ → Option (List ℕ)
Exact source text, lines 407–410
407/-- Two-frame restoration selector (paper Prop. restore / Thm search-gap (iii)):408 from the predecessor Q and current board Q', cancel delta = nim(Q) XOR nim(Q'). -/409def restore (Q Q' : List Nat) : Option (List Nat) :=410 cancelFirst (nimSum Q ^^^ nimSum Q') Q'
Project declarations in the statement: none
Project declarations used by the proof or definition body
Game.cancelFirst, nimSum
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
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).