proofs
Provedsampleability-lawheadline-theoremself-certifying-proposal

Self-certification theorem (Sampleability Law, strongest provable form): the attention samples certify, bound, identify and train their own proposal cost

For all J∈Type⁡\htmlData{mx=1}{J \in \htmlData{mx=0}{\operatorname{Type}}}, s,r,f:J→R\htmlData{mx=3}{s, r, f : \htmlData{mx=0}{J} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, π:J→R\htmlData{mx=3}{\pi : \htmlData{mx=0}{J} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, rr,r′:J→R→R\htmlData{mx=5}{\mathit{rr}, r' : \htmlData{mx=0}{J} \mathrel{\htmlData{mx=4}{\to}} \htmlData{mx=1}{\mathbb{R}} \mathrel{\htmlData{mx=3}{\to}} \htmlData{mx=2}{\mathbb{R}}}, θ0,θ,φ,F,ε∈R\htmlData{mx=1}{\theta_{0}, \theta, \varphi, F, \varepsilon \in \htmlData{mx=0}{\mathbb{R}}}, N∈N\htmlData{mx=1}{N \in \htmlData{mx=0}{\mathbb{N}}} and hd:∀j, HasDerivAt⁡ t↦rr(j,t) r′(j,θ0) θ0\htmlData{mx=13}{\mathit{hd} : \htmlData{mx=12}{\forall j,\ \htmlData{mx=11}{\htmlData{mx=0}{\operatorname{HasDerivAt}}\,\htmlData{mx=5}{t \mapsto \htmlData{mx=4}{\htmlData{mx=1}{\mathit{rr}}(\htmlData{mx=2}{j}, \htmlData{mx=3}{t})}}\,\htmlData{mx=9}{\htmlData{mx=6}{r'}(\htmlData{mx=7}{j}, \htmlData{mx=8}{\theta_{0}})}\,\htmlData{mx=10}{\theta_{0}}}}}, if ∀j, π(j)=es(j)∑kes(k)\htmlData{mx=14}{\forall j,\ \htmlData{mx=2}{\htmlData{mx=0}{\pi}(\htmlData{mx=1}{j})} \mathrel{\htmlData{mx=13}{=}} \htmlData{mx=12}{\frac{\htmlData{mx=6}{e^{\htmlData{mx=5}{\htmlData{mx=3}{s}(\htmlData{mx=4}{j})}}}}{\htmlData{mx=11}{\sum_{k} \htmlData{mx=10}{e^{\htmlData{mx=9}{\htmlData{mx=7}{s}(\htmlData{mx=8}{k})}}}}}}}, ∀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, ∀j, 0<rr(j,θ0)\htmlData{mx=5}{\forall j,\ 0 \mathrel{\htmlData{mx=4}{<}} \htmlData{mx=3}{\htmlData{mx=0}{\mathit{rr}}(\htmlData{mx=1}{j}, \htmlData{mx=2}{\theta_{0}})}}, 0≤F0 \mathrel{\htmlData{mx=1}{\leq}} \htmlData{mx=0}{F}, 0<ε0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{\varepsilon}, 0<N0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{N} and (∑jπ(j)2r(j))⋅F2ε2≤N\htmlData{mx=14}{\frac{\htmlData{mx=11}{\left(\htmlData{mx=8}{\sum_{j} \htmlData{mx=7}{\frac{\htmlData{mx=3}{\htmlData{mx=2}{\htmlData{mx=0}{\pi}(\htmlData{mx=1}{j})}^{2}}}{\htmlData{mx=6}{\htmlData{mx=4}{r}(\htmlData{mx=5}{j})}}}}\right) \cdot \htmlData{mx=10}{\htmlData{mx=9}{F}^{2}}}}{\htmlData{mx=13}{\htmlData{mx=12}{\varepsilon}^{2}}}} \mathrel{\htmlData{mx=16}{\leq}} \htmlData{mx=15}{N} (given Fintype⁡ J\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fintype}}\,\htmlData{mx=1}{J}} and Nonempty⁡ J\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Nonempty}}\,\htmlData{mx=1}{J}}), then

