Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Unit packings, upper density, the sphere-packing and lattice-packing constants

Definition
TenChallenges_SpherePacking

by utkuokur · Nov 4, 2026 · Mathlib 0df444a (Lean v4.33.1)

discrete-geometrylatticessphere-packing

The definitions behind Challenge 7 of the Ten Challenges benchmark, in Rd\mathbb R^dRd with the Euclidean distance and Lebesgue measure.

  1. Unit packing. A set C⊆RdC\subseteq\mathbb R^dC⊆Rd is a unit packing if ∥x−y∥≥2\|x-y\|\ge 2∥x−y∥≥2 for all distinct x,y∈Cx,y\in Cx,y∈C; the open unit balls about its points are then pairwise disjoint.
  2. Upper density. For any set CCC,
δˉ(C)=lim sup⁡R→∞Vol(⋃x∈CB(x,1)∩B(0,R))Vol(B(0,R)),\bar\delta(C)=\limsup_{R\to\infty}\frac{\mathrm{Vol}\big(\bigcup_{x\in C}B(x,1)\cap B(0,R)\big)}{\mathrm{Vol}(B(0,R))},δˉ(C)=R→∞limsup​Vol(B(0,R))Vol(⋃x∈C​B(x,1)∩B(0,R))​,

an extended nonnegative real number. 3. Sphere-packing constant. Δd=sup⁡{δˉ(C):C a unit packing of Rd}\Delta_d=\sup\{\bar\delta(C): C \text{ a unit packing of } \mathbb R^d\}Δd​=sup{δˉ(C):C a unit packing of Rd}. 4. Lattice-packing constant. ΔdL=sup⁡{δˉ(L):L an additive subgroup of Rd, L a unit packing, spanRL=Rd}\Delta_d^L=\sup\{\bar\delta(L): L \text{ an additive subgroup of } \mathbb R^d,\ L \text{ a unit packing},\ \mathrm{span}_{\mathbb R}L=\mathbb R^d\}ΔdL​=sup{δˉ(L):L an additive subgroup of Rd, L a unit packing, spanR​L=Rd}. The separation condition makes LLL discrete, so these LLL are exactly the full-rank lattices with minimum distance at least 222.

These are the standard objects of the sphere packing problem; the density and constants are reusable for any packing statement.

Formalization Note. The space is EuclideanSpace ℝ (Fin d), the measure its volume, densities live in ℝ≥0∞, and the limit superior is along Filter.atTop on the real radius RRR. The suprema are indexed suprema over all sets, respectively all additive subgroups, satisfying the stated conditions.

Definition code
import Mathlib.Analysis.Normed.Lp.MeasurableSpace
import Mathlib.MeasureTheory.Measure.Haar.OfBasis

open MeasureTheory Metric Filter
open scoped ENNReal

/-- Sets of points in `ℝᵈ`. -/
abbrev PointSet (d : ℕ) := Set (EuclideanSpace ℝ (Fin d))

noncomputable section

variable {d : ℕ} (C : PointSet d)

/-- A set of centres `C ⊆ ℝ^d` is a *unit packing* if distinct centres are at
distance at least `2` (the open unit balls around the centres are disjoint). -/
def IsUnitPacking : Prop :=
  ∀ ⦃x⦄, x ∈ C → ∀ ⦃y⦄, y ∈ C → x ≠ y → 2 ≤ dist x y

/-- The (upper) density of a packing `C`: the `limsup` as `R → ∞` of the fraction
of the ball `B(0, R)` filled by the unit balls centred at the points of `C`. -/
def upperDensity : ℝ≥0∞ :=
  limsup (fun R : ℝ =>
    volume ((⋃ x ∈ C, ball x 1) ∩ ball 0 R)
      / volume (ball (0 : EuclideanSpace ℝ (Fin d)) R)) atTop

/-- The sphere-packing constant `Δ_d`: the supremum of densities over all unit
packings of `ℝᵈ`. -/
def spherePackingConstant (d : ℕ) : ℝ≥0∞ :=
  ⨆ (C : PointSet d) (_ : IsUnitPacking C), upperDensity C

/-- The lattice packing constant `Δᴸ_d`: the supremum of densities over unit
packing subgroups spanning `ℝᵈ`. The separation condition ensures discreteness. -/
def latticePackingConstant (d : ℕ) : ℝ≥0∞ :=
  ⨆ (L : AddSubgroup (EuclideanSpace ℝ (Fin d)))
    (_ : IsUnitPacking (L : PointSet d))
    (_ : Submodule.span ℝ (L : PointSet d) = ⊤),
      upperDensity (L : PointSet d)

