proofs
Provedconversion-theoremrandomized-conversionheadline-theoremattention-compute-law

Randomized Conversion Theorem, end-to-end: a coin-dependent ε-oracle failing w.p. ≤ q per node induces a proposal with E[Σπ²/r] ≤ (1+2ε)^L + L·2^L·q·((1+2ε)/ε)^L

For all L∈N\htmlData{mx=1}{L \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}}}, π:(Fin⁡ L→Bool⁡)→R\htmlData{mx=7}{\pi : (\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{L}} \mathrel{\htmlData{mx=4}{\to}} \htmlData{mx=3}{\operatorname{Bool}}) \mathrel{\htmlData{mx=6}{\to}} \htmlData{mx=5}{\mathbb{R}}}, ε,q∈R\htmlData{mx=1}{\varepsilon, q \in \htmlData{mx=0}{\mathbb{R}}}, m:N→(Fin⁡ L→Bool⁡)→R\htmlData{mx=9}{m : \htmlData{mx=0}{\mathbb{N}} \mathrel{\htmlData{mx=8}{\to}} (\htmlData{mx=3}{\htmlData{mx=1}{\operatorname{Fin}}\,\htmlData{mx=2}{L}} \mathrel{\htmlData{mx=5}{\to}} \htmlData{mx=4}{\operatorname{Bool}}) \mathrel{\htmlData{mx=7}{\to}} \htmlData{mx=6}{\mathbb{R}}}, phat:Ω→N→(Fin⁡ L→Bool⁡)→R\htmlData{mx=11}{\mathit{phat} : \htmlData{mx=0}{\Omega} \mathrel{\htmlData{mx=10}{\to}} \htmlData{mx=1}{\mathbb{N}} \mathrel{\htmlData{mx=9}{\to}} (\htmlData{mx=4}{\htmlData{mx=2}{\operatorname{Fin}}\,\htmlData{mx=3}{L}} \mathrel{\htmlData{mx=6}{\to}} \htmlData{mx=5}{\operatorname{Bool}}) \mathrel{\htmlData{mx=8}{\to}} \htmlData{mx=7}{\mathbb{R}}}, pt,Q:Ω→N→(Fin⁡ L→Bool⁡)→R\htmlData{mx=11}{\mathit{pt}, Q : \htmlData{mx=0}{\Omega} \mathrel{\htmlData{mx=10}{\to}} \htmlData{mx=1}{\mathbb{N}} \mathrel{\htmlData{mx=9}{\to}} (\htmlData{mx=4}{\htmlData{mx=2}{\operatorname{Fin}}\,\htmlData{mx=3}{L}} \mathrel{\htmlData{mx=6}{\to}} \htmlData{mx=5}{\operatorname{Bool}}) \mathrel{\htmlData{mx=8}{\to}} \htmlData{mx=7}{\mathbb{R}}} and hQ∈∀ω,ℓ,b, Q(ω,ℓ,b)={:(ℓ)<Lif hthen⁡({pt(ω,ℓ,b)if b(⟨ℓ,h⟩)1−pt(ω,ℓ,b)otherwise)otherwise else 1\htmlData{mx=33}{\mathit{hQ} \in \htmlData{mx=32}{\htmlData{mx=31}{\forall \omega, \ell, b,\ \htmlData{mx=4}{\htmlData{mx=0}{Q}(\htmlData{mx=1}{\omega}, \htmlData{mx=2}{\ell}, \htmlData{mx=3}{b})} \mathrel{\htmlData{mx=30}{=}} \htmlData{mx=29}{\begin{cases} \htmlData{mx=6}{\mathtt{:}(\htmlData{mx=5}{\ell})} \mathrel{\htmlData{mx=8}{<}} \htmlData{mx=7}{L} & \text{if } \htmlData{mx=9}{h} \\ \htmlData{mx=28}{\htmlData{mx=10}{\operatorname{then}}\left(\htmlData{mx=27}{\begin{cases} \htmlData{mx=15}{\htmlData{mx=11}{\mathit{pt}}(\htmlData{mx=12}{\omega}, \htmlData{mx=13}{\ell}, \htmlData{mx=14}{b})} & \text{if } \htmlData{mx=20}{\htmlData{mx=16}{b}(\htmlData{mx=19}{\left\langle \htmlData{mx=17}{\ell}, \htmlData{mx=18}{h} \right\rangle})} \\ \htmlData{mx=26}{1 - \htmlData{mx=25}{\htmlData{mx=21}{\mathit{pt}}(\htmlData{mx=22}{\omega}, \htmlData{mx=23}{\ell}, \htmlData{mx=24}{b})}} & \text{otherwise} \end{cases}}\right)} & \text{otherwise} \end{cases}}}\,\mathtt{else\ 1}}}, 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, ∀b, 0≤π(b)\htmlData{mx=4}{\forall b,\ 0 \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{\htmlData{mx=0}{\pi}(\htmlData{mx=1}{b})}}, ∑bπ(b)=1\htmlData{mx=3}{\sum_{b} \htmlData{mx=2}{\htmlData{mx=0}{\pi}(\htmlData{mx=1}{b})}} \mathrel{\htmlData{mx=4}{=}} 1, 0<ε0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{\varepsilon}, ∀ℓ,b, m(ℓ,b)=∑b′:Fin⁡ L→Bool⁡({π(b′)if (∀i:Fin⁡ L, i<ℓ  ⟹  b′(i)=b(i))0otherwise)\htmlData{mx=31}{\forall \ell, b,\ \htmlData{mx=3}{\htmlData{mx=0}{m}(\htmlData{mx=1}{\ell}, \htmlData{mx=2}{b})} \mathrel{\htmlData{mx=30}{=}} \htmlData{mx=29}{\sum_{b' : \htmlData{mx=6}{\htmlData{mx=4}{\operatorname{Fin}}\,\htmlData{mx=5}{L}} \mathrel{\htmlData{mx=8}{\to}} \htmlData{mx=7}{\operatorname{Bool}}} \left(\htmlData{mx=28}{\begin{cases} \htmlData{mx=11}{\htmlData{mx=9}{\pi}(\htmlData{mx=10}{b'})} & \text{if } (\htmlData{mx=27}{\forall i : \htmlData{mx=26}{\htmlData{mx=24}{\operatorname{Fin}}\,\htmlData{mx=25}{L}},\ \htmlData{mx=13}{\htmlData{mx=12}{i}} \mathrel{\htmlData{mx=15}{<}} \htmlData{mx=14}{\ell} \mathrel{\htmlData{mx=23}{\implies}} \htmlData{mx=18}{\htmlData{mx=16}{b'}(\htmlData{mx=17}{i})} \mathrel{\htmlData{mx=22}{=}} \htmlData{mx=21}{\htmlData{mx=19}{b}(\htmlData{mx=20}{i})}}) \\ 0 & \text{otherwise} \end{cases}}\right)}}, ∀ω,ℓ, b,b′:Fin⁡ L→Bool⁡, (∀i:Fin⁡ L, i<ℓ  ⟹  b(i)=b′(i))  ⟹  phat(ω,ℓ,b)=phat(ω,ℓ,b′)\htmlData{mx=33}{\forall \omega, \ell,\ b, b' : \htmlData{mx=30}{\htmlData{mx=28}{\operatorname{Fin}}\,\htmlData{mx=29}{L}} \mathrel{\htmlData{mx=32}{\to}} \htmlData{mx=31}{\operatorname{Bool}},\ (\htmlData{mx=15}{\forall i : \htmlData{mx=14}{\htmlData{mx=12}{\operatorname{Fin}}\,\htmlData{mx=13}{L}},\ \htmlData{mx=1}{\htmlData{mx=0}{i}} \mathrel{\htmlData{mx=3}{<}} \htmlData{mx=2}{\ell} \mathrel{\htmlData{mx=11}{\implies}} \htmlData{mx=6}{\htmlData{mx=4}{b}(\htmlData{mx=5}{i})} \mathrel{\htmlData{mx=10}{=}} \htmlData{mx=9}{\htmlData{mx=7}{b'}(\htmlData{mx=8}{i})}}) \mathrel{\htmlData{mx=27}{\implies}} \htmlData{mx=20}{\htmlData{mx=16}{\mathit{phat}}(\htmlData{mx=17}{\omega}, \htmlData{mx=18}{\ell}, \htmlData{mx=19}{b})} \mathrel{\htmlData{mx=26}{=}} \htmlData{mx=25}{\htmlData{mx=21}{\mathit{phat}}(\htmlData{mx=22}{\omega}, \htmlData{mx=23}{\ell}, \htmlData{mx=24}{b'})}}, ∀ℓ, h:ℓ<L, b:Fin⁡ L→Bool⁡, ∑ω∈filter⁡(ω↦0<m(ℓ,b)∧ε<∣phat(ω,ℓ,b)−m(ℓ+1,update⁡(b,⟨ℓ,h⟩,true⁡))m(ℓ,b)∣)w(ω)≤q\htmlData{mx=48}{\forall \ell,\ h : \htmlData{mx=40}{\ell} \mathrel{\htmlData{mx=42}{<}} \htmlData{mx=41}{L},\ b : \htmlData{mx=45}{\htmlData{mx=43}{\operatorname{Fin}}\,\htmlData{mx=44}{L}} \mathrel{\htmlData{mx=47}{\to}} \htmlData{mx=46}{\operatorname{Bool}},\ \htmlData{mx=37}{\sum_{\omega \in \htmlData{mx=33}{\htmlData{mx=0}{\operatorname{filter}}\left(\htmlData{mx=32}{\omega \mapsto 0 \mathrel{\htmlData{mx=5}{<}} \htmlData{mx=4}{\htmlData{mx=1}{m}(\htmlData{mx=2}{\ell}, \htmlData{mx=3}{b})} \mathbin{\htmlData{mx=31}{\land}} \htmlData{mx=6}{\varepsilon} \mathrel{\htmlData{mx=30}{<}} \htmlData{mx=29}{\left\lvert \htmlData{mx=28}{\htmlData{mx=11}{\htmlData{mx=7}{\mathit{phat}}(\htmlData{mx=8}{\omega}, \htmlData{mx=9}{\ell}, \htmlData{mx=10}{b})} - \htmlData{mx=27}{\frac{\htmlData{mx=22}{\htmlData{mx=12}{m}(\htmlData{mx=14}{\htmlData{mx=13}{\ell} + 1}, \htmlData{mx=21}{\htmlData{mx=15}{\operatorname{update}}(\htmlData{mx=16}{b}, \htmlData{mx=19}{\left\langle \htmlData{mx=17}{\ell}, \htmlData{mx=18}{h} \right\rangle}, \htmlData{mx=20}{\operatorname{true}})})}}{\htmlData{mx=26}{\htmlData{mx=23}{m}(\htmlData{mx=24}{\ell}, \htmlData{mx=25}{b})}}}} \right\rvert}}\right)}} \htmlData{mx=36}{\htmlData{mx=34}{w}(\htmlData{mx=35}{\omega})}} \mathrel{\htmlData{mx=39}{\leq}} \htmlData{mx=38}{q}} and ∀ω,ℓ,b, pt(ω,ℓ,b)=max⁡(0,min⁡(1,phat(ω,ℓ,b)))+ε1+2ε\htmlData{mx=19}{\forall \omega, \ell, b,\ \htmlData{mx=4}{\htmlData{mx=0}{\mathit{pt}}(\htmlData{mx=1}{\omega}, \htmlData{mx=2}{\ell}, \htmlData{mx=3}{b})} \mathrel{\htmlData{mx=18}{=}} \htmlData{mx=17}{\frac{\htmlData{mx=13}{\htmlData{mx=11}{\max(0, \htmlData{mx=10}{\min(1, \htmlData{mx=9}{\htmlData{mx=5}{\mathit{phat}}(\htmlData{mx=6}{\omega}, \htmlData{mx=7}{\ell}, \htmlData{mx=8}{b})})})} + \htmlData{mx=12}{\varepsilon}}}{\htmlData{mx=16}{1 + \htmlData{mx=15}{2\htmlData{mx=14}{\varepsilon}}}}}} (given Fintype⁡ Ω\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fintype}}\,\htmlData{mx=1}{\Omega}}), then

∑ωw(ω)⋅∑b:Fin⁡ L→Bool⁡π(b)2∏ℓ=0L−1Q(ω,ℓ,b)≤(1+2ε)L+L⋅2L⋅q⋅(1+2εε)L\begin{aligned} & \htmlData{mx=23}{\sum_{\omega} \htmlData{mx=22}{\htmlData{mx=3}{\htmlData{mx=1}{w}(\htmlData{mx=2}{\omega})} \cdot \htmlData{mx=21}{\sum_{b : \htmlData{mx=6}{\htmlData{mx=4}{\operatorname{Fin}}\,\htmlData{mx=5}{L}} \mathrel{\htmlData{mx=8}{\to}} \htmlData{mx=7}{\operatorname{Bool}}} \htmlData{mx=20}{\frac{\htmlData{mx=12}{\htmlData{mx=11}{\htmlData{mx=9}{\pi}(\htmlData{mx=10}{b})}^{2}}}{\htmlData{mx=19}{\prod_{\ell=0}^{\htmlData{mx=13}{L} - 1} \htmlData{mx=18}{\htmlData{mx=14}{Q}(\htmlData{mx=15}{\omega}, \htmlData{mx=16}{\ell}, \htmlData{mx=17}{b})}}}}}}} \\ & \quad \htmlData{mx=0}{\leq} \htmlData{mx=44}{\htmlData{mx=28}{(\htmlData{mx=26}{1 + \htmlData{mx=25}{2\htmlData{mx=24}{\varepsilon}}})^{\htmlData{mx=27}{L}}} + \htmlData{mx=43}{\htmlData{mx=35}{\htmlData{mx=33}{\htmlData{mx=30}{\htmlData{mx=29}{L}} \cdot \htmlData{mx=32}{2^{\htmlData{mx=31}{L}}}} \cdot \htmlData{mx=34}{q}} \cdot \htmlData{mx=42}{\left(\htmlData{mx=40}{\frac{\htmlData{mx=38}{1 + \htmlData{mx=37}{2\htmlData{mx=36}{\varepsilon}}}}{\htmlData{mx=39}{\varepsilon}}}\right)^{\htmlData{mx=41}{L}}}}} \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. (ℕ)
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)
x ∈ TVariables
ε, q range over real numbers: the statement must hold for every choice. ((ε q : ℝ))
<Less than
0 is strictly smaller than ε. (0 < ε)
x : TVariables
pt, Q range over Ω → ℕ → (Fin L → Bool) → ℝ: the statement must hold for every choice. ((pt Q : Ω → ℕ → (Fin L → Bool) → ℝ))
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)
RReal numbers
The real numbers: every point on the number line. (ℝ)
≤At most
0 is less than or equal to w(ω). (0 ≤ w ω)
Bool
Bool: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Bool)
πPi
The ratio of a circle's circumference to its diameter, ≈ 3.14159. (π)
maxMaximum
The larger of 0 and min(1, phat(ω, ℓ, b)). (max 0 (min 1 (phat ω ℓ b)))
minMinimum
The smaller of 1 and phat(ω, ℓ, b). (min 1 (phat ω ℓ b))
aᵇPower
π(b) raised to the power 2. (π b ^ 2)
then
then: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (then)
{ a if c; b otherwiseCases (if … then … else)
π(b') when ∀ i, i < ℓ → b'(i) = b(i), and 0 otherwise. (if (∀ i : Fin L, (i : ℕ) < ℓ → b' i = b…)
∏Product
Multiply together Q(ω, ℓ, b) for ℓ = 0, 1, …, L − 1. (∏ ℓ ∈ Finset.range L, Q ω ℓ b)
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 : T)As natural numbers
i read as an element of natural numbers. Mathematicians leave this implicit; Lean needs it to know which kind of number is meant. ((i : ℕ))
·Multiplication
2 times ε. (2 * ε)
x ↦ f(x)Function (λ-abstraction)
The function sending ω to 0 < m(ℓ, b) ∧ ε < |phat(ω, ℓ, b) − m(ℓ + 1, update(b, ⟨ℓ, …. Lean writes fun x => …; papers write x ↦ …. (fun ω => 0 < m ℓ b ∧ ε < |phat ω ℓ b - …)
∧And
Both hold: 0 < m(ℓ, b), and ε < |phat(ω, ℓ, b) − m(ℓ + 1, update(b, ⟨ℓ, h⟩, true))/m(ℓ…. (0 < m ℓ b ∧ ε < |phat ω ℓ b - m (ℓ + 1)…)
|x|Absolute value
The size of phat(ω, ℓ, b) − m(ℓ + 1, update(b, ⟨ℓ, h⟩, true))/m(ℓ, b) without its sign. (|phat ω ℓ b - m (ℓ + 1) (Function.updat…)
-Subtraction
phat(ω, ℓ, b) minus m(ℓ + 1, update(b, ⟨ℓ, h⟩, true))/m(ℓ, b). On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (phat ω ℓ b - m (ℓ + 1) (Function.update…)
(x : T)As real numbers
L read as an element of real numbers. Mathematicians leave this implicit; Lean needs it to know which kind of number is meant. ((L : ℝ))
a/bDivision
m(ℓ + 1, update(b, ⟨ℓ, h⟩, true)) divided by m(ℓ, b). In Lean, dividing by 0 gives 0. (m (ℓ + 1) (Function.update b ⟨ℓ, h⟩ tru…)
+Addition
ℓ plus 1. (ℓ + 1)
update
Function.update: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Function.update)
⟨a, b⟩Anonymous constructor
Builds a structure (a pair, a subtype element, …) from ℓ, h. (⟨ℓ, h⟩)
true
true: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (true)

End-to-end form of the Attention Compute Law's crux for randomized algorithms, in one statement. Coins ω carry weights w; the oracle estimate phat(ω, ℓ, b) depends only on the node (prefix) and, for each node, differs from the true conditional mass by more than ε with probability at most q. The smoothed descent proposal r_ω(b) = Π_ℓ Q_ω(ℓ, b) then satisfies E_ω[Σ_b π_b²/r_ω(b)] ≤ (1+2ε)^L + L·2^L·q·((1+2ε)/ε)^L. Inside the proof: the deterministic Conversion Theorem (cv-conversion-theorem, embedded) bounds the good event; the smoothing floor (every factor ≥ ε/(1+2ε)) bounds every outcome; and a union bound over the L·2^L (level, leaf) indices bounds the bad mass. With q ≤ (7/8)^k from median-of-means boosting (rc-average-chebyshev, ua-majority-vote-amplification), k = O(L log(L+2)) runs per node make the second term O(1); composing the boosting layer into this statement is the remaining step.

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

More proved statements