proofs
Provedsampleabilitycertificateheadline-theoremsingle-statement

Sampleability Law, one statement: residual oscillation ≤ Δ ⇒ cost ≤ cosh²(Δ/2); samples certify the cost (failure ≤ (K²−1)/(Nδ²) under an envelope); features bound learned proposals

For all J,I∈Type⁡\htmlData{mx=1}{J, I \in \htmlData{mx=0}{\operatorname{Type}}}, s,st:J→R\htmlData{mx=3}{s, \mathit{st} : \htmlData{mx=0}{J} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, Δ∈R\htmlData{mx=1}{\Delta \in \htmlData{mx=0}{\mathbb{R}}}, N∈N\htmlData{mx=1}{N \in \htmlData{mx=0}{\mathbb{N}}}, r:J→R\htmlData{mx=3}{r : \htmlData{mx=0}{J} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, Z,C,K,δ∈R\htmlData{mx=1}{Z, C, K, \delta \in \htmlData{mx=0}{\mathbb{R}}}, lam:I→R\htmlData{mx=3}{\mathit{lam} : \htmlData{mx=0}{I} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, π:I→J→R\htmlData{mx=5}{\pi : \htmlData{mx=0}{I} \mathrel{\htmlData{mx=4}{\to}} \htmlData{mx=1}{J} \mathrel{\htmlData{mx=3}{\to}} \htmlData{mx=2}{\mathbb{R}}} and rφ:J→R\htmlData{mx=3}{\mathit{r{\varphi}} : \htmlData{mx=0}{J} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, if ∀i,j, s(i)−st(i)−(s(j)−st(j))≤Δ\htmlData{mx=17}{\forall i, j,\ \htmlData{mx=14}{\htmlData{mx=6}{\htmlData{mx=2}{\htmlData{mx=0}{s}(\htmlData{mx=1}{i})} - \htmlData{mx=5}{\htmlData{mx=3}{\mathit{st}}(\htmlData{mx=4}{i})}} - (\htmlData{mx=13}{\htmlData{mx=9}{\htmlData{mx=7}{s}(\htmlData{mx=8}{j})} - \htmlData{mx=12}{\htmlData{mx=10}{\mathit{st}}(\htmlData{mx=11}{j})}})} \mathrel{\htmlData{mx=16}{\leq}} \htmlData{mx=15}{\Delta}}, ∀j, 0<r(j)\htmlData{mx=4}{\forall j,\ 0 \mathrel{\htmlData{mx=3}{<}} \htmlData{mx=2}{\htmlData{mx=0}{r}(\htmlData{mx=1}{j})}}, ∑jr(j)=1\htmlData{mx=3}{\sum_{j} \htmlData{mx=2}{\htmlData{mx=0}{r}(\htmlData{mx=1}{j})}} \mathrel{\htmlData{mx=4}{=}} 1, Z=∑jes(j)\htmlData{mx=0}{Z} \mathrel{\htmlData{mx=6}{=}} \htmlData{mx=5}{\sum_{j} \htmlData{mx=4}{e^{\htmlData{mx=3}{\htmlData{mx=1}{s}(\htmlData{mx=2}{j})}}}}, C=∑j(es(j)Z)2r(j)\htmlData{mx=0}{C} \mathrel{\htmlData{mx=13}{=}} \htmlData{mx=12}{\sum_{j} \htmlData{mx=11}{\frac{\htmlData{mx=7}{\left(\htmlData{mx=6}{\frac{\htmlData{mx=4}{e^{\htmlData{mx=3}{\htmlData{mx=1}{s}(\htmlData{mx=2}{j})}}}}{\htmlData{mx=5}{Z}}}\right)^{2}}}{\htmlData{mx=10}{\htmlData{mx=8}{r}(\htmlData{mx=9}{j})}}}}, ∀j, es(j)Z≤K⋅r(j)\htmlData{mx=12}{\forall j,\ \htmlData{mx=5}{\frac{\htmlData{mx=3}{e^{\htmlData{mx=2}{\htmlData{mx=0}{s}(\htmlData{mx=1}{j})}}}}{\htmlData{mx=4}{Z}}} \mathrel{\htmlData{mx=11}{\leq}} \htmlData{mx=10}{\htmlData{mx=6}{K} \cdot \htmlData{mx=9}{\htmlData{mx=7}{r}(\htmlData{mx=8}{j})}}}, 0<N0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{N}, 0<δ0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{\delta}, δ<1\htmlData{mx=0}{\delta} \mathrel{\htmlData{mx=1}{<}} 1, ∀i, 0≤lam(i)\htmlData{mx=4}{\forall i,\ 0 \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{\htmlData{mx=0}{\mathit{lam}}(\htmlData{mx=1}{i})}}, ∀j, 0<rφ(j)\htmlData{mx=4}{\forall j,\ 0 \mathrel{\htmlData{mx=3}{<}} \htmlData{mx=2}{\htmlData{mx=0}{\mathit{r{\varphi}}}(\htmlData{mx=1}{j})}} and ∑jrφ(j)=1\htmlData{mx=3}{\sum_{j} \htmlData{mx=2}{\htmlData{mx=0}{\mathit{r{\varphi}}}(\htmlData{mx=1}{j})}} \mathrel{\htmlData{mx=4}{=}} 1 (given Fintype⁡ J\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fintype}}\,\htmlData{mx=1}{J}}, Nonempty⁡ J\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Nonempty}}\,\htmlData{mx=1}{J}} and Fintype⁡ I\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fintype}}\,\htmlData{mx=1}{I}}), then

