Theorem 4.3.5 — Guarantees for an error correcting code
DisprovedHighDimProb.RandomMatrices.error_correcting_code_guaranteeThis is Theorem 4.3.5: an application of the packing/covering machinery of §4.2 to coding theory, demonstrating (on a clean discrete statement, independent of the goal theorem's own proof path) how covering/packing numbers of a metric space — here the Hamming cube, rather than a Euclidean ball — control a concrete combinatorial guarantee.
Assume positive integers satisfy
Then there exists an error correcting code (companion definition IsErrorCorrectingCode)
that encodes -bit strings into -bit strings and can correct errors.
Formalization Note is Euler's number, Real.exp 1; is Real.logb 2. The
hypothesis and conclusion are stated exactly as the book's, with required positive
per "Assume that positive integers and ".
Retired. Retired because the printed hypothesis admits 2r > n, where the statement is false (disproved at (k,n,r) = (1,1,2)); replaced by HighDimProb.RandomMatrices.error_correcting_code_guarantee_v2, which adds 2r ≤ n, the range of Exercise 4.2.16 the book's proof uses.
import Mathlib import Definitions.Def_HighDimProb_RandomMatrices_hammingDist import Definitions.Def_HighDimProb_RandomMatrices_IsErrorCorrectingCode
namespace HighDimProb.RandomMatrices
/-- **Theorem 4.3.5** (Guarantees for an error correcting code), Vershynin, *High-Dimensional
Probability* (2018), p. 88.
Assume that positive integers `k, n, r` are such that `n ≥ k + 2r log₂(en/(2r))`. Then there
exists an error correcting code that encodes `k`-bit strings into `n`-bit strings and can
correct `r` errors. -/
theorem error_correcting_code_guarantee (k n r : ℕ) (hk : 0 < k) (hn : 0 < n) (hr : 0 < r)
(h : (n : ℝ) ≥ (k : ℝ) + 2 * (r : ℝ) * Real.logb 2 (Real.exp 1 * (n : ℝ) / (2 * (r : ℝ)))) :
∃ E : (Fin k → Bool) → (Fin n → Bool), ∃ D : (Fin n → Bool) → (Fin k → Bool),
IsErrorCorrectingCode (r := r) E D := by sorry
end HighDimProb.RandomMatrices
Read-back
What the Lean code literally says, in plain math · claude-opus-5
This statement concerns binary error-correcting codes and fixes four natural numbers , , together with the hypotheses , and . The remaining hypothesis is a real-number inequality obtained by casting , , into :
where is Euler's number and denotes the base- logarithm in the sense of the ambient library's real logarithm-with-base function, which returns the value for and returns at and at every negative (it is a total function, not a partial one). Note that the argument of the logarithm is the real quotient , using real division, and the inequality is non-strict.
Under these hypotheses the conclusion asserts the existence of two functions:
- an encoder mapping each -tuple of booleans to an -tuple of booleans , and
- a decoder mapping each -tuple of booleans back to a -tuple of booleans,
such that the pair satisfies the predicate IsErrorCorrectingCode at the error-tolerance parameter . Here is the type of indices , so a -bit string is a function from that index type to , and likewise for .
Two things about this conclusion must be stated plainly. First, the two existential quantifiers are ordinary (not unique) existence: the statement claims at least one such pair exists, with no assertion of uniqueness, canonicity, or any constructive description. Second — and this is the substance of the claim — the content of the conclusion rests entirely on the meaning of IsErrorCorrectingCode, which is a definition supplied by this bundle and not visible in the code shown here. Its code is not part of what is presented, so its precise content cannot be reported: whatever conditions it imposes on and (for instance, some relationship between the Hamming distance of a received word from and the requirement , or a minimum-distance condition on the image of ) are asserted, but this read-back cannot expand them. The parameter is passed to it as a named argument, while and are presumably inferred from the types of and . Note also that the auxiliary definition hammingDist is imported by the preamble but does not appear anywhere in the statement itself; whether it enters through IsErrorCorrectingCode cannot be determined from what is shown.
Regarding degenerate and boundary cases permitted by the hypotheses: the positivity assumptions rule out , and , so both and are non-empty index types and the divisor is a nonzero real, meaning the quotient is a genuine positive real and is evaluated on its ordinary domain rather than at its junk value. However, the real-arithmetic hypothesis is strong enough to be satisfiable only for certain triples, and it constrains but does not exclude regimes that may make the conclusion trivial: for instance, may exceed , or may be large relative to so that the quantity falls below and its logarithm becomes negative, weakening the inequality; the statement carries no hypothesis such as or beyond what the displayed inequality itself implies. The case makes the logarithm , so the inequality reduces to something weaker than and may be satisfied by triples for which the intended coding-theoretic reading is degenerate. If IsErrorCorrectingCode happens to be vacuously satisfiable — for example if its conditions are trivially met when is large enough that no pair of distinct codewords is ever within distance , or if it quantifies over an empty set of error patterns — then the conclusion would hold for arbitrary and in those regimes; this cannot be ruled out from the code shown. Finally, the theorem's proof is sorry, so nothing here has been verified by the proof assistant; the declaration records the assertion only.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.