(∑jr(j)⋅(π(j)r(j))2=∑jπ(j)2r(j))∧(∑jr(j)⋅(es(j)r(j))2=(∑jes(j))2⋅∑jπ(j)2r(j))∧(1≤∑jπ(j)2r(j))∧(∑jπ(j)2r(j)=1  ⟹  ∀j, π(j)=r(j))∧HasDerivAt⁡ t↦∑jπ(j)2rr(j,t) −∑jrr(j,θ0)⋅(π(j)rr(j,θ0))2⋅(r′(j,θ0)rr(j,θ0)) θ0∧(∀a:J→R,(∀j, 0<a(j))  ⟹  log⁡(∑ja(j)⋅eθ+φ2⋅f(j))≤log⁡(∑ja(j)⋅eθ⋅f(j))+log⁡(∑ja(j)⋅eφ⋅f(j))2)∧((∑jπ(j)2r(j))⋅F2N≤ε2)\begin{aligned} & \left(\htmlData{mx=13}{\sum_{j} \htmlData{mx=12}{\htmlData{mx=3}{\htmlData{mx=1}{r}(\htmlData{mx=2}{j})} \cdot \htmlData{mx=11}{\left(\htmlData{mx=10}{\frac{\htmlData{mx=6}{\htmlData{mx=4}{\pi}(\htmlData{mx=5}{j})}}{\htmlData{mx=9}{\htmlData{mx=7}{r}(\htmlData{mx=8}{j})}}}\right)^{2}}}} \mathrel{\htmlData{mx=23}{=}} \htmlData{mx=22}{\sum_{j} \htmlData{mx=21}{\frac{\htmlData{mx=17}{\htmlData{mx=16}{\htmlData{mx=14}{\pi}(\htmlData{mx=15}{j})}^{2}}}{\htmlData{mx=20}{\htmlData{mx=18}{r}(\htmlData{mx=19}{j})}}}}\right) \\ & \htmlData{mx=0}{\land} \left(\right. \htmlData{mx=38}{\sum_{j} \htmlData{mx=37}{\htmlData{mx=27}{\htmlData{mx=25}{r}(\htmlData{mx=26}{j})} \cdot \htmlData{mx=36}{\left(\htmlData{mx=35}{\frac{\htmlData{mx=31}{e^{\htmlData{mx=30}{\htmlData{mx=28}{s}(\htmlData{mx=29}{j})}}}}{\htmlData{mx=34}{\htmlData{mx=32}{r}(\htmlData{mx=33}{j})}}}\right)^{2}}}} \\ & \quad \htmlData{mx=24}{=} \htmlData{mx=54}{\htmlData{mx=44}{\left(\htmlData{mx=43}{\sum_{j} \htmlData{mx=42}{e^{\htmlData{mx=41}{\htmlData{mx=39}{s}(\htmlData{mx=40}{j})}}}}\right)^{2}} \cdot \htmlData{mx=53}{\sum_{j} \htmlData{mx=52}{\frac{\htmlData{mx=48}{\htmlData{mx=47}{\htmlData{mx=45}{\pi}(\htmlData{mx=46}{j})}^{2}}}{\htmlData{mx=51}{\htmlData{mx=49}{r}(\htmlData{mx=50}{j})}}}}} \left.\right) \\ & \htmlData{mx=0}{\land} \left(1 \mathrel{\htmlData{mx=64}{\leq}} \htmlData{mx=63}{\sum_{j} \htmlData{mx=62}{\frac{\htmlData{mx=58}{\htmlData{mx=57}{\htmlData{mx=55}{\pi}(\htmlData{mx=56}{j})}^{2}}}{\htmlData{mx=61}{\htmlData{mx=59}{r}(\htmlData{mx=60}{j})}}}}\right) \\ & \htmlData{mx=0}{\land} \left(\htmlData{mx=73}{\sum_{j} \htmlData{mx=72}{\frac{\htmlData{mx=68}{\htmlData{mx=67}{\htmlData{mx=65}{\pi}(\htmlData{mx=66}{j})}^{2}}}{\htmlData{mx=71}{\htmlData{mx=69}{r}(\htmlData{mx=70}{j})}}}} \mathrel{\htmlData{mx=74}{=}} 1 \mathrel{\htmlData{mx=83}{\implies}} \htmlData{mx=82}{\forall j,\ \htmlData{mx=77}{\htmlData{mx=75}{\pi}(\htmlData{mx=76}{j})} \mathrel{\htmlData{mx=81}{=}} \htmlData{mx=80}{\htmlData{mx=78}{r}(\htmlData{mx=79}{j})}}\right) \\ & \htmlData{mx=0}{\land} \htmlData{mx=123}{\htmlData{mx=84}{\operatorname{HasDerivAt}}\,\htmlData{mx=95}{t \mapsto \htmlData{mx=94}{\sum_{j} \htmlData{mx=93}{\frac{\htmlData{mx=88}{\htmlData{mx=87}{\htmlData{mx=85}{\pi}(\htmlData{mx=86}{j})}^{2}}}{\htmlData{mx=92}{\htmlData{mx=89}{\mathit{rr}}(\htmlData{mx=90}{j}, \htmlData{mx=91}{t})}}}}}\,\htmlData{mx=121}{-\htmlData{mx=120}{\sum_{j} \htmlData{mx=119}{\htmlData{mx=109}{\htmlData{mx=99}{\htmlData{mx=96}{\mathit{rr}}(\htmlData{mx=97}{j}, \htmlData{mx=98}{\theta_{0}})} \cdot \htmlData{mx=108}{\left(\htmlData{mx=107}{\frac{\htmlData{mx=102}{\htmlData{mx=100}{\pi}(\htmlData{mx=101}{j})}}{\htmlData{mx=106}{\htmlData{mx=103}{\mathit{rr}}(\htmlData{mx=104}{j}, \htmlData{mx=105}{\theta_{0}})}}}\right)^{2}}} \cdot \left(\htmlData{mx=118}{\frac{\htmlData{mx=113}{\htmlData{mx=110}{r'}(\htmlData{mx=111}{j}, \htmlData{mx=112}{\theta_{0}})}}{\htmlData{mx=117}{\htmlData{mx=114}{\mathit{rr}}(\htmlData{mx=115}{j}, \htmlData{mx=116}{\theta_{0}})}}}\right)}}}\,\htmlData{mx=122}{\theta_{0}}} \\ & \htmlData{mx=0}{\land} \left(\right. \htmlData{mx=124}{\forall} a : \htmlData{mx=125}{J} \mathrel{\htmlData{mx=127}{\to}} \htmlData{mx=126}{\mathbb{R}}, \\ & \quad (\htmlData{mx=133}{\forall j,\ 0 \mathrel{\htmlData{mx=132}{<}} \htmlData{mx=131}{\htmlData{mx=129}{a}(\htmlData{mx=130}{j})}}) \\ & \quad \htmlData{mx=128}{\implies} \htmlData{mx=149}{\log \left(\htmlData{mx=148}{\sum_{j} \htmlData{mx=147}{\htmlData{mx=137}{\htmlData{mx=135}{a}(\htmlData{mx=136}{j})} \cdot \htmlData{mx=146}{e^{\htmlData{mx=145}{\htmlData{mx=141}{\frac{\htmlData{mx=140}{\htmlData{mx=138}{\theta} + \htmlData{mx=139}{\varphi}}}{2}} \cdot \htmlData{mx=144}{\htmlData{mx=142}{f}(\htmlData{mx=143}{j})}}}}}}\right)} \\ & \quad \quad \htmlData{mx=134}{\leq} \htmlData{mx=175}{\frac{\htmlData{mx=174}{\htmlData{mx=161}{\log \left(\htmlData{mx=160}{\sum_{j} \htmlData{mx=159}{\htmlData{mx=152}{\htmlData{mx=150}{a}(\htmlData{mx=151}{j})} \cdot \htmlData{mx=158}{e^{\htmlData{mx=157}{\htmlData{mx=153}{\theta} \cdot \htmlData{mx=156}{\htmlData{mx=154}{f}(\htmlData{mx=155}{j})}}}}}}\right)} + \htmlData{mx=173}{\log \left(\htmlData{mx=172}{\sum_{j} \htmlData{mx=171}{\htmlData{mx=164}{\htmlData{mx=162}{a}(\htmlData{mx=163}{j})} \cdot \htmlData{mx=170}{e^{\htmlData{mx=169}{\htmlData{mx=165}{\varphi} \cdot \htmlData{mx=168}{\htmlData{mx=166}{f}(\htmlData{mx=167}{j})}}}}}}\right)}}}{2}} \left.\right) \\ & \htmlData{mx=0}{\land} \left(\htmlData{mx=189}{\frac{\htmlData{mx=187}{\left(\htmlData{mx=184}{\sum_{j} \htmlData{mx=183}{\frac{\htmlData{mx=179}{\htmlData{mx=178}{\htmlData{mx=176}{\pi}(\htmlData{mx=177}{j})}^{2}}}{\htmlData{mx=182}{\htmlData{mx=180}{r}(\htmlData{mx=181}{j})}}}}\right) \cdot \htmlData{mx=186}{\htmlData{mx=185}{F}^{2}}}}{\htmlData{mx=188}{N}}} \mathrel{\htmlData{mx=192}{\leq}} \htmlData{mx=191}{\htmlData{mx=190}{\varepsilon}^{2}}\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)
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, r, f range over J → ℝ: the statement must hold for every choice. ((s r f : J → ℝ))
x ∈ TVariables
θ₀, θ, φ, F, ε range over real numbers: the statement must hold for every choice. ((θ₀ θ φ F ε : ℝ))
NNatural numbers
The natural numbers 0, 1, 2, …. In Lean they start at 0. (ℕ)
∀For all
The statement after the comma holds for every j. (∀ j, π j = Real.exp (s j) / ∑ k, Real.e…)
≤At most
0 is less than or equal to F. (0 ≤ F)
·Multiplication
∑ j, π(j)^2/r(j) times F^2. ((∑ j, π j ^ 2 / r j) * F ^ 2)
RReal numbers
The real numbers: every point on the number line. (ℝ)
πPi
The ratio of a circle's circumference to its diameter, ≈ 3.14159. (π)
=Equality
π(j) and exp(s(j))/(∑ k, exp(s(k))) are the same. (π j = Real.exp (s j) / ∑ k, Real.exp (s…)
<Less than
0 is strictly smaller than r(j). (0 < r j)
HasDerivAt
HasDerivAt: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (HasDerivAt)
aᵇPower
π(j) raised to the power 2. (π j ^ 2)
eˣExponential function
e raised to the power s(j), where e ≈ 2.718. (Real.exp (s j))
a/bDivision
exp(s(j)) divided by ∑ k, exp(s(k)). In Lean, dividing by 0 gives 0. (Real.exp (s j) / ∑ k, Real.exp (s k))
x ↦ f(x)Function (λ-abstraction)
The function sending t to rr(j, t). Lean writes fun x => …; papers write x ↦ …. (fun t => rr j t)
∑Summation
Add up exp(s(k)) for every k. (∑ k, Real.exp (s k))
−xNegation
The negative of ∑ j, rr(j, θ₀) · (π(j)/rr(j, θ₀))^2 · (r'(j, θ₀)/rr(j, θ₀)). (-∑ j, rr j θ₀ * (π j / rr j θ₀) ^ 2 * (…)
∧And
Both hold: ∀ a, (∀ j, 0 < a(j)) → log(∑ j, a(j) · exp((θ + φ)/2 · f(j…, and (∑ j, π(j)^2/r(j)) · F^2/N ≤ ε^2. ((∀ a : J → ℝ, (∀ j, 0 < a j) → Real.log…)
logNatural logarithm
The logarithm of ∑ j, a(j) · exp((θ + φ)/2 · f(j)) to base e: the power e must be raised to to give ∑ j, a(j) · exp((θ + φ)/2 · f(j)). (Real.log (∑ j, a j * Real.exp ((θ + φ) …)
+Addition
θ plus φ. (θ + φ)

One statement combining the provable core of the Sampleability Law. For an attention row π = softmax(s) and any positive proposal r: (1) the certificate E_r[(π/r)²] equals the cost factor Σπ²/r = 1 + χ²; (2) it is computable from unnormalised weights, E_r[(e^s/r)²] = Z²·Σπ²/r; (3) it is at least 1; (4) it equals 1 only for the exact proposal r = π; (5) its gradient in a proposal parameter is an expectation of the same importance ratio (HasDerivAt); (6) for score-shaped proposals each log-sum-exp term of the log cost is midpoint-convex; and (7) N ≥ (Σπ²/r)F²/ε² samples give variance ≤ ε². The Law's full claim, that co-training drives every predictable head to O(1) cost, is a statement about neural training dynamics and is not provable in Lean; this is the strongest formal form, and the empirical claim stays a conjecture.

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

More proved statements