Provedunbiased-attentionrandomized-algorithmssoftmaxhardness
Range-aware gap, NO: every key ≤ baseline − g with g ≥ log(4n) forces output ≤ 1/4
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. (
ℕ) - 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
- b, g range over real numbers: the statement must hold for every choice. (
(b g : ℝ)) - <Less than
- 0 is strictly smaller than n. (
0 < n) - logNatural logarithm
- The logarithm of 4 · n to base e: the power e must be raised to to give 4 · n. (
Real.log (4 * n)) - ≤At most
- log(4 · n) is less than or equal to g. (
Real.log (4 * n) ≤ g) - ∀For all
- The statement after the comma holds for every k. (
∀ k, s k ≤ b - g) - a/bDivision
- ∑ k, exp(s(k)) divided by exp(b) + (∑ k, exp(s(k))). In Lean, dividing by 0 gives 0. (
(∑ k, Real.exp (s k)) / (Real.exp b + ∑…) - ∑Summation
- Add up exp(s(k)) for every k. (
∑ k, Real.exp (s k)) - eˣExponential function
- e raised to the power s(k), where e ≈ 2.718. (
Real.exp (s k)) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - ·Multiplication
- 4 times n. (
4 * n) - -Subtraction
- b minus g. On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (
b - g) - +Addition
- exp(b) plus ∑ k, exp(s(k)). (
Real.exp b + ∑ k, Real.exp (s k))
theorem ua-gap-general-no {n : ℕ} (s : Fin n → ℝ) (b g : ℝ) (hn : 0 < n) (hg : Real.log (4 * n) ≤ g) (hno : ∀ k, s k ≤ b - g) :
(∑ k, Real.exp (s k)) / (Real.exp b + ∑ k, Real.exp (s k)) ≤ 1 / 4If all n value-1 keys score ≤ b − g and g ≥ ln(4n), the output is ≤ 1/4. With the YES case, a score gap of 2 ln(4n) between close and far keys gives a constant output gap: this is what lets a multiplicative Hamming gap give hardness at score range Θ(log n) instead of Θ(log² n). Part of 'Unbiased randomized attention: cost x variance thresholds' (open theory problem), round 2.
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
- 31 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.