Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Equal-circle packing constants in the unit square

Definition
CirclePackingConstants

by xuanji · Sep 12, 2026 · Mathlib 0df444a (Lean v4.33.1)

circle-packingdiscrete-geometry

Defines admissible packings of nnn congruent disks in the unit square, the supremal radius rnr_nrn​, and the covered-area constant cn=nπrn2c_n=n\pi r_n^2cn​=nπrn2​.

Definition code
import Mathlib

noncomputable section

namespace CirclePackingConstants

abbrev Point := ℝ × ℝ

/-- Squared Euclidean distance in Cartesian coordinates. -/
def sqDist (p q : Point) : ℝ :=
  (p.1 - q.1) ^ 2 + (p.2 - q.2) ^ 2

/-- Coordinate containment conditions for a disk center in the unit square. -/
def InInnerSquare (r : ℝ) (p : Point) : Prop :=
  r ≤ p.1 ∧ p.1 ≤ 1 - r ∧ r ≤ p.2 ∧ p.2 ≤ 1 - r

/-- `n` equal disks of radius `r` fit in the unit square with disjoint interiors. -/
def Packable (n : ℕ) (r : ℝ) : Prop :=
  0 ≤ r ∧ r ≤ 1 / 2 ∧
    ∃ p : Fin n → Point,
      (∀ i, InInnerSquare r (p i)) ∧
      ∀ i j, i ≠ j → (2 * r) ^ 2 ≤ sqDist (p i) (p j)

/-- The supremum of radii admitted by `Packable`. -/
def r_n (n : ℕ) : ℝ := sSup {r : ℝ | Packable n r}

/-- The optimal covered-area fraction for `n` equal disks in the unit square. -/
def c_n (n : ℕ) : ℝ := (n : ℝ) * Real.pi * (r_n n) ^ 2

end CirclePackingConstants
Source
User-supplied Circles in squares: proofs and bounds, p. 1, and accompanying CirclePacking.lean source package, supplied September 12, 2026.
Read-back

What the Lean code literally says, in plain math · gpt-6-astra

Point. A point is an ordered pair of real numbers, so the type of points is R×R\mathbb{R}\times\mathbb{R}R×R.

sqDist. For any two points p=(p1,p2)p=(p_1,p_2)p=(p1​,p2​) and q=(q1,q2)q=(q_1,q_2)q=(q1​,q2​) in R×R\mathbb{R}\times\mathbb{R}R×R, define their squared distance by sqDist⁡(p,q)=(p1−q1)2+(p2−q2)2\operatorname{sqDist}(p,q)=(p_1-q_1)^2+(p_2-q_2)^2sqDist(p,q)=(p1​−q1​)2+(p2​−q2​)2. No distinctness assumption is imposed; in particular, this value is zero when p=qp=qp=q.

InInnerSquare. For any real number rrr and any point p=(p1,p2)∈R×Rp=(p_1,p_2)\in\mathbb{R}\times\mathbb{R}p=(p1​,p2​)∈R×R, the predicate InInnerSquare⁡(r,p)\operatorname{InInnerSquare}(r,p)InInnerSquare(r,p) means that r≤p1≤1−rr\le p_1\le 1-rr≤p1​≤1−r and r≤p2≤1−rr\le p_2\le 1-rr≤p2​≤1−r. The boundary inequalities are inclusive. There is no assumption that rrr is nonnegative; negative values are permitted, whereas for r>1/2r>1/2r>1/2 no point satisfies the predicate.

Packable. For every natural number nnn, including zero, and every real number rrr, the predicate Packable⁡(n,r)\operatorname{Packable}(n,r)Packable(n,r) means that 0≤r≤1/20\le r\le 1/20≤r≤1/2 and there exists a family of points pi=(xi,yi)∈R×Rp_i=(x_i,y_i)\in\mathbb{R}\times\mathbb{R}pi​=(xi​,yi​)∈R×R indexed by i∈{0,…,n−1}i\in\{0,\ldots,n-1\}i∈{0,…,n−1} such that r≤xi≤1−rr\le x_i\le 1-rr≤xi​≤1−r and r≤yi≤1−rr\le y_i\le 1-rr≤yi​≤1−r for every index iii, and (2r)2≤(xi−xj)2+(yi−yj)2(2r)^2\le (x_i-x_j)^2+(y_i-y_j)^2(2r)2≤(xi​−xj​)2+(yi​−yj​)2 for every pair of distinct indices i,ji,ji,j. Equality in the separation inequality is allowed. Distinct indices are not independently required to have distinct points, so coincident points are allowed when r=0r=0r=0. For n=0n=0n=0 the family is empty and all indexed conditions are vacuous, leaving exactly 0≤r≤1/20\le r\le 1/20≤r≤1/2.

r_n. For every natural number nnn, including zero, define rnr_nrn​ to be the real supremum of the set of all real numbers rrr for which Packable⁡(n,r)\operatorname{Packable}(n,r)Packable(n,r) holds.

c_n. For every natural number nnn, including zero, define cn=nπrn2c_n=n\pi r_n^2cn​=nπrn2​, where nnn is cast to a real number.

Human review
  • Endorsed by Shuze Chen · Sep 12, 2026

  • Endorsed by xuanji · Sep 12, 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