proofs
Provedvariational-cost-lawproposalheadline-theoremfirst-principles

Variational cost law: over proposals r, (Σ_j √(E[a_j] c_j))² ≤ (Σ_j r_j c_j)·E[Σ_j a_j/r_j], attained by r_j ∝ √(E[a_j]/c_j)

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

(∑j(∑ilam(i)⋅a(i,j))⋅c(j))2≤(∑jr(j)⋅c(j))⋅∑ilam(i)⋅∑ja(i,j)r(j)∧((∀j, 0<∑ilam(i)⋅a(i,j))  ⟹  (∑j∑ilam(i)⋅a(i,j)c(j)∑k∑ilam(i)⋅a(i,k)c(k)⋅c(j))⋅∑ilam(i)⋅∑ja(i,j)∑ilam(i)⋅a(i,j)c(j)∑k∑ilam(i)⋅a(i,k)c(k)=(∑j(∑ilam(i)⋅a(i,j))⋅c(j))2)\begin{aligned} & \htmlData{mx=17}{\left(\htmlData{mx=16}{\sum_{j} \htmlData{mx=15}{\sqrt{\htmlData{mx=14}{\left(\htmlData{mx=10}{\sum_{i} \htmlData{mx=9}{\htmlData{mx=4}{\htmlData{mx=2}{\mathit{lam}}(\htmlData{mx=3}{i})} \cdot \htmlData{mx=8}{\htmlData{mx=5}{a}(\htmlData{mx=6}{i}, \htmlData{mx=7}{j})}}}\right) \cdot \htmlData{mx=13}{\htmlData{mx=11}{c}(\htmlData{mx=12}{j})}}}}}\right)^{2}} \\ & \quad \htmlData{mx=1}{\leq} \htmlData{mx=40}{\left(\htmlData{mx=25}{\sum_{j} \htmlData{mx=24}{\htmlData{mx=20}{\htmlData{mx=18}{r}(\htmlData{mx=19}{j})} \cdot \htmlData{mx=23}{\htmlData{mx=21}{c}(\htmlData{mx=22}{j})}}}\right) \cdot \htmlData{mx=39}{\sum_{i} \htmlData{mx=38}{\htmlData{mx=28}{\htmlData{mx=26}{\mathit{lam}}(\htmlData{mx=27}{i})} \cdot \htmlData{mx=37}{\sum_{j} \htmlData{mx=36}{\frac{\htmlData{mx=32}{\htmlData{mx=29}{a}(\htmlData{mx=30}{i}, \htmlData{mx=31}{j})}}{\htmlData{mx=35}{\htmlData{mx=33}{r}(\htmlData{mx=34}{j})}}}}}}} \\ & \htmlData{mx=0}{\land} \left(\right. \left(\htmlData{mx=52}{\forall j,\ 0 \mathrel{\htmlData{mx=51}{<}} \htmlData{mx=50}{\sum_{i} \htmlData{mx=49}{\htmlData{mx=44}{\htmlData{mx=42}{\mathit{lam}}(\htmlData{mx=43}{i})} \cdot \htmlData{mx=48}{\htmlData{mx=45}{a}(\htmlData{mx=46}{i}, \htmlData{mx=47}{j})}}}}\right) \\ & \htmlData{mx=41}{\implies} \htmlData{mx=130}{\left(\htmlData{mx=88}{\sum_{j} \htmlData{mx=87}{\htmlData{mx=83}{\frac{\htmlData{mx=67}{\sqrt{\htmlData{mx=66}{\frac{\htmlData{mx=62}{\sum_{i} \htmlData{mx=61}{\htmlData{mx=56}{\htmlData{mx=54}{\mathit{lam}}(\htmlData{mx=55}{i})} \cdot \htmlData{mx=60}{\htmlData{mx=57}{a}(\htmlData{mx=58}{i}, \htmlData{mx=59}{j})}}}}{\htmlData{mx=65}{\htmlData{mx=63}{c}(\htmlData{mx=64}{j})}}}}}}{\htmlData{mx=82}{\sum_{k} \htmlData{mx=81}{\sqrt{\htmlData{mx=80}{\frac{\htmlData{mx=76}{\sum_{i} \htmlData{mx=75}{\htmlData{mx=70}{\htmlData{mx=68}{\mathit{lam}}(\htmlData{mx=69}{i})} \cdot \htmlData{mx=74}{\htmlData{mx=71}{a}(\htmlData{mx=72}{i}, \htmlData{mx=73}{k})}}}}{\htmlData{mx=79}{\htmlData{mx=77}{c}(\htmlData{mx=78}{k})}}}}}}}} \cdot \htmlData{mx=86}{\htmlData{mx=84}{c}(\htmlData{mx=85}{j})}}}\right) \cdot \htmlData{mx=129}{\sum_{i} \htmlData{mx=128}{\htmlData{mx=91}{\htmlData{mx=89}{\mathit{lam}}(\htmlData{mx=90}{i})} \cdot \htmlData{mx=127}{\sum_{j} \htmlData{mx=126}{\frac{\htmlData{mx=95}{\htmlData{mx=92}{a}(\htmlData{mx=93}{i}, \htmlData{mx=94}{j})}}{\htmlData{mx=125}{\frac{\htmlData{mx=109}{\sqrt{\htmlData{mx=108}{\frac{\htmlData{mx=104}{\sum_{i} \htmlData{mx=103}{\htmlData{mx=98}{\htmlData{mx=96}{\mathit{lam}}(\htmlData{mx=97}{i})} \cdot \htmlData{mx=102}{\htmlData{mx=99}{a}(\htmlData{mx=100}{i}, \htmlData{mx=101}{j})}}}}{\htmlData{mx=107}{\htmlData{mx=105}{c}(\htmlData{mx=106}{j})}}}}}}{\htmlData{mx=124}{\sum_{k} \htmlData{mx=123}{\sqrt{\htmlData{mx=122}{\frac{\htmlData{mx=118}{\sum_{i} \htmlData{mx=117}{\htmlData{mx=112}{\htmlData{mx=110}{\mathit{lam}}(\htmlData{mx=111}{i})} \cdot \htmlData{mx=116}{\htmlData{mx=113}{a}(\htmlData{mx=114}{i}, \htmlData{mx=115}{k})}}}}{\htmlData{mx=121}{\htmlData{mx=119}{c}(\htmlData{mx=120}{k})}}}}}}}}}}}}}} \\ & \quad \htmlData{mx=53}{=} \htmlData{mx=146}{\left(\htmlData{mx=145}{\sum_{j} \htmlData{mx=144}{\sqrt{\htmlData{mx=143}{\left(\htmlData{mx=139}{\sum_{i} \htmlData{mx=138}{\htmlData{mx=133}{\htmlData{mx=131}{\mathit{lam}}(\htmlData{mx=132}{i})} \cdot \htmlData{mx=137}{\htmlData{mx=134}{a}(\htmlData{mx=135}{i}, \htmlData{mx=136}{j})}}}\right) \cdot \htmlData{mx=142}{\htmlData{mx=140}{c}(\htmlData{mx=141}{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)
x ∈ TVariables
I, J range over Type: the statement must hold for every choice. ((I J : 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 I. Lean writes f x; papers write f(x). (Fintype I)
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 I, then ℝ. (Between types, A → B is the type of functions from A to B.) (I → ℝ)
x : TVariables
c, r range over J → ℝ: the statement must hold for every choice. ((c r : J → ℝ))
∀For all
The statement after the comma holds for every i. (∀ i, 0 ≤ lam i)
aᵇPower
∑ j, √((∑ i, lam(i) · a(i, j)) · c(j)) raised to the power 2. ((∑ j, Real.sqrt ((∑ i, lam i * a i j) *…)
∧And
Both hold: (∑ j, √((∑ i, lam(i) · a(i, j)) · c(j)))^2 ≤ (∑ j, r(j) · …, and (∀ j, 0 < (∑ i, lam(i) · a(i, j))) → (∑ j, √((∑ i, lam(i) …. ((∑ j, Real.sqrt ((∑ i, lam i * a i j) *…)
RReal numbers
The real numbers: every point on the number line. (ℝ)
≤At most
0 is less than or equal to lam(i). (0 ≤ lam i)
<Less than
0 is strictly smaller than c(j). (0 < c j)
√Square root
The non-negative number whose square is (∑ i, lam(i) · a(i, j)) · c(j). (Real.sqrt ((∑ i, lam i * a i j) * c j))
∑Summation
Add up lam(i) · a(i, j) for every i. (∑ i, lam i * a i j)
·Multiplication
lam(i) times a(i, j). (lam i * a i j)
a/bDivision
a(i, j) divided by r(j). In Lean, dividing by 0 gives 0. (a i j / r j)
=Equality
(∑ j, √((∑ i, lam(i) · a(i, j))/c(j))/(∑ k, √((∑ i, lam(i)… and (∑ j, √((∑ i, lam(i) · a(i, j)) · c(j)))^2 are the same. ((∑ j, (Real.sqrt ((∑ i, lam i * a i j) …)

The single law behind every proposal scheme in the programme. For a row drawn from any finite prior (weights λ_i over rows), any nonnegative per-key weights a_ij (a = π² for the output cost factor; a = π²‖v − g‖² for a residual estimator; a = Σ_h π_h² for a shared head group) and any per-key access cost c_j > 0, every proposal r has (expected access cost) × (expected second-moment factor) at least (Σ_j √(E[a_j] c_j))², and r_j ∝ √(E[a_j]/c_j) attains it. With c ≡ 1 the least expected cost factor of any proposal built from side information T is (Σ_j √E[π_j² | T])², attained by the square root of the posterior second moment. Proof: Cauchy–Schwarz after exchanging the two sums. Reformulation from first principles, 2026-10-05.

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

More proved statements