proofs
Provedunbiased-attentionproposalgqareview-response

Cost-aware proposal optimum: (Σ r_j c_j)(Σ A_j/r_j) ≥ (Σ √(A_j c_j))², attained by r_j ∝ √(A_j/c_j)

For all J∈Type⁡\htmlData{mx=1}{J \in \htmlData{mx=0}{\operatorname{Type}}} and A,c,r:J→R\htmlData{mx=3}{A, c, r : \htmlData{mx=0}{J} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, if ∀j, 0≤A(j)\htmlData{mx=4}{\forall j,\ 0 \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{\htmlData{mx=0}{A}(\htmlData{mx=1}{j})}}, ∀j, 0<c(j)\htmlData{mx=4}{\forall j,\ 0 \mathrel{\htmlData{mx=3}{<}} \htmlData{mx=2}{\htmlData{mx=0}{c}(\htmlData{mx=1}{j})}} and ∀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})}} (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

(∑jA(j)⋅c(j))2≤(∑jr(j)⋅c(j))⋅∑jA(j)r(j)∧((∀j, 0<A(j))  ⟹  (∑jA(j)c(j)∑kA(k)c(k)⋅c(j))⋅∑jA(j)A(j)c(j)∑kA(k)c(k)=(∑jA(j)⋅c(j))2)\begin{aligned} & \htmlData{mx=11}{\left(\htmlData{mx=10}{\sum_{j} \htmlData{mx=9}{\sqrt{\htmlData{mx=8}{\htmlData{mx=4}{\htmlData{mx=2}{A}(\htmlData{mx=3}{j})} \cdot \htmlData{mx=7}{\htmlData{mx=5}{c}(\htmlData{mx=6}{j})}}}}}\right)^{2}} \\ & \quad \htmlData{mx=1}{\leq} \htmlData{mx=28}{\left(\htmlData{mx=19}{\sum_{j} \htmlData{mx=18}{\htmlData{mx=14}{\htmlData{mx=12}{r}(\htmlData{mx=13}{j})} \cdot \htmlData{mx=17}{\htmlData{mx=15}{c}(\htmlData{mx=16}{j})}}}\right) \cdot \htmlData{mx=27}{\sum_{j} \htmlData{mx=26}{\frac{\htmlData{mx=22}{\htmlData{mx=20}{A}(\htmlData{mx=21}{j})}}{\htmlData{mx=25}{\htmlData{mx=23}{r}(\htmlData{mx=24}{j})}}}}} \\ & \htmlData{mx=0}{\land} \left(\right. (\htmlData{mx=34}{\forall j,\ 0 \mathrel{\htmlData{mx=33}{<}} \htmlData{mx=32}{\htmlData{mx=30}{A}(\htmlData{mx=31}{j})}}) \\ & \htmlData{mx=29}{\implies} \htmlData{mx=82}{\left(\htmlData{mx=58}{\sum_{j} \htmlData{mx=57}{\htmlData{mx=53}{\frac{\htmlData{mx=43}{\sqrt{\htmlData{mx=42}{\frac{\htmlData{mx=38}{\htmlData{mx=36}{A}(\htmlData{mx=37}{j})}}{\htmlData{mx=41}{\htmlData{mx=39}{c}(\htmlData{mx=40}{j})}}}}}}{\htmlData{mx=52}{\sum_{k} \htmlData{mx=51}{\sqrt{\htmlData{mx=50}{\frac{\htmlData{mx=46}{\htmlData{mx=44}{A}(\htmlData{mx=45}{k})}}{\htmlData{mx=49}{\htmlData{mx=47}{c}(\htmlData{mx=48}{k})}}}}}}}} \cdot \htmlData{mx=56}{\htmlData{mx=54}{c}(\htmlData{mx=55}{j})}}}\right) \cdot \htmlData{mx=81}{\sum_{j} \htmlData{mx=80}{\frac{\htmlData{mx=61}{\htmlData{mx=59}{A}(\htmlData{mx=60}{j})}}{\htmlData{mx=79}{\frac{\htmlData{mx=69}{\sqrt{\htmlData{mx=68}{\frac{\htmlData{mx=64}{\htmlData{mx=62}{A}(\htmlData{mx=63}{j})}}{\htmlData{mx=67}{\htmlData{mx=65}{c}(\htmlData{mx=66}{j})}}}}}}{\htmlData{mx=78}{\sum_{k} \htmlData{mx=77}{\sqrt{\htmlData{mx=76}{\frac{\htmlData{mx=72}{\htmlData{mx=70}{A}(\htmlData{mx=71}{k})}}{\htmlData{mx=75}{\htmlData{mx=73}{c}(\htmlData{mx=74}{k})}}}}}}}}}}}} \\ & \quad \htmlData{mx=35}{=} \htmlData{mx=92}{\left(\htmlData{mx=91}{\sum_{j} \htmlData{mx=90}{\sqrt{\htmlData{mx=89}{\htmlData{mx=85}{\htmlData{mx=83}{A}(\htmlData{mx=84}{j})} \cdot \htmlData{mx=88}{\htmlData{mx=86}{c}(\htmlData{mx=87}{j})}}}}}\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)
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
A, c, r range over J → ℝ: the statement must hold for every choice. ((A c r : J → ℝ))
∀For all
The statement after the comma holds for every j. (∀ j, 0 ≤ A j)
aᵇPower
∑ j, √(A(j) · c(j)) raised to the power 2. ((∑ j, Real.sqrt (A j * c j)) ^ 2)
∧And
Both hold: (∑ j, √(A(j) · c(j)))^2 ≤ (∑ j, r(j) · c(j)) · (∑ j, A(j)/…, and (∀ j, 0 < A(j)) → (∑ j, √(A(j)/c(j))/(∑ k, √(A(k)/c(k))) ·…. ((∑ j, Real.sqrt (A j * c j)) ^ 2 ≤ (∑ j…)
∑Summation
Add up √(A(j) · c(j)) for every j. (∑ j, Real.sqrt (A j * c j))
RReal numbers
The real numbers: every point on the number line. (ℝ)
≤At most
0 is less than or equal to A(j). (0 ≤ A j)
<Less than
0 is strictly smaller than c(j). (0 < c j)
√Square root
The non-negative number whose square is A(j) · c(j). (Real.sqrt (A j * c j))
·Multiplication
A(j) times c(j). (A j * c j)
a/bDivision
A(j) divided by r(j). In Lean, dividing by 0 gives 0. (A j / r j)
=Equality
(∑ j, √(A(j)/c(j))/(∑ k, √(A(k)/c(k))) · c(j)) · (∑ j, A(j… and (∑ j, √(A(j) · c(j)))^2 are the same. ((∑ j, (Real.sqrt (A j / c j) / ∑ k, Rea…)

Expected per-sample access cost times the importance-sampling second moment, with residual mass A_j = π_j²‖v_j − g_j‖² (or Σ_h λ_h π_hj²‖e_hj‖² for a shared GQA proposal) and per-item cost c_j. Cauchy–Schwarz gives the lower bound and r ∝ √(A/c) attains it when all A_j > 0. Generalises gs-shared-proposal-lower-bound/attained (A_j = Σ_h π_hj², c ≡ 1). Classical in importance sampling; formalised after an external review (2026-10-05) proposed value- and cost-aware proposals.

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

More proved statements