Lean library · module TopologyByExample.Slices.S1

The slice S1: countability, metrizability and the Hausdorff property

Source file

The slice S1 (content/slices/s1.md) has six properties, in this order:

index property Mathlib
0 first countable FirstCountableTopology
1 second countable SecondCountableTopology
2 separable TopologicalSpace.SeparableSpace
3 Lindelöf LindelofSpace
4 metrizable TopologicalSpace.MetrizableSpace
5 Hausdorff T2Space

Its theory is seven Horn clauses (S1.data.clauses), and its base library has eight spaces, in the order of the content's base_spaces:

index row base space here
0 111111 one-point space Unit
1 111100 Sierpiński space Prop
2 100011 ℝ with the discrete topology WithDiscreteTopology ℝ
3 111101 K-topology on ℝ field kTopology
4 101101 Sorgenfrey line field sorgenfreyLine
5 101001 Sorgenfrey plane field sorgenfreyPlane
6 100101 lexicographically ordered unit square field lexicographicSquare
7 001101 Arens–Fort space field arensFortSpace

The data here is checked against content/ by the generated file TopologyByExample.Generated.SliceCheck, which also checks that S1.data.solve agrees with the Python implementation of the algorithm on all 64 rows.

Main statements

  • S1.valid, S1.sumConjunctive, S1.covers: the three hypotheses of the general theorems: the clauses are theorems (in every universe), the properties are sum-conjunctive, and every consistent row is the meet of the base rows above it (by decide).
  • S1.not_realises_of_solve_eq_refuted: unconditional and universe polymorphic: no space realises a row the algorithm refutes.
  • S1.solve_correct and S1.exists_realises_iff_consistent: correctness and completeness of the algorithm, for any S1.BaseSpaces, the base library. Three of its eight spaces are filled in here; the other five are fields to be supplied from the space files. Completeness holds in every universe: the witness, built in Type, is lifted with ULift (S1.Realises.of_homeomorph). TopologyByExample.Slices.S1.Complete supplies the library and states both unconditionally.
  • S1.realises_kTopology etc.: for each base row, the few facts from which the whole row follows by the clauses (the values the content asserts for that space).

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 firstCountable

TopologyByExample.Slices.S1.firstCountable

First countability (FirstCountableTopology).

def firstCountable : SpaceProperty.{u}
:= ⟨fun X _ ↦ FirstCountableTopology X⟩

definition secondCountable

TopologyByExample.Slices.S1.secondCountable

Second countability (SecondCountableTopology).

def secondCountable : SpaceProperty.{u}
:= ⟨fun X _ ↦ SecondCountableTopology X⟩

definition separable

TopologyByExample.Slices.S1.separable

def separable : SpaceProperty.{u}
:= ⟨fun X _ ↦ SeparableSpace X⟩

definition lindelof

TopologyByExample.Slices.S1.lindelof

The Lindelöf property (LindelofSpace).

def lindelof : SpaceProperty.{u}
:= ⟨fun X _ ↦ LindelofSpace X⟩

definition metrizable

TopologyByExample.Slices.S1.metrizable

def metrizable : SpaceProperty.{u}
:= ⟨fun X _ ↦ MetrizableSpace X⟩

definition t2

TopologyByExample.Slices.S1.t2

The Hausdorff property (T2Space).

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

definition prop

TopologyByExample.Slices.S1.prop

The properties of S1, in slice order.

def prop : Fin 6 → SpaceProperty.{u}
:=
  ![firstCountable, secondCountable, separable, lindelof, metrizable, t2]

definition Realises

TopologyByExample.Slices.S1.Realises

The space X realises the row r of S1.

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

theorem sumConjunctive

TopologyByExample.Slices.S1.sumConjunctive

Every S1 property is sum-conjunctive.

theorem sumConjunctive : ∀ i, (prop.{u} i).SumConjunctive
Proof
:= by
  intro i
  fin_cases i <;> intro X Y _ _
  exacts [firstCountableTopology_sum_iff, secondCountableTopology_sum_iff,
    separableSpace_sum_iff, lindelofSpace_sum_iff, metrizableSpace_sum_iff, t2Space_sum_iff]

theorem holds_of_homeomorph

TopologyByExample.Slices.S1.holds_of_homeomorph

