{
  "id": "3768",
  "ident": "NS.03768",
  "slug": "erdos-959",
  "title": "Erdős Problem 959",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $A\\subseteq \\mathbb{R}^2$ be a set of size $n$ and let $\\{d_1,\\ldots,d_k\\}$ be\nthe set of distinct distances determined by $A$. Let $f(d)$ be the number of times\nthe distance $d$ is determined, ordered so that\n$f(d_1)\\geq f(d_2)\\geq \\cdots \\geq f(d_k)$. Estimate\n$$\\max (f(d_1)-f(d_2)),$$\nwhere the maximum is taken over all $A$ of size $n$ (this is `extremalGap n`).",
  "subjects": [
    "math.MG",
    "msc:52"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/959",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos959.erdos_959",
  "statement_lean": "theorem erdos_959 :\n    (fun n ↦ (extremalGap n : ℝ)) =Θ[atTop] erdos_959.answer",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Erdős Problem 959\n\n*Reference:* [erdosproblems.com/959](https://www.erdosproblems.com/959)\n-/\n\n@[expose] public section\n\nnamespace Erdos959\n\nopen EuclideanGeometry Filter\n\nnoncomputable section\n\n/-- The unordered index pairs, represented uniquely by the orientation `i < j`. -/\ndef indexPairs (n : ℕ) : Finset (Fin n × Fin n) :=\n  (Finset.univ ×ˢ Finset.univ).filter fun ij => ij.1 < ij.2\n\n/-- The finite set of distinct distances determined by a configuration. -/\ndef distanceValues {n : ℕ} (P : Fin n → ℝ²) : Finset ℝ :=\n  (indexPairs n).image fun ij => dist (P ij.1) (P ij.2)\n\n/-- $f(d)$: the number of unordered pairs in $P$ determining distance $d$. -/\ndef frequency {n : ℕ} (P : Fin n → ℝ²) (d : ℝ) : ℕ :=\n  ((indexPairs n).filter fun ij => dist (P ij.1) (P ij.2) = d).card\n\n/-- For a fixed distance $d$, the largest multiplicity among all *other*\nrepresented distances (`Finset.sup` returns $0$ when there is no other value). -/\ndef runnerUpFrequency {n : ℕ} (P : Fin n → ℝ²) (d : ℝ) : ℕ :=\n  ((distanceValues P).erase d).sup (frequency P)\n\n/-- $f(d_1) - f(d_2)$: the gap between the largest and second-largest distance\nmultiplicities. The supremum over $d$ handles both a unique winner and a tie:\nnon-winners contribute $0$ by truncated subtraction, and tied winners also\ncontribute $0$. -/\ndef multiplicityGap {n : ℕ} (P : Fin n → ℝ²) : ℕ :=\n  (distanceValues P).sup fun d => frequency P d - runnerUpFrequency P d\n\n/-- A configuration represents a set of size $n$ (injective) and has at least\ntwo distinct distances, so that $d_2$ exists. -/\ndef Admissible {n : ℕ} (P : Fin n → ℝ²) : Prop :=\n  Function.Injective P ∧ 2 ≤ (distanceValues P).card\n\n/-- A natural number occurs as the top-two multiplicity gap of some admissible\n$n$-point configuration. -/\ndef AttainableGap (n g : ℕ) : Prop :=\n  ∃ P : Fin n → ℝ², Admissible P ∧ multiplicityGap P = g\n\n/-- The extremal quantity of the problem, $\\max_{|A| = n} (f(d_1) - f(d_2))$. There\nare `Nat.choose n 2` unordered pairs, so this is a valid finite search interval. -/\ndef extremalGap (n : ℕ) : ℕ := by\n  classical\n  exact Nat.findGreatest (AttainableGap n) (Nat.choose n 2)\n\ndef erdos_959.answer : ℕ → ℝ := sorry\n\n/--\nLet $A\\subseteq \\mathbb{R}^2$ be a set of size $n$ and let $\\{d_1,\\ldots,d_k\\}$ be\nthe set of distinct distances determined by $A$. Let $f(d)$ be the number of times\nthe distance $d$ is determined, ordered so that\n$f(d_1)\\geq f(d_2)\\geq \\cdots \\geq f(d_k)$. Estimate\n$$\\max (f(d_1)-f(d_2)),$$\nwhere the maximum is taken over all $A$ of size $n$ (this is `extremalGap n`).\n-/\n@[category research open, question value, AMS 52]\ntheorem erdos_959 :\n    (fun n ↦ (extremalGap n : ℝ)) =Θ[atTop] erdos_959.answer := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nA superlinear lower bound: there is a $c>0$ with\n$$\\text{extremalGap}(n)\\geq n^{1 + c/\\log\\log n}$$\nfor all large $n$, so $\\max (f(d_1)-f(d_2))$ grows faster than any linear function\nof $n$. Determining the exact order remains open, which is `erdos_959`.\n-/\n@[category research solved, AMS 52, formal_proof using lean4 at \"https://github.com/williamjblair/lean-proofs/blob/4f915a323443bfb1709a6805a013812016dca88a/starfleet/erdos-959/Research/FinalLowerBound.lean\"]\ntheorem erdos_959.lower_bound :\n    ∃ c : ℝ, 0 < c ∧ ∃ N : ℕ, ∀ n ≥ N,\n      (n : ℝ) ^ (1 + c / Real.log (Real.log n)) ≤ extremalGap n := by\n  sorry\n\nend\n\nend Erdos959\n",
  "statement_hash": "d7dd99ede3fc5c50854366d0728bf274fd15a078b34b1bb5876cc18742560423",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}