Lean library · module TopologyByExample.Slices.S4

The separation study

Source file

The study of the separation axioms (Lean name S4) has nine properties, all Mathlib's unbundled classes, in this order:

index property Mathlib
0 T₀ T0Space
1 T₁ T1Space
2 Hausdorff T2Space
3 Urysohn (T₂½) T25Space
4 regular RegularSpace
5 completely regular CompletelyRegularSpace
6 normal NormalSpace
7 completely normal CompletelyNormalSpace
8 perfectly normal PerfectlyNormalSpace

Its theory is ten Horn clauses (S4.data.clauses): seven single implications and three chains through the R₀ property (R0Space), which is not one of the nine. Its base library has ten spaces:

index row base space here
0 111111111 one-point space Unit
1 111111110 first uncountable ordinal ω₁ field omegaOne
2 111111100 one-point compactification of 3 field rationalSequenceCompactification
3 111111000 rational sequence topology field rationalSequenceTopology
4 111110000 Mysior's space field mysiorSpace
5 111100000 real line with the K-topology field kTopology
6 111000000 a countable Hausdorff space that is not Urysohn NonUrysohn
7 110000000 cofinite topology on ℕ CofiniteTopology ℕ
8 100000110 Sierpiński space field sierpinskiSpace
9 000011111 two-point indiscrete space WithTopology Bool ⊤

Exactly 19 of the 512 rows are consistent, and each is the meet of the base rows above it. No row is open and no axiom beyond ZFC is used.

Main statements

  • S4.valid, S4.sumConjunctive, S4.covers: the three hypotheses of the general theorems.
  • S4.not_realises_of_solve_eq_refuted: no space, in any universe, realises a refuted row.
  • S4.solve_correct and S4.exists_realises_iff_consistent: correctness and completeness of the algorithm for any base library S4.BaseSpaces. Four of its ten spaces are filled in here; the other six are fields, supplied (through the lemmas S4.realises_* of the section Rows) in the companion file, which states both results unconditionally.
  • S4.card_consistent: 19 of the 512 rows are consistent.

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

The properties

definition t0

TopologyByExample.Slices.S4.t0

The T₀ property (T0Space).

def t0 : SpaceProperty.{u}
:= ⟨fun X _ ↦ T0Space X⟩

definition t1

TopologyByExample.Slices.S4.t1

The T₁ property (T1Space).

def t1 : SpaceProperty.{u}
:= ⟨fun X _ ↦ T1Space X⟩

definition t2

TopologyByExample.Slices.S4.t2

The Hausdorff property (T2Space).

def t2 : SpaceProperty.{u}
:= ⟨fun X _ ↦ T2Space X⟩

definition t25

TopologyByExample.Slices.S4.t25

The Urysohn property, T₂½ (T25Space).

def t25 : SpaceProperty.{u}
:= ⟨fun X _ ↦ T25Space X⟩

definition regular

TopologyByExample.Slices.S4.regular

Regularity (RegularSpace).

def regular : SpaceProperty.{u}
:= ⟨fun X _ ↦ RegularSpace X⟩

definition completelyRegular

TopologyByExample.Slices.S4.completelyRegular

Complete regularity (CompletelyRegularSpace).

def completelyRegular : SpaceProperty.{u}
:= ⟨fun X _ ↦ CompletelyRegularSpace X⟩

definition normal

TopologyByExample.Slices.S4.normal

Normality (NormalSpace).

def normal : SpaceProperty.{u}
:= ⟨fun X _ ↦ NormalSpace X⟩

definition completelyNormal

TopologyByExample.Slices.S4.completelyNormal

Complete normality (CompletelyNormalSpace).

def completelyNormal : SpaceProperty.{u}
:= ⟨fun X _ ↦ CompletelyNormalSpace X⟩

definition perfectlyNormal

TopologyByExample.Slices.S4.perfectlyNormal

Perfect normality (PerfectlyNormalSpace).

def perfectlyNormal : SpaceProperty.{u}
:= ⟨fun X _ ↦ PerfectlyNormalSpace X⟩

definition prop

TopologyByExample.Slices.S4.prop

The properties of S4, in study order.

