proofs
Provedquery-cover-lawdecode-attentionsoftmaxkv-cache

Bucketed tilt proposal along a direction u: bucket b w.p. ∝ W_b e^{a z_b}, then j ∝ π₀ inside ⇒ P(j) ∝ π₀(j) e^{a z_{b(j)}}

For all n,B∈N\htmlData{mx=1}{n, B \in \htmlData{mx=0}{\mathbb{N}}}, bk:Fin⁡ n→Fin⁡ B\htmlData{mx=7}{\mathit{bk} : \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{n}} \mathrel{\htmlData{mx=6}{\to}} \htmlData{mx=5}{\htmlData{mx=3}{\operatorname{Fin}}\,\htmlData{mx=4}{B}}}, π0:Fin⁡ n→R\htmlData{mx=5}{\pi_{0} : \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{n}} \mathrel{\htmlData{mx=4}{\to}} \htmlData{mx=3}{\mathbb{R}}}, zc:Fin⁡ B→R\htmlData{mx=5}{\mathit{zc} : \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{B}} \mathrel{\htmlData{mx=4}{\to}} \htmlData{mx=3}{\mathbb{R}}}, a∈R\htmlData{mx=1}{a \in \htmlData{mx=0}{\mathbb{R}}} and j∈Fin⁡ n\htmlData{mx=3}{j \in \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{n}}}, if ∀i, 0<π0(i)\htmlData{mx=4}{\forall i,\ 0 \mathrel{\htmlData{mx=3}{<}} \htmlData{mx=2}{\htmlData{mx=0}{\pi_{0}}(\htmlData{mx=1}{i})}}, then

