Provedunbiased-attentionrandomized-algorithmssoftmaxdebiasing
Variance of the single-term estimator ≤ its second moment Σ p (D/p)²
For all and :
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
- D, p range over ℕ → ℝ: the statement must hold for every choice. (
(D p : ℕ → ℝ)) - ∑Summation
- Add up p(l) · (D(l)/p(l))^2 for l = 0, 1, …, L − 1. (
∑ l ∈ Finset.range L, p l * (D l / p l)…) - -Subtraction
- ∑ l, p(l) · (D(l)/p(l))^2 minus (∑ l, p(l) · (D(l)/p(l)))^2. On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (
∑ l ∈ Finset.range L, p l * (D l / p l)…) - ≤At most
- (∑ l, p(l) · (D(l)/p(l))^2) − (∑ l, p(l) · (D(l)/p(l)))^2 is less than or equal to ∑ l, p(l) · (D(l)/p(l))^2. (
∑ l ∈ Finset.range L, p l * (D 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) - ·Multiplication
- p(l) times (D(l)/p(l))^2. (
p l * (D l / p l) ^ 2) - aᵇPower
- D(l)/p(l) raised to the power 2. (
(D l / p l) ^ 2) - a/bDivision
- D(l) divided by p(l). In Lean, dividing by 0 gives 0. (
D l / p l)
theorem ua-variance-le-second-moment {L : ℕ} (D p : ℕ → ℝ) :
∑ l ∈ Finset.range L, p l * (D l / p l) ^ 2 - (∑ l ∈ Finset.range L, p l * (D l / p l)) ^ 2 ≤ ∑ l ∈ Finset.range L, p l * (D l / p l) ^ 2Var Z = E Z² − (E Z)² ≤ E Z². Combined with the second-moment identity, Var ≤ Σ M_l/p_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
- 10 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.