Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Erdős Problem 331

Source:Erdős Problems
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

Let A,B⊆NA,B\subseteq \mathbb{N} such that for all large $N$\lvert A\cap \{1,\ldots,N\}\rvert \gg N^{1/2}and∣B∩{1,…,N}∣≫N1/2.\lvert B\cap \{1,\ldots,N\}\rvert \gg N^{1/2}. Is it true that there are infinitely many solutions to a1−a2=b1−b2≠0a_1-a_2=b_1-b_2\neq 0 with a1,a2∈Aa_1,a_2\in A and b1,b2∈Bb_1,b_2\in B?

Ruzsa has observed that there is a simple counterexample: take AA to be the set of numbers whose binary representation has only non-zero digits in even places, and BB similarly but with non-zero digits only in odd places. It is easy to see AA and BB both grow like ≫N1/2\gg N^{1/2} and yet for any n≥1n\geq 1 there is exactly one solution to n=a+bn=a+b with a∈Aa\in A and b∈Bb\in B.

This was formalized in Lean by van Doorn using Aristotle.

Subjects:Number Theory (math.NT)
MSC classes:11
Tags:question, formal_proof
Cite as:NS.01727 [math.NT] · NS.01727v1 for this version
Declaration:Erdos331.erdos_331
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:f21ec02db250f5736fc7e8749d92902e28399661197759ca75fc1277f6abda85
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/ErdosProblems/331.lean

Formal statement

theorem erdos_331 :
    ¬ ∀ A B : Set ℕ,
    (fun (n : ℕ) ↦ (n : ℝ) ^ (1 / 2 : ℝ)) =O[atTop] (fun (n : ℕ) ↦ (count (· ∈ A) n : ℝ)) →
    (fun (n : ℕ) ↦ (n : ℝ) ^ (1 / 2 : ℝ)) =O[atTop] (fun (n : ℕ) ↦ (count (· ∈ B) n : ℝ)) →
    { s : ℕ × ℕ × ℕ × ℕ | let ⟨a₁, a₂, b₁, b₂⟩ := s
      a₁ ∈ A ∧ a₂ ∈ A ∧ b₁ ∈ B ∧ b₂ ∈ B ∧
      a₁ ≠ a₂ ∧ a₁ + b₂ = a₂ + b₁ }.Infinite
Show the full Challenge.lean (84 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Erdős Problem 331

*References:*
- [erdosproblems.com/331](https://www.erdosproblems.com/331)
- [ErFr84] Erdős, P. and Freud, R., On disjoint sets of differences. J. Number Theory (1984),
  99--109.
-/

@[expose] public section

open Nat Filter
open scoped Asymptotics

namespace Erdos331

open scoped Classical in
set_option linter.style.formal_proof_palomar false in
/--
Let $A,B\subseteq \mathbb{N}$ such that for all large $N$$$\lvert A\cap \{1,\ldots,N\}\rvert \gg
N^{1/2}$$and$$\lvert B\cap \{1,\ldots,N\}\rvert \gg N^{1/2}.$$
Is it true that there are infinitely many solutions to $a_1-a_2=b_1-b_2\neq 0$ with $a_1,a_2\in A$
and $b_1,b_2\in B$?

Ruzsa has observed that there is a simple counterexample: take $A$ to be the set of numbers whose
binary representation has only non-zero digits in even places, and $B$ similarly but with non-zero
digits only in odd places. It is easy to see $A$ and $B$ both grow like $\gg N^{1/2}$ and yet for
any $n\geq 1$ there is exactly one solution to $n=a+b$ with $a\in A$ and $b\in B$.

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/d30552f64c55686d40b928a0a3b8e2396357a4ee/ErdosProblem331.lean"]
theorem erdos_331 :
    ¬ ∀ A B : Set ℕ,
    (fun (n : ℕ) ↦ (n : ℝ) ^ (1 / 2 : ℝ)) =O[atTop] (fun (n : ℕ) ↦ (count (· ∈ A) n : ℝ)) →
    (fun (n : ℕ) ↦ (n : ℝ) ^ (1 / 2 : ℝ)) =O[atTop] (fun (n : ℕ) ↦ (count (· ∈ B) n : ℝ)) →
    { s : ℕ × ℕ × ℕ × ℕ | let ⟨a₁, a₂, b₁, b₂⟩ := s
      a₁ ∈ A ∧ a₂ ∈ A ∧ b₁ ∈ B ∧ b₂ ∈ B ∧
      a₁ ≠ a₂ ∧ a₁ + b₂ = a₂ + b₁ }.Infinite := by
  sorry

open scoped Classical in
/--
Ruzsa suggests that a non-trivial variant of this problem arises if one imposes the stronger
condition that $|A \cap \{1,\dots,N\}| \sim c_A N^{1/2}$ for some constant $c_A>0$, and similarly
for $B$.

The answer is yes. Write $A(N) = |A \cap \{1,\dots,N\}|$ and $B(N) = |B \cap \{1,\dots,N\}|$.
Erdős and Freud [ErFr84, Theorem 4] proved that if $a_1 - a_2 = b_1 - b_2$ has only trivial
solutions and $\liminf_N \min(A(N), B(N)) / N^{1/2} > 0$, then neither $A(N) / N^{1/2}$ nor
$B(N) / N^{1/2}$ tends to a limit. If there were only finitely many non-trivial solutions, removing
the finitely many elements of $A$ that occur in them would give sets with the same asymptotics and
no non-trivial solution.
-/
@[category research solved, question, AMS 11]
theorem erdos_331.variants.ruzsa :
    ∀ A B : Set ℕ,
    (∃ c_A > 0, (fun (n : ℕ) ↦ (count (· ∈ A) n : ℝ)) ~[atTop] (fun (n : ℕ) ↦ c_A * (n : ℝ) ^ (1 / 2 : ℝ))) →
    (∃ c_B > 0, (fun (n : ℕ) ↦ (count (· ∈ B) n : ℝ)) ~[atTop] (fun (n : ℕ) ↦ c_B * (n : ℝ) ^ (1 / 2 : ℝ))) →
    { s : ℕ × ℕ × ℕ × ℕ | let ⟨a₁, a₂, b₁, b₂⟩ := s
      a₁ ∈ A ∧ a₂ ∈ A ∧ b₁ ∈ B ∧ b₂ ∈ B ∧
      a₁ ≠ a₂ ∧ a₁ + b₂ = a₂ + b₁ }.Infinite := by
  sorry
end Erdos331

To prove it: keep every definition of Challenge.lean unchanged and prove Erdos331.erdos_331 with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_erdos_331 : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch erdos-331
nosorry submit erdos-331 nosorry/erdos-331/Solution.lean --wait

Formal variants

Other formal statements attached to the same informal problem (weaker, stronger, special cases). Each is scored separately.

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.