{
  "id": "3783",
  "ident": "NS.03783",
  "slug": "erdos-963",
  "title": "Erdős Problem 963",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $f(n)$ be the maximal $k$ such that in any set $A\\subset \\mathbb{R}$ of size $n$ there is a\nsubset $B\\subseteq A$ of size $\\lvert B\\rvert\\geq k$ which is dissociated that is, the sums\n$\\sum_{b\\in S}b$ are distinct for all $S\\subseteq B$. Estimate $f(n)$ - in particular, is it true\nthat $f(n)\\geq \\lfloor \\log_2 n\\rfloor$?\n\nThis is the first part, a problem of Erdős [Er65, p. 188]. We read \"estimate\" as an asymptotic\nequivalence $f(n)\\sim$ `answer n`. The order of magnitude $\\log n$ is easy (see\n`erdos_963.variants.greedy` and the example $a_i=i$ in [Er65, p. 188]), so the question is the\nconstant.",
  "subjects": [
    "math.CO",
    "math.NT",
    "msc:05",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos963.erdos_963.parts.i",
  "statement_lean": "theorem erdos_963.parts.i :\n    (fun n : ℕ ↦ (f n : ℝ)) ~[atTop] erdos_963.parts.i.answer",
  "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 963\n\n*References:*\n- [erdosproblems.com/963](https://www.erdosproblems.com/963)\n- [Er65] Erdős, P., *Extremal problems in number theory*. Proc. Sympos. Pure Math., Vol. VIII\n  (1965), 181-189. [PDF](https://www.renyi.hu/~p_erdos/1965-02.pdf)\n\nA set `B` of real numbers is dissociated if all sums over its finite subsets are distinct. This is\n`AddDissociated` in Mathlib.\n-/\n\n@[expose] public section\n\nopen Filter Asymptotics\n\nnamespace Erdos963\n\n/-- $f(n)$ is the largest $k$ such that every set $A\\subset\\mathbb{R}$ with $n$ elements has a\ndissociated subset with at least $k$ elements. The set of such $k$ contains $0$ (take the empty\nsubset) and is bounded by $n$, so `sSup` is a true maximum. The set $A$ may contain $0$, which\ncan never belong to a dissociated set. For $n = 0$ the value is $0$. -/\nnoncomputable def f (n : ℕ) : ℕ :=\n  sSup {k : ℕ | ∀ A : Finset ℝ, A.card = n →\n    ∃ B ⊆ A, k ≤ B.card ∧ AddDissociated (B : Set ℝ)}\n\n/-- If every set of `n` reals has a dissociated subset with at least `k` elements, then\n$k \\leq f(n)$. -/\n@[category API, AMS 5 11]\ntheorem le_f {n k : ℕ}\n    (h : ∀ A : Finset ℝ, A.card = n → ∃ B ⊆ A, k ≤ B.card ∧ AddDissociated (B : Set ℝ)) :\n    k ≤ f n := by\n  refine le_csSup ⟨n, fun m hm ↦ ?_⟩ h\n  obtain ⟨A, hA⟩ := Infinite.exists_subset_card_eq ℝ n\n  obtain ⟨B, hBA, hmB, -⟩ := hm A hA\n  exact hmB.trans ((Finset.card_le_card hBA).trans hA.le)\n\n/-- If `A` has `n` elements and all dissociated subsets of `A` have at most `m` elements, then\n$f(n) \\leq m$. -/\n@[category API, AMS 5 11]\ntheorem f_le {n m : ℕ} (A : Finset ℝ) (hA : A.card = n)\n    (h : ∀ B ⊆ A, AddDissociated (B : Set ℝ) → B.card ≤ m) : f n ≤ m := by\n  refine csSup_le ⟨0, fun A' _ ↦ ⟨∅, Finset.empty_subset _, Nat.zero_le _, by simp⟩⟩ ?_\n  intro k hk\n  obtain ⟨B, hBA, hkB, hB⟩ := hk A hA\n  exact hkB.trans (h B hBA hB)\n\ndef erdos_963.parts.i.answer : ℕ → ℝ := sorry\n\n/--\nLet $f(n)$ be the maximal $k$ such that in any set $A\\subset \\mathbb{R}$ of size $n$ there is a\nsubset $B\\subseteq A$ of size $\\lvert B\\rvert\\geq k$ which is dissociated that is, the sums\n$\\sum_{b\\in S}b$ are distinct for all $S\\subseteq B$. Estimate $f(n)$ - in particular, is it true\nthat $f(n)\\geq \\lfloor \\log_2 n\\rfloor$?\n\nThis is the first part, a problem of Erdős [Er65, p. 188]. We read \"estimate\" as an asymptotic\nequivalence $f(n)\\sim$ `answer n`. The order of magnitude $\\log n$ is easy (see\n`erdos_963.variants.greedy` and the example $a_i=i$ in [Er65, p. 188]), so the question is the\nconstant.\n-/\n@[category research open, question value, AMS 5 11]\ntheorem erdos_963.parts.i :\n    (fun n : ℕ ↦ (f n : ℝ)) ~[atTop] erdos_963.parts.i.answer := by\n  sorry\n\n/--\nLet $f(n)$ be the maximal $k$ such that in any set $A\\subset \\mathbb{R}$ of size $n$ there is a\nsubset $B\\subseteq A$ of size $\\lvert B\\rvert\\geq k$ which is dissociated that is, the sums\n$\\sum_{b\\in S}b$ are distinct for all $S\\subseteq B$. Estimate $f(n)$ - in particular, is it true\nthat $f(n)\\geq \\lfloor \\log_2 n\\rfloor$?\n\nThis is the second part. Erdős [Er65, p. 188] asks whether the bound $\\lfloor\\log_3 n\\rfloor$ can\nbe improved to $\\lfloor\\log_2 n\\rfloor$. We state it for all $n\\geq 1$, with\n$\\lfloor\\log_2 n\\rfloor$ written as `Nat.log 2 n`.\n\nAs on the problem page, $A$ is any set of reals. [Er65] speaks of \"given numbers\" and uses the\nexample $a_i=i$. Allowing negative numbers makes the question harder. A dissociated set never\ncontains both $x$ and $-x$, and changing signs keeps a set dissociated. So the largest dissociated\nsubsets of $A$ and of $\\{\\lvert a\\rvert : a\\in A,\\ a\\neq 0\\}$ have the same size, and the sets\n$\\{\\pm a : a\\in S\\}$ (with $0$ added for odd $n$) show that $f(2m)=f(2m+1)$ is the least size of a\nlargest dissociated subset of a set of $m$ positive reals. Hence this statement asks for\n$\\lfloor\\log_2 m\\rfloor+1$ for $m$ positive reals. The question for positive reals with\n$\\lfloor\\log_2\\lvert A\\rvert\\rfloor$, one less, is `erdos_963.variants.positive`; it follows from\nthis statement.\n-/\n@[category research open, question, AMS 5 11]\ntheorem erdos_963.parts.ii : ∀ n : ℕ, 1 ≤ n → Nat.log 2 n ≤ f n := by\n  sorry\n\nsection Greedy\n\n/-- The sums $\\sum_{b\\in B}\\varepsilon_b b$ with all coefficients $\\varepsilon_b\\in\\{-1,0,1\\}$. -/\nprivate noncomputable def signedSums (B : Finset ℝ) : Finset ℝ :=\n  (Fintype.piFinset fun _ : B ↦ ({-1, 0, 1} : Finset ℝ)).image fun ε ↦ ∑ b : B, ε b * b\n\n/-- There are at most $3^{\\lvert B\\rvert}$ signed sums of `B`. -/\n@[category API, AMS 5 11]\nprivate lemma card_signedSums_le (B : Finset ℝ) : (signedSums B).card ≤ 3 ^ B.card := by\n  refine Finset.card_image_le.trans ?_\n  rw [Fintype.card_piFinset]\n  refine (Finset.prod_le_pow_card _ _ 3 fun _ _ ↦ Finset.card_le_three).trans ?_\n  simp\n\n/-- The difference of two subset sums of `B` is a signed sum of `B`. -/\n@[category API, AMS 5 11]\nprivate lemma sum_sub_sum_mem_signedSums {B t u : Finset ℝ} (ht : t ⊆ B) (hu : u ⊆ B) :\n    ∑ x ∈ u, x - ∑ x ∈ t, x ∈ signedSums B := by\n  classical\n  refine Finset.mem_image.2 ⟨fun b ↦ (if (b : ℝ) ∈ u then 1 else 0) - if (b : ℝ) ∈ t then 1 else 0,\n    Fintype.mem_piFinset.2 fun b ↦ ?_, ?_⟩\n  · split_ifs <;> simp\n  · simp only [sub_mul, ite_mul, one_mul, zero_mul, Finset.sum_sub_distrib]\n    rw [Finset.sum_coe_sort B fun x ↦ if x ∈ u then x else 0,\n      Finset.sum_coe_sort B fun x ↦ if x ∈ t then x else 0, Finset.sum_ite_mem,\n      Finset.sum_ite_mem, Finset.inter_eq_right.2 hu, Finset.inter_eq_right.2 ht]\n\n/-- If `t` and `u` are disjoint subsets of `insert a B` with the same sum and `a ∈ t`, then `a` is\na signed sum of `B`. -/\n@[category API, AMS 5 11]\nprivate lemma mem_signedSums_of_mem {B t u : Finset ℝ} {a : ℝ} (ht : t ⊆ insert a B)\n    (hu : u ⊆ insert a B) (htu : Disjoint t u) (hsum : ∑ x ∈ t, x = ∑ x ∈ u, x) (ha : a ∈ t) :\n    a ∈ signedSums B := by\n  classical\n  have h := sum_sub_sum_mem_signedSums (Finset.subset_insert_iff.1 ht)\n    ((Finset.subset_insert_iff_of_notMem (Finset.disjoint_left.1 htu ha)).1 hu)\n  rwa [← hsum, ← Finset.add_sum_erase t _ ha, add_sub_cancel_right] at h\n\nend Greedy\n\n/--\nErdős noted that the greedy algorithm showed $f(n)\\geq \\lfloor \\log_3 n\\rfloor$\n[Er65, p. 188].\n-/\n@[category research solved, AMS 5 11]\ntheorem erdos_963.variants.greedy (n : ℕ) : Nat.log 3 n ≤ f n := by\n  classical\n  refine le_f fun A hA ↦ ?_\n  -- Take a maximal dissociated subset `B` of `A`.\n  obtain ⟨B, hB⟩ :=\n    (A.powerset.filter fun B : Finset ℝ ↦ AddDissociated (B : Set ℝ)).exists_maximal\n      ⟨∅, Finset.mem_filter.2 ⟨Finset.empty_mem_powerset _, by simp⟩⟩\n  simp only [Finset.mem_filter, Finset.mem_powerset] at hB\n  -- Every element of `A` is a signed sum of `B`.\n  have hAB : A ⊆ signedSums B := by\n    intro a ha\n    by_cases haB : a ∈ B\n    · simpa using\n        sum_sub_sum_mem_signedSums (Finset.empty_subset B) (Finset.singleton_subset_iff.2 haB)\n    obtain ⟨t, u, ht, hu, htu, hne, hsum⟩ := not_addDissociated_iff_exists_disjoint.1 fun h ↦\n      hB.not_gt ⟨Finset.insert_subset_iff.2 ⟨ha, hB.1.1⟩, h⟩ <| Finset.ssubset_insert haB\n    rw [Finset.coe_subset] at ht hu\n    by_cases hat : a ∈ t\n    · exact mem_signedSums_of_mem ht hu htu hsum hat\n    by_cases hau : a ∈ u\n    · exact mem_signedSums_of_mem hu ht htu.symm hsum.symm hau\n    rw [Finset.subset_insert_iff_of_notMem hat] at ht\n    rw [Finset.subset_insert_iff_of_notMem hau] at hu\n    exact absurd (hB.1.2 (Finset.coe_subset.2 ht) (Finset.coe_subset.2 hu) hsum) hne\n  refine ⟨B, hB.1.1, ?_, hB.1.2⟩\n  calc Nat.log 3 n = Nat.log 3 A.card := by rw [hA]\n    _ ≤ Nat.log 3 (3 ^ B.card) :=\n        Nat.log_mono_right ((Finset.card_le_card hAB).trans (card_signedSums_le B))\n    _ = B.card := Nat.log_pow (by norm_num) _\n\n/--\nThe second part for sets of positive reals, with $\\lfloor\\log_2\\lvert A\\rvert\\rfloor$ as in\n[Er65, p. 188] and its example $a_i=i$: every set $A$ of positive reals has a dissociated subset\nwith at least $\\lfloor\\log_2 \\lvert A\\rvert\\rfloor$ elements.\n-/\n@[category research open, question, AMS 5 11]\ntheorem erdos_963.variants.positive :\n    ∀ A : Finset ℝ, (∀ a ∈ A, 0 < a) →\n      ∃ B ⊆ A, Nat.log 2 A.card ≤ B.card ∧ AddDissociated (B : Set ℝ) := by\n  sorry\n\nend Erdos963\n",
  "statement_hash": "6e2ad233b62429aaa5544ac2f59446404b8ad87b882919d4a234621ead2a99f8",
  "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."
}