Method of Types and Sanov's Large-Deviations Theorem

proved in Lean

Sorting sequences by their empirical letter frequencies (types) gives sharp counting estimates. Sanov's theorem follows: the probability that a sample's frequencies fall in a set E decays exponentially, at a rate set by the smallest KL divergence from E.

Imre Csiszár; Ivan N. Sanov (1957) · Ch. 11 · Method of Types & Statistics · Cover & Thomas, Theorems 11.1.1–11.1.4 & 11.4.1

Statement

For sequences of length $n \ge 1$ over a finite alphabet $\mathcal{X}$:

  1. The number of empirical types satisfies $|\mathcal{P}_n(\mathcal{X})| \le (n + 1)^{|\mathcal{X}|}$.
  2. Every $x^n$ of type $P$ with $P \ll Q$ has exact probability $Q^n(x^n) = 2^{-n(H(P) + D(P \| Q))}$.
  3. Each type class $T(P)$ satisfies $(n+1)^{-|\mathcal{X}|} 2^{n H(P)} \le |T(P)| \le 2^{n H(P)}$, and whenever $P \ll Q$, $(n+1)^{-|\mathcal{X}|} 2^{-n D(P \| Q)} \le Q^n(T(P)) \le 2^{-n D(P \| Q)}$.
  4. Sanov's Theorem (Upper, Lower, and Asymptotic Limit): For any set $E$ of distributions such that $D(P \| Q) \ge d$ whenever $P \in E$ and $P \ll Q$, $Q^n(\{x^n : \hat P_{x^n} \in E\}) \le (n+1)^{|\mathcal{X}|} 2^{-n d}$; for any $\ell_\infty$-interior point $P \in E$ with $P \ll Q$, eventually $Q^n(\{x^n : \hat P_{x^n} \in E\}) \ge 2^{-n(D(P \| Q) + \delta)}$; and when $d$ is approached by $\ell_\infty$-interior points $P \in E$ with $P \ll Q$, $-\frac{1}{n}\log_2 Q^n(\{x^n : \hat P_{x^n} \in E\}) \to d$ (valid for arbitrary $Q$, including distributions with zero-mass atoms).

How the proof works

The lower bound on $|T(P)|$ uses exact multinomial counting $|T(P)| \prod_a N(a|x)! = n!$ to show $P^n(T(P)) = \max_{P'} P^n(T(P')) \ge (n+1)^{-|\mathcal{X}|}$. Sanov's lower bound and limit constructively approximate any interior $P \in E$ by empirical types $P_n \ll P$ (exists_empiricalType_approx) and combine typeClass_prob_ge with continuity of $D(\cdot \| Q)$.

Lean declarations (9)

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.

Related open problems (4)

Open problems that build on, generalize, or are analogous to this theorem.