← All solved theorems
Shtarkov NML, Krichevsky–Trofimov Universal Coding & Exact Minimax Redundancy Asymptotics
proved in Lean
One compression scheme can work almost as well as a scheme tuned to the unknown source: the Krichevsky–Trofimov add-one-half estimator wastes only about (k − 1)/2 times log2 n bits over k letters, and this overhead is asymptotically optimal.
Raphail E. Krichevsky and Victor K. Trofimov; Yuri M. Shtarkov; Robert G. Gallager (1981) · Ch. 11 · Method of Types & Statistics · Krichevsky & Trofimov (1981), IEEE Trans. IT; Shtarkov (1987); Cover & Thomas, §13.1–13.2
Statement
For i.i.d. sources over a finite alphabet $\mathcal{X}$ of size $k = |\mathcal{X}| \ge 1$:
- Shtarkov's Minimax Pointwise Regret Theorem: The normalized maximum-likelihood (NML) distribution achieves exact uniform worst-case pointwise regret $\log_2 S_n(\mathcal{X})$ (matching the minimax lower bound over all distributions $Q$).
- Krichevsky–Trofimov (1981) Universal Mixture: The sequential add-$1/2$ predictor $q_{\mathrm{KT}}(a \mid x^{<t}) = \frac{N_a(x^{<t}) + 1/2}{t + k/2}$ obeys for every $P$ and $x^n$,
$$\log_2 \frac{P^n(x^n)}{q_{\mathrm{KT}}(x^n)} \le \frac{k - 1}{2} \log_2(n + 1) + 2, \qquad D(P^n \| q_{\mathrm{KT}}) \le \frac{k - 1}{2} \log_2(n + 1) + 2,$$ and yields an explicit universal prefix code with expected length $\mathbb{E}_{P^n}[|c(X^n)|] < n H(P) + \frac{k-1}{2}\log_2(n+1) + k$ for all $P$ simultaneously.
- Exact Minimax KL Redundancy Asymptotics: Combining the KT upper bound with the Gallager–Haussler capacity–redundancy lower bound on a $\sqrt{n}$-spaced simplex grid gives
$$\lim_{n \to \infty} \frac{R_n^*(\mathcal{X})}{\log_2 n} = \frac{k - 1}{2}.$$
How the proof works
Proves the exchangeable rising-factorial formula ktDist_pmf_eq_prod, an elementary Stirling-free binary ratio bound kt_binary_ratio_le ($\le 2\sqrt{n}$), alphabet induction kt_ml_ratio_le, Kraft prefix-code construction universal_prefix_code_redundancy_le, the Bayes compensation identity bayes_kl_decomposition, and the matching simplex-grid lower bound minimax_kl_redundancy_ge yielding minimax_kl_redundancy_asymptotics.
Lean declarations (8)
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 shtarkov_minimax_regret [Nonempty α] {n : ℕ} (hn : 0 < n) :
((∀ (P : ProbDist α) (x : Fin n → α), 0 < (iidDist P n).pmf x →
log2 ((iidDist P n).pmf x / (nmlDist α n).pmf x) ≤ log2 (shtarkovSum α n)) ∧
(∀ x : Fin n → α,
log2 ((iidDist (empiricalType hn x) n).pmf x / (nmlDist α n).pmf x) =
log2 (shtarkovSum α n))) ∧
(∀ Q : ProbDist (Fin n → α), (∀ x, 0 < Q.pmf x) →
∃ (x : Fin n → α) (P : ProbDist α),
log2 (shtarkovSum α n) ≤ log2 ((iidDist P n).pmf x / Q.pmf x)) := by …
theorem ktDist_pmf_eq_prod [Nonempty α] (n : ℕ) (x : Fin n → α) :
(ktDist α n).pmf x =
(∏ a : α, risingShift (1 / 2) (typeCount x a)) /
risingShift ((Fintype.card α : ℝ) / 2) n := by …
theorem kt_pointwise_regret_le [Nonempty α] {n : ℕ} (hn : 0 < n)
(P : ProbDist α) (x : Fin n → α) (hpx : 0 < (iidDist P n).pmf x) :
log2 ((iidDist P n).pmf x / (ktDist α n).pmf x) ≤
(((Fintype.card α - 1 : ℕ) : ℝ) / 2) * log2 ((n : ℝ) + 1) + 2 := by …
theorem kt_kl_redundancy_le [Nonempty α] {n : ℕ} (hn : 0 < n) (P : ProbDist α) :
klDivergence (iidDist P n) (ktDist α n) ≤
(((Fintype.card α - 1 : ℕ) : ℝ) / 2) * log2 ((n : ℝ) + 1) + 2 := by …
theorem universal_prefix_code_redundancy_le (α : Type*) [Fintype α] [Nonempty α]
{n : ℕ} (hn : 0 < n) :
∃ c : (Fin n → α) → List Bool,
Function.Injective c ∧
InformationTheory.IsPrefixFree ((Finset.univ.image c : Finset (List Bool)) : Set (List Bool)) ∧
∀ P : ProbDist α,
∑ x : Fin n → α, (iidDist P n).pmf x * ((c x).length : ℝ) <
(n : ℝ) * shannonEntropy P +
(((Fintype.card α - 1 : ℕ) : ℝ) / 2) * log2 ((n : ℝ) + 1) +
(Fintype.card α : ℝ) := by …
theorem bayes_kl_decomposition {ι β : Type*} [Fintype ι] [Fintype β]
(W : ProbDist ι) (P : ι → ProbDist β) (Q : ProbDist β)
(hac : ∀ j : ι, 0 < W.pmf j → AbsCont (P j) Q) :
∑ j : ι, W.pmf j * klDivergence (P j) Q =
mutualInfo (jointPrior W P) + klDivergence (bayesMixture W P) Q := by …
theorem minimax_kl_redundancy_ge (α : Type*) [Fintype α]
(hk : 2 ≤ Fintype.card α) {n : ℕ} (hn : 0 < n) :
(((Fintype.card α - 1 : ℕ) : ℝ) / 2) * log2 (n : ℝ) -
((Fintype.card α - 1 : ℕ) : ℝ) * (4 + log2 ((Fintype.card α - 1 : ℕ) : ℝ)) ≤
minimaxRedundancy α n := by …
theorem minimax_kl_redundancy_asymptotics (α : Type*) [Fintype α] [Nonempty α] :
Filter.Tendsto (fun n : ℕ => minimaxRedundancy α n / log2 (n : ℝ))
Filter.atTop (nhds (((Fintype.card α - 1 : ℕ) : ℝ) / 2)) := by …
Related open problems (3)
Open problems that build on, generalize, or are analogous to this theorem.