Representation count and positive lower density
DefinitionErdos1950_DefsTwo notions used throughout Erdős (1950).
- For a natural number , the representation count
counts the ways of writing as a power of two (exponent ) plus a prime. The set is finite, since and .
- A set has positive lower density if there are a real and such that for every natural ,
This is the sense of "positive density" in the paper's opening paragraph.
Formalization Note is repCount, defined with Set.ncard; positive lower density is HasPosLowerDensity.
import Mathlib.Data.Nat.Prime.Defs
import Mathlib.Data.Set.Card
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Data.Real.Basic
namespace Erdos1950
/-- `f(n)`: the number of pairs `(k, p)` with `k ≥ 0`, `p` prime and `2^k + p = n`. -/
noncomputable def repCount (n : ℕ) : ℕ :=
Set.ncard {kp : ℕ × ℕ | kp.2.Prime ∧ 2 ^ kp.1 + kp.2 = n}
/-- A set of natural numbers has positive lower density: for some `c > 0`, the number of
its elements `≤ x` is at least `c x` for all sufficiently large `x`. -/
def HasPosLowerDensity (S : Set ℕ) : Prop :=
∃ c : ℝ, 0 < c ∧ ∃ N : ℕ, ∀ x : ℕ, N ≤ x → c * x ≤ ({n | n ≤ x ∧ n ∈ S} : Set ℕ).ncard
end Erdos1950
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
This file introduces two definitions, both in the namespace Erdos1950.
1. The representation count (repCount). For a natural number ,
where is the cardinality function on sets that returns a natural number, with the convention that an infinite set is assigned the value . Here the set is always finite (from one gets and ), so is the genuine number of such pairs. Points to note: the exponent ranges over all natural numbers including (so is an allowed summand); is allowed; pairs are ordered as (exponent, prime) and counted with no further identification. Consequently (since and force ), and is a natural number, so it is for every .
2. Positive lower density (HasPosLowerDensity). For a set , the proposition holds exactly when
where and the count are converted to real numbers. The counted set is bounded, hence finite, so the count is its true size; it counts elements in the closed range , so it includes when (it counts up to elements, not ). The constant is any positive real (no upper bound is imposed in the definition, though a value cannot work for all large since the count is at most ). The threshold is a natural number and ranges over natural numbers only. This is a "for some fixed and all sufficiently large " condition; it is not phrased as a , but it is equivalent to .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.