proofs
Provedunbiased-attentionheadline-theoremsampling-lower-boundattention-compute-law

Unconditional sampling threshold, two-sided, one statement: range-R rows cost ≤ e^R under the uniform proposal, and any unbiased sampler needs ≥ (n/m)·min(1/2, 1/64V) probes

For all n,k,s∈N\htmlData{mx=1}{n, k, s \in \htmlData{mx=0}{\mathbb{N}}}, Ω∈Type⁡\htmlData{mx=1}{\Omega \in \htmlData{mx=0}{\operatorname{Type}}}, w:Ω→R\htmlData{mx=3}{w : \htmlData{mx=0}{\Omega} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, Pr:Ω→Finset⁡ Fin⁡ n\htmlData{mx=7}{\mathit{Pr} : \htmlData{mx=0}{\Omega} \mathrel{\htmlData{mx=6}{\to}} \htmlData{mx=5}{\htmlData{mx=1}{\operatorname{Finset}}\,\htmlData{mx=4}{\htmlData{mx=2}{\operatorname{Fin}}\,\htmlData{mx=3}{n}}}}, z1:Ω→R\htmlData{mx=3}{z_{1} : \htmlData{mx=0}{\Omega} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, z2:Finset⁡ Fin⁡ n→Ω→R\htmlData{mx=9}{z_{2} : \htmlData{mx=4}{\htmlData{mx=0}{\operatorname{Finset}}\,\htmlData{mx=3}{\htmlData{mx=1}{\operatorname{Fin}}\,\htmlData{mx=2}{n}}} \mathrel{\htmlData{mx=8}{\to}} \htmlData{mx=5}{\Omega} \mathrel{\htmlData{mx=7}{\to}} \htmlData{mx=6}{\mathbb{R}}} and o1,o2,V,R∈R\htmlData{mx=1}{o_{1}, o_{2}, V, R \in \htmlData{mx=0}{\mathbb{R}}}, if ∀ω, 0≤w(ω)\htmlData{mx=4}{\forall \omega,\ 0 \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{\htmlData{mx=0}{w}(\htmlData{mx=1}{\omega})}}, ∑ωw(ω)=1\htmlData{mx=3}{\sum_{\omega} \htmlData{mx=2}{\htmlData{mx=0}{w}(\htmlData{mx=1}{\omega})}} \mathrel{\htmlData{mx=4}{=}} 1, ∀ω, ∣Pr(ω)∣≤s\htmlData{mx=9}{\forall \omega,\ \htmlData{mx=6}{\lvert \htmlData{mx=5}{\htmlData{mx=3}{\mathit{Pr}}(\htmlData{mx=4}{\omega})} \rvert} \mathrel{\htmlData{mx=8}{\leq}} \htmlData{mx=7}{s}}, ∑ωw(ω)⋅z1(ω)=o1\htmlData{mx=7}{\sum_{\omega} \htmlData{mx=6}{\htmlData{mx=2}{\htmlData{mx=0}{w}(\htmlData{mx=1}{\omega})} \cdot \htmlData{mx=5}{\htmlData{mx=3}{z_{1}}(\htmlData{mx=4}{\omega})}}} \mathrel{\htmlData{mx=9}{=}} \htmlData{mx=8}{o_{1}}, ∑ωw(ω)⋅(z1(ω)−o1)2≤V\htmlData{mx=10}{\sum_{\omega} \htmlData{mx=9}{\htmlData{mx=2}{\htmlData{mx=0}{w}(\htmlData{mx=1}{\omega})} \cdot \htmlData{mx=8}{(\htmlData{mx=7}{\htmlData{mx=5}{\htmlData{mx=3}{z_{1}}(\htmlData{mx=4}{\omega})} - \htmlData{mx=6}{o_{1}}})^{2}}}} \mathrel{\htmlData{mx=12}{\leq}} \htmlData{mx=11}{V}, ∀S∈powersetCard⁡(k+1,univ⁡), ∑ωw(ω)⋅z2(S,ω)=o2\htmlData{mx=17}{\forall S \in \htmlData{mx=16}{\htmlData{mx=11}{\operatorname{powersetCard}}(\htmlData{mx=13}{\htmlData{mx=12}{k} + 1}, \htmlData{mx=15}{\htmlData{mx=14}{\operatorname{univ}}})},\ \htmlData{mx=8}{\sum_{\omega} \htmlData{mx=7}{\htmlData{mx=2}{\htmlData{mx=0}{w}(\htmlData{mx=1}{\omega})} \cdot \htmlData{mx=6}{\htmlData{mx=3}{z_{2}}(\htmlData{mx=4}{S}, \htmlData{mx=5}{\omega})}}} \mathrel{\htmlData{mx=10}{=}} \htmlData{mx=9}{o_{2}}}, ∀S∈powersetCard⁡(k+1,univ⁡), ∑ωw(ω)⋅(z2(S,ω)−o2)2≤V\htmlData{mx=20}{\forall S \in \htmlData{mx=19}{\htmlData{mx=14}{\operatorname{powersetCard}}(\htmlData{mx=16}{\htmlData{mx=15}{k} + 1}, \htmlData{mx=18}{\htmlData{mx=17}{\operatorname{univ}}})},\ \htmlData{mx=11}{\sum_{\omega} \htmlData{mx=10}{\htmlData{mx=2}{\htmlData{mx=0}{w}(\htmlData{mx=1}{\omega})} \cdot \htmlData{mx=9}{(\htmlData{mx=8}{\htmlData{mx=6}{\htmlData{mx=3}{z_{2}}(\htmlData{mx=4}{S}, \htmlData{mx=5}{\omega})} - \htmlData{mx=7}{o_{2}}})^{2}}}} \mathrel{\htmlData{mx=13}{\leq}} \htmlData{mx=12}{V}}, ∀S,ω, (∀p∈Pr(ω), p∉S)  ⟹  z2(S,ω)=z1(ω)\htmlData{mx=16}{\forall S, \omega,\ (\htmlData{mx=6}{\forall p \in \htmlData{mx=5}{\htmlData{mx=3}{\mathit{Pr}}(\htmlData{mx=4}{\omega})},\ \htmlData{mx=0}{p} \mathrel{\htmlData{mx=2}{\notin}} \htmlData{mx=1}{S}}) \mathrel{\htmlData{mx=15}{\implies}} \htmlData{mx=10}{\htmlData{mx=7}{z_{2}}(\htmlData{mx=8}{S}, \htmlData{mx=9}{\omega})} \mathrel{\htmlData{mx=14}{=}} \htmlData{mx=13}{\htmlData{mx=11}{z_{1}}(\htmlData{mx=12}{\omega})}}, k+1≤n\htmlData{mx=1}{\htmlData{mx=0}{k} + 1} \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{n}, 0<V0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{V}, 0≤R0 \mathrel{\htmlData{mx=1}{\leq}} \htmlData{mx=0}{R}, o1=0\htmlData{mx=0}{o_{1}} \mathrel{\htmlData{mx=1}{=}} 0, o2=k+1⋅eRk+1⋅eR+(n−(k+1))\htmlData{mx=0}{o_{2}} \mathrel{\htmlData{mx=20}{=}} \htmlData{mx=19}{\frac{\htmlData{mx=6}{\htmlData{mx=3}{\htmlData{mx=2}{\htmlData{mx=1}{k} + 1}} \cdot \htmlData{mx=5}{e^{\htmlData{mx=4}{R}}}}}{\htmlData{mx=18}{\htmlData{mx=12}{\htmlData{mx=9}{\htmlData{mx=8}{\htmlData{mx=7}{k} + 1}} \cdot \htmlData{mx=11}{e^{\htmlData{mx=10}{R}}}} + (\htmlData{mx=17}{\htmlData{mx=14}{\htmlData{mx=13}{n}} - (\htmlData{mx=16}{\htmlData{mx=15}{k} + 1})})}}} and n−(k+1)≤k+1⋅eR\htmlData{mx=4}{\htmlData{mx=1}{\htmlData{mx=0}{n}} - (\htmlData{mx=3}{\htmlData{mx=2}{k} + 1})} \mathrel{\htmlData{mx=11}{\leq}} \htmlData{mx=10}{\htmlData{mx=7}{\htmlData{mx=6}{\htmlData{mx=5}{k} + 1}} \cdot \htmlData{mx=9}{e^{\htmlData{mx=8}{R}}}} (given Fintype⁡ Ω\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fintype}}\,\htmlData{mx=1}{\Omega}}), then