def prop : Fin 9 → SpaceProperty.{u}
:=
  ![t0, t1, t2, t25, regular, completelyRegular, normal, completelyNormal, perfectlyNormal]

definition Realises

TopologyByExample.Slices.S4.Realises

The space X realises the row r of S4.

abbrev Realises (X : Type u) [TopologicalSpace X] (r : Row 9) : Prop
:=
  Slices.Realises prop X r

theorem sumConjunctive

TopologyByExample.Slices.S4.sumConjunctive

Every S4 property is sum-conjunctive.

theorem sumConjunctive : ∀ i, (prop.{u} i).SumConjunctive
Proof
:= by
  intro i
  fin_cases i <;> intro X Y _ _
  exacts [t0Space_sum_iff, t1Space_sum_iff, t2Space_sum_iff, t25Space_sum_iff,
    regularSpace_sum_iff, completelyRegularSpace_sum_iff, normalSpace_sum_iff,
    completelyNormalSpace_sum_iff, perfectlyNormalSpace_sum_iff]

theorem holds_of_homeomorph

TopologyByExample.Slices.S4.holds_of_homeomorph

The S4 properties are invariant under homeomorphisms, also between universes.

theorem holds_of_homeomorph {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y]
    (e : X ≃ₜ Y) (i : Fin 9) (h : (prop.{u} i).Holds X) : (prop.{v} i).Holds Y
Proof
:= by
  fin_cases i
  · have : T0Space X := h
    exact e.symm.isEmbedding.t0Space
  · have : T1Space X := h
    exact e.symm.isEmbedding.t1Space
  · have : T2Space X := h
    exact e.symm.isEmbedding.t2Space
  · have : T25Space X := h
    exact e.symm.isEmbedding.t25Space
  · have : RegularSpace X := h
    exact e.symm.isInducing.regularSpace
  · have : CompletelyRegularSpace X := h
    exact e.symm.isInducing.completelyRegularSpace
  · have : NormalSpace X := h
    exact e.symm.isClosedEmbedding.normalSpace
  · have : CompletelyNormalSpace X := h
    exact e.symm.isInducing.completelyNormalSpace
  · have : PerfectlyNormalSpace X := h
    exact e.symm.isInducing.perfectlyNormalSpace

theorem of_homeomorph

TopologyByExample.Slices.S4.Realises.of_homeomorph

Homeomorphic spaces, possibly in different universes, realise the same S4 rows.

theorem Realises.of_homeomorph {X : Type u} {Y : Type v} [TopologicalSpace X]
    [TopologicalSpace Y] (e : X ≃ₜ Y) {r : Row 9} (h : Realises X r) : Realises Y r
Proof
:=
  fun i ↦ ⟨fun hY ↦ (h i).1 (holds_of_homeomorph e.symm i hY),
    fun hr ↦ holds_of_homeomorph e i ((h i).2 hr)⟩

The combinatorial data

definition data

TopologyByExample.Slices.S4.data

The combinatorial data of S4. The clauses are listed in the order in which the content's algorithm prefers them (fewest literals, then key; the keys are the proposed theorem ids, a chain's ids joined by --):

  1. completely-normal-implies-normal
  2. completely-regular-implies-regular
  3. perfectly-normal-implies-completely-normal
  4. the chain perfectly-normal-implies-completely-normal, completely-normal-implies-normal, normal-r0-implies-completely-regular, perfectly-normal-implies-r0: perfectly normal ⇒ completely regular
  5. t1-implies-t0
  6. t2-implies-t1
  7. urysohn-implies-t2
  8. the chain regular-implies-r0, normal-r0-implies-completely-regular: regular and normal ⇒ completely regular
  9. t0-regular-implies-urysohn
  10. the chain t1-implies-r0, normal-r0-implies-completely-regular, completely-regular-implies-regular: T₁ and normal ⇒ regular

The base rows are those of the base spaces in the order of the module docstring, and the top space is the one-point space.

