Principal declarations
theorem AC0.network_ac0
Module Circuit
(lean/phase3/Circuit.lean, lines 921–937) · file SHA-256 af97cc0eec7d8464… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
FEEDFORWARD SIMULATION THEOREM (one network). A valid network of L layers with
all fan-ins and widths ≤ M, on inputs x_0..x_{n-1} (n ≤ M), is computed output by
output by formulas of depth ≤ 3L and size ≤ 2 (2W+3)^L (M+1)^(W L), reading only
inputs < n.
Statement as elaborated and printed by Lean 4.26.0
∀ {W M n : ℕ} (ls : List NimAudit.AC0.Layer),
NimAudit.AC0.NetValid W ls →
NimAudit.AC0.NetBounded M ls →
∀ (i : ℕ),
(∀ (x : ℕ → Bool),
NimAudit.AC0.Circ.eval x (NimAudit.AC0.compileNet W ls NimAudit.AC0.Circ.input i) =
NimAudit.AC0.evalNet ls x i) ∧
(NimAudit.AC0.compileNet W ls NimAudit.AC0.Circ.input i).depth ≤ 3 * ls.length ∧
(NimAudit.AC0.compileNet W ls NimAudit.AC0.Circ.input i).size ≤
2 * ((2 * W + 3) ^ ls.length * (M + 1) ^ (W * ls.length)) ∧
(NimAudit.AC0.compileNet W ls
(fun j =>
if j < n then NimAudit.AC0.Circ.input j else NimAudit.AC0.Circ.const false)
i).maxInput ≤
n
Exact source text, lines 921–937
921/-- FEEDFORWARD SIMULATION THEOREM (one network). A valid network of L layers with922 all fan-ins and widths ≤ M, on inputs x_0..x_{n-1} (n ≤ M), is computed output by923 output by formulas of depth ≤ 3L and size ≤ 2 (2W+3)^L (M+1)^(W L), reading only924 inputs < n. -/925theorem network_ac0 {W M n : Nat} (ls : List Layer) (hv : NetValid W ls) (hb : NetBounded M ls)926 (i : Nat) :927 (∀ x : Nat → Bool, eval x (compileNet W ls input i) = evalNet ls x i) ∧928 depth (compileNet W ls input i) ≤ 3 * ls.length ∧929 size (compileNet W ls input i) ≤ 2 * ((2 * W + 3) ^ ls.length * (M + 1) ^ (W * ls.length)) ∧930 maxInput (compileNet W ls (fun j => if j < n then input j else const false) i) ≤ n := by931 have hb' := compileNet_sd (W := W) ls hb input 1 0 (fun _ => by simp) (fun _ => by simp) i932 refine ⟨fun x => by rw [eval_compileNet ls hv]; simp, by have := hb'.2; omega, ?_, ?_⟩933 · have := sizeBound_closed W M ls.length; have := hb'.1; omega934 · exact compileNet_max (W := W) ls (fun j => if j < n then input j else const false) n935 (fun j => by936 show maxInput (if j < n then input j else const false) ≤ n937 split <;> simp <;> omega) i
Project declarations in the statement: AC0.Circ, AC0.Circ.const, AC0.Circ.depth, AC0.Circ.eval, AC0.Circ.input, AC0.Circ.maxInput, AC0.Circ.size, AC0.Layer, AC0.NetBounded, AC0.NetValid, AC0.compileNet, AC0.evalNet
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.const, AC0.Circ.depth, AC0.Circ.depth_input, AC0.Circ.eval, AC0.Circ.eval_input, AC0.Circ.input, AC0.Circ.maxInput, AC0.Circ.maxInput_const, AC0.Circ.maxInput_input, AC0.Circ.size, AC0.Circ.size_input, AC0.Layer, AC0.NetBounded, AC0.NetValid, AC0.compileNet, AC0.compileNet_max, AC0.compileNet_sd, AC0.evalNet, AC0.eval_compileNet, AC0.sizeBound, AC0.sizeBound_closed
theorem FiniteNet.family_finite
Module FiniteNet
(lean/phase4/FiniteNet.lean, lines 164–200) · file SHA-256 1d45c47650006bb7… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
FINITE-INPUT FAMILY THEOREM. Fix W, L, c, k, c', k'. For each input length n let
net n be a valid network with exactly L layers whose fan-ins and widths are
≤ c (n+1)^k, with K n ≤ c' (n+1)^k' designated output bits. Then each output i
is computed (zero-extended n-bit semantics) by one formula that reads only
inputs < n, has depth ≤ 3L and size ≤ 2 (2W+3)^L (c+1)^(WL) (n+1)^(kWL); the
total size of the K n output formulas is ≤ c'(n+1)^k' times that bound.
Statement as elaborated and printed by Lean 4.26.0
∀ {W L c k c' k' : ℕ} (net : ℕ → List NimAudit.AC0.Layer) (K : ℕ → ℕ),
(∀ (n : ℕ), (net n).length = L) →
(∀ (n : ℕ), NimAudit.AC0.NetValid W (net n)) →
(∀ (n : ℕ), NimAudit.AC0.NetBounded (c * (n + 1) ^ k) (net n)) →
(∀ (n : ℕ), K n ≤ c' * (n + 1) ^ k') →
∀ (n : ℕ),
(∀ (i : ℕ),
(∀ (x : ℕ → Bool),
NimAudit.AC0.Circ.eval x (NimAudit.FiniteNet.netFormula W n (net n) i) =
NimAudit.AC0.evalNet (net n) (NimAudit.FiniteNet.pad n x) i) ∧
(NimAudit.FiniteNet.netFormula W n (net n) i).depth ≤ 3 * L ∧
(NimAudit.FiniteNet.netFormula W n (net n) i).size ≤
2 * ((2 * W + 3) ^ L * ((c + 1) ^ (W * L) * (n + 1) ^ (k * (W * L)))) ∧
(NimAudit.FiniteNet.netFormula W n (net n) i).maxInput ≤ n) ∧
NimAudit.FiniteNet.totalSize W n (net n) (K n) ≤
c' * (n + 1) ^ k' *
(2 * ((2 * W + 3) ^ L * ((c + 1) ^ (W * L) * (n + 1) ^ (k * (W * L)))))
Exact source text, lines 164–200
164/-- FINITE-INPUT FAMILY THEOREM. Fix W, L, c, k, c', k'. For each input length n let165 net n be a valid network with exactly L layers whose fan-ins and widths are166 ≤ c (n+1)^k, with K n ≤ c' (n+1)^k' designated output bits. Then each output i167 is computed (zero-extended n-bit semantics) by one formula that reads only168 inputs < n, has depth ≤ 3L and size ≤ 2 (2W+3)^L (c+1)^(WL) (n+1)^(kWL); the169 total size of the K n output formulas is ≤ c'(n+1)^k' times that bound. -/170theorem family_finite {W L c k c' k' : Nat} (net : Nat → List Layer) (K : Nat → Nat)171 (hlen : ∀ n, (net n).length = L) (hv : ∀ n, NetValid W (net n))172 (hb : ∀ n, NetBounded (c * (n + 1) ^ k) (net n)) (hK : ∀ n, K n ≤ c' * (n + 1) ^ k')173 (n : Nat) :174 (∀ i, (∀ x : Nat → Bool, eval x (netFormula W n (net n) i) = evalNet (net n) (pad n x) i) ∧175 depth (netFormula W n (net n) i) ≤ 3 * L ∧176 size (netFormula W n (net n) i) ≤177 2 * ((2 * W + 3) ^ L * ((c + 1) ^ (W * L) * (n + 1) ^ (k * (W * L)))) ∧178 maxInput (netFormula W n (net n) i) ≤ n) ∧179 totalSize W n (net n) (K n) ≤180 c' * (n + 1) ^ k' * (2 * ((2 * W + 3) ^ L * ((c + 1) ^ (W * L) * (n + 1) ^ (k * (W * L))))) := by181 have hM : (c * (n + 1) ^ k + 1) ^ (W * L) ≤ (c + 1) ^ (W * L) * (n + 1) ^ (k * (W * L)) := by182 have hp : c * (n + 1) ^ k + 1 ≤ (c + 1) * (n + 1) ^ k := by183 have : 1 ≤ (n + 1) ^ k := Nat.pow_pos (by omega)184 generalize (n + 1) ^ k = p at *185 have e : (c + 1) * p = c * p + p := by rw [Nat.add_mul, Nat.one_mul]186 rw [e]; omega187 calc (c * (n + 1) ^ k + 1) ^ (W * L) ≤ ((c + 1) * (n + 1) ^ k) ^ (W * L) :=188 Nat.pow_le_pow_left hp _189 _ = (c + 1) ^ (W * L) * (n + 1) ^ (k * (W * L)) := by190 rw [Nat.mul_pow, ← Nat.pow_mul, Nat.mul_comm k]191 have hbound : 2 * ((2 * W + 3) ^ (net n).length * (c * (n + 1) ^ k + 1) ^ (W * (net n).length)) ≤192 2 * ((2 * W + 3) ^ L * ((c + 1) ^ (W * L) * (n + 1) ^ (k * (W * L)))) := by193 rw [hlen]194 exact Nat.mul_le_mul_left _ (Nat.mul_le_mul_left _ hM)195 refine ⟨fun i => ?_, ?_⟩196 · obtain ⟨h1, h2, h3, h4⟩ := netFormula_spec n (net n) (hv n) (hb n) i197 rw [hlen] at h2198 exact ⟨h1, h2, Nat.le_trans h3 hbound, h4⟩199 · have := totalSize_le n (net n) (hv n) (hb n) (K n)200 exact Nat.le_trans this (Nat.mul_le_mul (hK n) hbound)
Project declarations in the statement: AC0.Circ.depth, AC0.Circ.eval, AC0.Circ.maxInput, AC0.Circ.size, AC0.Layer, AC0.NetBounded, AC0.NetValid, AC0.evalNet, FiniteNet.netFormula, FiniteNet.pad, FiniteNet.totalSize
Project declarations used by the proof or definition body
AC0.Circ.depth, AC0.Circ.eval, AC0.Circ.maxInput, AC0.Circ.size, AC0.Layer, AC0.NetBounded, AC0.NetValid, AC0.evalNet, FiniteNet.netFormula, FiniteNet.netFormula_spec, FiniteNet.pad, FiniteNet.totalSize, FiniteNet.totalSize_le
theorem Family.netFam_ac0
Module Family
(lean/phase6/Family.lean, lines 156–203) · file SHA-256 7a647f0a667d5ede… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
NETWORK-TO-AC0 AT FAMILY LEVEL. If a network family satisfies NetFam with fixed W and
L, then its first K i outputs (K polynomial) are computed by the compiled formulas
netFormula W (len i) (net i), which form an AC0 family of depth ≤ 3L reading only the
len inputs; on unpadded inputs the formulas equal the networks (Wired, nonempty).
Statement as elaborated and printed by Lean 4.26.0
∀ {ι : Type} {adm : ι → Prop} {len : ι → ℕ} {net : ι → List NimAudit.AC0.Layer} {W L : ℕ},
NimAudit.Family.NetFam adm len net W L →
∀ (K : ι → ℕ),
NimAudit.Family.PolyIn adm len K →
NimAudit.Family.AC0Fam adm len
(fun i => List.map (NimAudit.FiniteNet.netFormula W (len i) (net i)) (List.range (K i)))
(3 * L) ∧
∀ (i : ι),
adm i →
net i ≠ [] →
∀ (o : ℕ) (x : ℕ → Bool),
NimAudit.AC0.Circ.eval x (NimAudit.FiniteNet.netFormula W (len i) (net i) o) =
NimAudit.AC0.evalNet (net i) x o
Exact source text, lines 156–203
156/-- NETWORK-TO-AC0 AT FAMILY LEVEL. If a network family satisfies NetFam with fixed W and157 L, then its first K i outputs (K polynomial) are computed by the compiled formulas158 netFormula W (len i) (net i), which form an AC0 family of depth ≤ 3L reading only the159 len inputs; on unpadded inputs the formulas equal the networks (Wired, nonempty). -/160theorem netFam_ac0 {ι : Type} {adm : ι → Prop} {len : ι → Nat} {net : ι → List Layer} {W L : Nat}161 (h : NetFam adm len net W L) (K : ι → Nat) (hK : PolyIn adm len K) :162 AC0Fam adm len (fun i => (List.range (K i)).map (netFormula W (len i) (net i))) (3 * L) ∧163 (∀ i, adm i → net i ≠ [] → ∀ o (x : Nat → Bool), eval x (netFormula W (len i) (net i) o) = evalNet (net i) x o) := by164 obtain ⟨c, k, hb⟩ := h.bounded165 have spec := fun i (hi : adm i) o => netFormula_spec (len i) (net i) (h.valid i hi) (hb i hi) o166 refine ⟨⟨h.pos, ?_, ?_, ?_⟩, ?_⟩167 · intro i hi c' hc168 obtain ⟨o, _, rfl⟩ := List.mem_map.mp hc169 have := (spec i hi o).2.1; have := h.layers i hi; omega170 · intro i hi c' hc171 obtain ⟨o, _, rfl⟩ := List.mem_map.mp hc172 exact (spec i hi o).2.2.2173 · -- each formula ≤ 2 (2W+3)^L (c len^k + 1)^(W L)174 have hpos := h.pos175 have hone : ∀ i, adm i → ∀ o, size (netFormula W (len i) (net i) o) ≤176 2 * ((2 * W + 3) ^ L * (c * len i ^ k + 1) ^ (W * L)) := by177 intro i hi o178 have h1 := (spec i hi o).2.2.1179 have hl := h.layers i hi180 have e1 : (2 * W + 3) ^ (net i).length ≤ (2 * W + 3) ^ L := Nat.pow_le_pow_right (by omega) hl181 have e2 : (c * len i ^ k + 1) ^ (W * (net i).length) ≤ (c * len i ^ k + 1) ^ (W * L) :=182 Nat.pow_le_pow_right (by omega) (Nat.mul_le_mul_left W hl)183 have := Nat.mul_le_mul e1 e2184 omega185 apply polyIn_mono (g := fun i => K i * (2 * ((2 * W + 3) ^ L * (c * len i ^ k + 1) ^ (W * L))))186 · intro i hi187 unfold tsize188 have := sum_map_le_mem (l := List.range (K i)) (f := fun o => size (netFormula W (len i) (net i) o))189 (g := fun _ => 2 * ((2 * W + 3) ^ L * (c * len i ^ k + 1) ^ (W * L))) (fun o _ => hone i hi o)190 rw [List.map_const', List.sum_replicate_nat, List.length_range] at this191 rw [List.map_map]192 exact this193 · apply polyIn_mul hK194 apply polyIn_mul (polyIn_const _ _ 2)195 apply polyIn_mul (polyIn_const _ _ _)196 apply polyIn_pow197 apply polyIn_add hpos _ (polyIn_const _ _ 1)198 apply polyIn_mul (polyIn_const _ _ c)199 apply polyIn_pow200 exact polyIn_leaf (fun i _ => Nat.le_refl _)201 · intro i hi hne o x202 exact (netFormula_wired (len i) (net i) (h.valid i hi) (hb i hi) (h.wired i hi) o203 (fun he => absurd he hne)).1 x
Project declarations in the statement: AC0.Circ, AC0.Circ.eval, AC0.Layer, AC0.evalNet, Family.AC0Fam, Family.NetFam, Family.PolyIn, FiniteNet.netFormula
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.depth, AC0.Circ.eval, AC0.Circ.maxInput, AC0.Circ.size, AC0.Circ.sum_map_le_mem, AC0.Layer, AC0.NetBounded, AC0.evalNet, Family.AC0Fam, Family.AC0Fam.mk, Family.NetFam, Family.NetFam.bounded, Family.NetFam.layers, Family.NetFam.pos, Family.NetFam.valid, Family.NetFam.wired, Family.PolyIn, Family.polyIn_add, Family.polyIn_const, Family.polyIn_leaf, Family.polyIn_mono, Family.polyIn_mul, Family.polyIn_pow, Family.tsize, FiniteNet.netFormula, FiniteNet.netFormula_spec, FiniteNet.netFormula_wired, FiniteNet.pad
theorem Windows.window_ac0
Module Windows
(lean/phase6/Windows.lean, lines 79–133) · file SHA-256 ff59ec8bf0a0de70… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
WINDOW SIMULATION THEOREM. For a valid L-layer cell with fan-ins/widths ≤ M reading
the input block and the w most recent states, the state after T updates is computed by
formulas with depth ≤ 3·L·T, size ≤ rnnSize W M L T, reading only the T input blocks.
Statement as elaborated and printed by Lean 4.26.0
∀ {W M : ℕ} (cell : List NimAudit.AC0.Layer),
NimAudit.AC0.NetValid W cell →
NimAudit.AC0.NetBounded M cell →
∀ (n m w : ℕ) (h0 : ℕ → Bool) (T i : ℕ),
(∀ (x : ℕ → Bool),
NimAudit.AC0.Circ.eval x (NimAudit.Windows.wCirc W cell n m w h0 T i) =
NimAudit.Windows.wState cell n m w h0 x T i) ∧
(NimAudit.Windows.wCirc W cell n m w h0 T i).size ≤
NimAudit.AC0.rnnSize W M cell.length T ∧
(NimAudit.Windows.wCirc W cell n m w h0 T i).depth ≤ 3 * cell.length * T ∧
(NimAudit.Windows.wCirc W cell n m w h0 T i).maxInput ≤ T * n
Exact source text, lines 79–133
79/-- WINDOW SIMULATION THEOREM. For a valid L-layer cell with fan-ins/widths ≤ M reading80 the input block and the w most recent states, the state after T updates is computed by81 formulas with depth ≤ 3·L·T, size ≤ rnnSize W M L T, reading only the T input blocks. -/82theorem window_ac0 {W M : Nat} (cell : List Layer) (hv : NetValid W cell) (hb : NetBounded M cell)83 (n m w : Nat) (h0 : Nat → Bool) : ∀ T i,84 (∀ x : Nat → Bool, eval x (wCirc W cell n m w h0 T i) = wState cell n m w h0 x T i) ∧85 size (wCirc W cell n m w h0 T i) ≤ rnnSize W M cell.length T ∧86 depth (wCirc W cell n m w h0 T i) ≤ 3 * cell.length * T ∧87 maxInput (wCirc W cell n m w h0 T i) ≤ T * n := by88 intro T89 induction T using Nat.strongRecOn with90 | ind T ih =>91 intro i92 cases T with93 | zero => simp [wCirc.eq_1, wState.eq_1, rnnSize]94 | succ t =>95 -- the leaves of the last update96 let prev : Nat → Circ := fun j => if j < n then input (t * n + j) else if j < n + w * m then97 (if (j - n) / m ≤ t then wCirc W cell n m w h0 (t - (j - n) / m) ((j - n) % m) else const (h0 ((j - n) % m)))98 else const false99 have hprev : ∀ j, size (prev j) ≤ rnnSize W M cell.length t ∧ depth (prev j) ≤ 3 * cell.length * t ∧100 maxInput (prev j) ≤ (t + 1) * n := by101 intro j102 simp only [prev]103 split104 · simp; refine ⟨rnnSize_pos _ _ _ _, ?_⟩; rw [Nat.succ_mul]; omega105 · split106 · split107 · next hδ =>108 have hlt : t - (j - n) / m < t + 1 := Nat.lt_succ_of_le (Nat.sub_le _ _)109 have hle : t - (j - n) / m ≤ t := Nat.sub_le _ _110 obtain ⟨_, h2, h3, h4⟩ := ih (t - (j - n) / m) hlt ((j - n) % m)111 refine ⟨Nat.le_trans h2 (rnnSize_mono W M _ hle), Nat.le_trans h3 (Nat.mul_le_mul_left _ hle),112 Nat.le_trans h4 ?_⟩113 rw [Nat.succ_mul]; exact Nat.le_trans (Nat.mul_le_mul_right n hle) (Nat.le_add_right _ _)114 · simp; exact rnnSize_pos _ _ _ _115 · simp; exact rnnSize_pos _ _ _ _116 have hsd := compileNet_sd (W := W) cell hb prev (rnnSize W M cell.length t) (3 * cell.length * t)117 (fun j => (hprev j).1) (fun j => (hprev j).2.1) i118 have hmx := compileNet_max (W := W) cell prev ((t + 1) * n) (fun j => (hprev j).2.2) i119 refine ⟨fun x => ?_, ?_, ?_, ?_⟩120 · rw [wCirc_succ, wState_succ, eval_compileNet cell hv]121 congr 1122 funext j123 unfold winIn124 split125 · simp126 · split127 · split128 · next hδ => simp only [if_pos hδ]; exact (ih (t - (j - n) / m) (Nat.lt_succ_of_le (Nat.sub_le _ _)) ((j - n) % m)).1 x129 · next hδ => simp [hδ]130 · simp131 · rw [wCirc_succ]; simp only [rnnSize]; exact hsd.1132 · rw [wCirc_succ]; have := hsd.2; rw [Nat.mul_succ]; omega133 · rw [wCirc_succ]; exact hmx
Project declarations in the statement: AC0.Circ.depth, AC0.Circ.eval, AC0.Circ.maxInput, AC0.Circ.size, AC0.Layer, AC0.NetBounded, AC0.NetValid, AC0.rnnSize, Windows.wCirc, Windows.wState
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.const, AC0.Circ.depth, AC0.Circ.depth_const, AC0.Circ.depth_input, AC0.Circ.eval, AC0.Circ.eval_const, AC0.Circ.eval_input, AC0.Circ.input, AC0.Circ.maxInput, AC0.Circ.maxInput_const, AC0.Circ.maxInput_input, AC0.Circ.size, AC0.Circ.size_const, AC0.Circ.size_input, AC0.Layer, AC0.NetBounded, AC0.NetValid, AC0.compileNet, AC0.compileNet_max, AC0.compileNet_sd, AC0.evalNet, AC0.eval_compileNet, AC0.rnnSize, AC0.rnnSize_pos, AC0.sizeBound, Windows.rnnSize_mono, Windows.wCirc, Windows.wCirc_succ, Windows.wState, Windows.wState_succ, Windows.winIn
theorem Windows.staged_ac0
Module Windows
(lean/phase6/Windows.lean, lines 165–188) · file SHA-256 ff59ec8bf0a0de70… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound
GATE-REALISED COMPOSITION THEOREM. If every stage is a W-valid network with at most L
layers and widths/fan-ins ≤ M, the K-stage model is computed (on zero-extended n-bit
inputs) by formulas of depth ≤ 3·K·L, size ≤ 2 (2W+3)^{KL} (M+1)^{W·KL}, reading only
the n inputs; the formulas compute the staged evaluation.
Statement as elaborated and printed by Lean 4.26.0
∀ {W M L : ℕ} (sts : List (List NimAudit.AC0.Layer)),
(∀ st ∈ sts, NimAudit.AC0.NetValid W st) →
(∀ st ∈ sts, NimAudit.AC0.NetBounded M st) →
(∀ st ∈ sts, st.length ≤ L) →
∀ (n i : ℕ),
(∀ (x : ℕ → Bool),
NimAudit.AC0.Circ.eval x (NimAudit.FiniteNet.netFormula W n sts.flatten i) =
NimAudit.Windows.runStages sts (NimAudit.FiniteNet.pad n x) i) ∧
(NimAudit.FiniteNet.netFormula W n sts.flatten i).depth ≤ 3 * (sts.length * L) ∧
(NimAudit.FiniteNet.netFormula W n sts.flatten i).size ≤
2 * ((2 * W + 3) ^ (sts.length * L) * (M + 1) ^ (W * (sts.length * L))) ∧
(NimAudit.FiniteNet.netFormula W n sts.flatten i).maxInput ≤ n
Exact source text, lines 165–188
165/-- GATE-REALISED COMPOSITION THEOREM. If every stage is a W-valid network with at most L166 layers and widths/fan-ins ≤ M, the K-stage model is computed (on zero-extended n-bit167 inputs) by formulas of depth ≤ 3·K·L, size ≤ 2 (2W+3)^{KL} (M+1)^{W·KL}, reading only168 the n inputs; the formulas compute the staged evaluation. -/169theorem staged_ac0 {W M L : Nat} (sts : List (List Layer)) (hv : ∀ st ∈ sts, NetValid W st)170 (hb : ∀ st ∈ sts, NetBounded M st) (hl : ∀ st ∈ sts, st.length ≤ L) (n i : Nat) :171 (∀ x : Nat → Bool, eval x (netFormula W n sts.flatten i) = runStages sts (pad n x) i) ∧172 depth (netFormula W n sts.flatten i) ≤ 3 * (sts.length * L) ∧173 size (netFormula W n sts.flatten i) ≤ 2 * ((2 * W + 3) ^ (sts.length * L) * (M + 1) ^ (W * (sts.length * L))) ∧174 maxInput (netFormula W n sts.flatten i) ≤ n := by175 have hv' : NetValid W sts.flatten := by176 intro l hl' g hg177 obtain ⟨st, hst, hlst⟩ := List.mem_flatten.mp hl'178 exact hv st hst l hlst g hg179 have hb' : NetBounded M sts.flatten := by180 intro l hl'181 obtain ⟨st, hst, hlst⟩ := List.mem_flatten.mp hl'182 exact hb st hst l hlst183 obtain ⟨h1, h2, h3, h4⟩ := netFormula_spec n sts.flatten hv' hb' i184 have hlen := flatten_length_le hl185 refine ⟨fun x => by rw [h1, evalNet_flatten], Nat.le_trans h2 (Nat.mul_le_mul_left 3 hlen), Nat.le_trans h3 ?_, h4⟩186 apply Nat.mul_le_mul_left187 exact Nat.mul_le_mul (Nat.pow_le_pow_right (by omega) hlen)188 (Nat.pow_le_pow_right (by omega) (Nat.mul_le_mul_left W hlen))
Project declarations in the statement: AC0.Circ.depth, AC0.Circ.eval, AC0.Circ.maxInput, AC0.Circ.size, AC0.Layer, AC0.NetBounded, AC0.NetValid, FiniteNet.netFormula, FiniteNet.pad, Windows.runStages
Project declarations used by the proof or definition body
AC0.Circ.depth, AC0.Circ.eval, AC0.Circ.maxInput, AC0.Circ.size, AC0.Gate, AC0.Gate.Valid, AC0.Gate.fanin, AC0.Layer, AC0.NetBounded, AC0.NetValid, AC0.evalNet, FiniteNet.netFormula, FiniteNet.netFormula_spec, FiniteNet.pad, Windows.evalNet_flatten, Windows.flatten_length_le, Windows.runStages
Definitions these statements use
inductive Family.AC0Fam
Module Family
(lean/phase6/Family.lean, lines 126–134) · file SHA-256 7a647f0a667d5ede…
AC0 FAMILY CERTIFICATE (nonuniform, multi-output). For every admissible member:
the input length is positive, every output formula has depth ≤ d and reads only
the first len inputs, and the total size of the outputs is ≤ c·len^k with c, k
independent of the member.
Statement as elaborated and printed by Lean 4.26.0
{ι : Type} → (ι → Prop) → (ι → ℕ) → (ι → List NimAudit.AC0.Circ) → ℕ → Prop
Exact source text, lines 126–134
126/-- AC0 FAMILY CERTIFICATE (nonuniform, multi-output). For every admissible member:127 the input length is positive, every output formula has depth ≤ d and reads only128 the first len inputs, and the total size of the outputs is ≤ c·len^k with c, k129 independent of the member. -/130structure AC0Fam {ι : Type} (adm : ι → Prop) (len : ι → Nat) (outs : ι → List Circ) (d : Nat) : Prop where131 pos : ∀ i, adm i → 1 ≤ len i132 depth_le : ∀ i, adm i → ∀ c ∈ outs i, depth c ≤ d133 reads : ∀ i, adm i → ∀ c ∈ outs i, maxInput c ≤ len i134 size_poly : PolyIn adm len (fun i => tsize (outs i))
Project declarations in the statement: AC0.Circ
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.depth, AC0.Circ.maxInput, Family.PolyIn, Family.tsize
inductive Family.NetFam
Module Family
(lean/phase6/Family.lean, lines 141–149) · file SHA-256 7a647f0a667d5ede…
NETWORK FAMILY CERTIFICATE: fixed grid W, at most L layers, valid gates, first layer
reading only the len inputs, polynomial widths/fan-ins and polynomial gate count.
Statement as elaborated and printed by Lean 4.26.0
{ι : Type} → (ι → Prop) → (ι → ℕ) → (ι → List NimAudit.AC0.Layer) → ℕ → ℕ → Prop
Exact source text, lines 141–149
141/-- NETWORK FAMILY CERTIFICATE: fixed grid W, at most L layers, valid gates, first layer142 reading only the len inputs, polynomial widths/fan-ins and polynomial gate count. -/143structure NetFam {ι : Type} (adm : ι → Prop) (len : ι → Nat) (net : ι → List Layer) (W L : Nat) : Prop where144 pos : ∀ i, adm i → 1 ≤ len i145 valid : ∀ i, adm i → NetValid W (net i)146 wired : ∀ i, adm i → Wired (len i) (net i)147 layers : ∀ i, adm i → (net i).length ≤ L148 bounded : ∃ c k, ∀ i, adm i → NetBounded (c * len i ^ k) (net i)149 gates : PolyIn adm len (fun i => gateCount (net i))
Project declarations in the statement: AC0.Layer
Project declarations used by the proof or definition body
AC0.Layer, AC0.NetBounded, AC0.NetValid, Family.PolyIn, FiniteNet.Wired, ThresholdNet.gateCount
inductive AC0.Circ
Module Circuit
(lean/phase3/Circuit.lean, lines 35–40) · file SHA-256 af97cc0eec7d8464…
Statement as elaborated and printed by Lean 4.26.0
Type
Exact source text, lines 35–40
35inductive Circ where36 | input (i : Nat)37 | const (b : Bool)38 | not (c : Circ)39 | and (cs : List Circ)40 | or (cs : List Circ)
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.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 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
def AC0.Layer
Module Circuit
(lean/phase3/Circuit.lean, lines 743–744) · file SHA-256 af97cc0eec7d8464…
A layer: a list of gates reading the previous layer's outputs (indexed by Nat).
Statement as elaborated and printed by Lean 4.26.0
Type
Exact source text, lines 743–744
743/-- A layer: a list of gates reading the previous layer's outputs (indexed by Nat). -/744abbrev Layer := List Gate
Project declarations in the statement: none
Project declarations used by the proof or definition body
AC0.Gate
def AC0.NetBounded
Module Circuit
(lean/phase3/Circuit.lean, lines 768–769) · file SHA-256 af97cc0eec7d8464…
Fan-in and width bounded by M.
Statement as elaborated and printed by Lean 4.26.0
ℕ → List NimAudit.AC0.Layer → Prop
Exact source text, lines 768–769
768/-- Fan-in and width bounded by M. -/769def NetBounded (M : Nat) (ls : List Layer) : Prop := ∀ l ∈ ls, l.length ≤ M ∧ ∀ g ∈ l, g.fanin ≤ M
Project declarations in the statement: AC0.Layer
Project declarations used by the proof or definition body
AC0.Gate, AC0.Gate.fanin, AC0.Layer
def AC0.NetValid
Module Circuit
(lean/phase3/Circuit.lean, lines 765–766) · file SHA-256 af97cc0eec7d8464…
All gates valid for W.
Statement as elaborated and printed by Lean 4.26.0
ℕ → List NimAudit.AC0.Layer → Prop
Exact source text, lines 765–766
765/-- All gates valid for W. -/766def NetValid (W : Nat) (ls : List Layer) : Prop := ∀ l ∈ ls, ∀ g ∈ l, Gate.Valid W g
Project declarations in the statement: AC0.Layer
Project declarations used by the proof or definition body
AC0.Gate, AC0.Gate.Valid, AC0.Layer
def AC0.compileNet
Module Circuit
(lean/phase3/Circuit.lean, lines 761–763) · file SHA-256 af97cc0eec7d8464…
Statement as elaborated and printed by Lean 4.26.0
ℕ → List NimAudit.AC0.Layer → (ℕ → NimAudit.AC0.Circ) → ℕ → NimAudit.AC0.Circ
Exact source text, lines 761–763
761def compileNet (W : Nat) : List Layer → (Nat → Circ) → (Nat → Circ)762 | [], prev => prev763 | l :: ls, prev => compileNet W ls (compileLayer W l prev)
Project declarations in the statement: AC0.Circ, AC0.Layer
Project declarations used by the proof or definition body
AC0.Circ, AC0.Layer, AC0.compileLayer
def AC0.evalNet
Module Circuit
(lean/phase3/Circuit.lean, lines 751–754) · file SHA-256 af97cc0eec7d8464…
A network: layers applied in order.
Statement as elaborated and printed by Lean 4.26.0
List NimAudit.AC0.Layer → (ℕ → Bool) → ℕ → Bool
Exact source text, lines 751–754
751/-- A network: layers applied in order. -/752def evalNet : List Layer → (Nat → Bool) → (Nat → Bool)753 | [], z => z754 | l :: ls, z => evalNet ls (evalLayer l z)
Project declarations in the statement: AC0.Layer
Project declarations used by the proof or definition body
AC0.Layer, AC0.evalLayer
def FiniteNet.netFormula
Module FiniteNet
(lean/phase4/FiniteNet.lean, lines 31–32) · file SHA-256 1d45c47650006bb7…
THE compiled formula for output i of network ls on n inputs.
Statement as elaborated and printed by Lean 4.26.0
ℕ → ℕ → List NimAudit.AC0.Layer → ℕ → NimAudit.AC0.Circ
Exact source text, lines 31–32
31/-- THE compiled formula for output i of network ls on n inputs. -/32def netFormula (W n : Nat) (ls : List Layer) (i : Nat) : Circ := compileNet W ls (clip n) i
Project declarations in the statement: AC0.Circ, AC0.Layer
Project declarations used by the proof or definition body
AC0.Layer, AC0.compileNet, FiniteNet.clip
def FiniteNet.pad
Module FiniteNet
(lean/phase4/FiniteNet.lean, lines 25–26) · file SHA-256 1d45c47650006bb7…
Zero-extension of an n-bit assignment.
Statement as elaborated and printed by Lean 4.26.0
ℕ → (ℕ → Bool) → ℕ → Bool
Exact source text, lines 25–26
25/-- Zero-extension of an n-bit assignment. -/26def pad (n : Nat) (x : Nat → Bool) : Nat → Bool := fun j => if j < n then x j else false
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
def FiniteNet.totalSize
Module FiniteNet
(lean/phase4/FiniteNet.lean, lines 150–152) · file SHA-256 1d45c47650006bb7…
Total formula size of the first K outputs (no sharing between outputs).
Statement as elaborated and printed by Lean 4.26.0
ℕ → ℕ → List NimAudit.AC0.Layer → ℕ → ℕ
Exact source text, lines 150–152
150/-- Total formula size of the first K outputs (no sharing between outputs). -/151def totalSize (W n : Nat) (ls : List Layer) (K : Nat) : Nat :=152 ((List.range K).map (fun i => size (netFormula W n ls i))).sum
Project declarations in the statement: AC0.Layer
Project declarations used by the proof or definition body
AC0.Circ.size, AC0.Layer, FiniteNet.netFormula
def Family.PolyIn
Module Family
(lean/phase6/Family.lean, lines 37–39) · file SHA-256 7a647f0a667d5ede…
f is bounded by c·(len i)^k on admissible indices, with c and k fixed.
Statement as elaborated and printed by Lean 4.26.0
{ι : Type} → (ι → Prop) → (ι → ℕ) → (ι → ℕ) → Prop
Exact source text, lines 37–39
37/-- f is bounded by c·(len i)^k on admissible indices, with c and k fixed. -/38def PolyIn (adm : ι → Prop) (len : ι → Nat) (f : ι → Nat) : Prop :=39 ∃ c k : Nat, ∀ i, adm i → f i ≤ c * len i ^ k
Project declarations in the statement: none
Project declarations used by the proof or definition body
none
def AC0.rnnSize
Module Circuit
(lean/phase3/Circuit.lean, lines 996–999) · file SHA-256 af97cc0eec7d8464…
Size bound after t updates.
Statement as elaborated and printed by Lean 4.26.0
ℕ → ℕ → ℕ → ℕ → ℕ
Exact source text, lines 996–999
996/-- Size bound after t updates. -/997def rnnSize (W M L : Nat) : Nat → Nat998 | 0 => 1999 | t + 1 => sizeBound W M (rnnSize W M L t) L
Project declarations in the statement: none
Project declarations used by the proof or definition body
AC0.sizeBound
def Windows.wCirc
Module Windows
(lean/phase6/Windows.lean, lines 42–49) · file SHA-256 ff59ec8bf0a0de70…
The unrolled formulas.
Statement as elaborated and printed by Lean 4.26.0
ℕ → List NimAudit.AC0.Layer → ℕ → ℕ → ℕ → (ℕ → Bool) → ℕ → ℕ → NimAudit.AC0.Circ
Exact source text, lines 42–49
42/-- The unrolled formulas. -/43def wCirc (W : Nat) (cell : List Layer) (n m w : Nat) (h0 : Nat → Bool) : Nat → Nat → Circ44 | 0 => fun i => const (h0 i)45 | t + 1 => compileNet W cell (fun j => if j < n then input (t * n + j) else if j < n + w * m then46 (if (j - n) / m ≤ t then wCirc W cell n m w h0 (t - (j - n) / m) ((j - n) % m) else const (h0 ((j - n) % m)))47 else const false)48termination_by t => t49decreasing_by exact Nat.lt_succ_of_le (Nat.sub_le _ _)
Project declarations in the statement: AC0.Circ, AC0.Layer
Project declarations used by the proof or definition body
AC0.Circ, AC0.Circ.const, AC0.Circ.input, AC0.Layer, AC0.compileNet
def Windows.wState
Module Windows
(lean/phase6/Windows.lean, lines 34–40) · file SHA-256 ff59ec8bf0a0de70…
State after t updates (h0 before time 0 and as the initial state).
Statement as elaborated and printed by Lean 4.26.0
List NimAudit.AC0.Layer → ℕ → ℕ → ℕ → (ℕ → Bool) → (ℕ → Bool) → ℕ → ℕ → Bool
Exact source text, lines 34–40
34/-- State after t updates (h0 before time 0 and as the initial state). -/35def wState (cell : List Layer) (n m w : Nat) (h0 : Nat → Bool) (x : Nat → Bool) : Nat → Nat → Bool36 | 0 => h037 | t + 1 => evalNet cell (winIn n m w (fun j => x (t * n + j))38 (fun δ => if δ ≤ t then wState cell n m w h0 x (t - δ) else h0))39termination_by t => t40decreasing_by exact Nat.lt_succ_of_le (Nat.sub_le _ _)
Project declarations in the statement: AC0.Layer
Project declarations used by the proof or definition body
AC0.Layer, AC0.evalNet, Windows.winIn
def Windows.runStages
Module Windows
(lean/phase6/Windows.lean, lines 147–150) · file SHA-256 ff59ec8bf0a0de70…
Staged evaluation: stages applied in order.
Statement as elaborated and printed by Lean 4.26.0
List (List NimAudit.AC0.Layer) → (ℕ → Bool) → ℕ → Bool
Exact source text, lines 147–150
147/-- Staged evaluation: stages applied in order. -/148def runStages : List (List Layer) → (Nat → Bool) → (Nat → Bool)149 | [], x => x150 | st :: sts, x => runStages sts (evalNet st x)
Project declarations in the statement: AC0.Layer
Project declarations used by the proof or definition body
AC0.Layer, AC0.evalNet
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).