The Hales-Jewett theorem #
We prove the Hales-Jewett theorem. We deduce Van der Waerden's theorem and the multidimensional Hales-Jewett theorem as corollaries.
The Hales-Jewett theorem is a result in Ramsey theory dealing with combinatorial lines. Given
an 'alphabet' α : Type*
and a b : α
, an example of a combinatorial line in α^5
is
{ (a, x, x, b, x) | x : α }
. See Combinatorics.Line
for a precise general definition. The
Hales-Jewett theorem states that for any fixed finite types α
and κ
, there exists a (potentially
huge) finite type ι
such that whenever ι → α
is κ
-colored (i.e. for any coloring
C : (ι → α) → κ
), there exists a monochromatic line. We prove the Hales-Jewett theorem using
the idea of color focusing and a product argument. See the proof of
Combinatorics.Line.exists_mono_in_high_dimension'
for details.
Combinatorial subspaces are higher-dimensional analogues of combinatorial lines. See
Combinatorics.Subspace
. The multidimensional Hales-Jewett theorem generalises the statement above
from combinatorial lines to combinatorial subspaces of a fixed dimension.
The version of Van der Waerden's theorem in this file states that whenever a commutative monoid M
is finitely colored and S
is a finite subset, there exists a monochromatic homothetic copy of S
.
This follows from the Hales-Jewett theorem by considering the map (ι → S) → M
sending v
to ∑ i : ι, v i
, which sends a combinatorial line to a homothetic copy of S
.
Main results #
Combinatorics.Line.exists_mono_in_high_dimension
: The Hales-Jewett theorem.Combinatorics.Subspace.exists_mono_in_high_dimension
: The multidimensional Hales-Jewett theorem.Combinatorics.exists_mono_homothetic_copy
: A generalization of Van der Waerden's theorem.
Implementation details #
For convenience, we work directly with finite types instead of natural numbers. That is, we write
α, ι, κ
for (finite) types where one might traditionally use natural numbers n, H, c
. This
allows us to work directly with α
, Option α
, (ι → α) → κ
, and ι ⊕ ι'
instead of Fin n
,
Fin (n+1)
, Fin (c^(n^H))
, and Fin (H + H')
.
TODO #
Prove a finitary version of Van der Waerden's theorem (either by compactness or by modifying the current proof).
One could reformulate the proof of Hales-Jewett to give explicit upper bounds on the number of coordinates needed.
Tags #
combinatorial line, Ramsey theory, arithmetic progression
References #
- https://en.wikipedia.org/wiki/Hales%E2%80%93Jewett_theorem
The type of combinatorial subspaces. A subspace l : Subspace η α ι
in the hypercube ι → α
defines a function (η → α) → ι → α
from η → α
to the hypercube, such that for each coordinate
i : ι
and direction e : η
, the function fun x ↦ l x i
is either fun x ↦ x e
for some
direction e : η
or constant. We require subspaces to be non-degenerate in the sense that, for
every e : η
, fun x ↦ l x i
is fun x ↦ x e
for at least one i
.
Formally, a subspace is represented by a word l.idxFun : ι → α ⊕ η
which says whether
fun x ↦ l x i
is fun x ↦ x e
(corresponding to l.idxFun i = Sum.inr e
) or constantly a
(corresponding to l.idxFun i = Sum.inl a
).
When α
has size 1
there can be many elements of Subspace η α ι
defining the same function.
- idxFun : ι → α ⊕ η
The word representing a combinatorial subspace.
l.idxfun i = Sum.inr e
means thatl x i = x e
for allx
andl.idxfun i = some a
means thatl x i = a
for allx
. We require combinatorial subspaces to be nontrivial in the sense that
fun x ↦ l x i
isfun x ↦ x e
for at least one coordinatei
.
Instances For
The combinatorial subspace corresponding to the identity embedding (ι → α) → (ι → α)
.
Equations
- Combinatorics.Subspace.instInhabited = { default := { idxFun := Sum.inr, proper := ⋯ } }
Consider a subspace l : Subspace η α ι
as a function (η → α) → ι → α
.
Instances For
Equations
- Combinatorics.Subspace.instCoeFun = { coe := Combinatorics.Subspace.toFun }
Given a coloring C
of ι → α
and a combinatorial subspace l
of ι → α
, l.IsMono C
means that l
is monochromatic with regard to C
.
Equations
- Combinatorics.Subspace.IsMono C l = ∃ (c : κ), ∀ (x : η → α), C (↑l x) = c
Instances For
Change the index types of a subspace.
Equations
Instances For
The type of combinatorial lines. A line l : Line α ι
in the hypercube ι → α
defines a
function α → ι → α
from α
to the hypercube, such that for each coordinate i : ι
, the function
fun x ↦ l x i
is either id
or constant. We require lines to be nontrivial in the sense that
fun x ↦ l x i
is id
for at least one i
.
Formally, a line is represented by a word l.idxFun : ι → Option α
which says whether
fun x ↦ l x i
is id
(corresponding to l.idxFun i = none
) or constantly y
(corresponding to
l.idxFun i = some y
).
When α
has size 1
there can be many elements of Line α ι
defining the same function.
- idxFun : ι → Option α
The word representing a combinatorial line.
l.idxfun i = none
means thatl x i = x
for allx
andl.idxfun i = some y
means thatl x i = y
. - proper : ∃ (i : ι), self.idxFun i = none
We require combinatorial lines to be nontrivial in the sense that
fun x ↦ l x i
isid
for at least one coordinatei
.
Instances For
Consider a line l : Line α ι
as a function α → ι → α
.
Equations
- ↑l x i = (l.idxFun i).getD x
Instances For
Equations
- Combinatorics.Line.instCoeFun = { coe := fun (l : Combinatorics.Line α ι) (x : α) (i : ι) => (l.idxFun i).getD x }
A line is monochromatic if all its points are the same color.
Equations
- Combinatorics.Line.IsMono C l = ∃ (c : κ), ∀ (x : α), C ((fun (x : α) (i : ι) => (l.idxFun i).getD x) x) = c
Instances For
Consider a line as a one-dimensional subspace.
Equations
Instances For
Alias of the reverse direction of Combinatorics.Line.toSubspaceUnit_isMono
.
Consider a line in ι → η → α
as a η
-dimensional subspace in ι × η → α
.
Equations
Instances For
Alias of the reverse direction of Combinatorics.Line.toSubspace_isMono
.
The diagonal line. It is the identity at every coordinate.
Equations
- Combinatorics.Line.diagonal α ι = { idxFun := fun (x : ι) => none, proper := ⋯ }
Instances For
Equations
- Combinatorics.Line.instInhabitedOfNonempty α ι = { default := Combinatorics.Line.diagonal α ι }
The type of lines that are only one color except possibly at their endpoints.
- line : Combinatorics.Line (Option α) ι
The underlying line of an almost monochromatic line, where the coordinate dimension
α
is extended by an additional symbolnone
, thought to be marking the endpoint of the line. - color : κ
The main color of an almost monochromatic line.
- has_color (x : α) : C ((fun (x : Option α) (i : ι) => (self.line.idxFun i).getD x) (some x)) = self.color
The proposition that the underlying line of an almost monochromatic line assumes its main color except possibly at the endpoints.
Instances For
Equations
- Combinatorics.Line.instInhabitedAlmostMonoDefaultOfNonempty = { default := { line := default, color := default, has_color := ⋯ } }
The type of collections of lines such that
- each line is only one color except possibly at its endpoint
- the lines all have the same endpoint
- the colors of the lines are distinct.
Used in the proof
exists_mono_in_high_dimension
.
- lines : Multiset (Combinatorics.Line.AlmostMono C)
The underlying multiset of almost monochromatic lines of a color-focused collection.
- focus : ι → Option α
The common endpoint of the lines in the color-focused collection.
- is_focused (p : Combinatorics.Line.AlmostMono C) : p ∈ self.lines → (fun (x : Option α) (i : ι) => (p.line.idxFun i).getD x) none = self.focus
The proposition that all lines in a color-focused collection have the same endpoint.
- distinct_colors : (Multiset.map Combinatorics.Line.AlmostMono.color self.lines).Nodup
The proposition that all lines in a color-focused collection of lines have distinct colors.
Instances For
Equations
- Combinatorics.Line.instInhabitedColorFocused C = { default := { lines := 0, focus := fun (x : ι) => none, is_focused := ⋯, distinct_colors := ⋯ } }
A function f : α → α'
determines a function line α ι → line α' ι
. For a coordinate i
l.map f
is the identity at i
if l
is, and constantly f y
if l
is constantly y
at i
.
Equations
- Combinatorics.Line.map f l = { idxFun := fun (i : ι) => Option.map f (l.idxFun i), proper := ⋯ }
Instances For
A point in ι → α
and a line in ι' → α
determine a line in ι ⊕ ι' → α
.
Equations
- Combinatorics.Line.vertical v l = { idxFun := Sum.elim (some ∘ v) l.idxFun, proper := ⋯ }
Instances For
A line in ι → α
and a point in ι' → α
determine a line in ι ⊕ ι' → α
.
Instances For
One line in ι → α
and one in ι' → α
together determine a line in ι ⊕ ι' → α
.
Instances For
The Hales-Jewett theorem: For any finite types α
and κ
, there exists a finite type ι
such that whenever the hypercube ι → α
is κ
-colored, there is a monochromatic combinatorial
line.
A generalization of Van der Waerden's theorem: if M
is a finitely colored commutative
monoid, and S
is a finite subset, then there exists a monochromatic homothetic copy of S
.
The multidimensional Hales-Jewett theorem, aka extended Hales-Jewett theorem: For any
finite types η
, α
and κ
, there exists a finite type ι
such that whenever the hypercube
ι → α
is κ
-colored, there is a monochromatic combinatorial subspace of dimension η
.
A variant of the extended Hales-Jewett theorem exists_mono_in_high_dimension
where the
returned type is some Fin n
instead of a general fintype.