Provedunbiased-attentionrandomized-algorithmssoftmaxproposal
Σ π_j²/r_j = 1 + χ²(π‖r) for probability vectors π, r
For all and , if , and , then
What the notation means · or point at any symbol
- NNatural numbers
- The natural numbers 0, 1, 2, …. In Lean they start at 0. (
ℕ) - Fin
- Fin: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (
Fin) - f(x)Function application
- Fin applied to n. Lean writes f x; papers write f(x). (
Fin n) - ⟹Implies
- If Fin(n), then ℝ. (Between types, A → B is the type of functions from A to B.) (
Fin n → ℝ) - x : TVariables
- π, r range over Fin n → ℝ: the statement must hold for every choice. (
(π r : Fin n → ℝ)) - ∀For all
- The statement after the comma holds for every j. (
∀ j, r j ≠ 0) - ∑Summation
- Add up π(j) for every j. (
∑ j, π j) - =Equality
- ∑ j, π(j) and 1 are the same. (
∑ j, π j = 1) - ≠Not equal
- r(j) and 0 are different. (
r j ≠ 0) - πPi
- The ratio of a circle's circumference to its diameter, ≈ 3.14159. (
π) - aᵇPower
- π(j) raised to the power 2. (
π j ^ 2) - a/bDivision
- π(j)^2 divided by r(j). In Lean, dividing by 0 gives 0. (
π j ^ 2 / r j) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - +Addition
- 1 plus ∑ j, (π(j) − r(j))^2/r(j). (
1 + ∑ j, (π j - r j) ^ 2 / r j) - -Subtraction
- π(j) minus r(j). On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (
π j - r j)
theorem ua-chi-square-identity {n : ℕ} (π r : Fin n → ℝ) (hr : ∀ j, r j ≠ 0) (hπ : ∑ j, π j = 1) (hrs : ∑ j, r j = 1) :
∑ j, π j ^ 2 / r j = 1 + ∑ j, (π j - r j) ^ 2 / r jThe second-moment factor of importance sampling attention row π from proposal r is exactly 1 + χ². All estimator variances below are measured in this unit. 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.