{
  "id": "1603",
  "ident": "NS.01603",
  "slug": "erdos-30",
  "title": "Erdős Problem 30",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Is it true that, for every $\\varepsilon > 0$, $h(N) = \\sqrt N + O_{\\varepsilon}(N^\\varepsilon)$",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos30.erdos_30",
  "statement_lean": "theorem erdos_30 :\n    ∀ᵉ (ε > 0), (fun N => h N - (N : Real).sqrt) =O[atTop] fun N => (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 30\n\n*References:*\n- [erdosproblems.com/30](https://www.erdosproblems.com/30)\n- [ErTu41] Erdős, P. and Turán, P., *On a problem of Sidon in additive number theory, and on\n  some related problems*. J. London Math. Soc. 16 (1941), 212-215.\n- [Li69] Lindström, B., *An inequality for $B_2$-sequences*. J. Combinatorial Theory 6 (1969),\n  211-212.\n- [Si38] Singer, J., *A theorem in finite projective geometry and some applications to number\n  theory*. Trans. Amer. Math. Soc. 43 (1938), 377-385.\n- [BFR23] Balogh, J., Füredi, Z. and Roy, S., *An upper bound on the size of Sidon sets*.\n  Amer. Math. Monthly 130 (2023), 437-445.\n- [OB22] O'Bryant, K., *On the size of finite Sidon sets*.\n  [arXiv:2207.07800](https://arxiv.org/abs/2207.07800) (2022).\n- [CHO25] Carter, D., Hunter, Z. and O'Bryant, K., *On the diameter of finite Sidon sets*.\n  Acta Math. Hungar. 175 (2025), 108-126.\n\nSee also [Ben Green's Open Problem 31](https://people.maths.ox.ac.uk/greenbj/papers/open-problems.pdf)\n(formalised in `FormalConjectures/GreensOpenProblems/31.lean`).\n-/\n\n@[expose] public section\n\nnamespace Erdos30\n\n/--\nLet $h(N)$ be the maximum size of a Sidon set in $\\{1, \\dots, N\\}$.\n-/\nnoncomputable abbrev h (N : ℕ) : ℕ := Finset.maxSidonSubsetCard (Finset.Icc 1 N)\n\n\nopen Filter\nopen scoped Asymptotics Pointwise\n\n/--\nIs it true that, for every $\\varepsilon > 0$, $h(N) = \\sqrt N + O_{\\varepsilon}(N^\\varepsilon)$\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_30 :\n    ∀ᵉ (ε > 0), (fun N => h N - (N : Real).sqrt) =O[atTop] fun N => (N : ℝ)^(ε : ℝ) := by\n  sorry\n\n/--\nA stronger conjecture: is it true that $h(N) = \\sqrt N + O(1)$?\nErdős thought this was perhaps too optimistic.\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_30.variants.O_one :\n    (fun N => h N - (N : ℝ).sqrt) =O[atTop] fun _ => (1 : ℝ) := by\n  sorry\n\n/--\nErdős and Turán [ErTu41] proved $h(N) \\le \\sqrt N + O(N^{1/4})$.\n\nThis is an upper bound only. A statement with `=O` would also assert the lower bound\n$h(N) \\ge \\sqrt N - O(N^{1/4})$, which is not part of this result.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_30.variants.erdos_turan :\n    ∃ C : ℝ, ∀ᶠ N in atTop, (h N : ℝ) ≤ (N : ℝ).sqrt + C * (N : ℝ) ^ (4⁻¹ : ℝ) := by\n  sorry\n\n/--\nThe proofs of Erdős–Turán [ErTu41] and Lindström [Li69] in fact give, for all $N$,\n$h(N) \\le N^{1/2} + N^{1/4} + 1$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_30.variants.lindstrom (N : ℕ) :\n    (h N : ℝ) ≤ (N : ℝ).sqrt + (N : ℝ) ^ (4⁻¹ : ℝ) + 1 := by\n  sorry\n\n/--\nBalogh, Füredi and Roy [BFR23] proved $h(N) \\le N^{1/2} + 0.998 N^{1/4}$ for all sufficiently\nlarge $N$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_30.variants.balogh_furedi_roy :\n    ∀ᶠ N in atTop, (h N : ℝ) ≤ (N : ℝ).sqrt + (0.998 : ℝ) * (N : ℝ) ^ (4⁻¹ : ℝ) := by\n  sorry\n\n/--\nO'Bryant [OB22] proved $h(N) \\le N^{1/2} + 0.99703 N^{1/4}$ for all sufficiently large $N$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_30.variants.obryant :\n    ∀ᶠ N in atTop, (h N : ℝ) ≤ (N : ℝ).sqrt + (0.99703 : ℝ) * (N : ℝ) ^ (4⁻¹ : ℝ) := by\n  sorry\n\n/--\nCarter, Hunter and O'Bryant [CHO25] proved $h(N) \\le N^{1/2} + 0.98183 N^{1/4} + O(1)$.\nThis is the current record upper bound.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_30.variants.carter_hunter_obryant :\n    ∃ C : ℝ, ∀ᶠ N in atTop,\n      (h N : ℝ) ≤ (N : ℝ).sqrt + (0.98183 : ℝ) * (N : ℝ) ^ (4⁻¹ : ℝ) + C := by\n  sorry\n\n/--\nSinger's construction [Si38] shows $h(N) \\ge (1 - o(1)) N^{1/2}$ for all $N$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_30.variants.singer :\n    ∀ ε > (0 : ℝ), ∀ᶠ N : ℕ in atTop, (1 - ε) * (N : ℝ).sqrt ≤ h N := by\n  sorry\n\n/--\nCombining Singer's lower bound [Si38] with the Erdős–Turán upper bound [ErTu41]:\n$h(N) \\sim N^{1/2}$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_30.variants.isEquivalent_sqrt :\n    (fun N => (h N : ℝ)) ~[atTop] fun N => (N : ℝ).sqrt := by\n  sorry\n\n/--\nThe counting argument of Erdős and Turán [ErTu41]: a Sidon set $A \\subseteq \\{0, \\dots, N\\}$\nhas $|A|(|A| - 1) \\le 2N$, because the $|A|(|A|-1)/2$ positive differences of $A$ are distinct\nand lie in $\\{1, \\dots, N\\}$.\n-/\n@[category textbook, AMS 11]\ntheorem erdos_30.variants.elementary_difference_count (A : Finset ℕ) (N : ℕ)\n    (hS : IsSidon (A : Set ℕ)) (hA : A ⊆ Finset.range (N + 1)) :\n    A.card * (A.card - 1) ≤ 2 * N := by\n  have h_inj : Set.InjOn (fun p : ℕ × ℕ ↦ p.1 - p.2)\n      (({p ∈ A ×ˢ A | p.2 < p.1} : Finset (ℕ × ℕ)) : Set (ℕ × ℕ)) := by\n    intro ⟨a₁, b₁⟩ h₁ ⟨a₂, b₂⟩ h₂ heq\n    simp only [Finset.mem_coe, Finset.mem_filter, Finset.mem_product] at h₁ h₂\n    have := Finset.IsSidon.eq_of_tsub hS h₁.1.1 h₁.1.2 h₂.1.1 h₂.1.2 h₁.2 h₂.2 heq\n    exact Prod.ext this.1 this.2\n  have h_sub : {p ∈ A ×ˢ A | p.2 < p.1}.image (fun p : ℕ × ℕ ↦ p.1 - p.2) ⊆ Finset.Icc 1 N := by\n    simp only [Finset.image_subset_iff, Finset.mem_filter, Finset.mem_product, Finset.mem_Icc,\n      and_imp, Prod.forall]\n    intro a b ha _ hlt\n    have := Finset.mem_range.mp (hA ha)\n    lia\n  have := Finset.card_le_card h_sub\n  rw [Finset.card_image_of_injOn h_inj, Nat.card_Icc] at this\n  have := Finset.two_mul_card_product_filter_gt A\n  lia\n\n/-- For a Sidon set $A$, $|A + A| = |A|(|A|+1)/2$: the sums $a + b$ with $a \\le b$ are pairwise\ndistinct [ErTu41]. -/\n@[category textbook, AMS 11]\ntheorem erdos_30.variants.distinct_sums_card (A : Finset ℕ) (hS : IsSidon (A : Set ℕ)) :\n    (A + A).card = A.card * (A.card + 1) / 2 := by\n  rw [Set.isSidon_iff_le] at hS\n  have hAA : A + A = {p ∈ A ×ˢ A | p.1 ≤ p.2}.image (fun p ↦ p.1 + p.2) := by\n    ext x\n    simp only [Finset.mem_add, Finset.mem_image, Finset.mem_filter, Finset.mem_product, Prod.exists]\n    constructor\n    · rintro ⟨a, ha, b, hb, rfl⟩\n      rcases le_total a b with hab | hba\n      · exact ⟨a, b, ⟨⟨ha, hb⟩, hab⟩, rfl⟩\n      · exact ⟨b, a, ⟨⟨hb, ha⟩, hba⟩, add_comm b a⟩\n    · rintro ⟨a, b, ⟨⟨ha, hb⟩, _⟩, rfl⟩\n      exact ⟨a, ha, b, hb, rfl⟩\n  have h_inj : Set.InjOn (fun p : ℕ × ℕ ↦ p.1 + p.2)\n      (({p ∈ A ×ˢ A | p.1 ≤ p.2} : Finset (ℕ × ℕ)) : Set (ℕ × ℕ)) := by\n    intro ⟨a₁, b₁⟩ h₁ ⟨a₂, b₂⟩ h₂ heq\n    simp only [Finset.mem_coe, Finset.mem_filter, Finset.mem_product] at h₁ h₂\n    have := hS a₁ h₁.1.1 b₁ h₁.1.2 a₂ h₂.1.1 b₂ h₂.1.2 h₁.2 h₂.2 heq\n    exact Prod.ext this.1 this.2\n  have h_split : {p ∈ A ×ˢ A | p.1 ≤ p.2} = {p ∈ A ×ˢ A | p.1 < p.2} ∪ A.diag := by\n    rw [Finset.diag_eq_filter]\n    simp [le_iff_lt_or_eq, Finset.filter_or]\n  have h_disj : Disjoint {p ∈ A ×ˢ A | p.1 < p.2} A.diag := by\n    rw [Finset.diag_eq_filter]\n    exact Finset.disjoint_filter.2 fun _ _ h₁ h₂ ↦ absurd h₂ h₁.ne\n  have h_tri := Finset.two_mul_card_product_filter_lt A\n  have h_le : A.card ≤ A.card * A.card := Nat.le_mul_self _\n  rw [Nat.mul_sub_one] at h_tri\n  rw [hAA, Finset.card_image_of_injOn h_inj, h_split, Finset.card_union_of_disjoint h_disj,\n    Finset.diag_card, mul_add_one]\n  lia\n\n/-- If $A \\subseteq \\{0, \\dots, N\\}$ then $A + A \\subseteq \\{0, \\dots, 2N\\}$. -/\n@[category textbook, AMS 11]\ntheorem erdos_30.variants.distinct_sums_in_range (A : Finset ℕ) (N : ℕ)\n    (hA : A ⊆ Finset.range (N + 1)) :\n    A + A ⊆ Finset.range (2 * N + 1) := by\n  grw [hA, Finset.range_add_range]\n  simp [two_mul]\n\n/--\nThe counting bound of Erdős and Turán [ErTu41] in its sum form: a Sidon set\n$A \\subseteq \\{0, \\dots, N\\}$ has $|A|(|A| + 1)/2 \\le 2N + 1$.\n-/\n@[category textbook, AMS 11]\ntheorem erdos_30.variants.erdos_turan_counting (A : Finset ℕ) (N : ℕ)\n    (hS : IsSidon (A : Set ℕ)) (hA : A ⊆ Finset.range (N + 1)) :\n    A.card * (A.card + 1) / 2 ≤ 2 * N + 1 := by\n  rw [← erdos_30.variants.distinct_sums_card A hS]\n  simpa using Finset.card_le_card (erdos_30.variants.distinct_sums_in_range A N hA)\n\n/--\nA weak form of Lindström's bound [Li69], following from\n`erdos_30.variants.elementary_difference_count`: a Sidon set $A \\subseteq \\{0, \\dots, N\\}$\nhas $|A| \\le \\lfloor \\sqrt{2N} \\rfloor + 1$.\n-/\n@[category textbook, AMS 11]\ntheorem erdos_30.variants.lindstrom_weak (A : Finset ℕ) (N : ℕ)\n    (hS : IsSidon (A : Set ℕ)) (hA : A ⊆ Finset.range (N + 1)) :\n    A.card ≤ Nat.sqrt (2 * N) + 1 := by\n  have h := erdos_30.variants.elementary_difference_count A N hS hA\n  have : (A.card - 1) * (A.card - 1) ≤ 2 * N := (Nat.mul_le_mul_right _ (Nat.sub_le _ _)).trans h\n  have := Nat.le_sqrt.mpr this\n  lia\n\nend Erdos30\n",
  "statement_hash": "d42ca7b6a2ad35089c80647059f55832a9e9e185eaab7079ed0c7f170fff0c24",
  "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."
}