{
  "id": "884",
  "ident": "NS.00884",
  "slug": "erdos-1179",
  "title": "Erdős Problem 1179",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $0<\\epsilon<1$ and let $g_\\epsilon(N)$ be the minimal $k$ such that if $G$ is an abelian\ngroup of size $N$ and $A\\subseteq G$ is a uniformly random subset of size $k$, and\n$$F_A(g) = \\#\\left\\{ S\\subseteq A : g = \\sum_{x\\in S}x\\right\\},$$\nthen, with probability $\\to 1$ as $N\\to \\infty$,\n$$\\left\\lvert F_A(g)-\\frac{2^k}{N}\\right\\rvert \\leq \\epsilon \\frac{2^k}{N}$$\nfor all $g\\in G$.\n\nEstimate $g_\\epsilon(N)$ - in particular, is it true that for all $\\epsilon>0$\n$$g_\\epsilon(N)=(1+o_\\epsilon(1))\\log_2N?$$\n\nIt is trivial that $g_\\epsilon(N)\\geq \\log_2N$ for all $0<\\epsilon<1$. Erdős and Rényi [ErRe65]\nproved that for all $0<\\epsilon<1$, $g_\\epsilon(N) \\leq (2+o(1))\\log_2N+O_\\epsilon(1)$. Erdős and\nHall [ErHa76] proved that, for all $0<\\epsilon<1$,\n$$g_\\epsilon(N)\\leq \\left(1+O_\\epsilon\\left(\\frac{\\log\\log\\log N}{\\log\\log N}\\right)\\right)\n\\log_2N.$$\n\nThe upper bound $g_\\epsilon(N)\\leq (1+o(1))\\log_2 N$ is formalised as: there is a choice of sizes\n$k(N) = (1+o(1))\\log_2 N$ such that, along any sequence of abelian groups with $|G|\\to\\infty$,\nthe probability that a random $k(|G|)$-subset is $\\epsilon$-balanced tends to $1$. The matching\nlower bound is `erdos_1179.variants.lower_bound`.\n\nSee also [543](https://www.erdosproblems.com/543).",
  "subjects": [
    "math.CO",
    "math.NT",
    "msc:05",
    "msc:11"
  ],
  "tags": [
    "question",
    "formal_proof"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos1179.erdos_1179",
  "statement_lean": "theorem erdos_1179 : ∀ ε : ℝ, 0 < ε → ε < 1 → ∃ k : ℕ → ℕ,\n    Tendsto (fun N : ℕ ↦ (k N : ℝ) / Real.logb 2 N) atTop (nhds 1) ∧\n      ∀ (G : ℕ → Type) [∀ i, AddCommGroup (G i)] [∀ i, Fintype (G i)],\n        Tendsto (fun i ↦ Fintype.card (G i)) atTop atTop →\n          Tendsto (fun i ↦ successProbability (G i) ε (k (Fintype.card (G i)))) atTop\n            (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 1179\n\n*References:*\n- [erdosproblems.com/1179](https://www.erdosproblems.com/1179)\n- [Er73] Erdős, P., *Problems and results on combinatorial number theory*. A survey of\n  combinatorial theory (Proc. Internat. Sympos., Colorado State Univ., Fort Collins, Colo., 1971)\n  (1973), 117-138.\n- [ErRe65] Erdős, P. and Rényi, A., *Probabilistic methods in group theory*. J. Analyse Math.\n  (1965), 127-138.\n- [ErHa76] Erdős, P. and Hall, R. R., *Probabilistic methods in group theory. II*. Houston J.\n  Math. (1976), 173-180.\n-/\n\n@[expose] public section\n\nopen Filter Finset\n\nnamespace Erdos1179\n\nvariable {G : Type*} [AddCommGroup G] [Fintype G]\n\nopen scoped Classical in\n/-- $F_A(g) = \\#\\{ S\\subseteq A : g = \\sum_{x\\in S}x\\}$. -/\nnoncomputable def repCount (A : Finset G) (g : G) : ℕ :=\n  (A.powerset.filter fun S ↦ ∑ x ∈ S, x = g).card\n\n/-- `A` is `ε`-balanced: $\\lvert F_A(g)-2^{|A|}/N\\rvert \\leq \\epsilon 2^{|A|}/N$ for all `g`. -/\ndef IsBalanced (ε : ℝ) (A : Finset G) : Prop :=\n  ∀ g : G, |(repCount A g : ℝ) - 2 ^ A.card / Fintype.card G| ≤\n    ε * (2 ^ A.card / Fintype.card G)\n\nopen scoped Classical in\n/-- The probability that a uniformly random `k`-element subset of `G` is `ε`-balanced. -/\nnoncomputable def successProbability (G : Type*) [AddCommGroup G] [Fintype G] (ε : ℝ) (k : ℕ) :\n    ℝ :=\n  (((univ : Finset G).powersetCard k).filter (IsBalanced ε)).card /\n    ((univ : Finset G).powersetCard k).card\n\nset_option linter.style.formal_proof_palomar false in\n/--\nLet $0<\\epsilon<1$ and let $g_\\epsilon(N)$ be the minimal $k$ such that if $G$ is an abelian\ngroup of size $N$ and $A\\subseteq G$ is a uniformly random subset of size $k$, and\n$$F_A(g) = \\#\\left\\{ S\\subseteq A : g = \\sum_{x\\in S}x\\right\\},$$\nthen, with probability $\\to 1$ as $N\\to \\infty$,\n$$\\left\\lvert F_A(g)-\\frac{2^k}{N}\\right\\rvert \\leq \\epsilon \\frac{2^k}{N}$$\nfor all $g\\in G$.\n\nEstimate $g_\\epsilon(N)$ - in particular, is it true that for all $\\epsilon>0$\n$$g_\\epsilon(N)=(1+o_\\epsilon(1))\\log_2N?$$\n\nIt is trivial that $g_\\epsilon(N)\\geq \\log_2N$ for all $0<\\epsilon<1$. Erdős and Rényi [ErRe65]\nproved that for all $0<\\epsilon<1$, $g_\\epsilon(N) \\leq (2+o(1))\\log_2N+O_\\epsilon(1)$. Erdős and\nHall [ErHa76] proved that, for all $0<\\epsilon<1$,\n$$g_\\epsilon(N)\\leq \\left(1+O_\\epsilon\\left(\\frac{\\log\\log\\log N}{\\log\\log N}\\right)\\right)\n\\log_2N.$$\n\nThe upper bound $g_\\epsilon(N)\\leq (1+o(1))\\log_2 N$ is formalised as: there is a choice of sizes\n$k(N) = (1+o(1))\\log_2 N$ such that, along any sequence of abelian groups with $|G|\\to\\infty$,\nthe probability that a random $k(|G|)$-subset is $\\epsilon$-balanced tends to $1$. The matching\nlower bound is `erdos_1179.variants.lower_bound`.\n\nSee also [543](https://www.erdosproblems.com/543).\n-/\n@[category research solved, question, AMS 5 11, formal_proof using lean4 at\n  \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos1179.lean#L3564\"]\ntheorem erdos_1179 : ∀ ε : ℝ, 0 < ε → ε < 1 → ∃ k : ℕ → ℕ,\n    Tendsto (fun N : ℕ ↦ (k N : ℝ) / Real.logb 2 N) atTop (nhds 1) ∧\n      ∀ (G : ℕ → Type) [∀ i, AddCommGroup (G i)] [∀ i, Fintype (G i)],\n        Tendsto (fun i ↦ Fintype.card (G i)) atTop atTop →\n          Tendsto (fun i ↦ successProbability (G i) ε (k (Fintype.card (G i)))) atTop\n            (nhds 1) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/-- It is trivial that $g_\\epsilon(N)\\geq \\log_2N$: an $\\epsilon$-balanced set $A$ with\n$\\epsilon < 1$ must satisfy $|G| \\leq 2^{|A|}$, since every $g$ has a representation. -/\n@[category research solved, AMS 5 11, formal_proof using lean4 at\n  \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos1179.lean#L3564\"]\ntheorem erdos_1179.variants.lower_bound : ∀ ε : ℝ, 0 < ε → ε < 1 →\n    ∀ A : Finset G, IsBalanced ε A → Fintype.card G ≤ 2 ^ A.card := by\n  sorry\n\nend Erdos1179\n",
  "statement_hash": "122c313ee6c1647c9fd18a7c5a20997a5807d852d5586cd1e77a9f02d74ac7ce",
  "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."
}