The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V30. Combinatorics

Mathlib.Combinatorics.Hindman

40 declarations and 8 deprecated aliases. Mathlib docs · Source

Hindman's theorem on finite sums

We prove Hindman's theorem on finite sums, using idempotent ultrafilters.

Given an infinite sequence a₀, a₁, a₂, … of positive integers, the set FS(a₀, …) is the set of positive integers that can be expressed as a finite sum of aᵢ's, without repetition. Hindman's theorem asserts that whenever the positive integers are finitely colored, there exists a sequence a₀, a₁, a₂, … such that FS(a₀, …) is monochromatic. There is also a stronger version, saying that whenever a set of the form FS(a₀, …) is finitely colored, there exists a sequence b₀, b₁, b₂, … such that FS(b₀, …) is monochromatic and contained in FS(a₀, …). We prove both these versions for a general semigroup M instead of ℕ+ since it is no harder, although this special case implies the general case.

The idea of the proof is to extend the addition (+) : M → M → M to addition (+) : βM → βM → βM on the space βM of ultrafilters on M. One can prove that if U is an idempotent ultrafilter, i.e. U + U = U, then any U-large subset of M contains some set FS(a₀, …) (see exists_FS_of_large). And with the help of a general topological argument one can show that any set of the form FS(a₀, …) is U-large according to some idempotent ultrafilter U (see exists_idempotent_ultrafilter_le_FS). This is enough to prove the theorem since in any finite partition of a U-large set, one of the parts is U-large.

Main results

  • FS_partition_regular: the strong form of Hindman's theorem
  • exists_FS_of_finite_cover: the weak form of Hindman's theorem

Tags

Ramsey theory, ultrafilter

ctor Hindman.FP.below.of_tail E0 #

