NIM paper · interactive edition Interactive edition · paper, explanations and Lean proofs.

Equation (H.1)Under the stated correlation premise η_N: success ≤ 2/(q−1) + (q−1)η_N

Checked theorem Lean checks a formal statement corresponding to this claim.

1 Paper text

Proof. Part (i). Fix B≥2B\ge2, N≥1N\ge1 and put q=2Bq=2^B. Let UU be the uniform distribution on all NN independent BB-bit heaps, before conditioning on a nonzero nim-sum. For any fixed values of N−1N-1 heaps and any target nim-sum, exactly one value of the remaining heap gives that target. Thus σ\sigma is exactly uniform on F2B\mathbb F_2^B, and Pr⁡U[σ≠0]=(q−1)/q\Pr_U[\sigma\ne0]=(q-1)/q. Let ℓ=ℓj\ell=\ell_j be the nonzero linear functional returned by the fixed structured head, and let β=ℓ(σ)\beta=\ell(\sigma).

For each fixed b∈{0,1}b\in\{0,1\}, decode FN(P,b)F_N(P,b) as a proposed move (i,v)(i,v). On legal outputs define gb(P)=hi⊕vg_b(P)=h_i\oplus v, and set gb(P)=0g_b(P)=0 on invalid outputs. Selecting an indexed input block, checking legality and taking its XOR with the output use polynomial-size, constant-depth circuits. Thus for each a∈F2Ba\in\mathbb F_2^B, the indicator Hb,a(P)=1{gb(P)=a}H_{b,a}(P)=\mathbf1\{g_b(P)=a\} is in AC0\AC^0. On σ≠0\sigma\ne0, a legal move wins exactly when gβ(P)=σ(P)g_\beta(P)=\sigma(P); invalid outputs cannot satisfy that equality.

For u∈F2Bu\in\mathbb F_2^B, write χu(P)=(−1)⟨u,σ(P)⟩\chi_u(P)=(-1)^{\langle u,\sigma(P)\rangle}. First consider the finite probability calculation under the explicit assumption that some ηN≥0\eta_N\ge0 satisfies ∣EU[Hb,a(P)χu(P)]∣≤ηN\bigl|\mathbb E_U[H_{b,a}(P)\chi_u(P)]\bigr| \le \eta_N for every b∈{0,1}b\in\{0,1\}, a∈F2Ba\in\mathbb F_2^B and nonzero u∈F2Bu\in\mathbb F_2^B. This is a two-sided correlation bound under the unconditioned distribution UU; it does not assume independence between the readout and the nim-sum. Expanding the exact-value indicator gives 1{σ=a}=q−1∑u∈F2B(−1)⟨u,a⟩χu(P),\mathbf1\{\sigma=a\}=q^{-1}\sum_{u\in\mathbb F_2^B} (-1)^{\langle u,a\rangle}\chi_u(P), so ∣EU[Hb,a1{σ=a}]−q−1EUHb,a∣≤q−1qηN.\left|\mathbb E_U[H_{b,a}\mathbf1\{\sigma=a\}] -q^{-1}\mathbb E_U H_{b,a}\right| \le \frac{q-1}{q}\eta_N. For each fixed bb, the events gb(P)=ag_b(P)=a are disjoint. Therefore Pr⁡U[winning move and σ≠0]=∑a≠0EU[Hℓ(a),a1{σ=a}]≤q−1∑b∈{0,1}∑a≠0ℓ(a)=bEUHb,a+(q−1)2qηN≤2q+(q−1)2qηN.\begin{aligned}\Pr_U[\text{winning move and }\sigma\ne0] &=\sum_{a\ne0}\mathbb E_U[H_{\ell(a),a}\mathbf1\{\sigma=a\}]\\ &\le q^{-1}\sum_{b\in\{0,1\}}\sum_{\substack{a\ne0\\\ell(a)=b}} \mathbb E_U H_{b,a}+\frac{(q-1)^2}{q}\eta_N\\ &\le \frac{2}{q}+\frac{(q-1)^2}{q}\eta_N.\end{aligned} Dividing by Pr⁡U[σ≠0]=(q−1)/q\Pr_U[\sigma\ne0]=(q-1)/q gives the finite bound Pr⁡U[legal winning move∣σ≠0]≤2q−1+(q−1)ηN.\Pr_U[\text{legal winning move}\mid\sigma\ne0] \le \frac{2}{q-1}+(q-1)\eta_N.(H.1)

