proofs
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 n,N∈N\htmlData{mx=1}{n, N \in \htmlData{mx=0}{\mathbb{N}}}, s,v:Fin⁡ n→R\htmlData{mx=5}{s, v : \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{n}} \mathrel{\htmlData{mx=4}{\to}} \htmlData{mx=3}{\mathbb{R}}} and F,R∈R\htmlData{mx=1}{F, R \in \htmlData{mx=0}{\mathbb{R}}}, if 0<N0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{N}, 0<n0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{n}, ∀i,j, s(i)−s(j)≤R\htmlData{mx=9}{\forall i, j,\ \htmlData{mx=6}{\htmlData{mx=2}{\htmlData{mx=0}{s}(\htmlData{mx=1}{i})} - \htmlData{mx=5}{\htmlData{mx=3}{s}(\htmlData{mx=4}{j})}} \mathrel{\htmlData{mx=8}{\leq}} \htmlData{mx=7}{R}} and ∀j, ∣v(j)∣≤F\htmlData{mx=6}{\forall j,\ \htmlData{mx=3}{\left\lvert \htmlData{mx=2}{\htmlData{mx=0}{v}(\htmlData{mx=1}{j})} \right\rvert} \mathrel{\htmlData{mx=5}{\leq}} \htmlData{mx=4}{F}}, then

∑f:Fin⁡ N→Fin⁡ n(∏_k:Fin⁡ N1n)⋅(∑ies(f(i))∑kes(k)1n⋅v(f(i))∑ies(f(i))∑kes(k)1n−∑jes(j)∑kes(k)⋅v(j))2≤16⋅F2⋅eRN\begin{aligned} & \htmlData{mx=74}{\sum_{f : \htmlData{mx=3}{\htmlData{mx=1}{\operatorname{Fin}}\,\htmlData{mx=2}{N}} \mathrel{\htmlData{mx=7}{\to}} \htmlData{mx=6}{\htmlData{mx=4}{\operatorname{Fin}}\,\htmlData{mx=5}{n}}} \htmlData{mx=73}{\left(\htmlData{mx=14}{\prod_{\mathit{\_k} : \htmlData{mx=10}{\htmlData{mx=8}{\operatorname{Fin}}\,\htmlData{mx=9}{N}}} \htmlData{mx=13}{\frac{1}{\htmlData{mx=12}{\htmlData{mx=11}{n}}}}}\right) \cdot \htmlData{mx=72}{\left(\htmlData{mx=71}{\htmlData{mx=55}{\frac{\htmlData{mx=37}{\sum_{i} \htmlData{mx=36}{\htmlData{mx=30}{\frac{\htmlData{mx=26}{\frac{\htmlData{mx=20}{e^{\htmlData{mx=19}{\htmlData{mx=15}{s}(\htmlData{mx=18}{\htmlData{mx=16}{f}(\htmlData{mx=17}{i})})}}}}{\htmlData{mx=25}{\sum_{k} \htmlData{mx=24}{e^{\htmlData{mx=23}{\htmlData{mx=21}{s}(\htmlData{mx=22}{k})}}}}}}}{\htmlData{mx=29}{\frac{1}{\htmlData{mx=28}{\htmlData{mx=27}{n}}}}}} \cdot \htmlData{mx=35}{\htmlData{mx=31}{v}(\htmlData{mx=34}{\htmlData{mx=32}{f}(\htmlData{mx=33}{i})})}}}}{\htmlData{mx=54}{\sum_{i} \htmlData{mx=53}{\frac{\htmlData{mx=49}{\frac{\htmlData{mx=43}{e^{\htmlData{mx=42}{\htmlData{mx=38}{s}(\htmlData{mx=41}{\htmlData{mx=39}{f}(\htmlData{mx=40}{i})})}}}}{\htmlData{mx=48}{\sum_{k} \htmlData{mx=47}{e^{\htmlData{mx=46}{\htmlData{mx=44}{s}(\htmlData{mx=45}{k})}}}}}}}{\htmlData{mx=52}{\frac{1}{\htmlData{mx=51}{\htmlData{mx=50}{n}}}}}}}}} - \htmlData{mx=70}{\sum_{j} \htmlData{mx=69}{\htmlData{mx=65}{\frac{\htmlData{mx=59}{e^{\htmlData{mx=58}{\htmlData{mx=56}{s}(\htmlData{mx=57}{j})}}}}{\htmlData{mx=64}{\sum_{k} \htmlData{mx=63}{e^{\htmlData{mx=62}{\htmlData{mx=60}{s}(\htmlData{mx=61}{k})}}}}}} \cdot \htmlData{mx=68}{\htmlData{mx=66}{v}(\htmlData{mx=67}{j})}}}}\right)^{2}}}} \\ & \quad \htmlData{mx=0}{\leq} \htmlData{mx=82}{\frac{\htmlData{mx=80}{\htmlData{mx=77}{16 \cdot \htmlData{mx=76}{\htmlData{mx=75}{F}^{2}}} \cdot \htmlData{mx=79}{e^{\htmlData{mx=78}{R}}}}}{\htmlData{mx=81}{N}}} \end{aligned}
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))

The 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.

More proved statements