∀ {M : Type u_1} [inst : Semigroup M] {motive : (a : Stream' M) → (a_1 : M) → Hindman.FP a a_1 → Prop} (a : Stream' M)
  (m : M) (h : Hindman.FP a.tail m), Hindman.FP.below h → motive a.tail m h → Hindman.FP.below ⋯

ctor Hindman.FS.below.cons E0 #

∀ {M : Type u_1} [inst : AddSemigroup M] {motive : (a : Stream' M) → (a_1 : M) → Hindman.FS a a_1 → Prop}
  (a : Stream' M) (m : M) (h : Hindman.FS a.tail m), Hindman.FS.below h → motive a.tail m h → Hindman.FS.below ⋯

ctor Hindman.FS.below.head E0 #

∀ {M : Type u_1} [inst : AddSemigroup M] {motive : (a : Stream' M) → (a_1 : M) → Hindman.FS a a_1 → Prop}
  (a : Stream' M), Hindman.FS.below ⋯

ctor Hindman.FP.below.cons E0 #

∀ {M : Type u_1} [inst : Semigroup M] {motive : (a : Stream' M) → (a_1 : M) → Hindman.FP a a_1 → Prop} (a : Stream' M)
  (m : M) (h : Hindman.FP a.tail m), Hindman.FP.below h → motive a.tail m h → Hindman.FP.below ⋯

ctor Hindman.FP.below.head E0 #

∀ {M : Type u_1} [inst : Semigroup M] {motive : (a : Stream' M) → (a_1 : M) → Hindman.FP a a_1 → Prop} (a : Stream' M),
  Hindman.FP.below ⋯

ctor Hindman.FS.below.of_tail E0 #

∀ {M : Type u_1} [inst : AddSemigroup M] {motive : (a : Stream' M) → (a_1 : M) → Hindman.FS a a_1 → Prop}
  (a : Stream' M) (m : M) (h : Hindman.FS a.tail m), Hindman.FS.below h → motive a.tail m h → Hindman.FS.below ⋯

def Ultrafilter.mul E1 #

{M : Type u_1} → [Mul M] → Mul (Ultrafilter M)

Multiplication of ultrafilters given by ∀ᶠ m in U*V, p m ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m*m').

def Ultrafilter.add E1 #

{M : Type u_1} → [Add M] → Add (Ultrafilter M)

Addition of ultrafilters given by ∀ᶠ m in U+V, p m ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m+m').

theorem Ultrafilter.eventually_mul E1 #

∀ {M : Type u_1} [inst : Mul M] (U V : Ultrafilter M) (p : M → Prop),
  (∀ᶠ (m : M) in ↑(U * V), p m) ↔ ∀ᶠ (m : M) in ↑U, ∀ᶠ (m' : M) in ↑V, p (m * m')

We could have taken this as the definition of U * V, but then we would have to prove that it defines an ultrafilter.

theorem Ultrafilter.eventually_add E1 #

∀ {M : Type u_1} [inst : Add M] (U V : Ultrafilter M) (p : M → Prop),
  (∀ᶠ (m : M) in ↑(U + V), p m) ↔ ∀ᶠ (m : M) in ↑U, ∀ᶠ (m' : M) in ↑V, p (m + m')

We could have taken this as the definition of U + V, but then we would have to prove that it defines an ultrafilter.

def Ultrafilter.semigroup E1 #

{M : Type u_1} → [Semigroup M] → Semigroup (Ultrafilter M)

Semigroup structure on Ultrafilter M induced by a semigroup structure on M.

def Ultrafilter.addSemigroup E1 #

{M : Type u_1} → [AddSemigroup M] → AddSemigroup (Ultrafilter M)

Additive semigroup structure on Ultrafilter M induced by an additive semigroup structure on M.

theorem Ultrafilter.continuous_add_left E1 #

∀ {M : Type u_1} [inst : Add M] (V : Ultrafilter M), Continuous fun x ↦ x + V

theorem Ultrafilter.continuous_mul_left E1 #

∀ {M : Type u_1} [inst : Mul M] (V : Ultrafilter M), Continuous fun x ↦ x * V

inductive Hindman.FS E1 #

{M : Type u_1} → [AddSemigroup M] → Stream' M → M → Prop

FS a m means that m is a finite sum in a, i.e. that m is the sum of a nonempty subsequence of a. We give a direct inductive definition instead of talking about subsequences.

ctor Hindman.FS.head E0 #

∀ {M : Type u_1} [inst : AddSemigroup M] (a : Stream' M), Hindman.FS a a.head

ctor Hindman.FS.of_tail E0 #

∀ {M : Type u_1} [inst : AddSemigroup M] (a : Stream' M) (m : M), Hindman.FS a.tail m → Hindman.FS a m

ctor Hindman.FS.cons E0 #

∀ {M : Type u_1} [inst : AddSemigroup M] (a : Stream' M) (m : M), Hindman.FS a.tail m → Hindman.FS a (a.head + m)

inductive Hindman.FP E1 #

{M : Type u_1} → [Semigroup M] → Stream' M → M → Prop

FP a m means that m is a finite product in a, i.e. that m is the product of a nonempty subsequence of a. We give a direct inductive definition instead of talking about subsequences.

ctor Hindman.FP.head E0 #

∀ {M : Type u_1} [inst : Semigroup M] (a : Stream' M), Hindman.FP a a.head

ctor Hindman.FP.of_tail E0 #

∀ {M : Type u_1} [inst : Semigroup M] (a : Stream' M) (m : M), Hindman.FP a.tail m → Hindman.FP a m

ctor Hindman.FP.cons E0 #

∀ {M : Type u_1} [inst : Semigroup M] (a : Stream' M) (m : M), Hindman.FP a.tail m → Hindman.FP a (a.head * m)

theorem Hindman.FP.mul E1 #

∀ {M : Type u_1} [inst : Semigroup M] {a : Stream' M} {m : M},
  Hindman.FP a m → ∃ n, ∀ (m' : M), Hindman.FP (Stream'.drop n a) m' → Hindman.FP a (m * m')

If m and m' are finite products in M, then so is m * m', provided that m' is obtained from a subsequence of M starting sufficiently late.

theorem Hindman.FS.add E1 #

∀ {M : Type u_1} [inst : AddSemigroup M] {a : Stream' M} {m : M},
  Hindman.FS a m → ∃ n, ∀ (m' : M), Hindman.FS (Stream'.drop n a) m' → Hindman.FS a (m + m')

If m and m' are finite sums in M, then so is m + m', provided that m' is obtained from a subsequence of M starting sufficiently late.

theorem Hindman.exists_idempotent_ultrafilter_le_FP E1 #

∀ {M : Type u_1} [inst : Semigroup M] (a : Stream' M), ∃ U, U * U = U ∧ ∀ᶠ (m : M) in ↑U, Hindman.FP a m

theorem Hindman.exists_idempotent_ultrafilter_le_FS E1 #

∀ {M : Type u_1} [inst : AddSemigroup M] (a : Stream' M), ∃ U, U + U = U ∧ ∀ᶠ (m : M) in ↑U, Hindman.FS a m

theorem Hindman.exists_FP_of_large E1 #

∀ {M : Type u_1} [inst : Semigroup M] (U : Ultrafilter M), U * U = U → ∀ s₀ ∈ U, ∃ a, ∀ (m : M), Hindman.FP a m → m ∈ s₀

theorem Hindman.exists_FS_of_large E1 #

∀ {M : Type u_1} [inst : AddSemigroup M] (U : Ultrafilter M),
  U + U = U → ∀ s₀ ∈ U, ∃ a, ∀ (m : M), Hindman.FS a m → m ∈ s₀

theorem Hindman.FP_partition_regular E3 #

∀ {M : Type u_1} [inst : Semigroup M] (a : Stream' M) (s : Set (Set M)),
  s.Finite → (∀ (m : M), Hindman.FP a m → m ∈ ⋃₀ s) → ∃ c ∈ s, ∃ b, ∀ (m : M), Hindman.FP b m → m ∈ c

The strong form of Hindman's theorem: in any finite cover of an FP-set, one the parts contains an FP-set.

theorem Hindman.FS_partition_regular E3 #

∀ {M : Type u_1} [inst : AddSemigroup M] (a : Stream' M) (s : Set (Set M)),
  s.Finite → (∀ (m : M), Hindman.FS a m → m ∈ ⋃₀ s) → ∃ c ∈ s, ∃ b, ∀ (m : M), Hindman.FS b m → m ∈ c

The strong form of Hindman's theorem: in any finite cover of an FS-set, one the parts contains an FS-set.

theorem Hindman.exists_FP_of_finite_cover E2 #

∀ {M : Type u_1} [inst : Semigroup M] [Nonempty M] (s : Set (Set M)),
  s.Finite → ⊤ ⊆ ⋃₀ s → ∃ c ∈ s, ∃ a, ∀ (m : M), Hindman.FP a m → m ∈ c

The weak form of Hindman's theorem: in any finite cover of a nonempty semigroup, one of the parts contains an FP-set.

theorem Hindman.exists_FS_of_finite_cover E3 #

∀ {M : Type u_1} [inst : AddSemigroup M] [Nonempty M] (s : Set (Set M)),
  s.Finite → ⊤ ⊆ ⋃₀ s → ∃ c ∈ s, ∃ a, ∀ (m : M), Hindman.FS a m → m ∈ c

The weak form of Hindman's theorem: in any finite cover of a nonempty additive semigroup, one of the parts contains an FS-set.

theorem Hindman.FS_iter_tail_sub_FS E1 #

∀ {M : Type u_1} [inst : AddSemigroup M] (a : Stream' M) (n : ℕ) ⦃m : M⦄,
  Hindman.FS (Stream'.drop n a) m → Hindman.FS a m

theorem Hindman.FP_drop_subset_FP E1 #

∀ {M : Type u_1} [inst : Semigroup M] (a : Stream' M) (n : ℕ) ⦃m : M⦄, Hindman.FP (Stream'.drop n a) m → Hindman.FP a m

theorem Hindman.FS.singleton E1 #

∀ {M : Type u_1} [inst : AddSemigroup M] (a : Stream' M) (i : ℕ), Hindman.FS a (a.get i)

theorem Hindman.FP.singleton E1 #

∀ {M : Type u_1} [inst : Semigroup M] (a : Stream' M) (i : ℕ), Hindman.FP a (a.get i)

theorem Hindman.FS.add_two E1 #

∀ {M : Type u_1} [inst : AddSemigroup M] (a : Stream' M) (i j : ℕ), i < j → Hindman.FS a (a.get i + a.get j)

theorem Hindman.FP.mul_two E1 #

∀ {M : Type u_1} [inst : Semigroup M] (a : Stream' M) (i j : ℕ), i < j → Hindman.FP a (a.get i * a.get j)

theorem Hindman.FS.finsetSum E1 #

∀ {M : Type u_1} [inst : AddCommMonoid M] (a : Stream' M) (s : Finset ℕ), s.Nonempty → Hindman.FS a (∑ i ∈ s, a.get i)

theorem Hindman.FP.finsetProd E1 #

∀ {M : Type u_1} [inst : CommMonoid M] (a : Stream' M) (s : Finset ℕ), s.Nonempty → Hindman.FP a (∏ i ∈ s, a.get i)

Deprecated aliases

NameNew nameSince
Hindman.FP.cons'Hindman.FP.cons2026-08-14
Hindman.FP.head'Hindman.FP.head2026-08-14
Hindman.FP.tailHindman.FP.of_tail2026-08-14
Hindman.FP.tail'Hindman.FP.of_tail2026-08-14
Hindman.FS.cons'Hindman.FS.cons2026-08-14
Hindman.FS.head'Hindman.FS.head2026-08-14
Hindman.FS.tailHindman.FS.of_tail2026-08-14
Hindman.FS.tail'Hindman.FS.of_tail2026-08-14