← All solved theorems
Log-Sum Inequality, Convexity of KL Divergence, and Concavity of Entropy
proved in Lean
A simple inequality about sums of logarithms implies that KL divergence is convex and entropy is concave: mixing distributions never raises divergence above the average, nor lowers entropy below it. These shape properties are used throughout capacity and compression calculations.
Imre Csiszár; Thomas M. Cover and Joy A. Thomas (1991) · Ch. 2 · Entropy, Divergence & Inequalities · Cover & Thomas, Theorems 2.7.1–2.7.3
Statement
For nonnegative numbers $a_i, b_i \ge 0$ with $b_i = 0 \implies a_i = 0$, $$\left(\sum_i a_i\right) \log_2 \frac{\sum_i a_i}{\sum_i b_i} \le \sum_i a_i \log_2 \frac{a_i}{b_i}.$$ Consequently, $D(P \| Q)$ is jointly convex in $(P, Q)$ (on $P \ll Q$) and $H(P)$ is concave in $P$.
How the proof works
The log-sum inequality is Jensen's inequality for the convex function t log t; convexity of divergence and concavity of entropy follow by applying it term by term to mixtures. Derived from the non-negativity of Mathlib's InformationTheory.klFun and applied coordinatewise to convex mixtures probMix t P₁ P₂.
Lean declarations (3)
The key theorems in the Lean library. Each is compiled with Lean 4, uses only the standard axioms propext, Classical.choice and Quot.sound, and is re-checked by leanchecker. Click a name to see the full proof on GitHub.
theorem log_sum_inequality {ι : Type*} (s : Finset ι) (a b : ι → ℝ)
(ha : ∀ i ∈ s, 0 ≤ a i) (hb : ∀ i ∈ s, 0 ≤ b i)
(hac : ∀ i ∈ s, b i = 0 → a i = 0) :
(∑ i ∈ s, a i) * log2 ((∑ i ∈ s, a i) / (∑ i ∈ s, b i)) ≤
∑ i ∈ s, if a i ≤ 0 then 0 else a i * log2 (a i / b i) := by …
theorem klDivergence_convex {α : Type*} [Fintype α]
(t : ℝ) (ht0 : 0 ≤ t) (ht1 : t ≤ 1)
(P₁ Q₁ P₂ Q₂ : ProbDist α) (hac₁ : AbsCont P₁ Q₁) (hac₂ : AbsCont P₂ Q₂) :
klDivergence (probMix t ht0 ht1 P₁ P₂) (probMix t ht0 ht1 Q₁ Q₂) ≤
t * klDivergence P₁ Q₁ + (1 - t) * klDivergence P₂ Q₂ := by …
theorem shannonEntropy_concave {α : Type*} [Fintype α]
(t : ℝ) (ht0 : 0 ≤ t) (ht1 : t ≤ 1) (P₁ P₂ : ProbDist α) :
t * shannonEntropy P₁ + (1 - t) * shannonEntropy P₂ ≤
shannonEntropy (probMix t ht0 ht1 P₁ P₂) := by …
Related open problems (4)
Open problems that build on, generalize, or are analogous to this theorem.