The S1 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 6) (h : (prop.{u} i).Holds X) : (prop.{v} i).Holds Y
Proof
:= by
  fin_cases i
  · have : FirstCountableTopology X := h
    exact e.symm.isEmbedding.firstCountableTopology
  · have : SecondCountableTopology X := h
    exact e.symm.isEmbedding.isInducing.secondCountableTopology
  · have : SeparableSpace X := h
    exact e.surjective.denseRange.separableSpace e.continuous
  · have : LindelofSpace X := h
    exact e.symm.isClosedEmbedding.LindelofSpace
  · have : MetrizableSpace X := h
    exact e.symm.isEmbedding.metrizableSpace
  · have : T2Space X := h
    exact e.symm.isEmbedding.t2Space

theorem of_homeomorph

TopologyByExample.Slices.S1.Realises.of_homeomorph

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

theorem Realises.of_homeomorph {X : Type u} {Y : Type v} [TopologicalSpace X]
    [TopologicalSpace Y] (e : X ≃ₜ Y) {r : Row 6} (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.S1.data

The combinatorial data of S1. The clauses are listed in the order in which the content's algorithm prefers them (fewest literals, then theorem id):

  1. metrizable-implies-first-countable
  2. metrizable-implies-t2
  3. second-countable-implies-first-countable
  4. second-countable-implies-lindelof
  5. second-countable-implies-separable
  6. lindelof-metrizable-implies-separable
  7. separable-metrizable-implies-second-countable

The base rows are those of the base spaces in the content's order, and the top space is the one-point space.

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

theorem valid

TopologyByExample.Slices.S1.valid

The S1 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
  · have : MetrizableSpace X := h 4 (by simp)
    exact (inferInstance : FirstCountableTopology X)
  · have : MetrizableSpace X := h 4 (by simp)
    exact (inferInstance : T2Space X)
  · have : SecondCountableTopology X := h 1 (by simp)
    exact (inferInstance : FirstCountableTopology X)
  · have : SecondCountableTopology X := h 1 (by simp)
    exact (inferInstance : LindelofSpace X)
  · have : SecondCountableTopology X := h 1 (by simp)
    exact (inferInstance : SeparableSpace X)
  · have : MetrizableSpace X := h 4 (by simp)
    have : LindelofSpace X := h 3 (by simp)
    exact (inferInstance : SeparableSpace X)
  · have : MetrizableSpace X := h 4 (by simp)
    have : SeparableSpace X := h 2 (by simp)
    let := pseudoMetrizableSpaceUniformity X
    have := pseudoMetrizableSpaceUniformity_countably_generated X
    exact UniformSpace.secondCountable_of_separable X

theorem covers

TopologyByExample.Slices.S1.covers

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

theorem covers : data.Covers
Proof
:= by decide

theorem card_consistent

TopologyByExample.Slices.S1.card_consistent

Exactly 20 of the 64 rows of S1 are consistent.

theorem card_consistent : ((Row.all 6).filter fun r ↦ decide (data.Consistent r)).length = 20
Proof
:= by
  decide

Completing the base rows

For each base row, the values the content asserts for its space determine the rest of the row through the clauses.

variable {X : Type u} [TopologicalSpace X]

theorem realises_onePointSpace

TopologyByExample.Slices.S1.realises_onePointSpace

A second-countable metrizable space has the row 111111 of the one-point space.

theorem realises_onePointSpace [SecondCountableTopology X] [MetrizableSpace X] :
    Realises X (data.baseRow 0)
Proof
:=
  data.realises_of_determines valid (cells := [(1, true), (4, true)])
    ⟨iff_of_true ‹SecondCountableTopology X› rfl,
      iff_of_true ‹MetrizableSpace X› rfl⟩
    (by decide)

theorem realises_sierpinskiSpace

TopologyByExample.Slices.S1.realises_sierpinskiSpace

A second-countable non-Hausdorff space has the row 111100 of the Sierpiński space.

theorem realises_sierpinskiSpace [SecondCountableTopology X] (h : ¬T2Space X) :
    Realises X (data.baseRow 1)
Proof
:=
  data.realises_of_determines valid (cells := [(1, true), (5, false)])
    ⟨iff_of_true ‹SecondCountableTopology X› rfl, iff_of_false h Bool.false_ne_true⟩
    (by decide)

theorem realises_discreteReals

TopologyByExample.Slices.S1.realises_discreteReals

A metrizable non-Lindelöf space has the row 100011 of the uncountable discrete space.

theorem realises_discreteReals [MetrizableSpace X] (h : ¬LindelofSpace X) :
    Realises X (data.baseRow 2)
Proof
:=
  data.realises_of_determines valid (cells := [(3, false), (4, true)])
    ⟨iff_of_false h Bool.false_ne_true, iff_of_true ‹MetrizableSpace X› rfl⟩
    (by decide)

theorem realises_kTopology

TopologyByExample.Slices.S1.realises_kTopology

A second-countable Hausdorff non-metrizable space has the row 111101 of the K-topology.

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

theorem realises_sorgenfreyLine

TopologyByExample.Slices.S1.realises_sorgenfreyLine

A first-countable, separable, Lindelöf, Hausdorff space that is not second countable has the row 101101 of the Sorgenfrey line.

theorem realises_sorgenfreyLine [FirstCountableTopology X] [SeparableSpace X] [LindelofSpace X]
    [T2Space X] (h : ¬SecondCountableTopology X) : Realises X (data.baseRow 4)
Proof
:=
  data.realises_of_determines valid
    (cells := [(0, true), (1, false), (2, true), (3, true), (5, true)])
    ⟨iff_of_true ‹FirstCountableTopology X› rfl, iff_of_false h Bool.false_ne_true,
      iff_of_true ‹SeparableSpace X› rfl, iff_of_true ‹LindelofSpace X› rfl,
      iff_of_true ‹T2Space X› rfl⟩
    (by decide)

theorem realises_sorgenfreyPlane

TopologyByExample.Slices.S1.realises_sorgenfreyPlane

A first-countable, separable, Hausdorff space that is not Lindelöf has the row 101001 of the Sorgenfrey plane.

theorem realises_sorgenfreyPlane [FirstCountableTopology X] [SeparableSpace X] [T2Space X]
    (h : ¬LindelofSpace X) : Realises X (data.baseRow 5)
Proof
:=
  data.realises_of_determines valid (cells := [(0, true), (2, true), (3, false), (5, true)])
    ⟨iff_of_true ‹FirstCountableTopology X› rfl, iff_of_true ‹SeparableSpace X› rfl,
      iff_of_false h Bool.false_ne_true, iff_of_true ‹T2Space X› rfl⟩
    (by decide)

theorem realises_lexicographicSquare

TopologyByExample.Slices.S1.realises_lexicographicSquare

A first-countable, Lindelöf, Hausdorff space that is not separable has the row 100101 of the lexicographically ordered unit square.

theorem realises_lexicographicSquare [FirstCountableTopology X] [LindelofSpace X] [T2Space X]
    (h : ¬SeparableSpace X) : Realises X (data.baseRow 6)
Proof
:=
  data.realises_of_determines valid (cells := [(0, true), (2, false), (3, true), (5, true)])
    ⟨iff_of_true ‹FirstCountableTopology X› rfl, iff_of_false h Bool.false_ne_true,
      iff_of_true ‹LindelofSpace X› rfl, iff_of_true ‹T2Space X› rfl⟩
    (by decide)

theorem realises_arensFortSpace

TopologyByExample.Slices.S1.realises_arensFortSpace

A separable, Lindelöf, Hausdorff space that is not first countable has the row 001101 of the Arens–Fort space.

theorem realises_arensFortSpace [SeparableSpace X] [LindelofSpace X] [T2Space X]
    (h : ¬FirstCountableTopology X) : Realises X (data.baseRow 7)
Proof
:=
  data.realises_of_determines valid (cells := [(0, false), (2, true), (3, true), (5, true)])
    ⟨iff_of_false h Bool.false_ne_true, iff_of_true ‹SeparableSpace X› rfl,
      iff_of_true ‹LindelofSpace X› rfl, iff_of_true ‹T2Space X› rfl⟩
    (by decide)

theorem realises_unit

TopologyByExample.Slices.S1.realises_unit

The one-point space Unit realises the row 111111.

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

theorem realises_prop

TopologyByExample.Slices.S1.realises_prop

The Sierpiński space Prop realises the row 111100.

theorem realises_prop : Realises (TopCat.of Prop) (data.baseRow 1)
Proof
:=
  realises_sierpinskiSpace (X := Prop) Sierpinski.not_t2Space

theorem realises_withDiscreteTopology_real

TopologyByExample.Slices.S1.realises_withDiscreteTopology_real

The uncountable discrete space WithDiscreteTopology ℝ realises the row 100011.

theorem realises_withDiscreteTopology_real :
    Realises (TopCat.of (WithDiscreteTopology ℝ)) (data.baseRow 2)
Proof
:=
  realises_discreteReals (X := WithDiscreteTopology ℝ) DiscreteReals.not_lindelofSpace

The base library and the main theorems

structure BaseSpaces

TopologyByExample.Slices.S1.BaseSpaces

The base library of S1: a space in Type realising each base row. The one-point space, the Sierpiński space and the uncountable discrete space are filled in by default; the other five are to be supplied from their space files, most easily through realises_kTopology, realises_sorgenfreyLine, realises_sorgenfreyPlane, realises_lexicographicSquare and realises_arensFortSpace.

structure BaseSpaces : Type 1 where
  /-- The one-point space (row `111111`). -/
  onePointSpace : TopCat.{0} := TopCat.of Unit
  onePointSpace_realises : Realises onePointSpace (data.baseRow 0) := by
    exact TopologyByExample.Slices.S1.realises_unit
  /-- The Sierpiński space (row `111100`). -/
  sierpinskiSpace : TopCat.{0} := TopCat.of Prop
  sierpinskiSpace_realises : Realises sierpinskiSpace (data.baseRow 1) := by
    exact TopologyByExample.Slices.S1.realises_prop
  /-- The real line with the discrete topology (row `100011`). -/
  discreteReals : TopCat.{0} := TopCat.of (WithDiscreteTopology ℝ)
  discreteReals_realises : Realises discreteReals (data.baseRow 2) := by
    exact TopologyByExample.Slices.S1.realises_withDiscreteTopology_real
  /-- The K-topology on the real line (row `111101`). -/
  kTopology : TopCat.{0}
  kTopology_realises : Realises kTopology (data.baseRow 3)
  /-- The Sorgenfrey line (row `101101`). -/
  sorgenfreyLine : TopCat.{0}
  sorgenfreyLine_realises : Realises sorgenfreyLine (data.baseRow 4)
  /-- The Sorgenfrey plane (row `101001`). -/
  sorgenfreyPlane : TopCat.{0}
  sorgenfreyPlane_realises : Realises sorgenfreyPlane (data.baseRow 5)
  /-- The lexicographically ordered unit square (row `100101`). -/
  lexicographicSquare : TopCat.{0}
  lexicographicSquare_realises : Realises lexicographicSquare (data.baseRow 6)
  /-- The Arens–Fort space (row `001101`). -/
  arensFortSpace : TopCat.{0}
  arensFortSpace_realises : Realises arensFortSpace (data.baseRow 7)

definition library

TopologyByExample.Slices.S1.BaseSpaces.library

The base library as a SliceData.Library, indexed in the content's order.

def BaseSpaces.library (B : BaseSpaces) : data.Library prop.{0}
Definition
where
  space := ![B.onePointSpace, B.sierpinskiSpace, B.discreteReals, B.kTopology, B.sorgenfreyLine,
    B.sorgenfreyPlane, B.lexicographicSquare, B.arensFortSpace]
  realises b := by
    fin_cases b
    exacts [B.onePointSpace_realises, B.sierpinskiSpace_realises, B.discreteReals_realises,
      B.kTopology_realises, B.sorgenfreyLine_realises, B.sorgenfreyPlane_realises,
      B.lexicographicSquare_realises, B.arensFortSpace_realises]

theorem not_realises_of_solve_eq_refuted

TopologyByExample.Slices.S1.not_realises_of_solve_eq_refuted

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

theorem not_realises_of_solve_eq_refuted {r : Row 6} {c : Clause 6}
    (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.S1.solve_correct

Correctness of the S1 algorithm. On every row, the algorithm either cites a clause of S1 that the row violates, and no space realises the row, or returns an expression whose space, built from the base library by disjoint sums, realises the row.

theorem solve_correct (B : BaseSpaces) (r : Row 6) :
    (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.S1.exists_realises_iff_consistent

Completeness of S1. A row of S1 is realised by some topological space (in any given universe) if and only if it satisfies the seven clauses of S1. The witness in Type u is the ULift of the algorithm's witness in Type.

theorem exists_realises_iff_consistent (B : BaseSpaces) (r : Row 6) :
    (∃ 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⟩