proofs
Provedunbiased-attentionrandomized-algorithmssoftmaxdebiasing

Second moment of the single-term estimator is Σ M_l / p_l

For all L∈N\htmlData{mx=1}{L \in \htmlData{mx=0}{\mathbb{N}}} and M,p:N→R\htmlData{mx=3}{M, p : \htmlData{mx=0}{\mathbb{N}} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, if ∀l<L, p(l)≠0\htmlData{mx=5}{\forall l < \htmlData{mx=4}{L},\ \htmlData{mx=2}{\htmlData{mx=0}{p}(\htmlData{mx=1}{l})} \mathrel{\htmlData{mx=3}{\neq}} 0}, then

∑l=0L−1p(l)⋅(M(l)p(l)2)=∑l=0L−1M(l)p(l)\htmlData{mx=13}{\sum_{l=0}^{\htmlData{mx=0}{L} - 1} \htmlData{mx=12}{\htmlData{mx=3}{\htmlData{mx=1}{p}(\htmlData{mx=2}{l})} \cdot \left(\htmlData{mx=11}{\frac{\htmlData{mx=6}{\htmlData{mx=4}{M}(\htmlData{mx=5}{l})}}{\htmlData{mx=10}{\htmlData{mx=9}{\htmlData{mx=7}{p}(\htmlData{mx=8}{l})}^{2}}}}\right)}} \mathrel{\htmlData{mx=23}{=}} \htmlData{mx=22}{\sum_{l=0}^{\htmlData{mx=14}{L} - 1} \htmlData{mx=21}{\frac{\htmlData{mx=17}{\htmlData{mx=15}{M}(\htmlData{mx=16}{l})}}{\htmlData{mx=20}{\htmlData{mx=18}{p}(\htmlData{mx=19}{l})}}}}
What the notation means · or point at any symbol
NNatural numbers
The natural numbers 0, 1, 2, …. In Lean they start at 0. (ℕ)
⟹Implies
If ℕ, then ℝ. (Between types, A → B is the type of functions from A to B.) (ℕ → ℝ)
x : TVariables
M, p range over ℕ → ℝ: the statement must hold for every choice. ((M p : ℕ → ℝ))
∀For all
The statement after the comma holds for every l. (∀ l < L, p l ≠ 0)
∑Summation
Add up p(l) · (M(l)/p(l)^2) for l = 0, 1, …, L − 1. (∑ l ∈ Finset.range L, p l * (M l / p l …)
=Equality
∑ l, p(l) · (M(l)/p(l)^2) and ∑ l, M(l)/p(l) are the same. (∑ l ∈ Finset.range L, p l * (M l / p l …)
RReal numbers
The real numbers: every point on the number line. (ℝ)
f(x)Function application
p applied to l. Lean writes f x; papers write f(x). (p l)
≠Not equal
p(l) and 0 are different. (p l ≠ 0)
·Multiplication
p(l) times M(l)/p(l)^2. (p l * (M l / p l ^ 2))
a/bDivision
M(l) divided by p(l)^2. In Lean, dividing by 0 gives 0. (M l / p l ^ 2)
aᵇPower
p(l) raised to the power 2. (p l ^ 2)

With M_l = E[(ΔY_l)²], E[Z²] = Σ p_l·M_l/p_l² = Σ M_l/p_l. This is the quantity the level law must control. Part of 'Unbiased randomized attention: cost x variance thresholds' (open theory problem).

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
13 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.

More proved statements