{
  "id": "2149",
  "ident": "NS.02149",
  "slug": "erdos-44--example-sidon-set",
  "title": "Erdős Problem 44: Extending Sidon Sets · example_sidon_set",
  "status": "textbook",
  "statement_status": "reviewed",
  "statement_md": "The set `{1, 2, 4, 8, 13}` is a Sidon set in `{1, ..., 13}`.",
  "subjects": [
    "math.CO",
    "math.NT",
    "msc:05",
    "msc:11"
  ],
  "tags": [],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos44.example_sidon_set",
  "statement_lean": "theorem example_sidon_set : IsSidon ({1, 2, 4, 8, 13} : Set ℕ)",
  "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 44: Extending Sidon Sets\n\n*References:*\n- [erdosproblems.com/44](https://www.erdosproblems.com/44)\n- [Si38] Singer, James, A theorem in finite projective geometry and some applications to number\n  theory. Trans. Amer. Math. Soc. (1938), 377--385.\n-/\n\n@[expose] public section\n\nopen Function Set Finset\n\nnamespace Erdos44\n\n-- Reference: https://arxiv.org/pdf/2103.15850\n/-- The maximum size of a Sidon set in `{1, ..., N}` is less than or equal to `2 * √N`. -/\n@[category textbook, AMS 5 11]\ntheorem maxSidonSubsetCard_icc_bound (N : ℕ) (hN : 1 ≤ N) :\n    maxSidonSubsetCard (Icc 1 N) ≤ 2 * Real.sqrt N := by\n  have key : maxSidonSubsetCard (Finset.Icc 1 N) ^ 2 ≤ 4 * N := by\n    -- Pick a Sidon subset of `{1, ..., N}` of maximal size.\n    obtain ⟨B, hB, hBeq⟩ := Finset.exists_mem_eq_sup\n      ((Finset.Icc 1 N).powerset.filter fun B : Finset ℕ ↦ IsSidon (B : Set ℕ))\n      ⟨∅, by simp [IsSidon]⟩ Finset.card\n    rw [maxSidonSubsetCard, hBeq]\n    simp only [Finset.mem_filter, Finset.mem_powerset] at hB\n    obtain ⟨hsub, hsid⟩ := hB\n    -- Distinct ordered pairs of elements of `B` have distinct differences, and each difference\n    -- lies in `{-N, ..., N}`.\n    have hcard : B.offDiag.card ≤ (Finset.Icc (-(N : ℤ)) N).card := by\n      refine Finset.card_le_card_of_injOn (fun p ↦ (p.1 : ℤ) - p.2) ?_ ?_\n      · rintro ⟨a, b⟩ hab\n        rw [Finset.mem_coe, Finset.mem_offDiag] at hab\n        have ha' := Finset.mem_Icc.mp (hsub hab.1)\n        have hb' := Finset.mem_Icc.mp (hsub hab.2.1)\n        simp only [Finset.mem_coe, Finset.mem_Icc]\n        omega\n      · rintro ⟨a, b⟩ ha ⟨c, d⟩ hc hac\n        rw [Finset.mem_coe, Finset.mem_offDiag] at ha hc\n        simp only at hac\n        have hsum : a + d = c + b := by omega\n        rcases hsid a ha.1 c hc.1 d hc.2.1 b ha.2.1 hsum with ⟨h1, h2⟩ | ⟨h1, h2⟩\n        · simp [h1, h2]\n        · exact absurd h1 ha.2.2\n    have hIcc : (Finset.Icc (-(N : ℤ)) N).card = 2 * N + 1 := by\n      rw [Int.card_Icc]\n      omega\n    rw [Finset.offDiag_card, hIcc] at hcard\n    have hle : B.card ≤ N := by simpa using Finset.card_le_card hsub\n    rcases Nat.eq_zero_or_pos B.card with h0 | hpos\n    · simp [h0]\n    have hkk : B.card ≤ B.card * B.card := Nat.le_mul_of_pos_left _ hpos\n    calc B.card ^ 2 = B.card * B.card := sq B.card\n      _ ≤ 2 * N + 1 + B.card := by omega\n      _ ≤ 4 * N := by omega\n  have h1 : ((maxSidonSubsetCard (Finset.Icc 1 N) : ℝ)) ^ 2 ≤ 4 * N := by exact_mod_cast key\n  have h2 : (2 : ℝ) * Real.sqrt N = Real.sqrt (4 * N) := by\n    rw [show (4 : ℝ) * N = 2 ^ 2 * N by ring, Real.sqrt_mul (by positivity),\n      Real.sqrt_sq (by norm_num)]\n  rw [h2, ← Real.sqrt_sq (by positivity : (0 : ℝ) ≤ (maxSidonSubsetCard (Finset.Icc 1 N) : ℝ))]\n  exact Real.sqrt_le_sqrt h1\n\n/--\n**Erdős Problem 44:** Let N ≥ 1 and `A ⊆ {1,…,N}` be a Sidon set. Is it true that, for any ε > 0,\nthere exist M = M(ε) and `B ⊆ {N+1,…,M}` such that `A ∪ B ⊆ {1,…,M}` is a Sidon set\nof size at least `(1−ε)M^{1/2}`?\n\nThis problem asks whether any Sidon set can be extended to achieve a density\narbitrarily close to the optimal density for Sidon sets.\n-/\n@[category research open, question, AMS 5 11]\ntheorem erdos_44 : ∀ᵉ (N ≥ (1 : ℕ)) (A ⊆ Finset.Icc 1 N), IsSidon (A : Set ℕ) →\n    ∀ᵉ (ε > (0 : ℝ)), ∃ᵉ (M > N) (B ⊆ Finset.Icc (N + 1) M),\n      IsSidon (A ∪ B : Set ℕ) ∧ (1 - ε) * Real.sqrt M ≤ (A ∪ B).card := by\n  sorry\n\n/--\nThe case where we start with an empty set (constructing large Sidon sets).\n\nThe answer is yes. Singer [Si38] constructed Sidon sets of size $q + 1$ in\n$\\{1, \\ldots, q^2 + q + 1\\}$ for every prime $q$. Since $p_{n+1}/p_n \\to 1$ for consecutive primes,\nthis gives Sidon sets of size $(1 - o(1))M^{1/2}$ in $\\{1, \\ldots, M\\}$ for every $M$; see\n[erdosproblems.com/30](https://www.erdosproblems.com/30).\n-/\n@[category research solved, question, AMS 5 11]\ntheorem erdos_44.variants.empty_start : ∀ᵉ (ε > (0 : ℝ)), ∀ᶠ (M : ℕ) in Filter.atTop,\n    ∃ᵉ (A ⊆ Finset.Icc 1 M), IsSidon (A : Set ℕ) ∧ (1 - ε) * Real.sqrt M ≤ A.card := by\n  sorry\n\n/-  ## Related results and examples -/\n\n/--\nThe set `{1, 2, 4, 8, 13}` is a Sidon set in `{1, ..., 13}`.\n-/\n@[category textbook, AMS 5 11]\ntheorem example_sidon_set : IsSidon ({1, 2, 4, 8, 13} : Set ℕ) := by\n  intro i₁ hi₁ j₁ hj₁ i₂ hi₂ j₂ hj₂ hsum\n  simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hi₁ hj₁ hi₂ hj₂\n  rcases hi₁ with rfl | rfl | rfl | rfl | rfl <;>\n  rcases hj₁ with rfl | rfl | rfl | rfl | rfl <;>\n  rcases hi₂ with rfl | rfl | rfl | rfl | rfl <;>\n  rcases hj₂ with rfl | rfl | rfl | rfl | rfl <;>\n  simp_all\n\n/--\nFor any `N`, there exists a Sidon set of size at least `√N/2`.\n-/\n@[category textbook, AMS 5 11]\ntheorem sidon_set_lower_bound (N : ℕ) (hN : 1 ≤ N) :\n    ∃ᵉ (A ⊆ Finset.Icc 1 N), IsSidon (A : Set ℕ) ∧ Real.sqrt N / 2 ≤ A.card := by\n  sorry\n\n/--\nThe greedy construction gives a Sidon set `A ⊆ {1, ..., N}` of size at least $N^{1/3}$,\nstated here as $N \\le |A|^3$. See Section 1 of [arXiv:2103.15850](https://arxiv.org/abs/2103.15850).\n-/\n@[category textbook, AMS 5 11]\ntheorem greedy_sidon_construction (N : ℕ) (hN : 1 ≤ N) :\n    ∃ᵉ (A ⊆ Finset.Icc 1 N), IsSidon (A : Set ℕ) ∧ N ≤ A.card ^ 3 := by\n  sorry\n\nend Erdos44\n",
  "statement_hash": "11971bb47a0bedb3c23146566739d71f6c995ef5ec145654c579a48e93c55015",
  "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."
}