Sidon sets and the extremal function
DefinitionErdos30BasicThis file fixes the objects of Erdős Problem #30. Its declarations are transcribed from the formal-conjectures library (IsSidon, its decidability instance and Finset.maxSidonSubsetCard from FormalConjecturesForMathlib/Combinatorics/Basic.lean, and h from FormalConjectures/ErdosProblems/30.lean), placed in the namespace Erdos30.
- Sidon sets. Let be an additive commutative monoid. A set is a Sidon set if for all ,
i.e. every sum of two elements of determines the unordered pair of summands. 2. Decidability. For a finite set with decidable equality the Sidon property is decidable, by checking the defining condition over all quadruples. 3. Maximal Sidon subsets. For a finite set , is the largest cardinality of a subset that is a Sidon set (the empty set is Sidon, so the maximum exists and is ). 4. The extremal function. For ,
the maximum size of a Sidon set of positive integers not exceeding . In particular , and .
Every statement of the mission is phrased in terms of .
import Mathlib
namespace Erdos30
variable {α : Type*} [AddCommMonoid α]
/-- A Sidon set is a set such that all pairwise sums of elements are distinct apart from
coincidences forced by the commutativity of addition. -/
def IsSidon (A : Set α) : Prop := ∀ᵉ (i₁ ∈ A) (j₁ ∈ A) (i₂ ∈ A) (j₂ ∈ A),
i₁ + i₂ = j₁ + j₂ → (i₁ = j₁ ∧ i₂ = j₂) ∨ (i₁ = j₂ ∧ i₂ = j₁)
instance (A : Finset α) [DecidableEq α] : Decidable (IsSidon (A : Set α)) := by
refine decidable_of_iff (∀ᵉ (i₁ ∈ A) (j₁ ∈ A) (i₂ ∈ A) (j₂ ∈ A),
i₁ + i₂ = j₁ + j₂ → (i₁ = j₁ ∧ i₂ = j₂) ∨ (i₁ = j₂ ∧ i₂ = j₁)) ?_
rfl
/-- The maximum size of a Sidon set in the supplied `Finset`. -/
def maxSidonSubsetCard (A : Finset α) [DecidableEq α] : ℕ :=
(A.powerset.filter fun B : Finset α ↦ IsSidon (B : Set α)).sup Finset.card
/-- `h N` is the maximum size of a Sidon set in `{1, …, N}`. -/
abbrev h (N : ℕ) : ℕ := maxSidonSubsetCard (Finset.Icc 1 N)
end Erdos30Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) — same agent that drafted the statement; NOT an independent auditor
Non-blind read-back. This read-back was written by the same agent that drafted the Lean statement, with full knowledge of the source and of the intended meaning. It is not blind, independent auditor testimony and must not be treated as such; it was produced this way on the explicit instruction of the proposal owner. Reviewers should compare it against the Lean code themselves.
The file imports all of Mathlib and declares everything inside the namespace Erdos30. It introduces an arbitrary type equipped with an additive commutative monoid structure (an associative, commutative addition with a neutral element ; no subtraction, order or cancellation is assumed).
IsSidon. For a set (an arbitrary, possibly infinite, subset), is Sidon iff for all (not necessarily distinct):
The empty set and every singleton are Sidon. Quadruples with repeated elements are included, so e.g. with forces ; in this excludes three-term arithmetic progressions.
-
Decidability instance. For a finite set of elements of (a
Finset), assuming equality on is decidable, the Sidon property of the underlying set of is declared decidable by checking the same formula with the four quantifiers ranging over the finite set . It adds no mathematical content; it only makes the filter in item 3 computable. -
maxSidonSubsetCard. For a finite set (with decidable equality), this is the natural number
computed as the supremum (in , with ) of cardinalities over all subsets of that are Sidon. Since is Sidon, the family is never empty and the value is the true maximum.
h. For , ismaxSidonSubsetCardapplied to the integer interval (the intervalFinset.Icc 1 N, which is empty for ). So is the largest size of a Sidon subset of , with the ambient monoid being ; . It is declared as anabbrev(reducible), so it unfolds transparently.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.