{
  "id": "566",
  "ident": "NS.00566",
  "slug": "erdos-107--su-bound",
  "title": "Erdős Problem 107 · su_bound",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Suk [Su17] proved\n$$\n  f(n) ≤ 2^{(1+o(1))n}.\n$$\n\n[Su17] Suk, Andrew, _On the Erdős-Szekeres convex polygon problem_.\n  J. Amer. Math. Soc. (2017), 1047-1053.",
  "subjects": [
    "math.MG",
    "msc:52"
  ],
  "tags": [],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos107.variants.su_bound",
  "statement_lean": "theorem su_bound :\n    ∃ r : ℕ → ℝ, r =o[atTop] (fun n => (n : ℝ)) ∧\n      ∀ n ≥ 3, (f n : ℝ) ≤ 2^(n + r n)",
  "challenge_source": "/-\nCopyright 2025 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 107\n\n*References:*\n- [erdosproblems.com/107](https://www.erdosproblems.com/107)\n- [Wikipedia](https://en.wikipedia.org/wiki/Happy_ending_problem)\n-/\n\n@[expose] public section\n\nopen Filter\nopen EuclideanGeometry\n\nnamespace Erdos107\n\n/-- The set of $N$ such that any $N$ points in the plane, no three on a line,\ncontain a convex $n$-gon. -/\ndef cardSet (n : ℕ) := { N | ∀ (pts : Finset ℝ²), pts.card = N → NonTrilinear (pts : Set ℝ²) →\n  HasConvexNGon n pts }\n\n/-- The function $f(n)$ specified in `erdos_107`. -/\nnoncomputable def f (n : ℕ) : ℕ :=\n  sInf (cardSet n)\n\n/--\nLet $f(n)$ be minimal such that any $f(n)$ points in $ℝ^2$, no three on a line,\ncontain $n$ points which form the vertices of a convex $n$-gon.\nProve that $f(n) = 2^{n-2} + 1$.\n-/\n@[category research open, question, AMS 52]\ntheorem erdos_107 : ∀ n ≥ 3, f n = 2^(n - 2) + 1 := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/-- For every $n ≥ 3$, there exists $N$ such that any $N$ points, no three on a line,\ncontain a convex $n$-gon. -/\n@[category research solved, AMS 52, formal_proof using lean4 at\n  \"https://github.com/linrock/math-proofs/blob/cd3cf0b176e95209584bf35555a7c0e501255f6e/erdos-107/Solution.lean#L59\"]\ntheorem nonempty_cardSet : ∀ n ≥ 3, (cardSet n).Nonempty := by\n  sorry\n\n/-- Depending on details of definitions,\nthe statement is false or trivial for $n < 3$. -/\n@[category test, AMS 52]\ntheorem f_zero_eq : f 0 = 0 := by\n  have : ∀ P, HasConvexNGon 0 P := by\n    intro; use ∅; simp [ConvexIndep]\n  simp [f, cardSet, this]\n\n/-- Three distinct non-collinear points form a convex-independent set. -/\n@[category API, AMS 52]\nprivate lemma convexIndep_triple_of_not_collinear {a b c : ℝ²}\n    (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c)\n    (hcoll : ¬ Collinear ℝ ({a, b, c} : Set ℝ²)) :\n    ConvexIndep ({a, b, c} : Set ℝ²) := by\n  intro x hx hmem\n  -- The point `x` lies in the affine span of `{a, b, c} \\ {x}` because it\n  -- lies in the convex hull of that two-element set.\n  apply hcoll\n  have hx_aff : x ∈ affineSpan ℝ (({a, b, c} : Set ℝ²) \\ {x}) :=\n    convexHull_subset_affineSpan _ hmem\n  rw [show ({a, b, c} : Set ℝ²) = insert x (({a, b, c} : Set ℝ²) \\ {x}) from\n        (Set.insert_sdiff_self_of_mem hx).symm,\n      collinear_insert_iff_of_mem_affineSpan hx_aff]\n  -- The two-element complement is collinear.\n  simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hx\n  rcases hx with rfl | rfl | rfl\n  · rw [show ({x, b, c} : Set ℝ²) \\ {x} = ({b, c} : Set ℝ²) by ext; aesop]\n    exact collinear_pair ℝ b c\n  · rw [show ({a, x, c} : Set ℝ²) \\ {x} = ({a, c} : Set ℝ²) by ext; aesop]\n    exact collinear_pair ℝ a c\n  · rw [show ({a, b, x} : Set ℝ²) \\ {x} = ({a, b} : Set ℝ²) by ext; aesop]\n    exact collinear_pair ℝ a b\n\n@[category test, AMS 52]\ntheorem f_three_eq : f 3 = 3 := by\n  -- The substantive bound: 3 ∈ cardSet 3.\n  have hmem3 : (3 : ℕ) ∈ cardSet 3 := by\n    intro pts hpts hnontri\n    obtain ⟨a, b, c, hab, hac, hbc, rfl⟩ := Finset.card_eq_three.mp hpts\n    refine ⟨{a, b, c}, by simp [hab, hac, hbc], subset_refl _, ?_⟩\n    have hcoerce : (({a, b, c} : Finset ℝ²) : Set ℝ²) = ({a, b, c} : Set ℝ²) := by simp\n    have hmem : ∀ {y : ℝ²}, y ∈ ({a, b, c} : Set ℝ²) →\n        y ∈ (({a, b, c} : Finset ℝ²) : Set ℝ²) := fun h => hcoerce ▸ h\n    have hnc : ¬ Collinear ℝ ({a, b, c} : Set ℝ²) :=\n      hnontri (hmem (by simp)) (hmem (by simp)) (hmem (by simp)) hab hbc hac\n    rw [hcoerce]\n    exact convexIndep_triple_of_not_collinear hab hac hbc hnc\n  refine le_antisymm (Nat.sInf_le hmem3) (le_csInf ⟨3, hmem3⟩ fun N hN => ?_)\n  -- A set with fewer than 3 points contains no 3-element subset.\n  by_contra! hlt\n  let f : ℕ → ℝ² := fun i => EuclideanSpace.single 0 (i : ℝ)\n  let pts : Finset ℝ² := (Finset.range N).image f\n  have hinj : Function.Injective f := fun i j hij => by\n    have := congrArg (fun v : ℝ² => v 0) hij; simpa [f] using this\n  have hpts_card : pts.card = N := by\n    simp [pts, Finset.card_image_of_injOn hinj.injOn]\n  have hnontri : NonTrilinear (pts : Set ℝ²) := by\n    apply Set.triplewise_of_encard_lt\n    rw [Set.encard_coe_eq_coe_finsetCard, hpts_card]\n    exact_mod_cast hlt\n  obtain ⟨S, hScard, hSsub, _⟩ := hN pts hpts_card hnontri\n  have : S.card ≤ pts.card := Finset.card_le_card (by exact_mod_cast hSsub)\n  omega\n\nnamespace variants\n\n/--\nErdős and Szekeres proved the bounds\n$$\n  2^{n-2} + 1 ≤ f(n) ≤ \\binom{2n-4}{n-2} + 1\n$$\n([ErSz60] and [ErSz35] respectively).\n\n[ErSz60] Erdős, P. and Szekeres, G., _On some extremum problems in elementary geometry_.\n  Ann. Univ. Sci. Budapest. Eötvös Sect. Math. (1960/61), 53-62.\n\n[ErSz35] Erdős, P. and Szekeres, G., _A combinatorial problem in geometry_.\n  Compos. Math. (1935), 463-470.\n-/\n@[category research solved, AMS 52]\ntheorem ersz_bounds :\n    ∀ n ≥ 3, 2^(n - 2) + 1 ≤ f n ∧ f n ≤ Nat.choose (2 * n - 4) (n - 2) + 1 := by\n  sorry\n\n/--\nSuk [Su17] proved\n$$\n  f(n) ≤ 2^{(1+o(1))n}.\n$$\n\n[Su17] Suk, Andrew, _On the Erdős-Szekeres convex polygon problem_.\n  J. Amer. Math. Soc. (2017), 1047-1053.\n-/\n@[category research solved, AMS 52]\ntheorem su_bound :\n    ∃ r : ℕ → ℝ, r =o[atTop] (fun n => (n : ℝ)) ∧\n      ∀ n ≥ 3, (f n : ℝ) ≤ 2^(n + r n) := by\n  sorry\n\n/--\nThe current best bound is due to Holmsen, Mojarrad, Pach, and Tardos [HMPT20],\nwho prove\n$$\n  f(n) ≤ 2^{n+O(\\sqrt{n\\log n})}.\n$$\n\n[HMPT20] Holmsen, Andreas F. and Mojarrad, Hossein Nassajian and Pach, János and Tardos, Gábor,\n  _Two extensions of the Erdős-Szekeres problem_. J. Eur. Math. Soc. (JEMS) (2020), 3981-3995.\n-/\n@[category research solved, AMS 52]\ntheorem hmpt_bound :\n    ∃ r : ℕ → ℝ, r =O[atTop] (fun n => Real.sqrt (n * Real.log n)) ∧\n      ∀ n ≥ 3, (f n : ℝ) ≤ 2^(n + r n) := by\n  sorry\n\nend Erdos107.variants\n",
  "statement_hash": "43f42ea2429d2d7590e86709adb49d674f197d05bd5060b088812afc3da92032",
  "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."
}