(∀sc:Fin⁡ n→R, a∈R,(∀j, a≤sc(j)∧sc(j)≤a+R)  ⟹  n⋅∑j(esc(j)∑iesc(i))2≤eR)∧(∀S∈powersetCard⁡(k+1,univ⁡),∑je{Rif j∈S0otherwise⋅({1if j∈S0otherwise)∑je{Rif j∈S0otherwise=k+1⋅eRk+1⋅eR+(n−(k+1)))∧min⁡(12,164V)≤s⋅(k+1)n\begin{aligned} & \left(\right. \htmlData{mx=1}{\forall} \mathit{sc} : \htmlData{mx=4}{\htmlData{mx=2}{\operatorname{Fin}}\,\htmlData{mx=3}{n}} \mathrel{\htmlData{mx=6}{\to}} \htmlData{mx=5}{\mathbb{R}},\ a \in \htmlData{mx=7}{\mathbb{R}}, \\ & \quad (\htmlData{mx=22}{\forall j,\ \htmlData{mx=9}{a} \mathrel{\htmlData{mx=13}{\leq}} \htmlData{mx=12}{\htmlData{mx=10}{\mathit{sc}}(\htmlData{mx=11}{j})} \mathbin{\htmlData{mx=21}{\land}} \htmlData{mx=16}{\htmlData{mx=14}{\mathit{sc}}(\htmlData{mx=15}{j})} \mathrel{\htmlData{mx=20}{\leq}} \htmlData{mx=19}{\htmlData{mx=17}{a} + \htmlData{mx=18}{R}}}) \\ & \quad \htmlData{mx=8}{\implies} \htmlData{mx=37}{\htmlData{mx=24}{\htmlData{mx=23}{n}} \cdot \htmlData{mx=36}{\sum_{j} \htmlData{mx=35}{\left(\htmlData{mx=34}{\frac{\htmlData{mx=28}{e^{\htmlData{mx=27}{\htmlData{mx=25}{\mathit{sc}}(\htmlData{mx=26}{j})}}}}{\htmlData{mx=33}{\sum_{i} \htmlData{mx=32}{e^{\htmlData{mx=31}{\htmlData{mx=29}{\mathit{sc}}(\htmlData{mx=30}{i})}}}}}}\right)^{2}}}} \mathrel{\htmlData{mx=40}{\leq}} \htmlData{mx=39}{e^{\htmlData{mx=38}{R}}} \left.\right) \\ & \htmlData{mx=0}{\land} \left(\right. \htmlData{mx=41}{\forall} S \in \htmlData{mx=47}{\htmlData{mx=42}{\operatorname{powersetCard}}(\htmlData{mx=44}{\htmlData{mx=43}{k} + 1}, \htmlData{mx=46}{\htmlData{mx=45}{\operatorname{univ}}})}, \\ & \quad \htmlData{mx=69}{\frac{\htmlData{mx=61}{\sum_{j} \htmlData{mx=60}{\htmlData{mx=54}{e^{\htmlData{mx=53}{\begin{cases} \htmlData{mx=49}{R} & \text{if } \htmlData{mx=50}{j} \mathrel{\htmlData{mx=52}{\in}} \htmlData{mx=51}{S} \\ 0 & \text{otherwise} \end{cases}}}} \cdot \left(\htmlData{mx=59}{\begin{cases} \htmlData{mx=55}{1} & \text{if } \htmlData{mx=56}{j} \mathrel{\htmlData{mx=58}{\in}} \htmlData{mx=57}{S} \\ 0 & \text{otherwise} \end{cases}}\right)}}}{\htmlData{mx=68}{\sum_{j} \htmlData{mx=67}{e^{\htmlData{mx=66}{\begin{cases} \htmlData{mx=62}{R} & \text{if } \htmlData{mx=63}{j} \mathrel{\htmlData{mx=65}{\in}} \htmlData{mx=64}{S} \\ 0 & \text{otherwise} \end{cases}}}}}}} \\ & \quad \quad \htmlData{mx=48}{=} \htmlData{mx=88}{\frac{\htmlData{mx=75}{\htmlData{mx=72}{\htmlData{mx=71}{\htmlData{mx=70}{k} + 1}} \cdot \htmlData{mx=74}{e^{\htmlData{mx=73}{R}}}}}{\htmlData{mx=87}{\htmlData{mx=81}{\htmlData{mx=78}{\htmlData{mx=77}{\htmlData{mx=76}{k} + 1}} \cdot \htmlData{mx=80}{e^{\htmlData{mx=79}{R}}}} + (\htmlData{mx=86}{\htmlData{mx=83}{\htmlData{mx=82}{n}} - (\htmlData{mx=85}{\htmlData{mx=84}{k} + 1})})}}} \left.\right) \\ & \htmlData{mx=0}{\land} \htmlData{mx=93}{\min(\htmlData{mx=89}{\frac{1}{2}}, \htmlData{mx=92}{\frac{1}{\htmlData{mx=91}{64\htmlData{mx=90}{V}}}})} \mathrel{\htmlData{mx=101}{\leq}} \htmlData{mx=100}{\frac{\htmlData{mx=98}{\htmlData{mx=97}{\htmlData{mx=94}{s} \cdot (\htmlData{mx=96}{\htmlData{mx=95}{k} + 1})}}}{\htmlData{mx=99}{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, k, s range over natural numbers: the statement must hold for every choice. ((n k s : ℕ))
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)
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.) (Ω → ℝ)
∀For all
The statement after the comma holds for every ω. (∀ ω, 0 ≤ w ω)
∑Summation
Add up w(ω) for every ω. (∑ ω, w ω)
=Equality
∑ ω, w(ω) and 1 are the same. (∑ ω, w ω = 1)
<Less than
0 is strictly smaller than V. (0 < V)
RReal numbers
The real numbers: every point on the number line. (ℝ)
Finset
Finset: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Finset)
≤At most
0 is less than or equal to w(ω). (0 ≤ w ω)
|s|Cardinality
The number of elements of Pr(ω). ((Pr ω).card)
·Multiplication
w(ω) times z₁(ω). (w ω * z₁ ω)
a/bDivision
(k + 1) · exp(R) divided by (k + 1) · exp(R) + (n − (k + 1)). In Lean, dividing by 0 gives 0. (((k + 1 : ℝ) * Real.exp R) / ((k + 1 : …)
powersetCard
Finset.powersetCard: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Finset.powersetCard)
(x : T)As real numbers
k + 1 read as an element of real numbers. Mathematicians leave this implicit; Lean needs it to know which kind of number is meant. ((k + 1 : ℝ))
aᵇPower
z₁(ω) − o₁ raised to the power 2. ((z₁ ω - o₁) ^ 2)
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)
-Subtraction
z₁(ω) minus o₁. On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (z₁ ω - o₁)
∉Not an element of
p is not a member of S. (p ∉ S)
eˣExponential function
e raised to the power R, where e ≈ 2.718. (Real.exp R)
+Addition
k plus 1. (k + 1)
(x : T)Type ascription
univ read as a Finset(Fin(n)). Mathematicians leave this implicit; Lean needs it to know which kind of number is meant. ((Finset.univ : Finset (Fin n)))
univ
Finset.univ: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Finset.univ)
∧And
Both hold: a ≤ sc(j), and sc(j) ≤ a + R. (a ≤ sc j ∧ sc j ≤ a + R)
{ a if c; b otherwiseCases (if … then … else)
R when j ∈ S, and 0 otherwise. (if j ∈ S then R else 0)
∈Element of
j is a member of S. (j ∈ S)
minMinimum
The smaller of 1/2 and 1/(64 · V). (min (1 / 2) (1 / (64 * V)))

Headline theorem of the Attention Compute Law's unconditional axis, end-to-end in one statement. (A) Upper: every attention row whose scores lie in an interval of width R has uniform-proposal cost factor n·Σπ² ≤ e^R. (B) Instance: the planted row (score R on a plant S of size m = k+1, 0 elsewhere, values 1 on the plant) has output m e^R/(m e^R + n − m), at least 1/2 when n − m ≤ m e^R. (C) Lower: any exactly unbiased sampler with variance ≤ V on the unplanted world (output 0) and on every planted world, reading at most s keys per run and agreeing between worlds when it misses the plant, satisfies s·m/n ≥ min(1/2, 1/(64V)); with m ≈ n e^{−R} this is s ≳ e^R. The verified ua-end-to-end-unbiased-sampler proof is inlined, so the statement is standalone. Adaptive probing beyond the stated agreement condition is covered by the coupling remark, not formalised.

How it was proved

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

More proved statements