Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Lemma 8.4.2 — sphere-packing bound A(n,2r+1)≤⌊2n/∑i≤r(ni)⌋A(n,2r+1) \le \lfloor 2^n/\sum_{i\le r}\binom ni\rfloorA(n,2r+1)≤⌊2n/∑i≤r​(in​)⌋

Proved
MatousekLP.Codes.sphere_packing_bound

by mikedeng1 · Oct 3, 2026 · Mathlib 0df444a (Lean v4.33.1)

coding-theoryp2o-batch-b23bp2o-gran-per-chapterp2o-plan-bookp2o-v1

For all integers n,r≥0n, r \ge 0n,r≥0,

A(n,2r+1)  ≤  ⌊2n∑i=0r(ni)⌋,A(n, 2r+1) \;\le\; \left\lfloor \frac{2^n}{\sum_{i=0}^{r}\binom{n}{i}} \right\rfloor ,A(n,2r+1)≤⌊∑i=0r​(in​)2n​⌋,

where A(n,d)A(n,d)A(n,d) is the maximum size of a code C⊆{0,1}nC \subseteq \{0,1\}^nC⊆{0,1}n with distance ddd.

This is the classical volume bound on codes correcting rrr errors; for example it gives A(7,3)≤16A(7,3) \le 16A(7,3)≤16 and A(17,3)≤7281A(17,3) \le 7281A(17,3)≤7281, the benchmark the Delsarte bound improves.

Formalization Note The floor of the quotient is natural-number division 2 ^ n / ∑ i ∈ range (r+1), n.choose i; the denominator is at least (n0)=1\binom n0 = 1(0n​)=1, so no division by zero occurs.

Preamble
import Mathlib
import Definitions.Def_MatousekLP_Codes_Basic

open Finset
Formal statement
namespace MatousekLP.Codes

/-- Lemma 8.4.2 (Sphere-packing bound), p. 159: for all `n` and `r`,
`A(n, 2r+1) ≤ ⌊2^n / ∑_{i=0}^r (n choose i)⌋`. Natural-number division is floor division,
and the denominator is at least `(n choose 0) = 1`. -/
theorem sphere_packing_bound (n r : ℕ) :
    A n (2 * r + 1) ≤ 2 ^ n / ∑ i ∈ Finset.range (r + 1), n.choose i := by sorry

end MatousekLP.Codes
Source
Matoušek & Gärtner, Understanding and Using Linear Programming, Springer 2007, p. 159, Lemma 8.4.2 (Sphere-packing bound)
Human review
  • Endorsed by Shuze Chen · Oct 5, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 5, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me