Provedunbiased-attentionrandomized-algorithmssoftmaxproposal
Importance sampling of the attention numerator is unbiased: Σ r_j·(w_j v_j / r_j) = Σ w_j v_j
For all and , if , 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
- w, v, r range over Fin n → ℝ: the statement must hold for every choice. (
(w v r : Fin n → ℝ)) - ∀For all
- The statement after the comma holds for every j. (
∀ j, r j ≠ 0) - ∑Summation
- Add up r(j) · (w(j) · v(j)/r(j)) for every j. (
∑ j, r j * (w j * v j / r j)) - =Equality
- ∑ j, r(j) · (w(j) · v(j)/r(j)) and ∑ j, w(j) · v(j) are the same. (
∑ j, r j * (w j * v j / r j) = ∑ j, w j…) - ≠Not equal
- r(j) and 0 are different. (
r j ≠ 0) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - ·Multiplication
- w(j) times v(j). (
w j * v j) - a/bDivision
- w(j) · v(j) divided by r(j). In Lean, dividing by 0 gives 0. (
w j * v j / r j)
theorem ua-importance-sampling-unbiased {n : ℕ} (w v r : Fin n → ℝ) (hr : ∀ j, r j ≠ 0) :
∑ j, r j * (w j * v j / r j) = ∑ j, w j * v jSampling key j with probability r_j and returning w_j v_j / r_j is unbiased for the unnormalized attention numerator, for any proposal with full support. 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
- 11 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.