It remains to supply the correlation estimate for the circuit class. For u≠0u\ne0, χu\chi_u is parity on NN times the number of nonzero coordinates of uu, hence on at least NN input bits. Fix all coordinates outside this support. The restricted indicator remains a polynomial-size, fixed-depth AC0\AC^0 circuit, so the standard parity-correlation bound applies uniformly to every such restriction; averaging over the fixed coordinates preserves the bound (Håstad, 1986, 2014). Taking the maximum over the finitely many a,b,u≠0a,b,u\ne0 gives a nonnegative negligible ηN\eta_N. Since BB, the circuit depth and the polynomial size exponent are fixed, (q−1)ηN(q-1)\eta_N is also negligible. This yields the asserted asymptotic bound. The fixed-BB assumption is essential to this stated asymptotic conclusion.

For attainability of the leading constant, choose a nonzero aba_b from each fibre ℓ(a)=b\ell(a)=b, possible because B≥2B\ge2. After observing bb, try to cancel aba_b using the first heap hih_i with hi⊕ab<hih_i\oplus a_b<h_i, with any legal fallback if none exists. This is an AC0\AC^0 readout and wins whenever σ=a0\sigma=a_0 or a1a_1, an event of conditional probability 2/(q−1)2/(q-1). Any additional success is at most negligible by the upper bound. For B=2B=2 and π0\pi_0, the choices a0=2,a1=1a_0=2,a_1=1 give exactly 2/32/3: the case σ=3\sigma=3 is assigned a legal delta-1 move and cannot win.

Part (ii). The BB root rollout bits reconstruct σ\sigma. If it is nonzero, a heap containing its highest set bit can be decreased to hi⊕σh_i\oplus\sigma, leaving zero nim-sum. An AC0\AC^0 first-qualifying-heap selector implements this choice. With zero nim-sum, any legal move is optimal in the game-theoretic sense that no winning move exists. Each root rollout has at most N(2B−1)N(2^B-1) moves. Hence BB rollouts use O(BN2B)O(BN2^B) simulated moves, each with polynomial circuit work; no successor enumeration or unrestricted controller is used.

