Principal declarations
theorem LocalRestore.bdC_eval
Module LocalRestore
(lean/phase4/LocalRestore.lean, lines 343–375) · file SHA-256 fc4c7f908b0c9c58… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
BOUNDED-CHANGE DIFFERENCES: if at most t heaps changed, the delta circuits compute
nim(Q) ⊕ nim(Q') exactly.
Statement as elaborated and printed by Lean 4.26.0
∀ {B N t : ℕ} {Q Q' : List ℕ},
Q.length = N →
Q'.length = N →
NimAudit.Game.Width B Q →
NimAudit.Game.Width B Q' →
NimAudit.LocalRestore.cntR (fun i => decide (Q.getD i 0 ≠ Q'.getD i 0)) N ≤ t →
∀ (q : ℕ),
NimAudit.AC0.Circ.eval (NimAudit.LocalRestore.tf B N Q Q')
(NimAudit.LocalRestore.bdC B N t q) =
(NimAudit.nimSum Q ^^^ NimAudit.nimSum Q').testBit q
Exact source text, lines 343–375
343/-- BOUNDED-CHANGE DIFFERENCES: if at most t heaps changed, the delta circuits compute344 nim(Q) ⊕ nim(Q') exactly. -/345theorem bdC_eval {B N t : Nat} {Q Q' : List Nat} (hQ : Q.length = N) (hQ' : Q'.length = N)346 (hw : Width B Q) (hw' : Width B Q')347 (ht : cntR (fun i => decide (Q.getD i 0 ≠ Q'.getD i 0)) N ≤ t) (q : Nat) :348 eval (tf B N Q Q') (bdC B N t q) = (nimSum Q ^^^ nimSum Q').testBit q := by349 unfold bdC350 by_cases hq : q < B351 · simp only [hq, if_true]352 have hyc : (fun i => eval (tf B N Q Q') (yC B N i (B - 1 - q))) =353 fun i => if i < N then ((Q.getD i 0).testBit q != (Q'.getD i 0).testBit q) else354 eval (tf B N Q Q') (yC B N i (B - 1 - q)) := by355 funext i356 by_cases hi : i < N357 · rw [if_pos hi, yC_eval hQ hQ' hi (by omega), show B - 1 - (B - 1 - q) = q by omega]358 · rw [if_neg hi]359 have hcnt : cntR (fun i => eval (tf B N Q Q') (yC B N i (B - 1 - q))) N =360 cntR (fun i => (Q.getD i 0).testBit q != (Q'.getD i 0).testBit q) N := by361 unfold cntR362 congr 1363 apply List.filter_congr364 intro i hi365 rw [yC_eval hQ hQ' (List.mem_range.mp hi) (by omega), show B - 1 - (B - 1 - q) = q by omega]366 have hle : cntR (fun i => (Q.getD i 0).testBit q != (Q'.getD i 0).testBit q) N ≤ t := by367 refine Nat.le_trans (cntR_mono N (fun i hi h => ?_)) ht368 simp only [bne_iff_ne, ne_eq] at h369 simp only [decide_eq_true_iff]370 intro he; rw [he] at h; exact h rfl371 rw [parC_eval _ _ t N (by rw [hcnt]; exact hle), hcnt,372 nimSum_xor_testBit Q Q' (by rw [hQ, hQ']) q, hQ]373 · simp only [hq, if_false, eval_const]374 rw [Nat.testBit_lt_two_pow (Nat.lt_of_lt_of_le (Nat.xor_lt_two_pow (nimSum_lt hw) (nimSum_lt hw'))375 (Nat.pow_le_pow_right (by decide) (by omega)))]
Project declarations in the statement: AC0.Circ.eval, Game.Width, LocalRestore.bdC, LocalRestore.cntR, LocalRestore.tf, nimSum
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.const, AC0.Circ.eval, AC0.Circ.eval_const, Game.Width, Game.nimSum_lt, LocalRestore.bdC, LocalRestore.cntR, LocalRestore.cntR_mono, LocalRestore.nimSum_xor_testBit, LocalRestore.parC, LocalRestore.parC_eval, LocalRestore.tf, LocalRestore.yC, LocalRestore.yC_eval, nimSum
theorem LocalRestore.bdDelta_eq
Module LocalRestore
(lean/phase4/LocalRestore.lean, lines 377–382) · file SHA-256 fc4c7f908b0c9c58… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
Statement as elaborated and printed by Lean 4.26.0
∀ {B N t : ℕ} {Q Q' : List ℕ},
Q.length = N →
Q'.length = N →
NimAudit.Game.Width B Q →
NimAudit.Game.Width B Q' →
NimAudit.LocalRestore.cntR (fun i => decide (Q.getD i 0 ≠ Q'.getD i 0)) N ≤ t →
(NimAudit.Game.ofBits B fun q =>
NimAudit.AC0.Circ.eval (NimAudit.LocalRestore.tf B N Q Q')
(NimAudit.LocalRestore.bdC B N t q)) =
NimAudit.nimSum Q ^^^ NimAudit.nimSum Q'
Exact source text, lines 377–382
377theorem bdDelta_eq {B N t : Nat} {Q Q' : List Nat} (hQ : Q.length = N) (hQ' : Q'.length = N)378 (hw : Width B Q) (hw' : Width B Q')379 (ht : cntR (fun i => decide (Q.getD i 0 ≠ Q'.getD i 0)) N ≤ t) :380 ofBits B (fun q => eval (tf B N Q Q') (bdC B N t q)) = nimSum Q ^^^ nimSum Q' :=381 ofBits_testBit_eq (Nat.xor_lt_two_pow (nimSum_lt hw) (nimSum_lt hw')) _382 (fun q _ => bdC_eval hQ hQ' hw hw' ht q)
Project declarations in the statement: AC0.Circ.eval, Game.Width, Game.ofBits, LocalRestore.bdC, LocalRestore.cntR, LocalRestore.tf, nimSum
Project declarations used by the proof or definition body
AC0.Circ.eval, Game.Width, Game.nimSum_lt, LocalRestore.bdC, LocalRestore.bdC_eval, LocalRestore.cntR, LocalRestore.tf, Recurrent.ofBits_testBit_eq, nimSum
theorem LocalRestore.bdC_res
Module LocalRestore
(lean/phase4/LocalRestore.lean, lines 518–545) · file SHA-256 fc4c7f908b0c9c58… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
BOUNDED-CHANGE DELTA RESOURCES: depth ≤ 2t + 8 and size ≤ (2t+6)·U^(3t+6) with
U = N + t + 11; inputs from the two frames only. Constant depth and polynomial size
for every fixed t.
Statement as elaborated and printed by Lean 4.26.0
∀ {B N : ℕ} (t q : ℕ),
(NimAudit.LocalRestore.bdC B N t q).depth ≤ 2 * t + 8 ∧
(NimAudit.LocalRestore.bdC B N t q).size ≤ (2 * t + 6) * (N + t + 11) ^ (3 * t + 6) ∧
(NimAudit.LocalRestore.bdC B N t q).maxInput ≤ 2 * (B * N)
Exact source text, lines 518–545
518/-- BOUNDED-CHANGE DELTA RESOURCES: depth ≤ 2t + 8 and size ≤ (2t+6)·U^(3t+6) with519 U = N + t + 11; inputs from the two frames only. Constant depth and polynomial size520 for every fixed t. -/521theorem bdC_res (t q : Nat) :522 depth (bdC B N t q) ≤ 2 * t + 8 ∧ size (bdC B N t q) ≤ (2 * t + 6) * (N + t + 11) ^ (3 * t + 6) ∧523 maxInput (bdC B N t q) ≤ 2 * (B * N) := by524 unfold bdC525 by_cases hq : q < B526 · simp only [hq, if_true]527 have hy : ∀ i, size (yC B N i (B - 1 - q)) ≤ N + t + 11 ∧ depth (yC B N i (B - 1 - q)) ≤ 3 :=528 fun i => ⟨by have := (yC_res (B := B) (N := N) i (B - 1 - q)).2; omega, (yC_res i _).1⟩529 have h := parC_res (by omega) _ hy t N (by omega) (by omega)530 refine ⟨by omega, h.1, ?_⟩531 unfold parC532 apply ControllerBits.maxInput_or_le; intro c hc533 obtain ⟨k, _, rfl⟩ := List.mem_map.mp hc534 split535 · apply ControllerBits.maxInput_and_le; intro c hc536 simp only [List.mem_cons, List.mem_singleton, List.not_mem_nil, or_false] at hc537 have hyM : ∀ i < N, maxInput (yC B N i (B - 1 - q)) ≤ 2 * (B * N) := fun i hi => yC_max hi (by omega)538 rcases hc with rfl | rfl539 · exact atLeast_max _ hyM k N (Nat.le_refl _)540 · simp only [maxInput_not]; exact atLeast_max _ hyM (k + 1) N (Nat.le_refl _)541 · simp542 · simp only [hq, if_false, depth_const, size_const, maxInput_const]543 refine ⟨by omega, ?_, by omega⟩544 have h1 : 1 ≤ (N + t + 11) ^ (3 * t + 6) := Nat.pow_pos (by omega)545 exact Nat.le_trans h1 (Nat.le_mul_of_pos_left _ (by omega))
Project declarations in the statement: AC0.Circ.depth, AC0.Circ.maxInput, AC0.Circ.size, LocalRestore.bdC
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.and, AC0.Circ.const, AC0.Circ.depth, AC0.Circ.depth_const, AC0.Circ.maxInput, AC0.Circ.maxInput_const, AC0.Circ.maxInput_not, AC0.Circ.not, AC0.Circ.size, AC0.Circ.size_const, ControllerBits.maxInput_and_le, ControllerBits.maxInput_or_le, LocalRestore.atLeastC, LocalRestore.atLeast_max, LocalRestore.bdC, LocalRestore.parC, LocalRestore.parC_res, LocalRestore.yC, LocalRestore.yC_max, LocalRestore.yC_res
Definitions these statements use
def LocalRestore.bdC
Module LocalRestore
(lean/phase4/LocalRestore.lean, lines 303–304) · file SHA-256 fc4c7f908b0c9c58…
Little-endian bit q of the bounded-change delta (t = maximum number of changed heaps).
Statement as elaborated and printed by Lean 4.26.0
ℕ → ℕ → ℕ → ℕ → NimAudit.AC0.Circ
Exact source text, lines 303–304
303/-- Little-endian bit q of the bounded-change delta (t = maximum number of changed heaps). -/304def bdC (B N t q : Nat) : Circ := if q < B then parC (fun i => yC B N i (B - 1 - q)) t N else const false
Project declarations in the statement: AC0.Circ
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.const, LocalRestore.parC, LocalRestore.yC
def LocalRestore.tf
Module LocalRestore
(lean/phase4/LocalRestore.lean, lines 29–31) · file SHA-256 fc4c7f908b0c9c58…
Two-frame input vector.
Statement as elaborated and printed by Lean 4.26.0
ℕ → ℕ → List ℕ → List ℕ → ℕ → Bool
Exact source text, lines 29–31
29/-- Two-frame input vector. -/30def tf (B N : Nat) (Q Q' : List Nat) : Nat → Bool := fun j =>31 if j < B * N then boardBits B Q j else boardBits B Q' (j - B * N)
Project declarations in the statement: none
Project declarations used by the proof or definition body
CorrBridge.boardBits
def AC0.Circ.eval
Module Circuit
(lean/phase3/Circuit.lean, lines 44–49) · file SHA-256 af97cc0eec7d8464…
Statement as elaborated and printed by Lean 4.26.0
(ℕ → Bool) → NimAudit.AC0.Circ → Bool
Exact source text, lines 44–49
44def eval (x : Nat → Bool) : Circ → Bool45 | input i => x i46 | const b => b47 | not c => !(eval x c)48 | and cs => cs.attach.all (fun ⟨c, _⟩ => eval x c)49 | or cs => cs.attach.any (fun ⟨c, _⟩ => eval x c)
Project declarations in the statement: AC0.Circ
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.and, AC0.Circ.casesOn, AC0.Circ.const, AC0.Circ.input, AC0.Circ.not, AC0.Circ.or, AC0.Circ.rec, AC0.Circ.rec_1
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 LocalRestore.cntR
Module LocalRestore
(lean/phase4/LocalRestore.lean, lines 233–234) · file SHA-256 fc4c7f908b0c9c58…
Number of indices below n satisfying p.
Statement as elaborated and printed by Lean 4.26.0
(ℕ → Bool) → ℕ → ℕ
Exact source text, lines 233–234
233/-- Number of indices below n satisfying p. -/234def cntR (p : Nat → Bool) (n : Nat) : Nat := ((List.range n).filter p).length
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
def Game.ofBits
Module NimGame
(lean/phase2/NimGame.lean, lines 178–181) · file SHA-256 23df6bb87ecfd344…
The number with bits f 0, ..., f (B-1).
Statement as elaborated and printed by Lean 4.26.0
ℕ → (ℕ → Bool) → ℕ
Exact source text, lines 178–181
178/-- The number with bits f 0, ..., f (B-1). -/179def ofBits : Nat → (Nat → Bool) → Nat180 | 0, _ => 0181 | B + 1, f => 2 ^ B * (if f B then 1 else 0) + ofBits B f
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
def AC0.Circ.depth
Module Circuit
(lean/phase3/Circuit.lean, lines 61–66) · file SHA-256 af97cc0eec7d8464…
Statement as elaborated and printed by Lean 4.26.0
NimAudit.AC0.Circ → ℕ
Exact source text, lines 61–66
61def depth : Circ → Nat62 | input _ => 063 | const _ => 064 | not c => depth c + 165 | and cs => listMax (cs.attach.map (fun ⟨c, _⟩ => depth c)) + 166 | or cs => listMax (cs.attach.map (fun ⟨c, _⟩ => depth c)) + 1
Project declarations in the statement: AC0.Circ
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.and, AC0.Circ.casesOn, AC0.Circ.const, AC0.Circ.input, AC0.Circ.listMax, AC0.Circ.not, AC0.Circ.or, AC0.Circ.rec, AC0.Circ.rec_1
def AC0.Circ.maxInput
Module Circuit
(lean/phase3/Circuit.lean, lines 68–74) · file SHA-256 af97cc0eec7d8464…
One more than the largest input index used (0 if none).
Statement as elaborated and printed by Lean 4.26.0
NimAudit.AC0.Circ → ℕ
Exact source text, lines 68–74
68/-- One more than the largest input index used (0 if none). -/69def maxInput : Circ → Nat70 | input i => i + 171 | const _ => 072 | not c => maxInput c73 | and cs => listMax (cs.attach.map (fun ⟨c, _⟩ => maxInput c))74 | or cs => listMax (cs.attach.map (fun ⟨c, _⟩ => maxInput c))
Project declarations in the statement: AC0.Circ
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.and, AC0.Circ.casesOn, AC0.Circ.const, AC0.Circ.input, AC0.Circ.listMax, AC0.Circ.not, AC0.Circ.or, AC0.Circ.rec, AC0.Circ.rec_1
def AC0.Circ.size
Module Circuit
(lean/phase3/Circuit.lean, lines 51–56) · file SHA-256 af97cc0eec7d8464…
Statement as elaborated and printed by Lean 4.26.0
NimAudit.AC0.Circ → ℕ
Exact source text, lines 51–56
51def size : Circ → Nat52 | input _ => 153 | const _ => 154 | not c => size c + 155 | and cs => (cs.attach.map (fun ⟨c, _⟩ => size c)).sum + 156 | or cs => (cs.attach.map (fun ⟨c, _⟩ => size c)).sum + 1
Project declarations in the statement: AC0.Circ
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.and, AC0.Circ.casesOn, AC0.Circ.const, AC0.Circ.input, AC0.Circ.not, AC0.Circ.or, AC0.Circ.rec, AC0.Circ.rec_1
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).