Provedunbiased-attentionend-to-endsoftmaxeasy-side
END-TO-END easy side: score range ≤ R and |v| ≤ F ⇒ uniform-proposal SNIS from N i.i.d. keys has MSE ≤ 16 F² e^R / N
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. (
ℕ) - x ∈ TVariables
- n, N range over natural numbers: the statement must hold for every choice. (
(n N : ℕ)) - <Less than
- 0 is strictly smaller than N. (
0 < N) - 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
- s, v range over Fin n → ℝ: the statement must hold for every choice. (
(s v : Fin n → ℝ)) - ∀For all
- The statement after the comma holds for every i, j. (
∀ i j, s i - s j ≤ R) - |x|Absolute value
- The size of v(j) without its sign. (
|v j|) - -Subtraction
- s(i) minus s(j). On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (
s i - s j) - ≤At most
- s(i) − s(j) is less than or equal to R. (
s i - s j ≤ R) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - ∏Product
- Multiply together 1/n for every _k in Fin(N). (
∏ _k : Fin N, (1 / (n : ℝ))) - a/bDivision
- 1 divided by n. In Lean, dividing by 0 gives 0. (
1 / (n : ℝ)) - (x : T)As real numbers
- n read as an element of real numbers. Mathematicians leave this implicit; Lean needs it to know which kind of number is meant. (
(n : ℝ)) - aᵇPower
- (∑ i, exp(s(f(i)))/(∑ k, exp(s(k)))/(1/n) · v(f(i)))/(∑ i,… raised to the power 2. (
((∑ i, (Real.exp (s (f i)) / ∑ k, Real.…) - ·Multiplication
- exp(s(f(i)))/(∑ k, exp(s(k)))/(1/n) times v(f(i)). (
(Real.exp (s (f i)) / ∑ k, Real.exp (s …) - eˣExponential function
- e raised to the power s(f(i)), where e ≈ 2.718. (
Real.exp (s (f i))) - ∑Summation
- Add up exp(s(k)) for every k. (
∑ k, Real.exp (s k))
theorem ua-end-to-end-uniform-snis {n N : ℕ} (hN : 0 < N) (hn : 0 < n) (s v : Fin n → ℝ) (F R : ℝ) (hR : ∀ i j, s i - s j ≤ R) (hv : ∀ j, |v j| ≤ F) :
∑ f : Fin N → Fin n, (∏ _k : Fin N, (1 / (n : ℝ))) * ((∑ i, (Real.exp (s (f i)) / ∑ k, Real.exp (s k)) / (1 / (n : ℝ)) * v (f i)) / (∑ i, (Real.exp (s (f i)) / ∑ k, Real.exp (s k)) / (1 / (n : ℝ))) - ∑ j, (Real.exp (s j) / ∑ k, Real.exp (s k)) * v j) ^ 2 ≤ 16 * F ^ 2 * Real.exp R / NThe first single-statement composition of the easy side (answering the external review's '0/9 claims formalized end-to-end'): SNIS MSE bound over the exact finite product space composed with the uniform-proposal χ² bound. With N = 16 F² e^R / ε this is constant-MSE attention at n^{1+α} work for range α ln n. The constant 16 is likely 4× loose (Agapiou et al. 2017). 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
- 200 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.