proofs
Provedunbiased-attentionend-to-endsoftmaxdebiasing

END-TO-END debiasing: single-term MLMC Z = Y₀ + (Y_{ℓ+1} − Y_ℓ)/p_ℓ (level ℓ ~ p independent of the sample draw) is exactly unbiased for m_L and E(Z − m_L)² ≤ 2E(Y₀ − m₀)² + 2Σ_ℓ D_ℓ/p_ℓ

For all L∈N\htmlData{mx=1}{L \in \htmlData{mx=0}{\mathbb{N}}}, Ω∈Type⁡\htmlData{mx=1}{\Omega \in \htmlData{mx=0}{\operatorname{Type}}}, w:Ω→R\htmlData{mx=3}{w : \htmlData{mx=0}{\Omega} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, p:N→R\htmlData{mx=3}{p : \htmlData{mx=0}{\mathbb{N}} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, Y:N→Ω→R\htmlData{mx=5}{Y : \htmlData{mx=0}{\mathbb{N}} \mathrel{\htmlData{mx=4}{\to}} \htmlData{mx=1}{\Omega} \mathrel{\htmlData{mx=3}{\to}} \htmlData{mx=2}{\mathbb{R}}} and m,D:N→R\htmlData{mx=3}{m, D : \htmlData{mx=0}{\mathbb{N}} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, if ∀ω, 0≤w(ω)\htmlData{mx=4}{\forall \omega,\ 0 \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{\htmlData{mx=0}{w}(\htmlData{mx=1}{\omega})}}, ∑ωw(ω)=1\htmlData{mx=3}{\sum_{\omega} \htmlData{mx=2}{\htmlData{mx=0}{w}(\htmlData{mx=1}{\omega})}} \mathrel{\htmlData{mx=4}{=}} 1, ∀l, l<L  ⟹  0<p(l)\htmlData{mx=8}{\forall l,\ \htmlData{mx=0}{l} \mathrel{\htmlData{mx=2}{<}} \htmlData{mx=1}{L} \mathrel{\htmlData{mx=7}{\implies}} 0 \mathrel{\htmlData{mx=6}{<}} \htmlData{mx=5}{\htmlData{mx=3}{p}(\htmlData{mx=4}{l})}}, ∑l=0L−1p(l)=1\htmlData{mx=4}{\sum_{l=0}^{\htmlData{mx=0}{L} - 1} \htmlData{mx=3}{\htmlData{mx=1}{p}(\htmlData{mx=2}{l})}} \mathrel{\htmlData{mx=5}{=}} 1, ∀l, l≤L  ⟹  ∑ωw(ω)⋅Y(l,ω)=m(l)\htmlData{mx=17}{\forall l,\ \htmlData{mx=0}{l} \mathrel{\htmlData{mx=2}{\leq}} \htmlData{mx=1}{L} \mathrel{\htmlData{mx=16}{\implies}} \htmlData{mx=11}{\sum_{\omega} \htmlData{mx=10}{\htmlData{mx=5}{\htmlData{mx=3}{w}(\htmlData{mx=4}{\omega})} \cdot \htmlData{mx=9}{\htmlData{mx=6}{Y}(\htmlData{mx=7}{l}, \htmlData{mx=8}{\omega})}}} \mathrel{\htmlData{mx=15}{=}} \htmlData{mx=14}{\htmlData{mx=12}{m}(\htmlData{mx=13}{l})}} and ∀l, l<L  ⟹  ∑ωw(ω)⋅(Y(l+1,ω)−Y(l,ω))2≤D(l)\htmlData{mx=24}{\forall l,\ \htmlData{mx=0}{l} \mathrel{\htmlData{mx=2}{<}} \htmlData{mx=1}{L} \mathrel{\htmlData{mx=23}{\implies}} \htmlData{mx=18}{\sum_{\omega} \htmlData{mx=17}{\htmlData{mx=5}{\htmlData{mx=3}{w}(\htmlData{mx=4}{\omega})} \cdot \htmlData{mx=16}{(\htmlData{mx=15}{\htmlData{mx=10}{\htmlData{mx=6}{Y}(\htmlData{mx=8}{\htmlData{mx=7}{l} + 1}, \htmlData{mx=9}{\omega})} - \htmlData{mx=14}{\htmlData{mx=11}{Y}(\htmlData{mx=12}{l}, \htmlData{mx=13}{\omega})}})^{2}}}} \mathrel{\htmlData{mx=22}{\leq}} \htmlData{mx=21}{\htmlData{mx=19}{D}(\htmlData{mx=20}{l})}} (given Fintype⁡ Ω\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fintype}}\,\htmlData{mx=1}{\Omega}}), then

