{
  "id": "1308",
  "ident": "NS.01308",
  "slug": "erdos-210",
  "title": "Erdős Problem 210",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $f(n)$ be the sharp guarantee such that, for any $n$ points in $\\mathbb R^2$,\nnot all on a line, there are at least $f(n)$ lines which contain exactly two points\n(called ordinary lines). Does $f(n)\\to\\infty$?\nThat $f(n)\\to\\infty$ was proved by Motzkin [Mo51].",
  "subjects": [
    "math.CO",
    "math.MG",
    "msc:05",
    "msc:51"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos210.erdos_210.parts.i",
  "statement_lean": "theorem erdos_210.parts.i : Tendsto f atTop atTop",
  "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 210\n\n*References:*\n- [erdosproblems.com/210](https://www.erdosproblems.com/210)\n- [Mo51] Motzkin, T. S., *The lines and planes connecting the points of a finite set*.\n  Transactions of the American Mathematical Society 70 (1951), 451–464.\n- [KeMo58] Kelly, L. M. and Moser, W. O. J., *On the number of ordinary lines determined by\n  n points*. Canadian Journal of Mathematics 10 (1958), 210–219.\n- [CsSa93] Csima, J. and Sawyer, E. T., *There exist 6n/13 ordinary points*.\n  Discrete & Computational Geometry 9 (1993), 187–202.\n- [GrTa13] Green, B. and Tao, T., *On sets defining few ordinary lines*.\n  Discrete & Computational Geometry 50 (2013), 409–468.\n-/\n\n@[expose] public section\n\nnamespace Erdos210\n\nopen EuclideanGeometry Filter\n\n/-- The sharp ordinary-line guarantee for noncollinear sets of $n$ points.\nFor $n<3$, there are no such configurations, and the infimum is $0$. -/\nnoncomputable def f (n : ℕ) : ℕ :=\n  sInf {m : ℕ | ∃ s : Finset ℝ²,\n    s.card = n ∧ ¬ Collinear ℝ (s : Set ℝ²) ∧ (ordinaryLines s).card = m}\n\n/-- Let $f(n)$ be the sharp guarantee such that, for any $n$ points in $\\mathbb R^2$,\nnot all on a line, there are at least $f(n)$ lines which contain exactly two points\n(called ordinary lines). Does $f(n)\\to\\infty$?\nThat $f(n)\\to\\infty$ was proved by Motzkin [Mo51]. -/\n@[category research solved, question, AMS 5 51]\ntheorem erdos_210.parts.i : Tendsto f atTop atTop := by\n  sorry\n\n/-- Kelly and Moser [KeMo58] proved that $f(n)\\geq 3n/7$ for all $n$.\nOnly $n\\geq3$ have noncollinear configurations. -/\n@[category research solved, AMS 5 51]\ntheorem erdos_210.lower_bound : ∀ n : ℕ, 3 ≤ n → 3 * n ≤ 7 * f n := by\n  sorry\n\n/-- Csima and Sawyer [CsSa93] proved $f(n)\\geq6n/13$ when $n\\geq8$. -/\n@[category research solved, AMS 5 51]\ntheorem erdos_210.variants.csima_sawyer : ∀ n : ℕ, 8 ≤ n → 6 * n ≤ 13 * f n := by\n  sorry\n\n/-- Green and Tao [GrTa13] proved $f(n)\\geq n/2$ for sufficiently large $n$. -/\n@[category research solved, AMS 5 51]\ntheorem erdos_210.variants.green_tao : ∀ᶠ n : ℕ in atTop, n ≤ 2 * f n := by\n  sorry\n\n/-- Green and Tao [GrTa13] proved $f(n)\\geq3\\lfloor n/4\\rfloor$ for sufficiently\nlarge odd $n$ [GrTa13, Theorem 2.2]. -/\n@[category research solved, AMS 5 51]\ntheorem erdos_210.variants.green_tao_odd :\n    ∀ᶠ n : ℕ in atTop, Odd n → 3 * (n / 4) ≤ f n := by\n  sorry\n\n/-- Green and Tao [GrTa13, Proposition 2.1] give configurations attaining $n/2$\nordinary lines for sufficiently large even $n$. -/\n@[category research solved, AMS 5 51]\ntheorem erdos_210.variants.even_upper_bound :\n    ∀ᶠ n : ℕ in atTop, Even n → 2 * f n ≤ n := by\n  sorry\n\n/-- Kelly and Moser [KeMo58] give a seven-point configuration with three ordinary\nlines, attaining their lower bound at $n=7$. -/\n@[category research solved, AMS 5 51]\ntheorem erdos_210.variants.seven : f 7 = 3 := by\n  sorry\n\n/-- A configuration bounds the sharp guarantee from above. -/\n@[category API, AMS 5 51]\ntheorem f_le {n : ℕ} {s : Finset ℝ²} (hn : s.card = n)\n    (hs : ¬ Collinear ℝ (s : Set ℝ²)) : f n ≤ (ordinaryLines s).card :=\n  csInf_le ⟨0, fun _ _ => Nat.zero_le _⟩ ⟨s, hn, hs, rfl⟩\n\n/-- A right triangle is noncollinear. -/\n@[category API, AMS 5 51]\ntheorem triangle_not_collinear :\n    ¬ Collinear ℝ ({!₂[(0 : ℝ), 0], !₂[(1 : ℝ), 0], !₂[(0 : ℝ), 1]} : Set ℝ²) := by\n  intro h\n  have heq : (!₂[(0 : ℝ), 0] : ℝ²) ≠ !₂[(1 : ℝ), 0] := by\n    intro he\n    have := congrArg (fun p : ℝ² => p 0) he\n    norm_num at this\n  have hm : (!₂[(0 : ℝ), 1] : ℝ²) ∈ line[ℝ, !₂[(0 : ℝ), 0], !₂[(1 : ℝ), 0]] :=\n    h.mem_affineSpan_of_mem_of_ne (by simp) (by simp) (by simp) heq\n  obtain ⟨t, ht⟩ := mem_affineSpan_pair_iff_exists_lineMap_eq.mp hm\n  have := congrArg (fun p : ℝ² => p 1) ht\n  norm_num [AffineMap.lineMap_apply] at this\n\n/-- Every cardinality at least three has a noncollinear configuration. -/\n@[category API, AMS 5 51]\ntheorem exists_configuration {n : ℕ} (hn : 3 ≤ n) :\n    ∃ s : Finset ℝ², s.card = n ∧ ¬ Collinear ℝ (s : Set ℝ²) := by\n  classical\n  let t : Finset ℝ² := {!₂[(0 : ℝ), 0], !₂[(1 : ℝ), 0], !₂[(0 : ℝ), 1]}\n  have ht : t.card ≤ n := by\n    calc\n      t.card ≤ 3 := Finset.card_le_three\n      _ ≤ n := hn\n  obtain ⟨s, hts, hsn⟩ := Infinite.exists_superset_card_eq t n ht\n  refine ⟨s, hsn, fun hs => triangle_not_collinear (hs.subset ?_)⟩\n  intro p hp\n  apply hts\n  simpa [t] using hp\n\n/-- The infimum defining $f(n)$ is attained when $n\\geq3$. -/\n@[category API, AMS 5 51]\ntheorem f_attained {n : ℕ} (hn : 3 ≤ n) :\n    ∃ s : Finset ℝ², s.card = n ∧ ¬ Collinear ℝ (s : Set ℝ²) ∧\n      (ordinaryLines s).card = f n := by\n  obtain ⟨s, hs, hcol⟩ := exists_configuration hn\n  apply csInf_mem (s := {m : ℕ | ∃ s : Finset ℝ²,\n    s.card = n ∧ ¬ Collinear ℝ (s : Set ℝ²) ∧ (ordinaryLines s).card = m})\n  exact ⟨(ordinaryLines s).card, s, hs, hcol, rfl⟩\n\n/-- The infimum is exactly the largest uniform lower bound over all configurations. -/\n@[category API, AMS 5 51]\ntheorem le_f_iff {n m : ℕ} (hn : 3 ≤ n) :\n    m ≤ f n ↔ ∀ s : Finset ℝ², s.card = n → ¬ Collinear ℝ (s : Set ℝ²) →\n      m ≤ (ordinaryLines s).card := by\n  constructor\n  · exact fun h s hs hc => h.trans (f_le hs hc)\n  · intro h\n    obtain ⟨s, hs, hc, hcard⟩ := f_attained hn\n    simpa [hcard] using h s hs hc\n\n/-- The Sylvester–Gallai theorem states that $f(n)\\geq1$. -/\n@[category research solved, AMS 5 51]\ntheorem erdos_210.variants.sylvester_gallai {n : ℕ} (hn : 3 ≤ n) : 1 ≤ f n := by\n  apply (le_f_iff hn).mpr\n  intro s _ hs\n  exact (ordinaryLines_nonempty hs).card_pos\n\n/-- The bound of Kelly–Moser implies the positive answer to the divergence question. -/\n@[category API, AMS 5 51]\ntheorem tendsto_of_kelly_moser (h : ∀ n : ℕ, 3 ≤ n → 3 * n ≤ 7 * f n) :\n    Tendsto f atTop atTop := by\n  apply tendsto_atTop.mpr\n  intro m\n  filter_upwards [eventually_ge_atTop (max 3 (7 * m))] with n hn\n  have hbound := h n (le_trans (le_max_left _ _) hn)\n  have hn' := le_trans (le_max_right _ _) hn\n  omega\n\n/-- The sufficiently-large $n/2$ bound implies divergence. -/\n@[category API, AMS 5 51]\ntheorem tendsto_of_green_tao (h : ∀ᶠ n : ℕ in atTop, n ≤ 2 * f n) : Tendsto f atTop atTop := by\n  apply tendsto_atTop.mpr\n  intro m\n  filter_upwards [h, eventually_ge_atTop (2 * m)] with n hn hm\n  omega\n\n/-- Points used for a configuration with all but one point on a single line. -/\ndef axisPoint (i : ℕ) : ℝ² := !₂[(i : ℝ), 0]\n\n/-- The point off that line. -/\ndef apex : ℝ² := !₂[(0 : ℝ), 1]\n\n/-- The near-pencil configuration consists of $n-1$ points on the horizontal axis and an apex. -/\nnoncomputable def nearPencil (n : ℕ) : Finset ℝ² := by\n  classical\n  exact insert apex ((Finset.range (n - 1)).image axisPoint)\n\n/-- Distinct indices give distinct axis points. -/\n@[category API, AMS 5 51]\ntheorem axisPoint_injective : Function.Injective axisPoint := by\n  intro i j h\n  have := congrArg (fun p : ℝ² => p 0) h\n  simpa [axisPoint] using this\n\n/-- The apex is distinct from every axis point. -/\n@[category API, AMS 5 51]\ntheorem apex_ne_axisPoint (i : ℕ) : apex ≠ axisPoint i := by\n  intro h\n  have := congrArg (fun p : ℝ² => p 1) h\n  norm_num [apex, axisPoint] at this\n\n/-- Each axis point is on the horizontal line. -/\n@[category API, AMS 5 51]\ntheorem axisPoint_mem (i : ℕ) : axisPoint i ∈ line[ℝ, axisPoint 0, axisPoint 1] := by\n  apply mem_affineSpan_pair_iff_exists_lineMap_eq.mpr\n  refine ⟨(i : ℝ), ?_⟩\n  ext j\n  fin_cases j <;> simp [axisPoint, AffineMap.lineMap_apply]\n\n/-- The near-pencil construction has the requested cardinality. -/\n@[category API, AMS 5 51]\ntheorem nearPencil_card {n : ℕ} (hn : 1 ≤ n) : (nearPencil n).card = n := by\n  classical\n  have hap : apex ∉ (Finset.range (n - 1)).image axisPoint := by\n    simp only [Finset.mem_image]\n    rintro ⟨i, _, hi⟩\n    exact apex_ne_axisPoint i hi.symm\n  rw [nearPencil, Finset.card_insert_of_notMem hap, Finset.card_image_of_injective _\n    axisPoint_injective, Finset.card_range]\n  omega\n\n/-- For $n\\geq3$, the near-pencil construction contains a noncollinear triangle. -/\n@[category API, AMS 5 51]\ntheorem nearPencil_not_collinear {n : ℕ} (hn : 3 ≤ n) :\n    ¬ Collinear ℝ (nearPencil n : Set ℝ²) := by\n  classical\n  intro h\n  apply triangle_not_collinear\n  apply h.subset\n  intro p hp\n  simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hp\n  have haxis (i : ℕ) (hi : i < n - 1) : axisPoint i ∈ nearPencil n := by\n    simp only [nearPencil, Finset.mem_insert, Finset.mem_image]\n    exact Or.inr ⟨i, Finset.mem_range.mpr hi, rfl⟩\n  rcases hp with rfl | rfl | rfl\n  · simpa [axisPoint] using haxis 0 (by omega)\n  · simpa [axisPoint] using haxis 1 (by omega)\n  · change apex ∈ nearPencil n\n    simp [nearPencil]\n\nopen scoped Classical in\n/-- Every ordinary line of a near-pencil is either horizontal or joins an axis point to the apex. -/\n@[category API, AMS 5 51]\ntheorem ordinaryLines_nearPencil_subset (n : ℕ) :\n    ordinaryLines (nearPencil n) ⊆\n      insert (line[ℝ, axisPoint 0, axisPoint 1])\n        (((Finset.range (n - 1)).image axisPoint).image fun p => line[ℝ, apex, p]) := by\n  intro L hL\n  obtain ⟨⟨a, ha, b, hb, hab, rfl⟩, _⟩ := mem_ordinaryLines.mp hL\n  simp only [nearPencil, Finset.mem_insert] at ha hb\n  rcases ha with rfl | ha\n  · rcases hb with rfl | hb\n    · exact (hab rfl).elim\n    · exact Finset.mem_insert_of_mem (Finset.mem_image.mpr ⟨b, hb, rfl⟩)\n  · rcases hb with rfl | hb\n    · exact Finset.mem_insert_of_mem\n        (Finset.mem_image.mpr ⟨a, ha, AffineSubspace.affineSpan_pair_comm⟩)\n    · obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp ha\n      obtain ⟨j, _, rfl⟩ := Finset.mem_image.mp hb\n      have heq := affineSpan_pair_eq_of_mem_of_mem_of_ne\n        (axisPoint_mem i) (axisPoint_mem j) hab\n      exact Finset.mem_insert.mpr (Or.inl heq)\n\n/-- The near-pencil construction has at most $n$ ordinary lines. -/\n@[category API, AMS 5 51]\ntheorem ordinaryLines_nearPencil_le {n : ℕ} (hn : 1 ≤ n) :\n    (ordinaryLines (nearPencil n)).card ≤ n := by\n  classical\n  calc\n    (ordinaryLines (nearPencil n)).card ≤ _ := Finset.card_le_card (ordinaryLines_nearPencil_subset n)\n    _ ≤ (((Finset.range (n - 1)).image axisPoint).image\n      fun p => line[ℝ, apex, p]).card + 1 := Finset.card_insert_le _ _\n    _ ≤ ((Finset.range (n - 1)).image axisPoint).card + 1 :=\n      Nat.add_le_add_right Finset.card_image_le 1\n    _ ≤ (Finset.range (n - 1)).card + 1 := Nat.add_le_add_right Finset.card_image_le 1\n    _ = n := by rw [Finset.card_range]; omega\n\n/-- An explicit near-pencil gives the linear upper bound $f(n)\\leq n$. -/\n@[category research solved, AMS 5 51]\ntheorem erdos_210.upper_bound {n : ℕ} (hn : 3 ≤ n) : f n ≤ n :=\n  (f_le (nearPencil_card (by omega)) (nearPencil_not_collinear hn)).trans\n    (ordinaryLines_nearPencil_le (by omega))\n\n/-- How fast does $f(n)$ tend to infinity? Kelly–Moser [KeMo58] and the near-pencil\nconstruction show that its growth is linear. -/\n@[category research solved, AMS 5 51]\ntheorem erdos_210.parts.ii :\n    (fun n : ℕ => (f n : ℝ)) =Θ[atTop] (fun n : ℕ => (n : ℝ)) := by\n  sorry\n\n/-- The proved upper bound is the upper half of the linear-growth assertion. -/\n@[category API, AMS 5 51]\ntheorem f_isBigO : (fun n : ℕ => (f n : ℝ)) =O[atTop] (fun n : ℕ => (n : ℝ)) := by\n  apply Asymptotics.IsBigO.of_bound 1\n  filter_upwards [eventually_ge_atTop 3] with n hn\n  simpa using (Nat.cast_le.mpr (erdos_210.upper_bound hn) : (f n : ℝ) ≤ (n : ℝ))\n\n/-- Kelly–Moser and the explicit upper construction together imply linear growth. -/\n@[category API, AMS 5 51]\ntheorem linear_growth_of_kelly_moser (h : ∀ n : ℕ, 3 ≤ n → 3 * n ≤ 7 * f n) :\n    (fun n : ℕ => (f n : ℝ)) =Θ[atTop] (fun n : ℕ => (n : ℝ)) := by\n  refine ⟨f_isBigO, Asymptotics.IsBigO.of_bound 7 ?_⟩\n  filter_upwards [eventually_ge_atTop 3] with n hn\n  have hb := h n hn\n  have hb' : n ≤ 7 * f n := by omega\n  have hr : (n : ℝ) ≤ 7 * (f n : ℝ) := by exact_mod_cast hb'\n  simpa using hr\n\n/-- The Green–Tao bound likewise implies linear growth. -/\n@[category API, AMS 5 51]\ntheorem linear_growth_of_green_tao (h : ∀ᶠ n : ℕ in atTop, n ≤ 2 * f n) :\n    (fun n : ℕ => (f n : ℝ)) =Θ[atTop] (fun n : ℕ => (n : ℝ)) := by\n  refine ⟨f_isBigO, Asymptotics.IsBigO.of_bound 2 ?_⟩\n  filter_upwards [h] with n hn\n  have hr : (n : ℝ) ≤ 2 * (f n : ℝ) := by exact_mod_cast hn\n  simpa using hr\n\n/-- Fewer than three points are collinear. -/\n@[category API, AMS 5 51]\ntheorem collinear_of_card_lt_three {s : Finset ℝ²} (hs : s.card < 3) :\n    Collinear ℝ (s : Set ℝ²) := by\n  classical\n  have hc : s.card = 0 ∨ s.card = 1 ∨ s.card = 2 := by omega\n  rcases hc with hc | hc | hc\n  · have he : s = ∅ := Finset.card_eq_zero.mp hc\n    simpa [he] using collinear_empty ℝ ℝ²\n  · obtain ⟨a, rfl⟩ := Finset.card_eq_one.mp hc\n    simpa using collinear_singleton ℝ a\n  · obtain ⟨a, b, _, rfl⟩ := Finset.card_eq_two.mp hc\n    simpa using collinear_pair ℝ a b\n\n/-- The definition uses the default value zero where no noncollinear configuration exists. -/\n@[category API, AMS 5 51]\ntheorem f_eq_zero_of_lt_three {n : ℕ} (hn : n < 3) : f n = 0 := by\n  have he : {m : ℕ | ∃ s : Finset ℝ²,\n      s.card = n ∧ ¬ Collinear ℝ (s : Set ℝ²) ∧ (ordinaryLines s).card = m} = ∅ := by\n    apply Set.eq_empty_iff_forall_notMem.mpr\n    rintro m ⟨s, hs, hc, _⟩\n    exact hc (collinear_of_card_lt_three (by omega))\n  simp [f, he]\n\n/-- Kelly–Moser's extremal-function formulation is equivalent to its configuration formulation. -/\n@[category API, AMS 5 51]\ntheorem kelly_moser_iff : (∀ n : ℕ, 3 ≤ n → 3 * n ≤ 7 * f n) ↔\n    ∀ s : Finset ℝ², ¬ Collinear ℝ (s : Set ℝ²) →\n      3 * s.card ≤ 7 * (ordinaryLines s).card := by\n  constructor\n  · intro h s hs\n    have hn : 3 ≤ s.card := by\n      by_contra! hn\n      exact hs (collinear_of_card_lt_three hn)\n    exact (h s.card hn).trans (Nat.mul_le_mul_left 7 (f_le rfl hs))\n  · intro h n hn\n    obtain ⟨s, hs, hc, hf⟩ := f_attained hn\n    simpa [hs, hf] using h s hc\n\n/-- The eventual Green–Tao bound has a single threshold uniform over all configurations. -/\n@[category API, AMS 5 51]\ntheorem green_tao_iff : (∀ᶠ n : ℕ in atTop, n ≤ 2 * f n) ↔\n    ∃ N : ℕ, 3 ≤ N ∧ ∀ s : Finset ℝ², N ≤ s.card →\n      ¬ Collinear ℝ (s : Set ℝ²) → s.card ≤ 2 * (ordinaryLines s).card := by\n  constructor\n  · intro h\n    obtain ⟨N, hN⟩ := eventually_atTop.mp h\n    refine ⟨max 3 N, le_max_left _ _, ?_⟩\n    intro s hs hc\n    exact (hN s.card ((le_max_right _ _).trans hs)).trans\n      (Nat.mul_le_mul_left 2 (f_le rfl hc))\n  · rintro ⟨N, hN, h⟩\n    apply eventually_atTop.mpr\n    refine ⟨N, ?_⟩\n    intro n hn\n    obtain ⟨s, hs, hc, hf⟩ := f_attained (hN.trans hn)\n    simpa [hs, hf] using h s (by simpa [hs] using hn) hc\n\n/-- A sharp extremal guarantee is uniquely characterized by uniform validity and attainment. -/\n@[category API, AMS 5 51]\ntheorem f_unique {n m : ℕ} (hn : 3 ≤ n)\n    (hlower : ∀ s : Finset ℝ², s.card = n → ¬ Collinear ℝ (s : Set ℝ²) →\n      m ≤ (ordinaryLines s).card)\n    (hattain : ∃ s : Finset ℝ², s.card = n ∧ ¬ Collinear ℝ (s : Set ℝ²) ∧\n      (ordinaryLines s).card = m) : m = f n := by\n  apply Nat.le_antisymm ((le_f_iff hn).mpr hlower)\n  obtain ⟨s, hs, hc, hm⟩ := hattain\n  simpa [hm] using f_le hs hc\n\n/-- The two sharp eventual bounds imply the exact value on sufficiently large even inputs. -/\n@[category API, AMS 5 51]\ntheorem eventually_even_exact\n    (hl : ∀ᶠ n : ℕ in atTop, n ≤ 2 * f n)\n    (hu : ∀ᶠ n : ℕ in atTop, Even n → 2 * f n ≤ n) :\n    ∀ᶠ n : ℕ in atTop, Even n → 2 * f n = n := by\n  filter_upwards [hl, hu] with n hl hu\n  intro hn\n  exact Nat.le_antisymm (hu hn) hl\n\nend Erdos210\n",
  "statement_hash": "f9431b77545ea1cd4f67bf05af58967108ad18516b0de227357a8b71390e43a8",
  "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."
}