def data : SliceData 9 10
Definition
where
  clauses :=
    [⟨[7], some 6⟩, ⟨[5], some 4⟩, ⟨[8], some 7⟩, ⟨[8], some 5⟩, ⟨[1], some 0⟩,
      ⟨[2], some 1⟩, ⟨[3], some 2⟩, ⟨[4, 6], some 5⟩, ⟨[0, 4], some 3⟩, ⟨[1, 6], some 4⟩]
  baseRow :=
    ![![true, true, true, true, true, true, true, true, true],
      ![true, true, true, true, true, true, true, true, false],
      ![true, true, true, true, true, true, true, false, false],
      ![true, true, true, true, true, true, false, false, false],
      ![true, true, true, true, true, false, false, false, false],
      ![true, true, true, true, false, false, false, false, false],
      ![true, true, true, false, false, false, false, false, false],
      ![true, true, false, false, false, false, false, false, false],
      ![true, false, false, false, false, false, true, true, false],
      ![false, false, false, false, true, true, true, true, true]]
  top := 0

theorem valid

TopologyByExample.Slices.S4.valid

The S4 clauses are theorems, for spaces in every universe.

theorem valid : data.Valid prop.{u}
Proof
:= by
  intro c hc X _ h
  simp only [data, List.mem_cons, List.not_mem_nil, or_false] at hc
  rcases hc with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl
  · have : CompletelyNormalSpace X := h 7 (by simp)
    exact (inferInstance : NormalSpace X)
  · have : CompletelyRegularSpace X := h 5 (by simp)
    exact (inferInstance : RegularSpace X)
  · have : PerfectlyNormalSpace X := h 8 (by simp)
    exact (inferInstance : CompletelyNormalSpace X)
  · -- perfectly normal ⇒ completely normal ⇒ normal, perfectly normal ⇒ R₀, and Urysohn's lemma
    have : PerfectlyNormalSpace X := h 8 (by simp)
    have : R0Space X := r0Space_of_perfectlyNormalSpace
    exact NormalSpace.instCompletelyRegularSpace
  · have : T1Space X := h 1 (by simp)
    exact (inferInstance : T0Space X)
  · have : T2Space X := h 2 (by simp)
    exact (inferInstance : T1Space X)
  · have : T25Space X := h 3 (by simp)
    exact (inferInstance : T2Space X)
  · -- regular ⇒ R₀, and Urysohn's lemma
    have : RegularSpace X := h 4 (by simp)
    have : NormalSpace X := h 6 (by simp)
    have : R0Space X := r0Space_of_regularSpace
    exact NormalSpace.instCompletelyRegularSpace
  · have : T0Space X := h 0 (by simp)
    have : RegularSpace X := h 4 (by simp)
    exact t25Space_of_t0Space_of_regularSpace
  · -- T₁ ⇒ R₀, Urysohn's lemma, and completely regular ⇒ regular
    have : T1Space X := h 1 (by simp)
    have : NormalSpace X := h 6 (by simp)
    have : R0Space X := r0Space_of_t1Space
    have : CompletelyRegularSpace X := NormalSpace.instCompletelyRegularSpace
    exact (inferInstance : RegularSpace X)

theorem covers

TopologyByExample.Slices.S4.covers

Every consistent row of S4 is the row of its witness expression: the meet of the base rows above it. Checked by kernel evaluation over all 512 rows.

theorem covers : data.Covers
Proof
:= by decide +kernel

theorem card_consistent

TopologyByExample.Slices.S4.card_consistent

Exactly 19 of the 512 rows of S4 are consistent.

theorem card_consistent :
    ((Row.all 9).filter fun r ↦ decide (data.Consistent r)).length = 19
Proof
:= by
  decide +kernel

Completing the base rows

For each base row, a few values determine the rest of the row through the clauses.

variable {X : Type u} [TopologicalSpace X]

theorem realises_onePointSpace

TopologyByExample.Slices.S4.realises_onePointSpace

A perfectly normal T₀ space has the row 111111111.

theorem realises_onePointSpace [T0Space X] [PerfectlyNormalSpace X] :
    Realises X (data.baseRow 0)
Proof
:=
  data.realises_of_determines valid (cells := [(0, true), (8, true)])
    ⟨iff_of_true ‹T0Space X› rfl, iff_of_true ‹PerfectlyNormalSpace X› rfl⟩
    (by decide +kernel)

theorem realises_omegaOne

