{
  "id": "3036",
  "ident": "NS.03036",
  "slug": "erdos-733",
  "title": "Erdős Problem 733",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Call a sequence $1<X_1\\leq\\cdots\\leq X_m\\leq n$ line-compatible if there is a set of $n$ points in\n$\\mathbb{R}^2$ such that there are $m$ lines $\\ell_1,\\ldots,\\ell_m$ containing at least two\npoints, and the number of points on $\\ell_i$ is exactly $X_i$.\n\nProve that there are at most\n$$\\exp(O(n^{1/2}))$$\nmany line-compatible sequences.\n\nAsked by Erdős [Er81] and proved by Szemerédi and Trotter [SzTr83]. We take the lines $\\ell_i$ to\nbe distinct but not necessarily all the lines determined by the points, as on erdosproblems.com;\n[Er81] uses all the determined lines (`allLinesSequences`), so this bound implies his. Finiteness\nof the set is part of the statement, since `Set.ncard` of an infinite set is $0$.",
  "subjects": [
    "math.CO",
    "math.MG",
    "msc:05",
    "msc:52"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos733.erdos_733",
  "statement_lean": "theorem erdos_733 :\n    ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ,\n      (compatibleSequences n).Finite ∧\n        ((compatibleSequences n).ncard : ℝ) ≤ Real.exp (C * Real.sqrt n)",
  "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 733\n\n*References:*\n- [erdosproblems.com/733](https://www.erdosproblems.com/733)\n- [Er81] Erdős, P., *On the combinatorial problems which I would most like to see solved*.\n  Combinatorica (1981), 25-42. [PDF](https://www.renyi.hu/~p_erdos/1981-16.pdf)\n- [SzTr83] Szemerédi, E. and Trotter, Jr., W. T., *Extremal problems in discrete geometry*.\n  Combinatorica (1983), 381-392.\n-/\n\n@[expose] public section\n\nopen EuclideanGeometry Filter Topology\n\nnamespace Erdos733\n\n/-- A line in the plane: a nonempty affine subspace of $\\mathbb{R}^2$ of dimension one.\n(The nonemptiness is implied by `IsLine`, see `nonempty_of_isLine`.) -/\nabbrev Line : Type :=\n  {ℓ : AffineSubspace ℝ ℝ² // (ℓ : Set ℝ²).Nonempty ∧ IsLine ℓ}\n\n/-- If `ℓ` satisfies `IsLine`, then `ℓ` is nonempty: the direction of the empty subspace `⊥` is\ntrivial, so it has dimension $0$ and not $1$. -/\n@[category API, AMS 5 52]\ntheorem nonempty_of_isLine {ℓ : AffineSubspace ℝ ℝ²} (h : IsLine ℓ) :\n    (ℓ : Set ℝ²).Nonempty := by\n  rw [AffineSubspace.nonempty_iff_ne_bot]\n  rintro rfl\n  rw [IsLine, AffineSubspace.direction_bot, finrank_bot] at h\n  exact zero_ne_one h\n\nopen scoped Classical in\n/-- The number of points of the finite set `P` that lie on the line `ℓ`. -/\nnoncomputable def lineCount (P : Finset ℝ²) (ℓ : Line) : ℕ :=\n  (P.filter fun p ↦ p ∈ (ℓ.1 : AffineSubspace ℝ ℝ²)).card\n\n/-- The multiset of the numbers of points of `P` on the (distinct) lines in `L`. Lines with the\nsame number of points are kept with multiplicity. -/\nnoncomputable def lineSizeMultiset (P : Finset ℝ²) (L : Finset Line) : Multiset ℕ :=\n  L.val.map (lineCount P)\n\n/-- The nondecreasing list $X_1\\leq\\cdots\\leq X_m$ of the numbers of points of `P` on the lines\nin `L`, i.e. the sorted version of `lineSizeMultiset P L`. -/\nnoncomputable def lineSizeSequence (P : Finset ℝ²) (L : Finset Line) : List ℕ :=\n  (lineSizeMultiset P L).sort (· ≤ ·)\n\n/-- A sequence `X` is line-compatible for $n$ if there is a set `P` of $n$ points of\n$\\mathbb{R}^2$ and a finite set `L` of distinct lines, each containing at least two points of\n`P`, such that `X` lists the numbers of points of `P` on the lines of `L` in nondecreasing\norder. -/\ndef LineCompatible (n : ℕ) (X : List ℕ) : Prop :=\n  ∃ P : Finset ℝ², P.card = n ∧\n    ∃ L : Finset Line, (∀ ℓ ∈ L, 2 ≤ lineCount P ℓ) ∧ X = lineSizeSequence P L\n\n/-- The set of line-compatible sequences for $n$ points. -/\ndef compatibleSequences (n : ℕ) : Set (List ℕ) :=\n  {X | LineCompatible n X}\n\n/-- Erdős's original count [Er81]: the sequences obtained from *all* the lines determined by a\nset `P` of $n$ points, i.e. `L` is exactly the set of lines containing at least two points of\n`P`. These form a subset of `compatibleSequences n`. -/\ndef allLinesSequences (n : ℕ) : Set (List ℕ) :=\n  {X | ∃ P : Finset ℝ², P.card = n ∧\n    ∃ L : Finset Line, (∀ ℓ : Line, ℓ ∈ L ↔ 2 ≤ lineCount P ℓ) ∧ X = lineSizeSequence P L}\n\nset_option linter.style.formal_proof_palomar false in\n/--\nCall a sequence $1<X_1\\leq\\cdots\\leq X_m\\leq n$ line-compatible if there is a set of $n$ points in\n$\\mathbb{R}^2$ such that there are $m$ lines $\\ell_1,\\ldots,\\ell_m$ containing at least two\npoints, and the number of points on $\\ell_i$ is exactly $X_i$.\n\nProve that there are at most\n$$\\exp(O(n^{1/2}))$$\nmany line-compatible sequences.\n\nAsked by Erdős [Er81] and proved by Szemerédi and Trotter [SzTr83]. We take the lines $\\ell_i$ to\nbe distinct but not necessarily all the lines determined by the points, as on erdosproblems.com;\n[Er81] uses all the determined lines (`allLinesSequences`), so this bound implies his. Finiteness\nof the set is part of the statement, since `Set.ncard` of an infinite set is $0$.\n-/\n@[category research solved, AMS 5 52, formal_proof using lean4 at\n  \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos733.lean#L41\"]\ntheorem erdos_733 :\n    ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ,\n      (compatibleSequences n).Finite ∧\n        ((compatibleSequences n).ncard : ℝ) ≤ Real.exp (C * Real.sqrt n) := by\n  sorry\n\n/--\nErdős [Er81] writes that it is 'easy' to prove there are at least\n$$\\exp(cn^{1/2})$$\nmany such sequences for some constant $c>0$, but expected proving the upper bound to be\ndifficult. Once it is done, he asked for the existence and value of\n$$\\lim_{n\\to \\infty}\\frac{\\log f(n)}{n^{1/2}},$$\nwhere $f(n)$ counts the number of line-compatible sequences. Does this limit exist?\n\nIn [Er81], $f(n)$ counts the sequences of the numbers of points on all the lines determined by\n$n$ points, i.e. `(allLinesSequences n).ncard`; this set is finite, as a subset of\n`compatibleSequences n`.\n-/\n@[category research open, question, AMS 5 52]\ntheorem erdos_733.variants.limit_exists :\n    ∃ c : ℝ, Tendsto\n      (fun n : ℕ ↦ Real.log ((allLinesSequences n).ncard : ℝ) / Real.sqrt n)\n      atTop (𝓝 c) := by\n  sorry\n\nend Erdos733\n",
  "statement_hash": "ac51e919f737f25880a4325bb08142f14c0b4a3f77b658376f70c73a5433d835",
  "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."
}