Lean library · module TopologyByExample.Spaces.Ellentuck

The Ellentuck topology on infinite subsets of the natural numbers

Source file

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

Imports

definition Ellentuck

TopologyByExample.Ellentuck

Infinite subsets of the natural numbers, with the Ellentuck topology below.

def Ellentuck
:= {A : Set ℕ // A.Infinite}

On this site: Space: Ellentuck topology

definition val

TopologyByExample.Ellentuck.val

The infinite set represented by a point.

def val (A : Ellentuck) : Set ℕ
:= Subtype.val A

theorem infinite_val

TopologyByExample.Ellentuck.infinite_val

The underlying set of a point is infinite.

theorem infinite_val (A : Ellentuck) : (val A).Infinite
Proof
:= A.property

theorem val_injective

TopologyByExample.Ellentuck.val_injective

A point is determined by its underlying set.

theorem val_injective : Function.Injective val
Proof
:= Subtype.val_injective

definition basic

TopologyByExample.Ellentuck.basic

A finite stem and an upper reservoir determine a basic set.

def basic (s : Finset ℕ) (A : Set ℕ) : Set Ellentuck
:=
  {B | (s : Set ℕ) ⊆ val B ∧ val B ⊆ A}

instance

Openness is witnessed by a finite stem at each infinite set.

instance : TopologicalSpace Ellentuck
Proof
where
  IsOpen U := ∀ B ∈ U, ∃ s : Finset ℕ, (s : Set ℕ) ⊆ val B ∧ basic s (val B) ⊆ U
  isOpen_univ := fun B _ ↦ ⟨∅, by simp, subset_univ _⟩
  isOpen_inter := by
    intro U V hU hV B hB
    obtain ⟨s, hs, hsU⟩ := hU B hB.1
    obtain ⟨t, ht, htV⟩ := hV B hB.2
    refine ⟨s ∪ t, ?_, fun C hC ↦ ⟨hsU ⟨?_, hC.2⟩, htV ⟨?_, hC.2⟩⟩⟩
    · simpa using union_subset hs ht
    · exact fun k hk ↦ hC.1 (Finset.mem_union_left t hk)
    · exact fun k hk ↦ hC.1 (Finset.mem_union_right s hk)
  isOpen_sUnion := by
    intro S hS B hB
    obtain ⟨U, hU, hBU⟩ := mem_sUnion.mp hB
    obtain ⟨s, hs, hsU⟩ := hS U hU B hBU
    exact ⟨s, hs, hsU.trans (subset_sUnion_of_mem hU)⟩

theorem isOpen_basic

TopologyByExample.Ellentuck.isOpen_basic

The interval basic sets are open.

theorem isOpen_basic (s : Finset ℕ) (A : Set ℕ) : IsOpen (basic s A)
Proof
:= by
  intro B hB
  exact ⟨s, hB.1, fun C hC ↦ ⟨hC.1, hC.2.trans hB.2⟩⟩

theorem hasBasis

TopologyByExample.Ellentuck.hasBasis

The finite stems give a neighborhood basis at each point.

theorem hasBasis (B : Ellentuck) :
    (𝓝 B).HasBasis (fun s : Finset ℕ ↦ (s : Set ℕ) ⊆ val B) (fun s ↦ basic s (val B))
Proof
:= by
  refine ⟨fun U ↦ ⟨?_, ?_⟩⟩
  · intro hU
    obtain ⟨V, hVU, hVo, hBV⟩ := mem_nhds_iff.mp hU
    obtain ⟨s, hs, hsV⟩ := hVo B hBV
    exact ⟨s, hs, hsV.trans hVU⟩
  · rintro ⟨s, hs, hsU⟩
    exact mem_of_superset ((isOpen_basic s (val B)).mem_nhds ⟨hs, subset_rfl⟩) hsU

instance

There are only countably many finite stems.

instance : FirstCountableTopology Ellentuck
Proof
:=
  ⟨fun B ↦ (hasBasis B).isCountablyGenerated⟩

theorem isClosed_basic

TopologyByExample.Ellentuck.isClosed_basic

Every interval basic set is closed.

theorem isClosed_basic (s : Finset ℕ) (A : Set ℕ) : IsClosed (basic s A)
Proof
:= by
  classical
  apply isOpen_compl_iff.mp
  intro B hB
  by_cases hs : (s : Set ℕ) ⊆ val B
  · have hn : ¬ val B ⊆ A := fun h ↦ hB ⟨hs, h⟩
    obtain ⟨k, hkB, hkA⟩ := not_subset.mp hn
    refine ⟨{k}, by simpa using (singleton_subset_iff.mpr hkB), ?_⟩
    intro C hC hCA
    exact hkA (hCA.2 (hC.1 (by simp)))
  · refine ⟨∅, by simp, ?_⟩
    intro C hC hCA
    exact hs (hCA.1.trans hC.2)

instance

The clopen interval sets form a base.

instance : ZeroDimensionalSpace Ellentuck
Proof
:= by
  rw [zeroDimensionalSpace_iff_isTopologicalBasis_isClopen]
  apply isTopologicalBasis_of_isOpen_of_nhds (fun (U : Set Ellentuck) (h : IsClopen U) ↦ h.isOpen)
  intro B U hBU hU
  obtain ⟨s, hs, hsU⟩ := hU B hBU
  exact ⟨basic s (val B), ⟨isClosed_basic _ _, isOpen_basic _ _⟩,
    ⟨hs, subset_rfl⟩, hsU⟩

instance

Singletons are closed.

instance : T1Space Ellentuck
Proof
:= by
  constructor
  intro A
  apply isOpen_compl_iff.mp
  intro B hB
  by_cases hAB : val A ⊆ val B
  · have hBA : ¬ val B ⊆ val A := fun h ↦ hB (val_injective (Subset.antisymm h hAB))
    obtain ⟨k, hkB, hkA⟩ := not_subset.mp hBA
    refine ⟨{k}, by simpa using (singleton_subset_iff.mpr hkB), ?_⟩
    rintro C hC rfl
    exact hkA (hC.1 (by simp))
  · refine ⟨∅, by simp, ?_⟩
    rintro C hC rfl
    exact hAB hC.2

definition whole

TopologyByExample.Ellentuck.whole

The whole set of natural numbers is an Ellentuck point.

def whole : Ellentuck
:= ⟨univ, infinite_univ⟩

instance

instance : Nonempty Ellentuck
Proof
:= ⟨whole⟩

theorem not_isOpen_singleton

TopologyByExample.Ellentuck.not_isOpen_singleton

No infinite subset is isolated: remove a point beyond the finite stem.

theorem not_isOpen_singleton (B : Ellentuck) : ¬ IsOpen ({B} : Set Ellentuck)
Proof
:= by
  intro h
  obtain ⟨s, hs, hsub⟩ := h B rfl
  obtain ⟨k, hkB, hks⟩ := (infinite_val B).exists_notMem_finite s.finite_toSet
  let C : Ellentuck := ⟨val B \ {k}, (infinite_val B).sdiff (finite_singleton k)⟩
  have hCB : C ∈ basic s (val B) := by
    refine ⟨fun j hj ↦ ⟨hs hj, ?_⟩, sdiff_subset⟩
    intro he
    exact hks (mem_singleton_iff.mp he ▸ hj)
  have he : C = B := hsub hCB
  have hk : k ∉ val C := by simp [C, val]
  exact hk (he.symm ▸ hkB)

definition prefixBasic

TopologyByExample.Ellentuck.prefixBasic

Initial-segment basic sets in the source's convention.

def prefixBasic (s : Finset ℕ) (A : Set ℕ) : Set Ellentuck
:=
  {B | (s : Set ℕ) ⊆ val B ∧ val B ⊆ (s : Set ℕ) ∪ A ∧
    ∀ k ∈ val B, k ∉ s → ∀ j ∈ s, j < k}

theorem isOpen_prefixBasic

TopologyByExample.Ellentuck.isOpen_prefixBasic

The source's initial-segment basic sets are open.

theorem isOpen_prefixBasic (s : Finset ℕ) (A : Set ℕ) : IsOpen (prefixBasic s A)
Proof
:= by
  intro B hB
  exact ⟨s, hB.1, fun C hC ↦ ⟨hC.1, hC.2.trans hB.2.1,
    fun k hk hks j hj ↦ hB.2.2 k (hC.2 hk) hks j hj⟩⟩

theorem exists_prefixBasic_subset

TopologyByExample.Ellentuck.exists_prefixBasic_subset

Initial-segment basic sets form a neighborhood basis for the defined topology.

theorem exists_prefixBasic_subset {B : Ellentuck} {U : Set Ellentuck}
    (hU : IsOpen U) (hBU : B ∈ U) :
    ∃ s : Finset ℕ, B ∈ prefixBasic s (val B) ∧ prefixBasic s (val B) ⊆ U
Proof
:= by
  classical
  obtain ⟨t, ht, htU⟩ := hU B hBU
  obtain ⟨n, hn⟩ := t.exists_nat_subset_range
  let s := (Finset.range n).filter (fun k ↦ k ∈ val B)
  have hsB : (s : Set ℕ) ⊆ val B := fun k hk ↦ (Finset.mem_filter.mp hk).2
  have hts : (t : Set ℕ) ⊆ s := by
    intro k hk
    exact Finset.mem_filter.mpr ⟨hn hk, ht hk⟩
  refine ⟨s, ⟨hsB, subset_union_right, ?_⟩, ?_⟩
  · intro k hk hks j hjs
    have hjn := Finset.mem_range.mp (Finset.mem_filter.mp hjs).1
    have hkn : n ≤ k := by
      by_contra! hkn
      exact hks (Finset.mem_filter.mpr ⟨Finset.mem_range.mpr hkn, hk⟩)
    exact hjn.trans_le hkn
  · intro C hC
    apply htU
    exact ⟨hts.trans hC.1, hC.2.1.trans (union_subset hsB subset_rfl)⟩

theorem not_hasIsolatedPoint

TopologyByExample.Ellentuck.not_hasIsolatedPoint

The Ellentuck topology has no isolated point.

theorem not_hasIsolatedPoint : ¬ HasIsolatedPoint Ellentuck
Proof
:= by
  rintro ⟨B, hB⟩
  exact not_isOpen_singleton B hB

On this site: The Ellentuck space has no isolated point

definition code

TopologyByExample.Ellentuck.code

Coding an arbitrary set on odd numbers while retaining every even number.

def code (A : Set ℕ) : Ellentuck
Definition
:=
  ⟨range (fun n : ℕ ↦ 2 * n) ∪ (fun n : ℕ ↦ 2 * n + 1) '' A,
    (Set.infinite_range_of_injective (show Function.Injective (fun n : ℕ ↦ 2 * n) from by
      intro a b h; dsimp at h; omega)).mono
      subset_union_left⟩

theorem odd_mem_code

TopologyByExample.Ellentuck.odd_mem_code

Odd membership recovers the coded set.

theorem odd_mem_code (A : Set ℕ) (n : ℕ) : 2 * n + 1 ∈ val (code A) ↔ n ∈ A
Proof
:= by
  change (2 * n + 1 ∈ range (fun k : ℕ ↦ 2 * k) ∪ (fun k : ℕ ↦ 2 * k + 1) '' A) ↔ n ∈ A
  constructor
  · rintro (⟨k, hk⟩ | ⟨k, hk, he⟩)
    · dsimp at hk; omega
    · have : k = n := by dsimp at he; omega
      simpa [this] using hk
  · intro hn
    exact Or.inr ⟨n, hn, rfl⟩

theorem code_injective

TopologyByExample.Ellentuck.code_injective

Different subsets give different infinite coded sets.

theorem code_injective : Function.Injective code
Proof
:= by
  intro A B h
  ext n
  rw [← odd_mem_code A n, ← odd_mem_code B n, h]

theorem cardinality_continuum

TopologyByExample.Ellentuck.cardinality_continuum

The infinite-subset carrier has continuum cardinality.

theorem cardinality_continuum : CardinalityContinuum Ellentuck
Proof
:= by
  have he : Cardinal.mk (Set ℕ) = Cardinal.continuum := by
    rw [Cardinal.mk_set, Cardinal.mk_nat, Cardinal.two_power_aleph0]
  exact le_antisymm ((Cardinal.mk_le_of_injective val_injective).trans_eq he)
    (he ▸ Cardinal.mk_le_of_injective code_injective)

On this site: The Ellentuck space has cardinality equal to \(\mathfrak{c}\)