Lean library · module TopologyByExample.Spaces.StoneCechNaturals

The Stone–Čech compactification of the natural numbers

Source file

The space of ultrafilters on ℕ (Ultrafilter ℕ, with the topology whose basic open sets are the sets {u | A ∈ u}) is the Stone–Čech compactification of the discrete space ℕ. Mathlib shows that it is compact and Hausdorff, and that the principal ultrafilters are dense.

Main statements

Separation axioms

  • TopologyByExample.StoneCechNaturals.exists_discreteTopology_continuum_le_mk: βℕ has a discrete subspace of cardinality 𝔠, so (not_completelyNormalSpace) it is not completely normal. The discrete subspace comes from an almost disjoint family of size 𝔠: for each f : ℕ → Bool, the set of codes of the finite initial segments of f. Two different branches share only finitely many initial segments. Each branch set lies in a non-principal ultrafilter, the image of the cofinite ultrafilter under the enumeration of the branch, and the basic open set of the branch set contains no other of these ultrafilters.

This file was written by Claude (Anthropic's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.

Imports

theorem separableSpace

TopologyByExample.StoneCechNaturals.separableSpace

The principal ultrafilters form a countable dense set.

theorem separableSpace : SeparableSpace (Ultrafilter ℕ)
Proof
:=
  denseRange_pure.separableSpace continuous_of_discreteTopology

On this site: The Stone–Čech compactification of the natural numbers is separable

theorem not_seqCompactSpace

TopologyByExample.StoneCechNaturals.not_seqCompactSpace

The space of ultrafilters on ℕ is not sequentially compact: if pure (φ n) converged to p along a strictly increasing φ, then the clopen set given by {φ (2 k)} or by its complement would be a neighbourhood of p that the subsequence keeps leaving.

theorem not_seqCompactSpace : ¬SeqCompactSpace (Ultrafilter ℕ)
Proof
:= by
  intro h
  obtain ⟨p, -, φ, hφ, hp⟩ :=
    h.isSeqCompact_univ (x := fun n ↦ (pure n : Ultrafilter ℕ)) fun _ ↦ mem_univ _
  let A : Set ℕ := range fun k ↦ φ (2 * k)
  by_cases hA : A ∈ p
  · obtain ⟨N, hN⟩ := eventually_atTop.1 (hp.eventually ((ultrafilter_isOpen_basic A).mem_nhds hA))
    obtain ⟨k, hk⟩ : φ (2 * N + 1) ∈ A := by simpa using hN (2 * N + 1) (by omega)
    have := hφ.injective hk
    omega
  · have hAc : Aᶜ ∈ p := Ultrafilter.compl_mem_iff_notMem.2 hA
    obtain ⟨N, hN⟩ :=
      eventually_atTop.1 (hp.eventually ((ultrafilter_isOpen_basic Aᶜ).mem_nhds hAc))
    have h1 : φ (2 * N) ∉ A := by simpa using hN (2 * N) (by omega)
    exact h1 ⟨N, rfl⟩

On this site: The Stone–Čech compactification of the natural numbers is not sequentially compact

theorem existsUnique_continuous_comp_pure_eq

TopologyByExample.StoneCechNaturals.existsUnique_continuous_comp_pure_eq

The universal property of the Stone–Čech compactification of ℕ: every map f from ℕ to a compact Hausdorff space has exactly one continuous extension g to the space of ultrafilters, in the sense that g (pure n) = f n for every n.

theorem existsUnique_continuous_comp_pure_eq {γ : Type*} [TopologicalSpace γ] [T2Space γ]
    [CompactSpace γ] (f : ℕ → γ) : ∃! g : Ultrafilter ℕ → γ, Continuous g ∧ g ∘ pure = f
Proof
:=
  ⟨Ultrafilter.extend f, ⟨continuous_ultrafilter_extend f, ultrafilter_extend_extends f⟩,
    fun _ hg ↦ denseRange_pure.equalizer hg.1 (continuous_ultrafilter_extend f)
      (hg.2.trans (ultrafilter_extend_extends f).symm)⟩

On this site: Stone–Čech compactification of the natural numbers: Every map from \(\mathbb{N}\) to a compact Hausdorff space extends uniquely

A discrete subspace of size continuum, and complete normality

definition branchCode

TopologyByExample.StoneCechNaturals.branchCode

The code of the initial segment of length n of a branch f : ℕ → Bool.

noncomputable def branchCode (f : ℕ → Bool) (n : ℕ) : ℕ
:=
  Encodable.encode (List.ofFn fun i : Fin n ↦ f i)

theorem branchCode_injective

TopologyByExample.StoneCechNaturals.branchCode_injective

Initial segments of different lengths have different codes.

theorem branchCode_injective (f : ℕ → Bool) : Function.Injective (branchCode f)
Proof
:= fun m n h ↦ by
  simpa using congrArg List.length (Encodable.encode_injective h)

theorem eq_of_branchCode_eq

TopologyByExample.StoneCechNaturals.eq_of_branchCode_eq

If the initial segments of length m of f and of length n of g have the same code, then m = n and f and g agree below n.

theorem eq_of_branchCode_eq {f g : ℕ → Bool} {m n : ℕ} (h : branchCode f m = branchCode g n) :
    m = n ∧ ∀ k < n, f k = g k
Proof
:= by
  have h' := Encodable.encode_injective h
  have hmn : m = n := by simpa using congrArg List.length h'
  subst hmn
  refine ⟨rfl, fun k hk ↦ ?_⟩
  simpa using congrFun (List.ofFn_injective h') ⟨k, hk⟩

theorem finite_range_branchCode_inter

TopologyByExample.StoneCechNaturals.finite_range_branchCode_inter

Two different branches share only finitely many initial segments.

theorem finite_range_branchCode_inter {f g : ℕ → Bool} (hfg : f ≠ g) :
    (range (branchCode f) ∩ range (branchCode g)).Finite
Proof
:= by
  obtain ⟨k, hk⟩ := Function.ne_iff.1 hfg
  refine ((finite_Iic k).image (branchCode f)).subset ?_
  rintro _ ⟨⟨m, rfl⟩, ⟨n, hn⟩⟩
  obtain ⟨rfl, h⟩ := eq_of_branchCode_eq hn.symm
  exact ⟨m, mem_Iic.2 (not_lt.1 fun hkm ↦ hk (h k hkm)), rfl⟩

definition branchUltrafilter

TopologyByExample.StoneCechNaturals.branchUltrafilter

A non-principal ultrafilter on ℕ containing the initial segments of the branch f.

noncomputable def branchUltrafilter (f : ℕ → Bool) : Ultrafilter ℕ
:=
  (hyperfilter ℕ).map (branchCode f)

theorem range_branchCode_mem

TopologyByExample.StoneCechNaturals.range_branchCode_mem

The ultrafilter of a branch contains the branch set.

theorem range_branchCode_mem (f : ℕ → Bool) : range (branchCode f) ∈ branchUltrafilter f
Proof
:=
  Ultrafilter.mem_map.2 (by rw [preimage_range]; exact univ_mem)

theorem notMem_branchUltrafilter_of_finite

TopologyByExample.StoneCechNaturals.notMem_branchUltrafilter_of_finite

The ultrafilter of a branch is non-principal: it contains no finite set.

theorem notMem_branchUltrafilter_of_finite (f : ℕ → Bool) {s : Set ℕ} (hs : s.Finite) :
    s ∉ branchUltrafilter f
Proof
:= fun h ↦
  (hs.preimage (branchCode_injective f).injOn).notMem_hyperfilter (Ultrafilter.mem_map.1 h)

theorem range_branchCode_mem_branchUltrafilter_iff

TopologyByExample.StoneCechNaturals.range_branchCode_mem_branchUltrafilter_iff

The ultrafilter of the branch g contains the branch set of f only if f = g.

theorem range_branchCode_mem_branchUltrafilter_iff {f g : ℕ → Bool} :
    range (branchCode f) ∈ branchUltrafilter g ↔ f = g
Proof
:= by
  refine ⟨fun h ↦ by_contra fun hfg ↦ notMem_branchUltrafilter_of_finite g
    (finite_range_branchCode_inter hfg) (inter_mem h (range_branchCode_mem g)), ?_⟩
  rintro rfl
  exact range_branchCode_mem f

theorem branchUltrafilter_injective

TopologyByExample.StoneCechNaturals.branchUltrafilter_injective

Different branches have different ultrafilters.

theorem branchUltrafilter_injective : Function.Injective branchUltrafilter
Proof
:= fun f _ h ↦
  range_branchCode_mem_branchUltrafilter_iff.1 (h ▸ range_branchCode_mem f)

instance instDiscreteTopologyRangeBranchUltrafilter

TopologyByExample.StoneCechNaturals.instDiscreteTopologyRangeBranchUltrafilter

The ultrafilters of the branches form a discrete subspace of βℕ.

instance instDiscreteTopologyRangeBranchUltrafilter :
    DiscreteTopology (range branchUltrafilter)
Proof
:= by
  refine discreteTopology_iff_isOpen_singleton.2 ?_
  rintro ⟨_, f, rfl⟩
  refine isOpen_induced_iff.2 ⟨_, ultrafilter_isOpen_basic (range (branchCode f)), ?_⟩
  ext ⟨_, g, rfl⟩
  simp [range_branchCode_mem_branchUltrafilter_iff, Subtype.ext_iff,
    branchUltrafilter_injective.eq_iff, eq_comm]

theorem mk_range_branchUltrafilter

TopologyByExample.StoneCechNaturals.mk_range_branchUltrafilter

There are 𝔠 branch ultrafilters.

theorem mk_range_branchUltrafilter : #(range branchUltrafilter) = 𝔠
Proof
:= by
  rw [mk_range_eq _ branchUltrafilter_injective]
  simp

theorem exists_discreteTopology_continuum_le_mk

TopologyByExample.StoneCechNaturals.exists_discreteTopology_continuum_le_mk

βℕ has a discrete subspace of cardinality 𝔠.

theorem exists_discreteTopology_continuum_le_mk :
    ∃ s : Set (Ultrafilter ℕ), DiscreteTopology s ∧ 𝔠 ≤ #s
Proof
:=
  ⟨_, inferInstance, mk_range_branchUltrafilter.ge⟩

On this site: Stone–Čech compactification of the natural numbers: A discrete subspace of cardinality \(\mathfrak{c}\)

theorem not_completelyNormalSpace

TopologyByExample.StoneCechNaturals.not_completelyNormalSpace

βℕ is not completely normal: it is separable and has a discrete subspace of cardinality 𝔠, which Jones's lemma forbids in a separable completely normal space.

theorem not_completelyNormalSpace : ¬CompletelyNormalSpace (Ultrafilter ℕ)
Proof
:=
  have := separableSpace
  not_completelyNormalSpace_of_continuum_le_mk mk_range_branchUltrafilter.ge

On this site: The Stone–Čech compactification of the natural numbers is not completely normal

Spaces of ultrafilters

theorem projective_ultrafilter

TopologyByExample.projective_ultrafilter

The space of ultrafilters on a type (its Stone–Čech compactification as a discrete space) is projective among compact Hausdorff spaces: a map from it lifts along a continuous surjection by lifting its values at the principal ultrafilters and extending.

theorem projective_ultrafilter (α : Type u) : CompactT2.Projective (Ultrafilter α)
Proof
:= by
  intro Y Z _ _ _ _ _ _ f g hf hg g_sur
  choose s hs using g_sur
  refine ⟨Ultrafilter.extend (s ∘ f ∘ pure), continuous_ultrafilter_extend _, ?_⟩
  refine denseRange_pure.equalizer (hg.comp (continuous_ultrafilter_extend _)) hf ?_
  ext a
  simp [hs]

theorem extremallyDisconnected_ultrafilter

TopologyByExample.extremallyDisconnected_ultrafilter

The space of ultrafilters on a type is extremally disconnected.

theorem extremallyDisconnected_ultrafilter (α : Type u) : ExtremallyDisconnected (Ultrafilter α)
Proof
:=
  CompactT2.Projective.extremallyDisconnected (projective_ultrafilter α)

On this site: Theorem: The space of ultrafilters on a set is extremally disconnected

theorem not_scatteredSpace_ultrafilter

TopologyByExample.not_scatteredSpace_ultrafilter

The space of ultrafilters on an infinite type is not scattered: the free ultrafilters form a nonempty set without isolated points, since an infinite set splits into two disjoint infinite sets, each lying in some free ultrafilter.

theorem not_scatteredSpace_ultrafilter (α : Type u) [Infinite α] :
    ¬ScatteredSpace (Ultrafilter α)
Proof
:= by
  intro h
  set C : Set (Ultrafilter α) := {u | (u : Filter α) ≤ cofinite}
  have hne : C.Nonempty := ⟨Ultrafilter.of cofinite, Ultrafilter.of_le _⟩
  refine hne.ne_empty (h.eq_empty_of_preperfect C (preperfect_iff_nhds.2 fun u hu U hU ↦ ?_))
  obtain ⟨_, ⟨A, rfl⟩, huA, hAU⟩ := ultrafilterBasis_is_basis.mem_nhds_iff.1 hU
  change A ∈ u at huA
  have hA : A.Infinite := fun hfin ↦
    Ultrafilter.compl_notMem_iff.2 huA (hu hfin.compl_mem_cofinite)
  set e := hA.natEmbedding A
  have hinj (k : ℕ) : Function.Injective fun n ↦ (e (2 * n + k) : α) := fun m n hmn ↦ by
    have := e.injective (Subtype.ext hmn)
    omega
  set B := range fun n ↦ (e (2 * n + 0) : α)
  set D := range fun n ↦ (e (2 * n + 1) : α)
  have hBD : Disjoint B D := by
    refine disjoint_left.2 ?_
    rintro _ ⟨m, rfl⟩ ⟨n, hn⟩
    have := e.injective (Subtype.ext hn)
    omega
  obtain ⟨T, hTA, hTinf, hTu⟩ : ∃ T ⊆ A, T.Infinite ∧ T ∉ u := by
    by_cases hB : B ∈ u
    · refine ⟨D, ?_, infinite_range_of_injective (hinj 1), fun hD ↦ ?_⟩
      · rintro _ ⟨n, rfl⟩
        exact (e _).property
      · have := Ultrafilter.nonempty_of_mem (inter_mem hB hD)
        rw [hBD.inter_eq] at this
        exact not_nonempty_empty this
    · refine ⟨B, ?_, infinite_range_of_injective (hinj 0), hB⟩
      rintro _ ⟨n, rfl⟩
      exact (e _).property
  have := hTinf.cofinite_inf_principal_neBot
  set v := Ultrafilter.of (cofinite ⊓ 𝓟 T)
  have hTv : T ∈ v := Ultrafilter.of_le _ (mem_inf_of_right (mem_principal_self T))
  exact ⟨v, ⟨hAU (show A ∈ v from mem_of_superset hTv hTA),
    (Ultrafilter.of_le _).trans inf_le_left⟩, fun hvu ↦ hTu (hvu ▸ hTv)⟩

On this site: Theorem: The space of ultrafilters on an infinite set is not scattered

Further properties

theorem extremallyDisconnected

TopologyByExample.StoneCechNaturals.extremallyDisconnected

βℕ is extremally disconnected.

theorem extremallyDisconnected : ExtremallyDisconnected (Ultrafilter ℕ)
Proof
:=
  extremallyDisconnected_ultrafilter ℕ

On this site: The Stone–Čech compactification of the natural numbers is extremally disconnected

theorem not_scatteredSpace

TopologyByExample.StoneCechNaturals.not_scatteredSpace

βℕ is not scattered: its remainder ℕ* is nonempty and has no isolated point.

theorem not_scatteredSpace : ¬ScatteredSpace (Ultrafilter ℕ)
Proof
:=
  not_scatteredSpace_ultrafilter ℕ

On this site: The Stone–Čech compactification of the natural numbers is not scattered