TopologyByExample.Slices.S4.realises_omegaOne

A completely normal Hausdorff space that is not perfectly normal has the row 111111110.

theorem realises_omegaOne [T2Space X] [CompletelyNormalSpace X] (h : ¬PerfectlyNormalSpace X) :
    Realises X (data.baseRow 1)
Proof
:=
  data.realises_of_determines valid (cells := [(2, true), (7, true), (8, false)])
    ⟨iff_of_true ‹T2Space X› rfl, iff_of_true ‹CompletelyNormalSpace X› rfl,
      iff_of_false h Bool.false_ne_true⟩
    (by decide +kernel)

theorem realises_rationalSequenceCompactification

TopologyByExample.Slices.S4.realises_rationalSequenceCompactification

A normal Hausdorff space that is not completely normal has the row 111111100.

theorem realises_rationalSequenceCompactification [T2Space X] [NormalSpace X]
    (h : ¬CompletelyNormalSpace X) : Realises X (data.baseRow 2)
Proof
:=
  data.realises_of_determines valid (cells := [(2, true), (6, true), (7, false)])
    ⟨iff_of_true ‹T2Space X› rfl, iff_of_true ‹NormalSpace X› rfl,
      iff_of_false h Bool.false_ne_true⟩
    (by decide +kernel)

theorem realises_rationalSequenceTopology

TopologyByExample.Slices.S4.realises_rationalSequenceTopology

A completely regular Hausdorff space that is not normal has the row 111111000.

theorem realises_rationalSequenceTopology [T2Space X] [CompletelyRegularSpace X]
    (h : ¬NormalSpace X) : Realises X (data.baseRow 3)
Proof
:=
  data.realises_of_determines valid (cells := [(2, true), (5, true), (6, false)])
    ⟨iff_of_true ‹T2Space X› rfl, iff_of_true ‹CompletelyRegularSpace X› rfl,
      iff_of_false h Bool.false_ne_true⟩
    (by decide +kernel)

theorem realises_mysiorSpace

TopologyByExample.Slices.S4.realises_mysiorSpace

A regular T₁ space that is not completely regular has the row 111110000.

theorem realises_mysiorSpace [T1Space X] [RegularSpace X] (h : ¬CompletelyRegularSpace X) :
    Realises X (data.baseRow 4)
Proof
:=
  data.realises_of_determines valid (cells := [(1, true), (4, true), (5, false)])
    ⟨iff_of_true ‹T1Space X› rfl, iff_of_true ‹RegularSpace X› rfl,
      iff_of_false h Bool.false_ne_true⟩
    (by decide +kernel)

theorem realises_kTopology

TopologyByExample.Slices.S4.realises_kTopology

A Urysohn space that is not regular has the row 111100000.

theorem realises_kTopology [T25Space X] (h : ¬RegularSpace X) : Realises X (data.baseRow 5)
Proof
:=
  data.realises_of_determines valid (cells := [(3, true), (4, false)])
    ⟨iff_of_true ‹T25Space X› rfl, iff_of_false h Bool.false_ne_true⟩
    (by decide +kernel)

theorem realises_nonUrysohnSpace

TopologyByExample.Slices.S4.realises_nonUrysohnSpace

A Hausdorff space that is not Urysohn has the row 111000000.

theorem realises_nonUrysohnSpace [T2Space X] (h : ¬T25Space X) : Realises X (data.baseRow 6)
Proof
:=
  data.realises_of_determines valid (cells := [(2, true), (3, false)])
    ⟨iff_of_true ‹T2Space X› rfl, iff_of_false h Bool.false_ne_true⟩
    (by decide +kernel)

theorem realises_cofiniteNaturals

TopologyByExample.Slices.S4.realises_cofiniteNaturals

A T₁ space that is not Hausdorff has the row 110000000.

theorem realises_cofiniteNaturals [T1Space X] (h : ¬T2Space X) : Realises X (data.baseRow 7)
Proof
:=
  data.realises_of_determines valid (cells := [(1, true), (2, false)])
    ⟨iff_of_true ‹T1Space X› rfl, iff_of_false h Bool.false_ne_true⟩
    (by decide +kernel)

theorem realises_sierpinskiSpace