(∑i∈filter⁡(i↦bk(i)=bk(j))π0(i))⋅ea⋅zc(bk(j))∑b(∑i∈filter⁡(i↦bk(i)=b)π0(i))⋅ea⋅zc(b)⋅(π0(j)∑i∈filter⁡(i↦bk(i)=bk(j))π0(i))=π0(j)⋅ea⋅zc(bk(j))∑iπ0(i)⋅ea⋅zc(bk(i))\begin{aligned} & \htmlData{mx=63}{\htmlData{mx=44}{\frac{\htmlData{mx=23}{\left(\htmlData{mx=14}{\sum_{i \in \htmlData{mx=10}{\htmlData{mx=1}{\operatorname{filter}}(\htmlData{mx=9}{i \mapsto \htmlData{mx=4}{\htmlData{mx=2}{\mathit{bk}}(\htmlData{mx=3}{i})} \mathrel{\htmlData{mx=8}{=}} \htmlData{mx=7}{\htmlData{mx=5}{\mathit{bk}}(\htmlData{mx=6}{j})}})}} \htmlData{mx=13}{\htmlData{mx=11}{\pi_{0}}(\htmlData{mx=12}{i})}}\right) \cdot \htmlData{mx=22}{e^{\htmlData{mx=21}{\htmlData{mx=15}{a} \cdot \htmlData{mx=20}{\htmlData{mx=16}{\mathit{zc}}(\htmlData{mx=19}{\htmlData{mx=17}{\mathit{bk}}(\htmlData{mx=18}{j})})}}}}}}{\htmlData{mx=43}{\sum_{b} \htmlData{mx=42}{\left(\htmlData{mx=35}{\sum_{i \in \htmlData{mx=31}{\htmlData{mx=24}{\operatorname{filter}}(\htmlData{mx=30}{i \mapsto \htmlData{mx=27}{\htmlData{mx=25}{\mathit{bk}}(\htmlData{mx=26}{i})} \mathrel{\htmlData{mx=29}{=}} \htmlData{mx=28}{b}})}} \htmlData{mx=34}{\htmlData{mx=32}{\pi_{0}}(\htmlData{mx=33}{i})}}\right) \cdot \htmlData{mx=41}{e^{\htmlData{mx=40}{\htmlData{mx=36}{a} \cdot \htmlData{mx=39}{\htmlData{mx=37}{\mathit{zc}}(\htmlData{mx=38}{b})}}}}}}}} \cdot \left(\htmlData{mx=62}{\frac{\htmlData{mx=47}{\htmlData{mx=45}{\pi_{0}}(\htmlData{mx=46}{j})}}{\htmlData{mx=61}{\sum_{i \in \htmlData{mx=57}{\htmlData{mx=48}{\operatorname{filter}}(\htmlData{mx=56}{i \mapsto \htmlData{mx=51}{\htmlData{mx=49}{\mathit{bk}}(\htmlData{mx=50}{i})} \mathrel{\htmlData{mx=55}{=}} \htmlData{mx=54}{\htmlData{mx=52}{\mathit{bk}}(\htmlData{mx=53}{j})}})}} \htmlData{mx=60}{\htmlData{mx=58}{\pi_{0}}(\htmlData{mx=59}{i})}}}}\right)} \\ & \quad \htmlData{mx=0}{=} \htmlData{mx=89}{\frac{\htmlData{mx=75}{\htmlData{mx=66}{\htmlData{mx=64}{\pi_{0}}(\htmlData{mx=65}{j})} \cdot \htmlData{mx=74}{e^{\htmlData{mx=73}{\htmlData{mx=67}{a} \cdot \htmlData{mx=72}{\htmlData{mx=68}{\mathit{zc}}(\htmlData{mx=71}{\htmlData{mx=69}{\mathit{bk}}(\htmlData{mx=70}{j})})}}}}}}{\htmlData{mx=88}{\sum_{i} \htmlData{mx=87}{\htmlData{mx=78}{\htmlData{mx=76}{\pi_{0}}(\htmlData{mx=77}{i})} \cdot \htmlData{mx=86}{e^{\htmlData{mx=85}{\htmlData{mx=79}{a} \cdot \htmlData{mx=84}{\htmlData{mx=80}{\mathit{zc}}(\htmlData{mx=83}{\htmlData{mx=81}{\mathit{bk}}(\htmlData{mx=82}{i})})}}}}}}}} \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, B range over natural numbers: the statement must hold for every choice. ((n B : ℕ))
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 Fin(B). (Between types, A → B is the type of functions from A to B.) (Fin n → Fin B)
∀For all
The statement after the comma holds for every i. (∀ i, 0 < π0 i)
a/bDivision
(∑ i, π0(i)) · exp(a · zc(bk(j))) divided by ∑ b, (∑ i, π0(i)) · exp(a · zc(b)). In Lean, dividing by 0 gives 0. ((∑ i ∈ Finset.univ.filter (fun i => bk …)
∑Summation
Add up π0(i) for each i in filter(i ↦ bk(i) = bk(j)). (∑ i ∈ Finset.univ.filter (fun i => bk i…)
<Less than
0 is strictly smaller than π0(i). (0 < π0 i)
RReal numbers
The real numbers: every point on the number line. (ℝ)
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 i to bk(i) = bk(j). Lean writes fun x => …; papers write x ↦ …. (fun i => bk i = bk j)
=Equality
bk(i) and bk(j) are the same. (bk i = bk j)
eˣExponential function
e raised to the power a · zc(bk(j)), where e ≈ 2.718. (Real.exp (a * zc (bk j)))
·Multiplication
a times zc(bk(j)). (a * zc (bk j))

Counterexample to the Query-Cover lower bound: for a rank-1 decode trajectory q_t = q₀ + a_t u, precompute z_j = ⟨u, k_j⟩ once and bucket keys by z. Each query then gets a proposal in O(#buckets) time that is a snapshot-tilt with log-ratio ≤ A·w to the true row, so rejection gives exact samples without any new full pass. Part of 'The Query-Cover Law: decode attention cost is set by where the queries go, not by how long the context is'.

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

More proved statements