Provedunbiased-attentionend-to-endsoftmaxeasy-side
Independent unbiased estimates: E[A·B] = ab and E[(AB − ab)²] = Va·Vb + a²Vb + b²Va (exact product of two finite spaces)
For all , , , , and , if , , , , and (given and ), then
What the notation means · or point at any symbol
- Type
- Type: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (
Type) - x ∈ TVariables
- Ω₁, Ω₂ range over Type: the statement must hold for every choice. (
(Ω₁ Ω₂ : Type)) - Fintype
- Fintype: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (
Fintype) - f(x)Function application
- Fintype applied to Ω₁. Lean writes f x; papers write f(x). (
Fintype Ω₁) - ⟹Implies
- If Ω₁, then ℝ. (Between types, A → B is the type of functions from A to B.) (
Ω₁ → ℝ) - ∑Summation
- Add up w₁(x) for every x. (
∑ x, w₁ x) - =Equality
- ∑ x, w₁(x) and 1 are the same. (
∑ x, w₁ x = 1) - ∧And
- Both hold: (∑ x, ∑ y, w₁(x) · w₂(y) · (A(x) · B(y))) = a · b, and (∑ x, ∑ y, w₁(x) · w₂(y) · (A(x) · B(y) − a · b)^2) = Va ·…. (
(∑ x, ∑ y, w₁ x * w₂ y * (A x * B y) = …) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - ·Multiplication
- w₁(x) times A(x). (
w₁ x * A x) - aᵇPower
- A(x) − a raised to the power 2. (
(A x - a) ^ 2) - -Subtraction
- A(x) minus a. On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (
A x - a) - +Addition
- Va · Vb plus a^2 · Vb. (
Va * Vb + a ^ 2 * Vb)
theorem ua-independent-product-mean-variance {Ω₁ Ω₂ : Type} [Fintype Ω₁] [Fintype Ω₂] (w₁ : Ω₁ → ℝ) (w₂ : Ω₂ → ℝ) (A : Ω₁ → ℝ) (B : Ω₂ → ℝ) (a b Va Vb : ℝ) (hs1 : ∑ x, w₁ x = 1) (hs2 : ∑ y, w₂ y = 1) (hA : ∑ x, w₁ x * A x = a) (hB : ∑ y, w₂ y * B y = b) (hVa : ∑ x, w₁ x * (A x - a) ^ 2 = Va) (hVb : ∑ y, w₂ y * (B y - b) ^ 2 = Vb) :
(∑ x, ∑ y, w₁ x * w₂ y * (A x * B y) = a * b) ∧ (∑ x, ∑ y, w₁ x * w₂ y * (A x * B y - a * b) ^ 2 = Va * Vb + a ^ 2 * Vb + b ^ 2 * Va)The corrected gradient-product statement after external review: ua-product-estimate-error needs |b̂| ≤ F, which MLMC-debiased estimates violate. For independent debiased estimates of E[uk], E[u], E[k] the product is exactly unbiased with this variance, so the query gradient (a covariance) is estimated unbiasedly with constant-factor overhead. Part of 'Unbiased randomized attention: cost x variance thresholds' (end-to-end composition round).
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
- 36 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.