TopologyByExample.Slices.S4.realises_sierpinskiSpace

A completely normal T₀ space that is not T₁ has the row 100000110.

theorem realises_sierpinskiSpace [T0Space X] [CompletelyNormalSpace X] (h : ¬T1Space X) :
    Realises X (data.baseRow 8)
Proof
:=
  data.realises_of_determines valid (cells := [(0, true), (1, false), (7, true)])
    ⟨iff_of_true ‹T0Space X› rfl, iff_of_false h Bool.false_ne_true,
      iff_of_true ‹CompletelyNormalSpace X› rfl⟩
    (by decide +kernel)

theorem realises_indiscretePair

TopologyByExample.Slices.S4.realises_indiscretePair

A perfectly normal space that is not T₀ has the row 000011111.

theorem realises_indiscretePair [PerfectlyNormalSpace X] (h : ¬T0Space X) :
    Realises X (data.baseRow 9)
Proof
:=
  data.realises_of_determines valid (cells := [(0, false), (8, true)])
    ⟨iff_of_false h Bool.false_ne_true, iff_of_true ‹PerfectlyNormalSpace X› rfl⟩
    (by decide +kernel)

theorem realises_unit

TopologyByExample.Slices.S4.realises_unit

The one-point space Unit realises the row 111111111.

theorem realises_unit : Realises (TopCat.of Unit) (data.baseRow 0)
Proof
:=
  realises_onePointSpace (X := Unit)

theorem realises_nonUrysohn

TopologyByExample.Slices.S4.realises_nonUrysohn

The countable Hausdorff space NonUrysohn realises the row 111000000.

theorem realises_nonUrysohn : Realises (TopCat.of NonUrysohn) (data.baseRow 6)
Proof
:=
  realises_nonUrysohnSpace (X := NonUrysohn) NonUrysohn.not_t25Space

theorem realises_cofiniteTopology_nat

TopologyByExample.Slices.S4.realises_cofiniteTopology_nat

The cofinite topology on ℕ realises the row 110000000.

theorem realises_cofiniteTopology_nat :
    Realises (TopCat.of (CofiniteTopology ℕ)) (data.baseRow 7)
Proof
:=
  realises_cofiniteNaturals (X := CofiniteTopology ℕ) CofiniteNat.not_t2Space

theorem realises_withTopology_bool_top

TopologyByExample.Slices.S4.realises_withTopology_bool_top

The two-point indiscrete space realises the row 000011111.

theorem realises_withTopology_bool_top :
    Realises (TopCat.of (WithTopology Bool ⊤)) (data.baseRow 9)
Proof
:=
  have : PerfectlyNormalSpace (WithTopology Bool ⊤) := IndiscretePair.perfectlyNormalSpace
  realises_indiscretePair (X := WithTopology Bool ⊤) IndiscretePair.not_t0Space

The base library and the main theorems

structure BaseSpaces

TopologyByExample.Slices.S4.BaseSpaces

The base library of S4: a space in Type realising each base row. Four spaces are filled in by default; ω₁, the rational sequence topology and its one-point compactification, Mysior's space, the K-topology and the Sierpiński space are supplied by S4.baseSpaces in the companion file.

