proofs
Provedunbiased-attentionrandomized-algorithmssoftmaxfull-exponent

Multiplicity gadget NO: N keys with x ≤ s, baseline mass m·e^β, β = log(4N/m)/(1−s) ⇒ output ≤ 1/4

For all N∈N\htmlData{mx=1}{N \in \htmlData{mx=0}{\mathbb{N}}}, x:Fin⁡ N→R\htmlData{mx=5}{x : \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{N}} \mathrel{\htmlData{mx=4}{\to}} \htmlData{mx=3}{\mathbb{R}}} and m,s∈R\htmlData{mx=1}{m, s \in \htmlData{mx=0}{\mathbb{R}}}, if 0<m0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{m}, 0≤s0 \mathrel{\htmlData{mx=1}{\leq}} \htmlData{mx=0}{s}, s<1\htmlData{mx=0}{s} \mathrel{\htmlData{mx=1}{<}} 1, m≤4N\htmlData{mx=0}{m} \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{4\htmlData{mx=1}{N}} and ∀k, x(k)≤s\htmlData{mx=5}{\forall k,\ \htmlData{mx=2}{\htmlData{mx=0}{x}(\htmlData{mx=1}{k})} \mathrel{\htmlData{mx=4}{\leq}} \htmlData{mx=3}{s}}, then

∑kelog⁡(4Nm)1−s⋅x(k)m⋅elog⁡(4Nm)1−s+∑kelog⁡(4Nm)1−s⋅x(k)≤14\begin{aligned} & \htmlData{mx=41}{\frac{\htmlData{mx=14}{\sum_{k} \htmlData{mx=13}{e^{\htmlData{mx=12}{\htmlData{mx=8}{\frac{\htmlData{mx=5}{\log \left(\htmlData{mx=4}{\frac{\htmlData{mx=2}{4\htmlData{mx=1}{N}}}{\htmlData{mx=3}{m}}}\right)}}{\htmlData{mx=7}{1 - \htmlData{mx=6}{s}}}} \cdot \htmlData{mx=11}{\htmlData{mx=9}{x}(\htmlData{mx=10}{k})}}}}}}{\htmlData{mx=40}{\htmlData{mx=25}{\htmlData{mx=15}{m} \cdot \htmlData{mx=24}{e^{\htmlData{mx=23}{\frac{\htmlData{mx=20}{\log \left(\htmlData{mx=19}{\frac{\htmlData{mx=17}{4\htmlData{mx=16}{N}}}{\htmlData{mx=18}{m}}}\right)}}{\htmlData{mx=22}{1 - \htmlData{mx=21}{s}}}}}}} + \htmlData{mx=39}{\sum_{k} \htmlData{mx=38}{e^{\htmlData{mx=37}{\htmlData{mx=33}{\frac{\htmlData{mx=30}{\log \left(\htmlData{mx=29}{\frac{\htmlData{mx=27}{4\htmlData{mx=26}{N}}}{\htmlData{mx=28}{m}}}\right)}}{\htmlData{mx=32}{1 - \htmlData{mx=31}{s}}}} \cdot \htmlData{mx=36}{\htmlData{mx=34}{x}(\htmlData{mx=35}{k})}}}}}}}} \\ & \quad \htmlData{mx=0}{\leq} \htmlData{mx=42}{\frac{1}{4}} \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. (ℕ)
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
m, s range over real numbers: the statement must hold for every choice. ((m s : ℝ))
<Less than
0 is strictly smaller than m. (0 < m)
≤At most
0 is less than or equal to s. (0 ≤ s)
∀For all
The statement after the comma holds for every k. (∀ k, x k ≤ s)
∑Summation
Add up exp(log(4 · N/m)/(1 − s) · x(k)) for every k. (∑ k, Real.exp (Real.log (4 * N / m) / (…)
·Multiplication
4 times N. (4 * N)
eˣExponential function
e raised to the power log(4 · N/m)/(1 − s) · x(k), where e ≈ 2.718. (Real.exp (Real.log (4 * N / m) / (1 - s…)
RReal numbers
The real numbers: every point on the number line. (ℝ)
logNatural logarithm
The logarithm of 4 · N/m to base e: the power e must be raised to to give 4 · N/m. (Real.log (4 * N / m))
a/bDivision
4 · N divided by m. In Lean, dividing by 0 gives 0. (4 * N / m)
-Subtraction
1 minus s. On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (1 - s)
+Addition
m · exp(log(4 · N/m)/(1 − s)) plus ∑ k, exp(log(4 · N/m)/(1 − s) · x(k)). (m * Real.exp (Real.log (4 * N / m) / (1…)

All N = n value-1 keys weigh ≤ e^{βs} each, and 4N e^{βs} = m e^β exactly at this β. Part of 'Unbiased randomized attention: cost x variance thresholds', round 12 (full exponent: multiplicity gadget for α < 1).

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
32 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.

More proved statements