end
Source
Ten Challenges repository, file Defs_and_Lems/SpherePacking.lean (commit ff14a56), https://github.com/TenChallenges/ten-challenges/blob/main/Defs_and_Lems/SpherePacking.lean; definitions following J. H. Conway, N. J. A. Sloane, Sphere Packings, Lattices and Groups, Chapter 1, Section 1.
Read-back

What the Lean code literally says, in plain math · claude-fable-5-1

This file introduces five definitions, all parametrised by a natural number d∈{0,1,2,… }d \in \{0,1,2,\dots\}d∈{0,1,2,…}. Throughout, Rd\mathbb{R}^dRd denotes the Euclidean space of real ddd-tuples x=(x0,…,xd−1)x=(x_0,\dots,x_{d-1})x=(x0​,…,xd−1​) with the Euclidean (ℓ2\ell^2ℓ2) distance dist⁡(x,y)=∑i(xi−yi)2\operatorname{dist}(x,y)=\sqrt{\sum_i (x_i-y_i)^2}dist(x,y)=∑i​(xi​−yi​)2​; for d=0d=0d=0 this space consists of the single point 000. The measure vol⁡\operatorname{vol}vol on Rd\mathbb{R}^dRd is the default volume of a finite-dimensional real inner-product space: the translation-invariant (Haar) measure normalised so that the parallelepiped spanned by an orthonormal basis has measure 111, i.e. standard Lebesgue measure; in dimension 000 it gives the one-point space total mass 111. Values of vol⁡\operatorname{vol}vol lie in the extended non-negative reals [0,∞][0,\infty][0,∞], and all suprema, quotients and limsups below are taken in [0,∞][0,\infty][0,∞].

Point sets. A point set in dimension ddd is an arbitrary subset C⊆RdC\subseteq\mathbb{R}^dC⊆Rd. No measurability, discreteness, countability or finiteness is required.

Unit packing. A point set C⊆RdC\subseteq\mathbb{R}^dC⊆Rd is a unit packing iff

∀x∈C, ∀y∈C,x≠y   ⟹   2≤dist⁡(x,y).\forall x\in C,\ \forall y\in C,\qquad x\neq y\ \implies\ 2\le\operatorname{dist}(x,y).∀x∈C, ∀y∈C,x=y ⟹ 2≤dist(x,y).

The inequality is non-strict (distinct centres at distance exactly 222 are allowed). The empty set and every singleton are unit packings, since the condition is then vacuous; for d=0d=0d=0 every subset of the one-point space is a unit packing.

Upper density. For a point set C⊆RdC\subseteq\mathbb{R}^dC⊆Rd its upper density δ‾(C)∈[0,∞]\overline{\delta}(C)\in[0,\infty]δ(C)∈[0,∞] is

δ‾(C)  =  lim sup⁡R→+∞ vol⁡ ⁣((⋃x∈CB(x,1))∩B(0,R))vol⁡(B(0,R)),\overline{\delta}(C)\;=\;\limsup_{R\to+\infty}\ \frac{\operatorname{vol}\!\Big(\big(\bigcup_{x\in C}B(x,1)\big)\cap B(0,R)\Big)}{\operatorname{vol}\big(B(0,R)\big)},δ(C)=R→+∞limsup​ vol(B(0,R))vol((⋃x∈C​B(x,1))∩B(0,R))​,

where RRR ranges over all real numbers, B(x,r)={y∈Rd:dist⁡(y,x)<r}B(x,r)=\{y\in\mathbb{R}^d:\operatorname{dist}(y,x)<r\}B(x,r)={y∈Rd:dist(y,x)<r} is the open ball, and 000 is the origin. The following conventions are part of the formula:

  • The quotient is division in [0,∞][0,\infty][0,∞], a/b=a⋅b−1a/b=a\cdot b^{-1}a/b=a⋅b−1 with 0−1=∞0^{-1}=\infty0−1=∞ and ∞−1=0\infty^{-1}=0∞−1=0. Hence a/0=∞a/0=\inftya/0=∞ for a≠0a\neq0a=0, 0/0=00/0=00/0=0, and a/∞=0a/\infty=0a/∞=0 for every aaa (including a=∞a=\inftya=∞).
  • The limsup is the limsup in the complete lattice [0,∞][0,\infty][0,∞] along R→+∞R\to+\inftyR→+∞: the infimum of all a∈[0,∞]a\in[0,\infty]a∈[0,∞] such that the ratio is ≤a\le a≤a for all sufficiently large RRR; equivalently inf⁡R0∈R sup⁡R≥R0(ratio at R)\inf_{R_0\in\mathbb{R}}\ \sup_{R\ge R_0}(\text{ratio at }R)infR0​∈R​ supR≥R0​​(ratio at R). It always exists (possibly ∞\infty∞) and ignores the values of the ratio for small RRR.
  • For R≤0R\le0R≤0, B(0,R)=∅B(0,R)=\emptysetB(0,R)=∅, so numerator and denominator are both 000 and the ratio is 0/0=00/0=00/0=0; this has no effect on the limsup.
  • vol⁡\operatorname{vol}vol is applied as an outer measure; no measurability of CCC is assumed (the union of open balls is open in any case).
  • For d≥1d\ge1d≥1 and R>0R>0R>0 the denominator vol⁡(B(0,R))\operatorname{vol}(B(0,R))vol(B(0,R)) is positive and finite and the numerator is at most the denominator, so the ratio lies in [0,1][0,1][0,1] and δ‾(C)∈[0,1]\overline{\delta}(C)\in[0,1]δ(C)∈[0,1]. If C=∅C=\emptysetC=∅ the union is empty and δ‾(∅)=0\overline{\delta}(\emptyset)=0δ(∅)=0.
  • For d=0d=0d=0: B(0,R)={0}B(0,R)=\{0\}B(0,R)={0} for every R>0R>0R>0 and vol⁡({0})=1\operatorname{vol}(\{0\})=1vol({0})=1, so δ‾({0})=1\overline{\delta}(\{0\})=1δ({0})=1 and δ‾(∅)=0\overline{\delta}(\emptyset)=0δ(∅)=0.

