{
  "id": "3500",
  "ident": "NS.03500",
  "slug": "erdos-882",
  "title": "Erdős Problem 882",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "What is the size of the largest $A\\subseteq \\{1,\\ldots,n\\}$ such that in the set\n$$\\left\\{ \\sum_{a\\in S} a : \\emptyset\\neq S\\subseteq A\\right\\}$$\nno two distinct elements divide each other?\n\nA problem of Erdős and Sárközy. The answer is $(1+o(1))\\log_2 n$: the lower bound\n$\\lvert A\\rvert > \\log_2 n - 1$ is achieved by the construction of Erdős, Lev, Rauzy, Sándor\nand Sárközy [ELRSS99] (see `erdos_882.variants.lower_bound`), while\n[Erdős Problem 1](https://www.erdosproblems.com/1) gives\n$\\lvert A\\rvert \\leq \\log_2 n + \\tfrac{1}{2}\\log_2\\log n + O(1)$.",
  "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": "Erdos882.erdos_882",
  "statement_lean": "theorem erdos_882 :\n    Filter.Tendsto (fun n : ℕ => (maxAntichainCard n : ℝ) / Real.logb 2 n)\n      Filter.atTop (nhds 1)",
  "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 882\n\n*References:*\n- [erdosproblems.com/882](https://www.erdosproblems.com/882)\n- [Er98] Erdős, Paul, *Some of my new and almost new problems and results in combinatorial\n  number theory*. Number theory (Eger, 1996) (1998), 169-180.\n- [ELRSS99] Erdős, P., Lev, V., Rauzy, G., Sándor, C. and Sárközy, A., *Greedy algorithm,\n  arithmetic progressions, subset sums and divisibility*. Discrete Math. (1999), 119-135.\n- [Erdős Problem 1](https://www.erdosproblems.com/1) for the upper bound.\n- [Alexeev] Boris Alexeev's sorry-free Lean 4 formalisation of the lower bound,\n  [plby/lean-proofs](https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos882.lean).\n-/\n\n@[expose] public section\n\nopen Finset\n\nnamespace Erdos882\n\n/--\nA finite set `A` of naturals is *subset-sum antichain* if no two distinct nonempty subsets of\n`A` have subset sums dividing one another.\n-/\ndef IsSubsetSumAntichain (A : Finset ℕ) : Prop :=\n  ∀ S₁ ⊆ A, ∀ S₂ ⊆ A, S₁.Nonempty → S₂.Nonempty → S₁ ≠ S₂ →\n    ¬ (∑ a ∈ S₁, a) ∣ (∑ a ∈ S₂, a)\n\n/-- The largest size of a subset-sum antichain contained in `{1, ..., n}`. -/\nnoncomputable def maxAntichainCard (n : ℕ) : ℕ :=\n  sSup {k | ∃ A ⊆ Finset.Icc 1 n, IsSubsetSumAntichain A ∧ A.card = k}\n\n/--\nWhat is the size of the largest $A\\subseteq \\{1,\\ldots,n\\}$ such that in the set\n$$\\left\\{ \\sum_{a\\in S} a : \\emptyset\\neq S\\subseteq A\\right\\}$$\nno two distinct elements divide each other?\n\nA problem of Erdős and Sárközy. The answer is $(1+o(1))\\log_2 n$: the lower bound\n$\\lvert A\\rvert > \\log_2 n - 1$ is achieved by the construction of Erdős, Lev, Rauzy, Sándor\nand Sárközy [ELRSS99] (see `erdos_882.variants.lower_bound`), while\n[Erdős Problem 1](https://www.erdosproblems.com/1) gives\n$\\lvert A\\rvert \\leq \\log_2 n + \\tfrac{1}{2}\\log_2\\log n + O(1)$.\n-/\n@[category research solved, AMS 5 11]\ntheorem erdos_882 :\n    Filter.Tendsto (fun n : ℕ => (maxAntichainCard n : ℝ) / Real.logb 2 n)\n      Filter.atTop (nhds 1) := by\n  sorry\n\n/--\nThe construction of [ELRSS99]: $A_m = \\{2^m - 2^i : 0 \\leq i < m\\}$.\n-/\ndef A (m : ℕ) : Finset ℕ := (Finset.range m).image (fun i => 2 ^ m - 2 ^ i)\n\n/-- `A m` is contained in `{1, ..., 2^m - 1}`. -/\n@[category test, AMS 5 11]\ntheorem A_subset_Icc (m : ℕ) : A m ⊆ Finset.Icc 1 (2 ^ m - 1) := by\n  intro a ha\n  simp only [A, Finset.mem_image, Finset.mem_range] at ha\n  obtain ⟨i, hi, rfl⟩ := ha\n  have h1 : 2 ^ i < 2 ^ m := Nat.pow_lt_pow_right (by norm_num) hi\n  have h2 : 0 < 2 ^ i := by positivity\n  rw [Finset.mem_Icc]\n  omega\n\n/-- `A m` has `m` elements: the map $i \\mapsto 2^m - 2^i$ is injective on $\\{0, \\ldots, m-1\\}$. -/\n@[category test, AMS 5 11]\ntheorem card_A (m : ℕ) : (A m).card = m := by\n  rw [A, Finset.card_image_of_injOn, Finset.card_range]\n  intro i hi j hj hij\n  have hi' : 2 ^ i < 2 ^ m :=\n    Nat.pow_lt_pow_right (by norm_num) (Finset.mem_range.mp (Finset.mem_coe.mp hi))\n  have hj' : 2 ^ j < 2 ^ m :=\n    Nat.pow_lt_pow_right (by norm_num) (Finset.mem_range.mp (Finset.mem_coe.mp hj))\n  have h : 2 ^ m - 2 ^ i = 2 ^ m - 2 ^ j := hij\n  have h' : 2 ^ i = 2 ^ j := by omega\n  exact Nat.pow_right_injective le_rfl h'\n\nset_option linter.style.formal_proof_palomar false in\n/--\nErdős, Lev, Rauzy, Sándor and Sárközy [ELRSS99] proved that\n$\\lvert A\\rvert > \\log_2 n - 1$ is achievable, taking\n$A = \\{2^m - 2^{m-1}, 2^m - 2^{m-2}, \\ldots, 2^m - 1\\}$.\n\nThe key property of this construction is that distinct nonempty subsets have subset sums\nwhich never divide one another.\n\nThe linked theorem `no_div` is phrased in terms of index sets $S \\subseteq \\{0, \\ldots, m-1\\}$,\ni.e. $\\sum_{i \\in S_1} (2^m - 2^i) \\nmid \\sum_{i \\in S_2} (2^m - 2^i)$ for distinct nonempty\n$S_1, S_2$; it transfers to subsets of `A m` via the injectivity of $i \\mapsto 2^m - 2^i$\n(see `card_A`).\n-/\n@[category research solved, AMS 5 11,\n  formal_proof using lean4 at \"https://github.com/ToshiDad/erdos-882/blob/6ea233aed4b3efce92e2754177ef15c4085f8732/Erdos882.lean#L394\"]\ntheorem erdos_882.variants.lower_bound (m : ℕ) : IsSubsetSumAntichain (A m) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nThe lower bound of [ELRSS99] in quantitative form: for every $n \\geq 1$ there is a subset-sum\nantichain $A \\subseteq \\{1, \\ldots, n\\}$ with $\\lvert A\\rvert > \\log_2 n - 1$, namely $A_m$\nwith $m = \\lfloor \\log_2 n \\rfloor$ (by `erdos_882.variants.lower_bound`, `A_subset_Icc`\nand `card_A`).\n\nA sorry-free Lean 4 proof of this statement is the theorem `erdos_882` of [Alexeev].\nThat formalisation expresses the antichain condition as primitivity of the *set* of nonempty\nsubset sums (no element divides another one). For $A \\subseteq \\{1, \\ldots, n\\}$ this is\nequivalent to `IsSubsetSumAntichain A`: if two distinct subsets had the same sum, then\nremoving their common elements would leave two disjoint nonempty subsets with a common sum\n$t \\geq 1$, so that $t$ and $2t$ would both be nonempty subset sums.\n-/\n@[category research solved, AMS 5 11,\n  formal_proof using lean4 at \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos882.lean#L561\"]\ntheorem erdos_882.variants.lower_bound_explicit (n : ℕ) (hn : 0 < n) :\n    Real.logb 2 n - 1 < (maxAntichainCard n : ℝ) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nSándor's construction (reported without reference in [Er98]) is claimed to achieve\n$\\lvert A\\rvert = (1-o(1))\\log_2 n$ with $A = \\{2^i + m 2^m : 0 \\leq i < m\\}$ and\n$n = 2^{m-1} + m 2^m$.\n-/\n@[category research solved, AMS 5 11, formal_proof using other_system at \"https://github.com/karlesmarin/formalizations/blob/1aa7ad1ccadb6c7ba2378e3ee595fdd798f0f1b4/Isabelle/AFP/Sandor_Subset_Sum_Antichain/Sandor_Antichain.thy#L250\"]\ntheorem erdos_882.variants.sandor (m : ℕ) (hm : 1 ≤ m) :\n    IsSubsetSumAntichain ((Finset.range m).image (fun i => 2 ^ i + m * 2 ^ m)) := by\n  sorry\n\n/--\nThe greedy algorithm shows that $\\lvert A\\rvert \\geq (1-o(1))\\log_3 n$ is possible.\n-/\n@[category research solved, AMS 5 11]\ntheorem erdos_882.variants.greedy :\n    ∀ᶠ n : ℕ in Filter.atTop, (Real.logb 3 n - 1 : ℝ) ≤ (maxAntichainCard n : ℝ) := by\n  sorry\n\nend Erdos882\n",
  "statement_hash": "cfcd3e21e5d0eff049310622b566911cbd30d4d44c4f12a62e4df0900fee2a1a",
  "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."
}