(∑l=0L−1∑ωp(l)⋅w(ω)⋅(Y(0,ω)+Y(l+1,ω)−Y(l,ω)p(l))=m(L))∧(∑l=0L−1∑ωp(l)⋅w(ω)⋅(Y(0,ω)+Y(l+1,ω)−Y(l,ω)p(l)−m(L))2≤2⋅∑ωw(ω)⋅(Y(0,ω)−m(0))2+2⋅∑l=0L−1D(l)p(l))\begin{aligned} & \left(\right. \htmlData{mx=30}{\sum_{l=0}^{\htmlData{mx=2}{L} - 1} \htmlData{mx=29}{\sum_{\omega} \htmlData{mx=28}{\htmlData{mx=9}{\htmlData{mx=5}{\htmlData{mx=3}{p}(\htmlData{mx=4}{l})} \cdot \htmlData{mx=8}{\htmlData{mx=6}{w}(\htmlData{mx=7}{\omega})}} \cdot \left(\htmlData{mx=27}{\htmlData{mx=12}{\htmlData{mx=10}{Y}(0, \htmlData{mx=11}{\omega})} + \htmlData{mx=26}{\frac{\htmlData{mx=22}{\htmlData{mx=17}{\htmlData{mx=13}{Y}(\htmlData{mx=15}{\htmlData{mx=14}{l} + 1}, \htmlData{mx=16}{\omega})} - \htmlData{mx=21}{\htmlData{mx=18}{Y}(\htmlData{mx=19}{l}, \htmlData{mx=20}{\omega})}}}{\htmlData{mx=25}{\htmlData{mx=23}{p}(\htmlData{mx=24}{l})}}}}\right)}}} \\ & \quad \htmlData{mx=1}{=} \htmlData{mx=33}{\htmlData{mx=31}{m}(\htmlData{mx=32}{L})} \left.\right) \\ & \htmlData{mx=0}{\land} \left(\right. \htmlData{mx=68}{\sum_{l=0}^{\htmlData{mx=35}{L} - 1} \htmlData{mx=67}{\sum_{\omega} \htmlData{mx=66}{\htmlData{mx=42}{\htmlData{mx=38}{\htmlData{mx=36}{p}(\htmlData{mx=37}{l})} \cdot \htmlData{mx=41}{\htmlData{mx=39}{w}(\htmlData{mx=40}{\omega})}} \cdot \htmlData{mx=65}{\left(\htmlData{mx=64}{\htmlData{mx=60}{\htmlData{mx=45}{\htmlData{mx=43}{Y}(0, \htmlData{mx=44}{\omega})} + \htmlData{mx=59}{\frac{\htmlData{mx=55}{\htmlData{mx=50}{\htmlData{mx=46}{Y}(\htmlData{mx=48}{\htmlData{mx=47}{l} + 1}, \htmlData{mx=49}{\omega})} - \htmlData{mx=54}{\htmlData{mx=51}{Y}(\htmlData{mx=52}{l}, \htmlData{mx=53}{\omega})}}}{\htmlData{mx=58}{\htmlData{mx=56}{p}(\htmlData{mx=57}{l})}}}} - \htmlData{mx=63}{\htmlData{mx=61}{m}(\htmlData{mx=62}{L})}}\right)^{2}}}}} \\ & \quad \htmlData{mx=34}{\leq} \htmlData{mx=92}{\htmlData{mx=81}{2 \cdot \htmlData{mx=80}{\sum_{\omega} \htmlData{mx=79}{\htmlData{mx=71}{\htmlData{mx=69}{w}(\htmlData{mx=70}{\omega})} \cdot \htmlData{mx=78}{(\htmlData{mx=77}{\htmlData{mx=74}{\htmlData{mx=72}{Y}(0, \htmlData{mx=73}{\omega})} - \htmlData{mx=76}{\htmlData{mx=75}{m}(0)}})^{2}}}}} + \htmlData{mx=91}{2 \cdot \htmlData{mx=90}{\sum_{l=0}^{\htmlData{mx=82}{L} - 1} \htmlData{mx=89}{\frac{\htmlData{mx=85}{\htmlData{mx=83}{D}(\htmlData{mx=84}{l})}}{\htmlData{mx=88}{\htmlData{mx=86}{p}(\htmlData{mx=87}{l})}}}}}} \left.\right) \end{aligned}
What the notation means · or point at any symbol
NNatural numbers
The natural numbers 0, 1, 2, …. In Lean they start at 0. (ℕ)
Type
Type: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Type)
Fintype
Fintype: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Fintype)
f(x)Function application
Fintype applied to Ω. Lean writes f x; papers write f(x). (Fintype Ω)
⟹Implies
If Ω, then ℝ. (Between types, A → B is the type of functions from A to B.) (Ω → ℝ)
x : TVariables
m, D range over ℕ → ℝ: the statement must hold for every choice. ((m D : ℕ → ℝ))
∀For all
The statement after the comma holds for every ω. (∀ ω, 0 ≤ w ω)
∑Summation
Add up w(ω) for every ω. (∑ ω, w ω)
=Equality
∑ ω, w(ω) and 1 are the same. (∑ ω, w ω = 1)
∧And
Both hold: (∑ l, ∑ ω, p(l) · w(ω) · (Y(0, ω) + (Y(l + 1, ω) − Y(l, ω)…, and (∑ l, ∑ ω, p(l) · w(ω) · (Y(0, ω) + (Y(l + 1, ω) − Y(l, ω)…. ((∑ l ∈ Finset.range L, ∑ ω, p l * w ω *…)
RReal numbers
The real numbers: every point on the number line. (ℝ)
≤At most
0 is less than or equal to w(ω). (0 ≤ w ω)
<Less than
l is strictly smaller than L. (l < L)
·Multiplication
w(ω) times Y(l, ω). (w ω * Y l ω)
aᵇPower
Y(l + 1, ω) − Y(l, ω) raised to the power 2. ((Y (l + 1) ω - Y l ω) ^ 2)
-Subtraction
Y(l + 1, ω) minus Y(l, ω). On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (Y (l + 1) ω - Y l ω)
+Addition
l plus 1. (l + 1)
a/bDivision
Y(l + 1, ω) − Y(l, ω) divided by p(l). In Lean, dividing by 0 gives 0. ((Y (l + 1) ω - Y l ω) / p l)

Second single-statement composition (external review asked for end-to-end claims): unbiasedness AND the variance bound of the randomized multilevel estimator in one theorem over the exact finite product space (levels × sample draws). With Y_ℓ the SNIS estimates at 2^ℓ draws (D_ℓ ≤ 2(MSE_{ℓ+1}+MSE_ℓ) from ua-level-difference-bound and ua-end-to-end-uniform-snis) and Y_L exact, this is the unbiased easy side of the sharp threshold. Part of 'Unbiased randomized attention: cost x variance thresholds' (end-to-end composition round).

How it was proved

Proved
4 October 2026
By
Ajax, with the agent “Baguette math & proofs (Claude Code, 2026-10-03)”
Checked by
Lean's kernel (Lean 4.33.1, with Mathlib); the proof is signed and replays offline
Axioms
Classical.choice, Quot.sound, propext
Proof
76 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.

More proved statements