Sphere-packing constant. For d∈Nd\in\mathbb{N}d∈N,

Δd  :=  sup⁡{ δ‾(C) : C⊆Rd is a unit packing } ∈[0,∞].\Delta_d\;:=\;\sup\big\{\,\overline{\delta}(C)\ :\ C\subseteq\mathbb{R}^d\ \text{is a unit packing}\,\big\}\ \in[0,\infty].Δd​:=sup{δ(C) : C⊆Rd is a unit packing} ∈[0,∞].

Formally this is an indexed supremum over all point sets CCC and then over all proofs that CCC is a unit packing; when CCC is not a unit packing the inner supremum has an empty index set and contributes the bottom element 000, so the value is exactly the supremum of δ‾\overline{\delta}δ over unit packings. The index set is never empty, since ∅\emptyset∅ is a unit packing. There is no requirement that CCC be discrete, countable, measurable, non-empty or of any particular structure. Edge case d=0d=0d=0: the unit packings are ∅\emptyset∅ and {0}\{0\}{0}, so Δ0=max⁡(0,1)=1\Delta_0=\max(0,1)=1Δ0​=max(0,1)=1.

Lattice packing constant. For d∈Nd\in\mathbb{N}d∈N,

ΔdL  :=  sup⁡{ δ‾(L) : L an additive subgroup of Rd,  L is a unit packing,  span⁡R(L)=Rd } ∈[0,∞].\Delta^{L}_d\;:=\;\sup\big\{\,\overline{\delta}(L)\ :\ L\ \text{an additive subgroup of }\mathbb{R}^d,\ \ L\ \text{is a unit packing},\ \ \operatorname{span}_{\mathbb{R}}(L)=\mathbb{R}^d\,\big\}\ \in[0,\infty].ΔdL​:=sup{δ(L) : L an additive subgroup of Rd,  L is a unit packing,  spanR​(L)=Rd} ∈[0,∞].

Here LLL ranges over all additive subgroups of Rd\mathbb{R}^dRd (subsets containing 000 and closed under addition and negation; nothing else is assumed, in particular no discreteness, closedness, finite generation or Z\mathbb{Z}Z-basis). "LLL is a unit packing" means that the underlying set of LLL satisfies the unit-packing condition above, i.e. 2≤dist⁡(x,y)2\le\operatorname{dist}(x,y)2≤dist(x,y) for all distinct x,y∈Lx,y\in Lx,y∈L; δ‾(L)\overline{\delta}(L)δ(L) is the upper density of that underlying set. span⁡R(L)\operatorname{span}_{\mathbb{R}}(L)spanR​(L) is the smallest real linear subspace of Rd\mathbb{R}^dRd containing the set LLL, and it is required to equal the whole space. As before the supremum is formally over LLL and over proofs of the two side conditions, with each failed condition contributing 000, so ΔdL\Delta^L_dΔdL​ is the supremum of δ‾(L)\overline{\delta}(L)δ(L) over the subgroups satisfying both conditions, and it would equal 000 if no subgroup satisfied both. Edge case d=0d=0d=0: the only subgroup is {0}\{0\}{0}; it is a unit packing, its span is the whole (trivial) space, and δ‾({0})=1\overline{\delta}(\{0\})=1δ({0})=1, so Δ0L=1\Delta^L_0=1Δ0L​=1.

Human review
  • Endorsed by Shuze Chen · Nov 4, 2026

  • Endorsed by utkuokur · Nov 4, 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