(∑j(es(j)∑kes(k))2est(j)∑kest(k)≤cosh⁡(Δ2)2)∧(1≤C∧C≤K∧∑f∈filter⁡(f↦¬((1−δ)⋅C(1+δ)2<∑i(es(f(i))r(f(i)))2N(∑ies(f(i))r(f(i))N)2∧∑i(es(f(i))r(f(i)))2N(∑ies(f(i))r(f(i))N)2<(1+δ)⋅C(1−δ)2))∏ir(f(i))≤K2−1N⋅δ2)∧((∑j∑ilam(i)⋅π(i,j)2)2≤∑ilam(i)⋅∑jπ(i,j)2rφ(j))∧((∀j, 0<∑ilam(i)⋅π(i,j)2)  ⟹  ∑ilam(i)⋅∑jπ(i,j)2∑ilam(i)⋅π(i,j)2∑k∑ilam(i)⋅π(i,k)2=(∑j∑ilam(i)⋅π(i,j)2)2)\begin{aligned} & \left(\right. \htmlData{mx=24}{\sum_{j} \htmlData{mx=23}{\frac{\htmlData{mx=12}{\left(\htmlData{mx=11}{\frac{\htmlData{mx=5}{e^{\htmlData{mx=4}{\htmlData{mx=2}{s}(\htmlData{mx=3}{j})}}}}{\htmlData{mx=10}{\sum_{k} \htmlData{mx=9}{e^{\htmlData{mx=8}{\htmlData{mx=6}{s}(\htmlData{mx=7}{k})}}}}}}\right)^{2}}}{\htmlData{mx=22}{\frac{\htmlData{mx=16}{e^{\htmlData{mx=15}{\htmlData{mx=13}{\mathit{st}}(\htmlData{mx=14}{j})}}}}{\htmlData{mx=21}{\sum_{k} \htmlData{mx=20}{e^{\htmlData{mx=19}{\htmlData{mx=17}{\mathit{st}}(\htmlData{mx=18}{k})}}}}}}}}} \\ & \quad \htmlData{mx=1}{\leq} \htmlData{mx=28}{\htmlData{mx=27}{\cosh \left(\htmlData{mx=26}{\frac{\htmlData{mx=25}{\Delta}}{2}}\right)}^{2}} \left.\right) \\ & \htmlData{mx=0}{\land} \left(1 \mathrel{\htmlData{mx=30}{\leq}} \htmlData{mx=29}{C} \mathbin{\htmlData{mx=145}{\land}} \htmlData{mx=31}{C} \mathrel{\htmlData{mx=33}{\leq}} \htmlData{mx=32}{K} \mathbin{\htmlData{mx=144}{\land}} \htmlData{mx=134}{\sum_{f \in \htmlData{mx=127}{\htmlData{mx=34}{\operatorname{filter}}\left(\htmlData{mx=126}{f \mapsto \htmlData{mx=120}{\lnot \left(\htmlData{mx=42}{\frac{\htmlData{mx=38}{(\htmlData{mx=36}{1 - \htmlData{mx=35}{\delta}}) \cdot \htmlData{mx=37}{C}}}{\htmlData{mx=41}{(\htmlData{mx=40}{1 + \htmlData{mx=39}{\delta}})^{2}}}} \mathrel{\htmlData{mx=76}{<}} \htmlData{mx=75}{\frac{\htmlData{mx=58}{\frac{\htmlData{mx=56}{\sum_{i} \htmlData{mx=55}{\left(\htmlData{mx=54}{\frac{\htmlData{mx=48}{e^{\htmlData{mx=47}{\htmlData{mx=43}{s}(\htmlData{mx=46}{\htmlData{mx=44}{f}(\htmlData{mx=45}{i})})}}}}{\htmlData{mx=53}{\htmlData{mx=49}{r}(\htmlData{mx=52}{\htmlData{mx=50}{f}(\htmlData{mx=51}{i})})}}}\right)^{2}}}}{\htmlData{mx=57}{N}}}}{\htmlData{mx=74}{\left(\htmlData{mx=73}{\frac{\htmlData{mx=71}{\sum_{i} \htmlData{mx=70}{\frac{\htmlData{mx=64}{e^{\htmlData{mx=63}{\htmlData{mx=59}{s}(\htmlData{mx=62}{\htmlData{mx=60}{f}(\htmlData{mx=61}{i})})}}}}{\htmlData{mx=69}{\htmlData{mx=65}{r}(\htmlData{mx=68}{\htmlData{mx=66}{f}(\htmlData{mx=67}{i})})}}}}}{\htmlData{mx=72}{N}}}\right)^{2}}}} \mathbin{\htmlData{mx=119}{\land}} \htmlData{mx=109}{\frac{\htmlData{mx=92}{\frac{\htmlData{mx=90}{\sum_{i} \htmlData{mx=89}{\left(\htmlData{mx=88}{\frac{\htmlData{mx=82}{e^{\htmlData{mx=81}{\htmlData{mx=77}{s}(\htmlData{mx=80}{\htmlData{mx=78}{f}(\htmlData{mx=79}{i})})}}}}{\htmlData{mx=87}{\htmlData{mx=83}{r}(\htmlData{mx=86}{\htmlData{mx=84}{f}(\htmlData{mx=85}{i})})}}}\right)^{2}}}}{\htmlData{mx=91}{N}}}}{\htmlData{mx=108}{\left(\htmlData{mx=107}{\frac{\htmlData{mx=105}{\sum_{i} \htmlData{mx=104}{\frac{\htmlData{mx=98}{e^{\htmlData{mx=97}{\htmlData{mx=93}{s}(\htmlData{mx=96}{\htmlData{mx=94}{f}(\htmlData{mx=95}{i})})}}}}{\htmlData{mx=103}{\htmlData{mx=99}{r}(\htmlData{mx=102}{\htmlData{mx=100}{f}(\htmlData{mx=101}{i})})}}}}}{\htmlData{mx=106}{N}}}\right)^{2}}}} \mathrel{\htmlData{mx=118}{<}} \htmlData{mx=117}{\frac{\htmlData{mx=113}{(\htmlData{mx=111}{1 + \htmlData{mx=110}{\delta}}) \cdot \htmlData{mx=112}{C}}}{\htmlData{mx=116}{(\htmlData{mx=115}{1 - \htmlData{mx=114}{\delta}})^{2}}}}\right)}}\right)}} \htmlData{mx=133}{\prod_{i} \htmlData{mx=132}{\htmlData{mx=128}{r}(\htmlData{mx=131}{\htmlData{mx=129}{f}(\htmlData{mx=130}{i})})}}} \mathrel{\htmlData{mx=143}{\leq}} \htmlData{mx=142}{\frac{\htmlData{mx=137}{\htmlData{mx=136}{\htmlData{mx=135}{K}^{2}} - 1}}{\htmlData{mx=141}{\htmlData{mx=138}{N} \cdot \htmlData{mx=140}{\htmlData{mx=139}{\delta}^{2}}}}}\right) \\ & \htmlData{mx=0}{\land} \left(\right. \htmlData{mx=159}{\left(\htmlData{mx=158}{\sum_{j} \htmlData{mx=157}{\sqrt{\htmlData{mx=156}{\sum_{i} \htmlData{mx=155}{\htmlData{mx=149}{\htmlData{mx=147}{\mathit{lam}}(\htmlData{mx=148}{i})} \cdot \htmlData{mx=154}{\htmlData{mx=153}{\htmlData{mx=150}{\pi}(\htmlData{mx=151}{i}, \htmlData{mx=152}{j})}^{2}}}}}}}\right)^{2}} \\ & \quad \htmlData{mx=146}{\leq} \htmlData{mx=174}{\sum_{i} \htmlData{mx=173}{\htmlData{mx=162}{\htmlData{mx=160}{\mathit{lam}}(\htmlData{mx=161}{i})} \cdot \htmlData{mx=172}{\sum_{j} \htmlData{mx=171}{\frac{\htmlData{mx=167}{\htmlData{mx=166}{\htmlData{mx=163}{\pi}(\htmlData{mx=164}{i}, \htmlData{mx=165}{j})}^{2}}}{\htmlData{mx=170}{\htmlData{mx=168}{\mathit{r{\varphi}}}(\htmlData{mx=169}{j})}}}}}} \left.\right) \\ & \htmlData{mx=0}{\land} \left(\right. \left(\htmlData{mx=187}{\forall j,\ 0 \mathrel{\htmlData{mx=186}{<}} \htmlData{mx=185}{\sum_{i} \htmlData{mx=184}{\htmlData{mx=178}{\htmlData{mx=176}{\mathit{lam}}(\htmlData{mx=177}{i})} \cdot \htmlData{mx=183}{\htmlData{mx=182}{\htmlData{mx=179}{\pi}(\htmlData{mx=180}{i}, \htmlData{mx=181}{j})}^{2}}}}}\right) \\ & \htmlData{mx=175}{\implies} \htmlData{mx=224}{\sum_{i} \htmlData{mx=223}{\htmlData{mx=191}{\htmlData{mx=189}{\mathit{lam}}(\htmlData{mx=190}{i})} \cdot \htmlData{mx=222}{\sum_{j} \htmlData{mx=221}{\frac{\htmlData{mx=196}{\htmlData{mx=195}{\htmlData{mx=192}{\pi}(\htmlData{mx=193}{i}, \htmlData{mx=194}{j})}^{2}}}{\htmlData{mx=220}{\frac{\htmlData{mx=207}{\sqrt{\htmlData{mx=206}{\sum_{i} \htmlData{mx=205}{\htmlData{mx=199}{\htmlData{mx=197}{\mathit{lam}}(\htmlData{mx=198}{i})} \cdot \htmlData{mx=204}{\htmlData{mx=203}{\htmlData{mx=200}{\pi}(\htmlData{mx=201}{i}, \htmlData{mx=202}{j})}^{2}}}}}}}{\htmlData{mx=219}{\sum_{k} \htmlData{mx=218}{\sqrt{\htmlData{mx=217}{\sum_{i} \htmlData{mx=216}{\htmlData{mx=210}{\htmlData{mx=208}{\mathit{lam}}(\htmlData{mx=209}{i})} \cdot \htmlData{mx=215}{\htmlData{mx=214}{\htmlData{mx=211}{\pi}(\htmlData{mx=212}{i}, \htmlData{mx=213}{k})}^{2}}}}}}}}}}}}}} \\ & \quad \htmlData{mx=188}{=} \htmlData{mx=237}{\left(\htmlData{mx=236}{\sum_{j} \htmlData{mx=235}{\sqrt{\htmlData{mx=234}{\sum_{i} \htmlData{mx=233}{\htmlData{mx=227}{\htmlData{mx=225}{\mathit{lam}}(\htmlData{mx=226}{i})} \cdot \htmlData{mx=232}{\htmlData{mx=231}{\htmlData{mx=228}{\pi}(\htmlData{mx=229}{i}, \htmlData{mx=230}{j})}^{2}}}}}}}\right)^{2}} \left.\right) \end{aligned}
What the notation means · or point at any symbol
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)
x ∈ TVariables
J, I range over Type: the statement must hold for every choice. ((J I : 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 J. Lean writes f x; papers write f(x). (Fintype J)
Nonempty
Nonempty: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Nonempty)
⟹Implies
If J, then ℝ. (Between types, A → B is the type of functions from A to B.) (J → ℝ)
x : TVariables
s, st range over J → ℝ: the statement must hold for every choice. ((s st : J → ℝ))
∀For all
The statement after the comma holds for every i, j. (∀ i j, (s i - st i) - (s j - st j) ≤ Δ)
NNatural numbers
The natural numbers 0, 1, 2, …. In Lean they start at 0. (ℕ)
∑Summation
Add up r(j) for every j. (∑ j, r j)
=Equality
∑ j, r(j) and 1 are the same. (∑ j, r j = 1)
RReal numbers
The real numbers: every point on the number line. (ℝ)
<Less than
0 is strictly smaller than r(j). (0 < r j)
≤At most
s(i) − st(i) − (s(j) − st(j)) is less than or equal to Δ. ((s i - st i) - (s j - st j) ≤ Δ)
-Subtraction
s(i) minus st(i). On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (s i - st i)
eˣExponential function
e raised to the power s(j), where e ≈ 2.718. (Real.exp (s j))
aᵇPower
exp(s(j))/Z raised to the power 2. ((Real.exp (s j) / Z) ^ 2)
a/bDivision
exp(s(j)) divided by Z. In Lean, dividing by 0 gives 0. (Real.exp (s j) / Z)
·Multiplication
K times r(j). (K * r j)
coshHyperbolic cosine
(eˣ + e⁻ˣ)/2 at Δ/2. (Real.cosh (Δ / 2))
filter
Finset.univ.filter: 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.filter)
x ↦ f(x)Function (λ-abstraction)
The function sending f to ¬((1 − δ) · C/(1 + δ)^2 < (∑ i, (exp(s(f(i)))/r(f(i)))^2)/…. Lean writes fun x => …; papers write x ↦ …. (fun f : Fin N → J => ¬ ((1 - δ) * C / (…)
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)
¬Not
It is not the case that (1 − δ) · C/(1 + δ)^2 < (∑ i, (exp(s(f(i)))/r(f(i)))^2)/N/…. (¬ ((1 - δ) * C / (1 + δ) ^ 2 < ((∑ i, (…)
∧And
Both hold: (1 − δ) · C/(1 + δ)^2 < (∑ i, (exp(s(f(i)))/r(f(i)))^2)/N/…, and (∑ i, (exp(s(f(i)))/r(f(i)))^2)/N/((∑ i, exp(s(f(i)))/r(f(…. ((1 - δ) * C / (1 + δ) ^ 2 < ((∑ i, (Rea…)
+Addition
1 plus δ. (1 + δ)
∏Product
Multiply together r(f(i)) for every i. (∏ i, r (f i))
√Square root
The non-negative number whose square is ∑ i, lam(i) · π(i, j)^2. (Real.sqrt (∑ i, lam i * π i j ^ 2))
πPi
The ratio of a circle's circumference to its diameter, ≈ 3.14159. (π)

The strongest provable single statement of the Sampleability Law. For a row with scores s: (i) any proposal softmax(s̃) whose score residual s − s̃ has oscillation ≤ Δ has cost factor Σπ²/r ≤ cosh²(Δ/2), so a head is cheaply sampleable as soon as some cheap score approximation is uniformly accurate up to a shift; (ii) with an envelope π ≤ K r, N draws from r give an empirical certificate mean(w²)/mean(w)² of the cost factor C within [(1−δ)C/(1+δ)², (1+δ)C/(1−δ)²] except with probability ≤ (K²−1)/(Nδ²), and 1 ≤ C ≤ K, so the same samples that compute attention certify the proposal; (iii) for a proposal built from features φ (a mixture over rows with weights λ, the posterior given φ), the expected cost is ≥ (Σ_j √E[π_j²|φ])² and r ∝ √E[π²|φ] attains it, which is the ceiling of any learned proposal on those features and the closed-form target for training one. The co-training dynamics (whether trained heads reach O(1) residual oscillation) remain a conjecture. Conjoins drift-oscillation-cosh-bound, sc-certificate-quadratic-failure and the variational cost law.

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

More proved statements