Part (iii). If the predecessor QQ has nim-sum zero and the opponent legally reaches Q′Q', then δ=Δ(Q,Q′)=nim⁡(Q′)≠0\delta=\Delta(Q,Q')=\operatorname{nim}(Q')\ne0. Select a decreasing heap hi→hi⊕δh_i\to h_i\oplus\delta as above. The two-frame difference and move selector are AC0\AC^0, and the response returns nim-sum zero. Repeating this response after the player’s own successful moves wins from the established invariant. No assertion about establishing it from an arbitrary start is used.

Generated from paper_jmlr.tex, lines 1662–1711.

2 Explain this

The finite form of the single-channel bound: if every readout indicator has correlation at most ηN\eta_N with every nonconstant character of the nim-sum (under the unconditioned uniform distribution), then a legal winning move is found with probability at most 2/(q−1)+(q−1)ηN2/(q-1)+(q-1)\eta_N given σ≠0\sigma\ne0, where q=2Bq=2^B. The premise is a two-sided correlation bound; it does not assume independence between readout and nim-sum.

3 How this is formalised

Prob.success_bound, for every B≥1B\ge1, N≥1N\ge1, every readout and every η\eta, with the premise Prob.CorrHyp as a hypothesis of the theorem (not an axiom). The inequality is proved outright from its stated premise; the premise is supplied for AC0 readouts only through the classical input (see Theorem 5.12 (i)).

Coverage record
Paper anchoreq:finite-correlation-bound (manuscript label)
Displayed asEquation (H.1)
ClaimUnder the stated correlation premise η_N: success ≤ 2/(q−1) + (q−1)η_N
Coverage categoryChecked theorem
Statement sourcepaper_jmlr.tex lines 1662–1711; SHA-256 of the normalised block source a172e3ca2d1bb096…
Lean declarations
Assumptions and domain

The premise: ∣EU[Hb,aχu]∣≤ηN|\mathbb E_U[H_{b,a}\chi_u]|\le\eta_N for all bb, all aa and all nonzero uu, under the unconditioned uniform distribution.

Prose-to-formal notes

This inequality is proved outright from its stated premise. Only the step that supplies a negligible ηN\eta_N for AC0 readouts uses the classical input.

Audited correspondence rowseq:finite-correlation-bound
Explanationsexplain/eq:finite-correlation-bound, formal/eq:finite-correlation-bound
Build evidencefresh isolated rebuild, audit report

4 Lean statement and source

Principal declarations

theorem Prob.success_bound

Module NimProbability (lean/phase2/NimProbability.lean, lines 834–871) · file SHA-256 1d5d7977a43e854d… Axioms reported by the fresh build: propext, Classical.choice, Quot.sound

MAIN THEOREM (Appendix G(i), finite form). For every B ≥ 1, N ≥ 1 (written N + 1), every readout F, every vector w (the head's linear functional ell(sigma) = <w, sigma>), and every η, the parity-correlation premise implies Pr[legal winning move | sigma ≠ 0] ≤ 2/(q-1) + (q-1) η, q = 2^B.

Statement as elaborated and printed by Lean 4.26.0

∀ {B N : ℕ},
  1 ≤ B →
    ∀ (F : NimAudit.Prob.Readout) (w : ℕ) {η : ℚ},
      NimAudit.Prob.CorrHyp B (N + 1) F η →
        NimAudit.Prob.succCount B (N + 1) F w / NimAudit.Prob.nonzeroCount B (N + 1) ≤
          2 / (↑(2 ^ B) - 1) + (↑(2 ^ B) - 1) * η
Exact source text, lines 834–871
834/-- MAIN THEOREM (Appendix G(i), finite form).  For every B ≥ 1, N ≥ 1 (written835    N + 1), every readout F, every vector w (the head's linear functional836    ell(sigma) = <w, sigma>), and every η, the parity-correlation premise implies837      Pr[legal winning move | sigma ≠ 0] ≤ 2/(q-1) + (q-1) η,   q = 2^B. -/838theorem success_bound {B N : Nat} (hB : 1 ≤ B) (F : Readout) (w : Nat) {η : Rat}839    (hyp : CorrHyp B (N + 1) F η) :840    succCount B (N + 1) F w / nonzeroCount B (N + 1) ≤841      2 / (((2 ^ B : Nat) : Rat) - 1) + (((2 ^ B : Nat) : Rat) - 1) * η := by842  have hqge : 2 ≤ 2 ^ B := by843    have := Nat.pow_le_pow_right (show 0 < 2 by decide) hB; simpa using this844  have hq2 : (2 : Rat) ≤ ((2 ^ B : Nat) : Rat) := by845    have := Rat.natCast_le_natCast.mpr hqge; simpa using this846  have hjoint := succCount_bound F w hyp847  rw [natCast_pred] at hjoint848  have ht : (0 : Rat) < ((2 ^ B : Nat) : Rat) ^ N := by849    rw [← Rat.natCast_pow]; exact Rat.natCast_pos.mpr (Nat.pow_pos (Nat.two_pow_pos B))850  have hT : T B (N + 1) = ((2 ^ B : Nat) : Rat) * ((2 ^ B : Nat) : Rat) ^ N := by851    unfold T; rw [Rat.pow_succ]; grind852  have hZ : nonzeroCount B (N + 1) =853      (((2 ^ B : Nat) : Rat) - 1) * ((2 ^ B : Nat) : Rat) ^ N := by854    rw [nonzeroCount_eq, hT]; grind855  rw [hT] at hjoint856  rw [hZ]857  generalize succCount B (N + 1) F w = S at *858  generalize ((2 ^ B : Nat) : Rat) ^ N = t at *859  generalize ((2 ^ B : Nat) : Rat) = q at *860  have h1 : (0 : Rat) < q - 1 := by grind861  have hZpos : 0 < (q - 1) * t := Rat.mul_pos h1 ht862  apply le_div_of_mul_le hZpos863  have hqpos : (0 : Rat) < q := by grind864  have hS : S ≤ 2 * t + (q - 1) * ((q - 1) * (η * t)) := by865    apply Rat.le_of_mul_le_mul_left _ hqpos866    grind867  have hq1 : q - 1 ≠ 0 := Rat.ne_of_gt h1868  have eR : (2 / (q - 1) + (q - 1) * η) * ((q - 1) * t) =869      2 * t + (q - 1) * ((q - 1) * (η * t)) := by grind870  rw [eR]871  exact hS

Project declarations in the statement: Prob.CorrHyp, Prob.Readout, Prob.nonzeroCount, Prob.succCount

Project declarations used by the proof or definition body

Prob.CorrHyp, Prob.Readout, Prob.T, Prob.le_div_of_mul_le, Prob.natCast_pred, Prob.nonzeroCount, Prob.nonzeroCount_eq, Prob.succCount, Prob.succCount_bound

Definitions these statements use

def Prob.CorrHyp

Module NimProbability (lean/phase2/NimProbability.lean, lines 541–546) · file SHA-256 1d5d7977a43e854d…

THE IMPORTED PARITY-CORRELATION PREMISE, as a predicate used only as a theorem hypothesis: |E[H_{b,a} chi_u]| ≤ η for every b, every a < q and every nonzero u < q. (Not an axiom; not proved here.)

Statement as elaborated and printed by Lean 4.26.0

ℕ → ℕ → NimAudit.Prob.Readout → ℚ → Prop
Exact source text, lines 541–546
541/-- THE IMPORTED PARITY-CORRELATION PREMISE, as a predicate used only as a theorem542    hypothesis: |E[H_{b,a} chi_u]| ≤ η for every b, every a < q and every nonzero543    u < q.  (Not an axiom; not proved here.) -/544def CorrHyp (B N : Nat) (F : Readout) (η : Rat) : Prop :=545  ∀ (b : Bool) (a u : Nat), a < 2 ^ B → 0 < u → u < 2 ^ B →546    -η ≤ corr B N F b a u ∧ corr B N F b a u ≤ η

Project declarations in the statement: Prob.Readout

Project declarations used by the proof or definition body

Prob.Readout, Prob.corr

def Prob.Readout

Module NimProbability (lean/phase2/NimProbability.lean, lines 399–402) · file SHA-256 1d5d7977a43e854d…

A readout: from board P and observed bit b, a proposed move (heap index i, new value v), or `none` (invalid output). No circuit restriction is imposed here; the only property ever used is the correlation premise `CorrHyp`.

Statement as elaborated and printed by Lean 4.26.0

Type
Exact source text, lines 399–402
399/-- A readout: from board P and observed bit b, a proposed move (heap index i, new400    value v), or `none` (invalid output).  No circuit restriction is imposed here;401    the only property ever used is the correlation premise `CorrHyp`. -/402abbrev Readout := List Nat → Bool → Option (Nat × Nat)

Project declarations in the statement: none

Project declarations used by the proof or definition body

none

def Prob.nonzeroCount

Module NimProbability (lean/phase2/NimProbability.lean, lines 691–693) · file SHA-256 1d5d7977a43e854d…

Number of boards with sigma ≠ 0.

Statement as elaborated and printed by Lean 4.26.0

ℕ → ℕ → ℚ
Exact source text, lines 691–693
691/-- Number of boards with sigma ≠ 0. -/692def nonzeroCount (B N : Nat) : Rat :=693  rsum (boards (2 ^ B) N) (fun P => if nimSum P ≠ 0 then 1 else 0)

Project declarations in the statement: none

Project declarations used by the proof or definition body

Prob.boards, Prob.rsum, nimSum

def Prob.succCount

Module NimProbability (lean/phase2/NimProbability.lean, lines 685–689) · file SHA-256 1d5d7977a43e854d…

Number of boards with sigma ≠ 0 on which the readout, fed b = ell_w(sigma), makes a legal move to nim-sum zero.

Statement as elaborated and printed by Lean 4.26.0

ℕ → ℕ → NimAudit.Prob.Readout → ℕ → ℚ
Exact source text, lines 685–689
685/-- Number of boards with sigma ≠ 0 on which the readout, fed b = ell_w(sigma),686    makes a legal move to nim-sum zero. -/687def succCount (B N : Nat) (F : Readout) (w : Nat) : Rat :=688  rsum (boards (2 ^ B) N)689    (fun P => if nimSum P ≠ 0 ∧ successB F (dotB B w (nimSum P)) P = true then 1 else 0)

Project declarations in the statement: Prob.Readout

Project declarations used by the proof or definition body

Prob.Readout, Prob.boards, Prob.dotB, Prob.rsum, Prob.successB, nimSum

Full modules

ModuleFileLinesImports
NimProbabilitylean/phase2/NimProbability.lean1074NimGame

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).