← All solved theorems
Singleton, Hamming, Gilbert–Varshamov Bounds & Reed–Solomon MDS Optimality
proved in Lean
Fundamental limits on error-correcting codes: the Singleton and Hamming bounds cap how many codewords a code with given minimum distance can have, Gilbert–Varshamov guarantees good codes exist, and Reed–Solomon codes meet the Singleton bound exactly.
Richard W. Hamming; Edgar N. Gilbert; Rom R. Varshamov; Richard C. Singleton; Irving S. Reed and Gustave Solomon (1950) · Zero-Error & Classical Coding Bounds · MacWilliams & Sloane, Ch. 1 & 11; Cover & Thomas, Ch. 7
Statement
For any $q$-ary block code $C \subseteq \mathbb{F}_q^n$ of minimum Hamming distance $d$:
- Singleton bound: $|C| \le q^{n - d + 1}$, attained with equality by Reed–Solomon codes over $\mathbb{F}_q$.
- Hamming (sphere-packing) bound: $|C| \cdot V_q(n, t) \le q^n$ for $d \ge 2t + 1$.
- Gilbert–Varshamov bound: $A_q(n, d) \ge q^n / V_q(n, d - 1)$, yielding the asymptotic binary rate bound $R(\delta) \ge 1 - h(\delta)$ for $\delta \in (0, 1/2)$.
How the proof works
Singleton follows by deleting d − 1 coordinates (codewords stay distinct), Hamming by packing disjoint radius-t balls, Gilbert–Varshamov by greedily choosing words outside the radius-(d − 1) balls, and Reed–Solomon codes meet Singleton because a nonzero low-degree polynomial has few roots. All five classical coding-theory theorems are proved directly against InfoTheory.Core.Coding in Known/Coding.lean (reusing Mathlib's Hamming metric via Bridge/Mathlib.lean and Polynomial.roots for Reed–Solomon MDS distance).
Lean declarations (5)
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 singleton_bound {q n d : ℕ} (hd : 1 ≤ d) (hdn : d ≤ n) :
maxCodeSize q n d ≤ q ^ (n - d + 1) := by …
theorem hamming_bound (q n t : ℕ) :
maxCodeSize q n (2 * t + 1) * ∑ i ∈ Finset.range (t + 1), n.choose i * (q - 1) ^ i
≤ q ^ n := by …
theorem gilbert_varshamov_bound {q n d : ℕ} (hd : 1 ≤ d) :
q ^ n ≤ maxCodeSize q n d * ∑ i ∈ Finset.range d, n.choose i * (q - 1) ^ i := by …
theorem gilbertVarshamov_le_asymptoticCodeRate {δ : ℝ} (h0 : 0 < δ) (h1 : δ < 1 / 2) :
gilbertVarshamov δ ≤ asymptoticCodeRate 2 δ := by …
theorem reedSolomon_isLinearMDSCode (F : Type*) [Field F] [Fintype F] [DecidableEq F]
{n k : ℕ} (hkn : k ≤ n) (hnF : n ≤ Fintype.card F) : IsLinearMDSCode F n k := by …
Related open problems (9)
Open problems that build on, generalize, or are analogous to this theorem.