Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Saturated distance incidences and close ordered pairs

Definition
Esgk_AnnularClosePairCounting

by mysticflounder · Oct 20, 2026 · Mathlib 0df444a (Lean v4.33.1)

discrete-geometrydistinct-distances

For an indexed configuration p=(p1,…,pn)p=(p_1,\dots,p_n)p=(p1​,…,pn​) of points in the plane, with distance values R(p)={∣pi−pj∣:i≠j}R(p)=\{|p_i-p_j|: i\ne j\}R(p)={∣pi​−pj​∣:i=j} and dr(i)=#{j≠i:∣pi−pj∣=r}d_r(i)=\#\{j\ne i: |p_i-p_j|=r\}dr​(i)=#{j=i:∣pi​−pj​∣=r}, this module defines three finite sets.

  1. SaturatedDistanceIncidences p: the pairs (i,r)(i,r)(i,r) with r∈R(p)r\in R(p)r∈R(p) and dr(i)=3d_r(i)=3dr​(i)=3, that is, the circles about pip_ipi​ of radius rrr that contain exactly three indices j≠ij\ne ij=i.
  2. OrderedClosePairs p t: the ordered pairs (i,j)(i,j)(i,j) of distinct indices with ∣pi−pj∣2≤t|p_i-p_j|^2\le t∣pi​−pj​∣2≤t.
  3. IncreasingClosePairs p t: the pairs of OrderedClosePairs p t with i<ji<ji<j.

When each circle about a configuration point contains at most three other indices, 333 is the largest possible value of dr(i)d_r(i)dr​(i), and the saturated incidences are the circles of maximal occupancy. These sets are used to count close pairs among points on such circles.

Formalization Note Indices are elements of Fin n with their usual order; the threshold ttt is a squared distance.

Definition code
/-
Copyright (c) 2026 Adam McKenna. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Adam McKenna
-/

import Definitions.Def_Esgk_DistanceDesign
import Definitions.Def_Esgk_Energy
import Definitions.Def_Esgk_Foundation

namespace Esgk

open EuclideanGeometry
open scoped BigOperators
variable {n : ℕ}

noncomputable def SaturatedDistanceIncidences (p : Config n) : Finset (Fin n × ℝ) :=
  (Finset.univ.product (OrderedDistanceValues p)).filter
    (fun ir ↦ (DistanceOutNeighborsAtValue p ir.1 ir.2).card = 3)

noncomputable def OrderedClosePairs (p : Config n) (t : ℝ) : Finset (Fin n × Fin n) :=
  (Finset.univ : Finset (Fin n)).offDiag.filter (fun ij ↦ dist (p ij.1) (p ij.2) ^ 2 ≤ t)

noncomputable def IncreasingClosePairs (p : Config n) (t : ℝ) : Finset (Fin n × Fin n) :=
  (OrderedClosePairs p t).filter (fun ij ↦ ij.1 < ij.2)

end Esgk

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