Szemerédi's theorem (Erdős #139):
OpenErdos142.erdos_139_szemerediFor every ,
that is, . Equivalently, every set of integers of positive upper density contains arbitrarily long arithmetic progressions.
This is Szemerédi's theorem, conjectured by Erdős and Turán in 1936, proved by Roth for in 1953, by Szemerédi for in 1969 and in general in 1975. It is the qualitative core of Erdős Problem #142: without it there is no asymptotic question to ask, and with it the entire remaining difficulty is quantitative. Furstenberg's 1977 ergodic-theoretic proof and Gowers's 2001 Fourier-analytic proof give two further routes, the latter with effective bounds.
The statement is erdos_139 of the formal-conjectures repository, reproduced binder for binder over the same definition of that this mission's goal uses; erdosproblems.com/142 points at problem #139 under "see also". Combined with the milestone on the existence of , it identifies that limit as . No machine-checked proof of Szemerédi's theorem is known to exist in any proof assistant, for any ; the case (Roth's theorem) is also absent from Mathlib, although the surrounding infrastructure — the triangle removal lemma and Szemerédi's regularity lemma — is present.
Formalization Note. The limit is stated as convergence of the quotient to , not as an IsLittleO relation; the two are equivalent along atTop. Real division is Lean's, so the quotient is at , which is invisible to the filter.
import Mathlib import Definitions.Def_Erdos142Basic open scoped Topology
namespace Erdos142
theorem erdos_139_szemeredi (k : ℕ) (hk : 1 < k) :
Filter.Tendsto (fun N => (r k N / N : ℝ)) Filter.atTop (𝓝 0) := by sorry
end Erdos142Read-back
What the Lean code literally says, in plain math · claude-opus-5
Read-back: Erdos142.erdos_139_szemeredi
The statement
The declaration takes two explicit arguments: a natural number , and a proof of . Its conclusion is a statement about a function of a natural number : it asserts that
where the quotient is formed in (both and are natural numbers, each cast into ), the limit is taken along the "eventually large" filter on , and convergence is convergence in the neighbourhood filter of in with its usual topology. Unwound, the assertion is: for every there is an such that for all natural numbers one has . No rate of convergence, no explicit bound, and no uniformity in is claimed; is fixed before the limit is taken.
Two conventions are silently in play. First, division in is a total function in this formalism, so at the term is defined and equals (Lean's convention ); since the limit is along , this value — and indeed any finite set of values — is irrelevant to the truth of the conclusion. Second, ranges over only (it is forced to be a natural number by its use as the second argument of ), so this is a statement about a sequence, not about a real-variable limit.
Which the hypothesis admits
The hypothesis is with . It therefore admits exactly , and excludes and . In particular the case is within the scope of the theorem. The hypothesis is satisfiable (e.g. ), so the statement is not vacuous.
Expansion of the imported definitions
The symbol is not a standard notion; it is defined in the imported bundle, and its definition rests on a chain of three further definitions. All of them are stated for an arbitrary type carrying an additive commutative monoid structure, and are used here at . Throughout, lengths are elements of (the extended naturals), and a natural number appearing in a length slot is coerced into .
Arithmetic progression with given data. For a set , a length , and elements , the predicate " is an AP of length with first term and difference " means the conjunction of two conditions:
where is the cardinality of measured in (so it is when is infinite), denotes the -fold monoid sum , and the condition compares the coerced with . Note that must equal that set exactly, not merely contain it, and that the cardinality clause is an independent requirement imposed on top of the set equality.
Arithmetic progression of a given length. " is an AP of length " means: there exist such that the previous predicate holds for . The first term and the difference are existentially quantified; is not excluded a priori.
Progression-freeness. " is free of APs of length " is defined as
The conclusion of the implication is in — not falsehood. So for a length with (i.e. or ) this predicate is satisfied by every set whatsoever; it acquires content only when . Under the hypothesis of the theorem, the coerced length satisfies , and the predicate is therefore equivalent to: no subset of (subsets of every cardinality, finite or infinite, are quantified over) is an AP of length in the above sense.
Combining the expansions: for and a set , " is free of APs of length " says that there are no and no subset with
Because the cardinality is required to be exactly , the case cannot occur (it would make the displayed set the singleton , of cardinality ); so the excluded configurations are precisely the genuine, non-degenerate -term progressions with common difference , and each such is automatically finite with distinct members.
The counting function. For natural numbers and ,
where is the number of elements of , the ambient interval is the integer interval from to inclusive, and the supremum is a supremum of a set of natural numbers. The set being supremized is non-empty (the empty set qualifies, contributing the value ; the bundle proves that the empty set is free of APs of every length) and bounded above by , so this supremum is an honest maximum and there is no junk value here; the bundle separately proves for all , and that every progression-free satisfies . For the interval is empty, so .
Degenerate and boundary readings
- : by the total-division convention; irrelevant to the limit.
- is admitted by . With , every two-element subset of with is an AP of length (take , ), so the freeness condition forces and hence for all .
- The freeness predicate ranges over all subsets , not only those of size ; the size restriction comes from the cardinality clause inside the AP predicate.
- The bundle also defines an "elementary" pair of predicates — " has a -term AP", meaning with and for every , and its negation — but neither of these appears in the statement of this theorem; the theorem's is built solely from the cardinality-based definitions expanded above.
- Nothing in the statement asserts a lower bound on , positivity of , or monotonicity in or .