proofs
Provedunbiased-attentionrandomized-algorithmssoftmaxdebiasing

Single-term randomized MLMC is exactly unbiased: Σ p_l·(ΔY_l/p_l) = Y_L − Y_0

For all L∈N\htmlData{mx=1}{L \in \htmlData{mx=0}{\mathbb{N}}} and Y,p:N→R\htmlData{mx=3}{Y, 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)⋅(Y(l+1)−Y(l)p(l))=Y(L)−Y(0)\htmlData{mx=17}{\sum_{l=0}^{\htmlData{mx=0}{L} - 1} \htmlData{mx=16}{\htmlData{mx=3}{\htmlData{mx=1}{p}(\htmlData{mx=2}{l})} \cdot \left(\htmlData{mx=15}{\frac{\htmlData{mx=11}{\htmlData{mx=7}{\htmlData{mx=4}{Y}(\htmlData{mx=6}{\htmlData{mx=5}{l} + 1})} - \htmlData{mx=10}{\htmlData{mx=8}{Y}(\htmlData{mx=9}{l})}}}{\htmlData{mx=14}{\htmlData{mx=12}{p}(\htmlData{mx=13}{l})}}}\right)}} \mathrel{\htmlData{mx=24}{=}} \htmlData{mx=23}{\htmlData{mx=20}{\htmlData{mx=18}{Y}(\htmlData{mx=19}{L})} - \htmlData{mx=22}{\htmlData{mx=21}{Y}(0)}}
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
Y, p range over ℕ → ℝ: the statement must hold for every choice. ((Y p : ℕ → ℝ))
∀For all
The statement after the comma holds for every l. (∀ l < L, p l ≠ 0)
∑Summation
Add up p(l) · ((Y(l + 1) − Y(l))/p(l)) for l = 0, 1, …, L − 1. (∑ l ∈ Finset.range L, p l * ((Y (l + 1)…)
=Equality
∑ l, p(l) · ((Y(l + 1) − Y(l))/p(l)) and Y(L) − Y(0) are the same. (∑ l ∈ Finset.range L, p l * ((Y (l + 1)…)
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 (Y(l + 1) − Y(l))/p(l). (p l * ((Y (l + 1) - Y l) / p l))
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)
-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)

Draw a level l with probability p_l, return (Y_{l+1} − Y_l)/p_l. Its mean telescopes to Y_L − Y_0 for ANY positive level law: the finite Rhee–Glynn identity behind exact debiasing of a self-normalized attention estimate over nested key sets of size 2^l. 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