/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import FormalConjecturesUtil /-! # Erdős Problem 785 *References:* - [erdosproblems.com/785](https://www.erdosproblems.com/785) - [ChFa10] Fang, Jin-Hui and Chen, Yong-Gao, *On additive complements*. Proc. Amer. Math. Soc. (2010), 1923-1927. - [ChFa11] Chen, Yong-Gao and Fang, Jin-Hui, *On additive complements. II*. Proc. Amer. Math. Soc. (2011), 881-883. - [ChFa14] Fang, Jin-Hui and Chen, Yong-Gao, *On additive complements. III*. J. Number Theory (2014), 83-91. - [ChFa15] Chen, Yong-Gao and Fang, Jin-Hui, *On a conjecture of Sárközy and Szemerédi*. Acta Arith. (2015), 47-58. - [Da64] Danzer, L., *Über eine Frage von G. Hanani aus der additiven Zahlentheorie*. J. Reine Angew. Math. (1964), 392-394. - [Er57] Erdős, Paul, *Some unsolved problems*. Michigan Math. J. (1957), 291-300. - [Er61] Erdős, Paul, *Some unsolved problems*. Magyar Tud. Akad. Mat. Kutató Int. Közl. (1961), 221-254. - [Na59] Narkiewicz, Władysław, *Remarks on a conjecture of Hanani in additive number theory*. Colloq. Math. (1959/60), 161-165. - [Ru17] Ruzsa, Imre Z., *Exact additive complements*. Q. J. Math. (2017), 227-235. - [SaSz94] Sárközy, A. and Szemerédi, E., *On a problem in additive number theory*. Acta Math. Hungar. (1994), 237-245. -/ @[expose] public section open Filter Pointwise open scoped Topology namespace Erdos785 /-- The counting function $A(x)=\lvert A\cap [1,x]\rvert$. -/ noncomputable def counting (A : Set ℕ) (x : ℕ) : ℕ := (A ∩ Set.Icc 1 x).ncard /-- The largest element of $A$ in $[1,x]$, that is $a^*(x)=\max A\cap [1,x]$ (equal to $0$ when there is no such element). -/ noncomputable def aStar (A : Set ℕ) (x : ℕ) : ℕ := sSup (A ∩ Set.Icc 1 x) /-- Two sets $A, B\subseteq \mathbb{N}$ are *exact additive complements* if $A+B$ contains all large integers and $A(x)B(x)\sim x$. -/ def IsExactAdditiveComplement (A B : Set ℕ) : Prop := IsAdditiveComplement A B ∧ Tendsto (fun x : ℕ => (counting A x * counting B x : ℝ) / (x : ℝ)) atTop (𝓝 1) set_option linter.style.formal_proof_palomar false in /-- Let $A,B\subseteq \mathbb{N}$ be infinite sets of positive integers such that $A+B$ contains all large integers. Let $A(x)=\lvert A\cap [1,x]\rvert$ and similarly for $B(x)$. Is it true that if $A(x)B(x)\sim x$ then $$A(x)B(x)-x\to \infty$$ as $x\to \infty$? A conjecture of Erdős and Danzer. The answer is yes, proved by Sárközy and Szemerédi [SaSz94], who actually proved that it is impossible for $$A(x)B(x)-x=o(A(x)).$$ This was formalized in Lean by van Doorn using Aristotle. -/ @[category research solved, question, AMS 11, formal_proof using lean4 at "https://github.com/Woett/Lean-files/blob/main/ErdosProblem785.lean"] theorem erdos_785 : ∀ A B : Set ℕ, A.Infinite → B.Infinite → 0 ∉ A → 0 ∉ B → IsExactAdditiveComplement A B → Tendsto (fun x : ℕ => (counting A x * counting B x : ℝ) - (x : ℝ)) atTop atTop := by sorry /-- Danzer [Da64] proved that exact additive complements exist (Hanani had earlier conjectured they do not exist, as reported in [Er57] and [Er61]). -/ @[category research solved, AMS 11] theorem erdos_785.variants.danzer : ∃ A B : Set ℕ, A.Infinite ∧ B.Infinite ∧ 0 ∉ A ∧ 0 ∉ B ∧ IsExactAdditiveComplement A B := by sorry /-- Sárközy and Szemerédi [SaSz94, pp. 244–245] stated that the global estimate $A(x)B(x) - x = o(\min(A(x), B(x)))$ is impossible. The stronger eventual bound stated here, $$A(x)B(x) - x \ge c \min(A(x), B(x))$$ for some $c > 0$ and all sufficiently large $x$, follows as a later consequence of Chen and Fang [ChFa15, Theorem 0.2] (for instance, taking $M = 2$). -/ @[category research solved, AMS 11] theorem erdos_785.variants.sarkozy_szemeredi (A B : Set ℕ) (hA : A.Infinite) (hB : B.Infinite) (hA₀ : 0 ∉ A) (hB₀ : 0 ∉ B) (h : IsExactAdditiveComplement A B) : ∃ c > (0 : ℝ), ∀ᶠ x : ℕ in atTop, c * (min (counting A x) (counting B x) : ℝ) ≤ (counting A x * counting B x : ℝ) - (x : ℝ) := by sorry /-- Chen and Fang [ChFa15, Theorem 0.2] proved that for any $M > 1$, $$A(x)B(x) - x \ge \min(A(x), B(x))^M$$ for all sufficiently large $x$. In particular $A(x)B(x)-x\ll A(x)^c$ cannot hold for any constant $c>0$ when $A$ is the sparser of the two sets. -/ @[category research solved, AMS 11] theorem erdos_785.variants.chen_fang (A B : Set ℕ) (hA : A.Infinite) (hB : B.Infinite) (hA₀ : 0 ∉ A) (hB₀ : 0 ∉ B) (h : IsExactAdditiveComplement A B) (M : ℝ) (hM : 1 < M) : ∀ᶠ x : ℕ in atTop, (min (counting A x) (counting B x) : ℝ) ^ M ≤ (counting A x * counting B x : ℝ) - (x : ℝ) := by sorry /-- Narkiewicz [Na59] proved that, under the given assumptions (and perhaps swapping $A$ and $B$) we must have $A(2x)/A(x)\to 1$ and $B(2x)/B(x)\to 2$. -/ @[category research solved, AMS 11] theorem erdos_785.variants.narkiewicz (A B : Set ℕ) (hA : A.Infinite) (hB : B.Infinite) (hA₀ : 0 ∉ A) (hB₀ : 0 ∉ B) (h : IsExactAdditiveComplement A B) : (Tendsto (fun x : ℕ => (counting A (2 * x) : ℝ) / (counting A x : ℝ)) atTop (𝓝 1) ∧ Tendsto (fun x : ℕ => (counting B (2 * x) : ℝ) / (counting B x : ℝ)) atTop (𝓝 2)) ∨ (Tendsto (fun x : ℕ => (counting B (2 * x) : ℝ) / (counting B x : ℝ)) atTop (𝓝 1) ∧ Tendsto (fun x : ℕ => (counting A (2 * x) : ℝ) / (counting A x : ℝ)) atTop (𝓝 2)) := by sorry /-- Ruzsa [Ru17] has constructed, for any function $w(x)\to \infty$, such a pair of sets with $$A(x)B(x)-x (1-o(1))\frac{a^*(x)}{A(x)}.$$ -/ @[category research solved, AMS 11] theorem erdos_785.variants.ruzsa_lower_bound (A B : Set ℕ) (hA : A.Infinite) (hB : B.Infinite) (hA₀ : 0 ∉ A) (hB₀ : 0 ∉ B) (h : IsExactAdditiveComplement A B) (hsmall : Tendsto (fun x : ℕ => (counting A (2 * x) : ℝ) / (counting A x : ℝ)) atTop (𝓝 1)) : ∀ ε > (0 : ℝ), ∀ᶠ x : ℕ in atTop, (1 - ε) * (aStar A x : ℝ) / (counting A x : ℝ) < (counting A x * counting B x : ℝ) - (x : ℝ) := by sorry /-- Chen and Fang [ChFa10] proved the stronger statement that $A(x)B(x)-x\to \infty$ if $A$ and $B$ are infinite sets such that $A+B$ contains all large integers and $$\limsup_{x\to \infty}\frac{A(x)B(x)}{x}<\frac{5}{4}.$$ They later [ChFa14] improved $5/4$ to $3-\sqrt{3}\approx 1.268$. -/ @[category research solved, AMS 11] theorem erdos_785.variants.chen_fang_limsup (A B : Set ℕ) (hA : A.Infinite) (hB : B.Infinite) (hA₀ : 0 ∉ A) (hB₀ : 0 ∉ B) (h : IsAdditiveComplement A B) (hlim : limsup (fun x : ℕ => ((counting A x * counting B x : ℝ) / (x : ℝ) : EReal)) atTop < ((3 - Real.sqrt 3 : ℝ) : EReal)) : Tendsto (fun x : ℕ => (counting A x * counting B x : ℝ) - (x : ℝ)) atTop atTop := by sorry /-- Chen conjectures that this should be true with $3/2$. -/ @[category research open, question, AMS 11] theorem erdos_785.variants.chen_conjecture : ∀ A B : Set ℕ, A.Infinite → B.Infinite → 0 ∉ A → 0 ∉ B → IsAdditiveComplement A B → limsup (fun x : ℕ => ((counting A x * counting B x : ℝ) / (x : ℝ) : EReal)) atTop < ((3 / 2 : ℝ) : EReal) → Tendsto (fun x : ℕ => (counting A x * counting B x : ℝ) - (x : ℝ)) atTop atTop := by sorry /-- This is sharp, as Chen and Fang [ChFa11] also proved that there exist such $A$ and $B$ with $$\limsup_{x\to \infty}\frac{A(x)B(x)}{x}=\frac{3}{2}$$ for which $A(x)B(x)-x=1$ for infinitely many $x$. -/ @[category research solved, AMS 11] theorem erdos_785.variants.chen_fang_sharp : ∃ A B : Set ℕ, A.Infinite ∧ B.Infinite ∧ 0 ∉ A ∧ 0 ∉ B ∧ IsAdditiveComplement A B ∧ limsup (fun x : ℕ => ((counting A x * counting B x : ℝ) / (x : ℝ) : EReal)) atTop = ((3 / 2 : ℝ) : EReal) ∧ ∃ᶠ x : ℕ in atTop, (counting A x * counting B x : ℝ) - (x : ℝ) = 1 := by sorry end Erdos785