structure BaseSpaces : Type 1 where
  /-- The one-point space (row `111111111`). -/
  onePointSpace : TopCat.{0} := TopCat.of Unit
  onePointSpace_realises : Realises onePointSpace (data.baseRow 0) := by
    exact TopologyByExample.Slices.S4.realises_unit
  /-- The first uncountable ordinal (row `111111110`). -/
  omegaOne : TopCat.{0}
  omegaOne_realises : Realises omegaOne (data.baseRow 1)
  /-- The one-point compactification of the rational sequence topology (row `111111100`). -/
  rationalSequenceCompactification : TopCat.{0}
  rationalSequenceCompactification_realises :
    Realises rationalSequenceCompactification (data.baseRow 2)
  /-- The rational sequence topology (row `111111000`). -/
  rationalSequenceTopology : TopCat.{0}
  rationalSequenceTopology_realises : Realises rationalSequenceTopology (data.baseRow 3)
  /-- Mysior's space (row `111110000`). -/
  mysiorSpace : TopCat.{0}
  mysiorSpace_realises : Realises mysiorSpace (data.baseRow 4)
  /-- The real line with the K-topology (row `111100000`). -/
  kTopology : TopCat.{0}
  kTopology_realises : Realises kTopology (data.baseRow 5)
  /-- A countable Hausdorff space that is not Urysohn (row `111000000`). -/
  nonUrysohnSpace : TopCat.{0} := TopCat.of NonUrysohn
  nonUrysohnSpace_realises : Realises nonUrysohnSpace (data.baseRow 6) := by
    exact TopologyByExample.Slices.S4.realises_nonUrysohn
  /-- The cofinite topology on the natural numbers (row `110000000`). -/
  cofiniteNaturals : TopCat.{0} := TopCat.of (CofiniteTopology ℕ)
  cofiniteNaturals_realises : Realises cofiniteNaturals (data.baseRow 7) := by
    exact TopologyByExample.Slices.S4.realises_cofiniteTopology_nat
  /-- The Sierpiński space (row `100000110`). -/
  sierpinskiSpace : TopCat.{0}
  sierpinskiSpace_realises : Realises sierpinskiSpace (data.baseRow 8)
  /-- The two-point indiscrete space (row `000011111`). -/
  indiscretePair : TopCat.{0} := TopCat.of (WithTopology Bool ⊤)
  indiscretePair_realises : Realises indiscretePair (data.baseRow 9) := by
    exact TopologyByExample.Slices.S4.realises_withTopology_bool_top

definition library

TopologyByExample.Slices.S4.BaseSpaces.library

The base library as a SliceData.Library, indexed as in the module docstring.

def BaseSpaces.library (B : BaseSpaces) : data.Library prop.{0}
Definition
where
  space := ![B.onePointSpace, B.omegaOne, B.rationalSequenceCompactification,
    B.rationalSequenceTopology, B.mysiorSpace, B.kTopology, B.nonUrysohnSpace, B.cofiniteNaturals,
    B.sierpinskiSpace, B.indiscretePair]
  realises b := by
    fin_cases b
    exacts [B.onePointSpace_realises, B.omegaOne_realises,
      B.rationalSequenceCompactification_realises, B.rationalSequenceTopology_realises,
      B.mysiorSpace_realises, B.kTopology_realises, B.nonUrysohnSpace_realises,
      B.cofiniteNaturals_realises, B.sierpinskiSpace_realises, B.indiscretePair_realises]

theorem not_realises_of_solve_eq_refuted

TopologyByExample.Slices.S4.not_realises_of_solve_eq_refuted

Soundness of S4 refutations. If the algorithm refutes a row, by a clause of S4 the row violates, then no topological space, in any universe, realises the row.

theorem not_realises_of_solve_eq_refuted {r : Row 9} {c : Clause 9}
    (h : data.solve r = .refuted c) (X : Type u) [TopologicalSpace X] : ¬Realises X r
Proof
:=
  data.not_realises_of_solve_eq_refuted valid h X

theorem solve_correct

TopologyByExample.Slices.S4.solve_correct

Correctness of the S4 algorithm, for any base library.

theorem solve_correct (B : BaseSpaces) (r : Row 9) :
    (data.solve r).Correct data prop B.library.space r
Proof
:=
  data.solve_correct valid sumConjunctive B.library covers r

theorem exists_realises_iff_consistent

TopologyByExample.Slices.S4.exists_realises_iff_consistent

Completeness of S4, for any base library: a row is realised by some topological space (in any given universe) if and only if it satisfies the ten clauses.

theorem exists_realises_iff_consistent (B : BaseSpaces) (r : Row 9) :
    (∃ X : TopCat.{u}, Realises X r) ↔ data.Consistent r
Proof
:= by
  refine ⟨fun ⟨X, hX⟩ ↦ valid.consistent hX, fun hr ↦ ?_⟩
  obtain ⟨X, hX⟩ :=
    (data.exists_realises_iff_consistent valid sumConjunctive B.library covers r).2 hr
  exact ⟨TopCat.of (ULift.{u} X), Realises.of_homeomorph Homeomorph.ulift.symm hX⟩