Lean library · module TopologyByExample.Slices.S6

The connectedness study

Source file

The study of connectedness (Lean name S6) has ten properties, in this order:

index property Lean
0 connected PreconnectedSpace
1 path connected TopologyByExample.PathPreconnectedSpace
2 locally connected LocallyConnectedSpace
3 locally path connected LocallyPathConnectedSpace
4 totally disconnected TotallyDisconnectedSpace
5 totally separated TotallySeparatedSpace
6 zero-dimensional ZeroDimensionalSpace
7 T₀ T0Space
8 T₁ T1Space
9 Hausdorff T2Space

Connectedness and path connectedness are taken in the forms that hold of the empty space, like the other eight properties.

Its theory is thirteen Horn clauses (S6.data.clauses): ten single implications and three chains, two through discreteness and one through indiscreteness, neither of which is one of the ten properties. Its base library has thirteen nonempty spaces:

index row base space here
0 1111111111 one-point space Unit
1 0011111111 discrete natural numbers ℕ
2 0000111111 rational numbers ℚ
3 0000110111 Mysior's space field mysiorSpace
4 0000100111 a countable Hausdorff space that is not Urysohn field nonUrysohnSpace
5 0000100110 a convergent sequence with two limits field twoLimitSequence
6 1010000111 lexicographically ordered square field lexicographicSquare
7 1100000111 comb space field combSpace
8 1110000111 cone over the lexicographic square field coneLexicographicSquare
9 1111000100 Sierpiński space field sierpinskiSpace
10 1111000110 cofinite topology on ℝ field cofiniteReals
11 1111000111 unit interval unitInterval
12 1111001000 two-point indiscrete space WithTopology Bool ⊤

Witnesses are products of base spaces, not sums: a disjoint sum of two nonempty spaces is never connected, while each of the ten properties holds of a product of two nonempty spaces exactly when it holds of both factors (S6.prodConjunctive). The algorithm and its witness trees are those of TopologyByExample.Slices.Horn; the node of a witness expression (Expr.node) is read as the product by Expr.evalBy .prod.

Exactly 41 of the 1024 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

  • S6.valid, S6.prodConjunctive, S6.covers: the three hypotheses of the general theorems.
  • S6.nonempty_of_realises: a space realising a row other than the top row is nonempty, since the empty space has all ten properties. So every base space but the top one is nonempty by its row.
  • S6.not_realises_of_solve_eq_refuted: no space, in any universe, realises a refuted row.
  • S6.solve_correct and S6.exists_realises_iff_consistent: correctness and completeness of the algorithm for any base library S6.BaseSpaces. Five of its thirteen spaces are filled in here; the other eight are fields, supplied (through the lemmas S6.realises_* of the section Rows) in the companion file, which states both results unconditionally.
  • S6.card_consistent: 41 of the 1024 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 connected

TopologyByExample.Slices.S6.connected

Connectedness, in the form that holds of the empty space (PreconnectedSpace).

def connected : SpaceProperty.{u}
:= ⟨fun X _ ↦ PreconnectedSpace X⟩

definition pathConnected

TopologyByExample.Slices.S6.pathConnected

Path connectedness, in the form that holds of the empty space (PathPreconnectedSpace).

def pathConnected : SpaceProperty.{u}
:= ⟨fun X _ ↦ PathPreconnectedSpace X⟩

definition locallyConnected

TopologyByExample.Slices.S6.locallyConnected

Local connectedness (LocallyConnectedSpace).

def locallyConnected : SpaceProperty.{u}
:= ⟨fun X _ ↦ LocallyConnectedSpace X⟩

definition locallyPathConnected

TopologyByExample.Slices.S6.locallyPathConnected

Local path connectedness (LocallyPathConnectedSpace).

def locallyPathConnected : SpaceProperty.{u}
:= ⟨fun X _ ↦ LocallyPathConnectedSpace X⟩

definition totallyDisconnected

TopologyByExample.Slices.S6.totallyDisconnected

Total disconnectedness (TotallyDisconnectedSpace).

def totallyDisconnected : SpaceProperty.{u}
:= ⟨fun X _ ↦ TotallyDisconnectedSpace X⟩

definition totallySeparated

TopologyByExample.Slices.S6.totallySeparated

Total separatedness (TotallySeparatedSpace).

def totallySeparated : SpaceProperty.{u}
:= ⟨fun X _ ↦ TotallySeparatedSpace X⟩

definition zeroDimensional

TopologyByExample.Slices.S6.zeroDimensional

Zero-dimensionality, having a base of clopen sets (ZeroDimensionalSpace).

def zeroDimensional : SpaceProperty.{u}
:= ⟨fun X _ ↦ ZeroDimensionalSpace X⟩

definition t0

TopologyByExample.Slices.S6.t0

The T₀ property (T0Space).

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

definition t1

TopologyByExample.Slices.S6.t1

The T₁ property (T1Space).

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

definition t2

TopologyByExample.Slices.S6.t2

The Hausdorff property (T2Space).

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

definition prop

TopologyByExample.Slices.S6.prop

The properties of S6, in study order.

def prop : Fin 10 → SpaceProperty.{u}
:=
  ![connected, pathConnected, locallyConnected, locallyPathConnected, totallyDisconnected,
    totallySeparated, zeroDimensional, t0, t1, t2]

definition Realises

TopologyByExample.Slices.S6.Realises

The space X realises the row r of S6.

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

theorem prodConjunctive

TopologyByExample.Slices.S6.prodConjunctive

Every S6 property is product-conjunctive: it holds of a product of two nonempty spaces exactly when it holds of both factors.

theorem prodConjunctive : ∀ i, (prop.{u} i).ProdConjunctive
Proof
:= by
  intro i
  fin_cases i <;> intro X Y _ _ _ _
  exacts [preconnectedSpace_prod_iff, pathPreconnectedSpace_prod_iff,
    locallyConnectedSpace_prod_iff, locallyPathConnectedSpace_prod_iff,
    totallyDisconnectedSpace_prod_iff, totallySeparatedSpace_prod_iff,
    zeroDimensionalSpace_prod_iff, t0Space_prod_iff, t1Space_prod_iff, t2Space_prod_iff]

theorem holds_of_homeomorph

TopologyByExample.Slices.S6.holds_of_homeomorph

The S6 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 10) (h : (prop.{u} i).Holds X) : (prop.{v} i).Holds Y
Proof
:= by
  fin_cases i
  · have : PreconnectedSpace X := h
    exact preconnectedSpace_of_surjective e.surjective e.continuous
  · have : PathPreconnectedSpace X := h
    exact pathPreconnectedSpace_of_surjective e.surjective e.continuous
  · have : LocallyConnectedSpace X := h
    exact e.symm.isOpenEmbedding.locallyConnectedSpace
  · have : LocallyPathConnectedSpace X := h
    exact e.locallyPathConnectedSpace
  · have : TotallyDisconnectedSpace X := h
    exact totallyDisconnectedSpace_of_injective e.symm.continuous e.symm.injective
  · have : TotallySeparatedSpace X := h
    exact totallySeparatedSpace_of_injective e.symm.continuous e.symm.injective
  · have : ZeroDimensionalSpace X := h
    exact (zeroDimensionalSpace_congr e).1 this
  · 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

theorem of_homeomorph

TopologyByExample.Slices.S6.Realises.of_homeomorph

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

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

theorem holds_of_subsingleton

TopologyByExample.Slices.S6.holds_of_subsingleton

A space with at most one point has all ten properties.

theorem holds_of_subsingleton {X : Type u} [TopologicalSpace X] [Subsingleton X] (i : Fin 10) :
    (prop.{u} i).Holds X
Proof
:= by
  fin_cases i
  exacts [preconnectedSpace_of_subsingleton (X := X), (inferInstance : PathPreconnectedSpace X),
    (inferInstance : LocallyConnectedSpace X), (inferInstance : LocallyPathConnectedSpace X),
    (inferInstance : TotallyDisconnectedSpace X), (inferInstance : TotallySeparatedSpace X),
    (inferInstance : ZeroDimensionalSpace X), (inferInstance : T0Space X),
    (inferInstance : T1Space X), (inferInstance : T2Space X)]

theorem nonempty_of_realises

TopologyByExample.Slices.S6.nonempty_of_realises

A space realising a row in which some property is false is nonempty: the empty space has all ten properties.

theorem nonempty_of_realises {X : Type u} [TopologicalSpace X] {r : Row 10} (h : Realises X r)
    {i : Fin 10} (hi : r i = false) : Nonempty X
Proof
:= by
  by_contra hX
  have : IsEmpty X := not_nonempty_iff.1 hX
  exact Bool.false_ne_true (hi ▸ (h i).1 (holds_of_subsingleton i))

The combinatorial data

definition data

TopologyByExample.Slices.S6.data

The combinatorial data of S6. 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. locally-path-connected-implies-locally-connected
  2. path-connected-implies-connected
  3. t1-implies-t0
  4. t2-implies-t1
  5. totally-disconnected-implies-t1
  6. totally-separated-implies-t2
  7. totally-separated-implies-totally-disconnected
  8. connected-locally-path-connected-implies-path-connected
  9. the chain connected-totally-disconnected-implies-discrete, discrete-implies-locally-connected: connected and totally disconnected ⇒ locally connected
  10. the chain connected-zero-dimensional-implies-indiscrete, indiscrete-implies-locally-path-connected: connected and zero-dimensional ⇒ locally path connected
  11. the chain locally-connected-totally-disconnected-implies-discrete, discrete-implies-zero-dimensional: locally connected and totally disconnected ⇒ zero-dimensional
  12. locally-connected-zero-dimensional-implies-locally-path-connected
  13. zero-dimensional-t0-implies-totally-separated

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 10 13
Definition
where
  clauses :=
    [⟨[3], some 2⟩, ⟨[1], some 0⟩, ⟨[8], some 7⟩, ⟨[9], some 8⟩, ⟨[4], some 8⟩,
      ⟨[5], some 9⟩, ⟨[5], some 4⟩, ⟨[0, 3], some 1⟩, ⟨[0, 4], some 2⟩, ⟨[0, 6], some 3⟩,
      ⟨[2, 4], some 6⟩, ⟨[2, 6], some 3⟩, ⟨[6, 7], some 5⟩]
  baseRow :=
    ![![true, true, true, true, true, true, true, true, true, true],
      ![false, false, true, true, true, true, true, true, true, true],
      ![false, false, false, false, true, true, true, true, true, true],
      ![false, false, false, false, true, true, false, true, true, true],
      ![false, false, false, false, true, false, false, true, true, true],
      ![false, false, false, false, true, false, false, true, true, false],
      ![true, false, true, false, false, false, false, true, true, true],
      ![true, true, false, false, false, false, false, true, true, true],
      ![true, true, true, false, false, false, false, true, true, true],
      ![true, true, true, true, false, false, false, true, false, false],
      ![true, true, true, true, false, false, false, true, true, false],
      ![true, true, true, true, false, false, false, true, true, true],
      ![true, true, true, true, false, false, true, false, false, false]]
  top := 0

theorem valid

TopologyByExample.Slices.S6.valid

The S6 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 | rfl | rfl | rfl
  · have : LocallyPathConnectedSpace X := h 3 (by simp)
    exact (inferInstance : LocallyConnectedSpace X)
  · have : PathPreconnectedSpace X := h 1 (by simp)
    exact (inferInstance : PreconnectedSpace X)
  · have : T1Space X := h 8 (by simp)
    exact (inferInstance : T0Space X)
  · have : T2Space X := h 9 (by simp)
    exact (inferInstance : T1Space X)
  · have : TotallyDisconnectedSpace X := h 4 (by simp)
    exact (inferInstance : T1Space X)
  · have : TotallySeparatedSpace X := h 5 (by simp)
    exact (inferInstance : T2Space X)
  · have : TotallySeparatedSpace X := h 5 (by simp)
    exact (inferInstance : TotallyDisconnectedSpace X)
  · have : PreconnectedSpace X := h 0 (by simp)
    have : LocallyPathConnectedSpace X := h 3 (by simp)
    exact pathPreconnectedSpace_of_locallyPathConnectedSpace
  · -- connected and totally disconnected ⇒ discrete ⇒ locally connected
    have : PreconnectedSpace X := h 0 (by simp)
    have : TotallyDisconnectedSpace X := h 4 (by simp)
    have : DiscreteTopology X := discreteTopology_of_preconnectedSpace
    exact (inferInstance : LocallyConnectedSpace X)
  · -- connected and zero-dimensional ⇒ indiscrete ⇒ locally path connected
    have : PreconnectedSpace X := h 0 (by simp)
    have : ZeroDimensionalSpace X := h 6 (by simp)
    have : IndiscreteTopology X := indiscreteTopology_of_preconnectedSpace
    exact (inferInstance : LocallyPathConnectedSpace X)
  · -- locally connected and totally disconnected ⇒ discrete ⇒ zero-dimensional
    have : LocallyConnectedSpace X := h 2 (by simp)
    have : TotallyDisconnectedSpace X := h 4 (by simp)
    have : DiscreteTopology X := discreteTopology_of_locallyConnectedSpace
    exact (inferInstance : ZeroDimensionalSpace X)
  · have : LocallyConnectedSpace X := h 2 (by simp)
    have : ZeroDimensionalSpace X := h 6 (by simp)
    exact locallyPathConnectedSpace_of_locallyConnectedSpace_of_zeroDimensionalSpace
  · have : ZeroDimensionalSpace X := h 6 (by simp)
    have : T0Space X := h 7 (by simp)
    exact (inferInstance : TotallySeparatedSpace X)

theorem covers

TopologyByExample.Slices.S6.covers

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

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

theorem card_consistent

TopologyByExample.Slices.S6.card_consistent

Exactly 41 of the 1024 rows of S6 are consistent.

theorem card_consistent :
    ((Row.all 10).filter fun r ↦ decide (data.Consistent r)).length = 41
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.S6.realises_onePointSpace

A connected, totally separated space has the row 1111111111.

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

theorem realises_discreteNaturals

TopologyByExample.Slices.S6.realises_discreteNaturals

A locally path connected, totally separated space that is not connected has the row 0011111111.

theorem realises_discreteNaturals [LocallyPathConnectedSpace X] [TotallySeparatedSpace X]
    (h : ¬PreconnectedSpace X) : Realises X (data.baseRow 1)
Proof
:=
  data.realises_of_determines valid (cells := [(0, false), (3, true), (5, true)])
    ⟨iff_of_false h Bool.false_ne_true, iff_of_true ‹LocallyPathConnectedSpace X› rfl,
      iff_of_true ‹TotallySeparatedSpace X› rfl⟩
    (by decide +kernel)

theorem realises_rationals

TopologyByExample.Slices.S6.realises_rationals

A zero-dimensional T₀ space that is not locally connected has the row 0000111111.

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

theorem realises_mysiorSpace

TopologyByExample.Slices.S6.realises_mysiorSpace

A totally separated space that is not zero-dimensional has the row 0000110111.

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

theorem realises_nonUrysohnSpace

TopologyByExample.Slices.S6.realises_nonUrysohnSpace

A totally disconnected Hausdorff space that is not totally separated has the row 0000100111.

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

theorem realises_twoLimitSequence

TopologyByExample.Slices.S6.realises_twoLimitSequence

A totally disconnected space that is not Hausdorff has the row 0000100110.

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

theorem realises_lexicographicSquare

TopologyByExample.Slices.S6.realises_lexicographicSquare

A connected, locally connected Hausdorff space that is not path connected has the row 1010000111.

theorem realises_lexicographicSquare [PreconnectedSpace X] [LocallyConnectedSpace X] [T2Space X]
    (h : ¬PathPreconnectedSpace X) : Realises X (data.baseRow 6)
Proof
:=
  data.realises_of_determines valid (cells := [(0, true), (1, false), (2, true), (9, true)])
    ⟨iff_of_true ‹PreconnectedSpace X› rfl, iff_of_false h Bool.false_ne_true,
      iff_of_true ‹LocallyConnectedSpace X› rfl, iff_of_true ‹T2Space X› rfl⟩
    (by decide +kernel)

theorem realises_combSpace

TopologyByExample.Slices.S6.realises_combSpace

A path connected Hausdorff space that is not locally connected has the row 1100000111.

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

theorem realises_coneLexicographicSquare

TopologyByExample.Slices.S6.realises_coneLexicographicSquare

A path connected, locally connected Hausdorff space that is not locally path connected has the row 1110000111.

theorem realises_coneLexicographicSquare [PathPreconnectedSpace X] [LocallyConnectedSpace X]
    [T2Space X] (h : ¬LocallyPathConnectedSpace X) : Realises X (data.baseRow 8)
Proof
:=
  data.realises_of_determines valid (cells := [(1, true), (2, true), (3, false), (9, true)])
    ⟨iff_of_true ‹PathPreconnectedSpace X› rfl, iff_of_true ‹LocallyConnectedSpace X› rfl,
      iff_of_false h Bool.false_ne_true, iff_of_true ‹T2Space X› rfl⟩
    (by decide +kernel)

theorem realises_sierpinskiSpace

TopologyByExample.Slices.S6.realises_sierpinskiSpace

A connected, locally path connected T₀ space that is not T₁ has the row 1111000100.

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

theorem realises_cofiniteReals

TopologyByExample.Slices.S6.realises_cofiniteReals

A connected, locally path connected T₁ space that is not Hausdorff has the row 1111000110.

theorem realises_cofiniteReals [PreconnectedSpace X] [LocallyPathConnectedSpace X] [T1Space X]
    (h : ¬T2Space X) : Realises X (data.baseRow 10)
Proof
:=
  data.realises_of_determines valid (cells := [(0, true), (3, true), (8, true), (9, false)])
    ⟨iff_of_true ‹PreconnectedSpace X› rfl, iff_of_true ‹LocallyPathConnectedSpace X› rfl,
      iff_of_true ‹T1Space X› rfl, iff_of_false h Bool.false_ne_true⟩
    (by decide +kernel)

theorem realises_unitIntervalSpace

TopologyByExample.Slices.S6.realises_unitIntervalSpace

A connected, locally path connected Hausdorff space that is not totally disconnected has the row 1111000111.

theorem realises_unitIntervalSpace [PreconnectedSpace X] [LocallyPathConnectedSpace X]
    [T2Space X] (h : ¬TotallyDisconnectedSpace X) : Realises X (data.baseRow 11)
Proof
:=
  data.realises_of_determines valid (cells := [(0, true), (3, true), (4, false), (9, true)])
    ⟨iff_of_true ‹PreconnectedSpace X› rfl, iff_of_true ‹LocallyPathConnectedSpace X› rfl,
      iff_of_false h Bool.false_ne_true, iff_of_true ‹T2Space X› rfl⟩
    (by decide +kernel)

theorem realises_indiscretePair

TopologyByExample.Slices.S6.realises_indiscretePair

A connected, zero-dimensional space that is not T₀ has the row 1111001000.

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

theorem realises_unit

TopologyByExample.Slices.S6.realises_unit

The one-point space Unit realises the row 1111111111.

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

theorem realises_nat

TopologyByExample.Slices.S6.realises_nat

The discrete natural numbers realise the row 0011111111.

theorem realises_nat : Realises (TopCat.of ℕ) (data.baseRow 1)
Proof
:=
  realises_discreteNaturals (X := ℕ) not_preconnectedSpace_of_nontrivial

theorem realises_rat

TopologyByExample.Slices.S6.realises_rat

The rational numbers realise the row 0000111111: they are zero-dimensional, being countable and completely regular, and not locally connected, since they are totally disconnected and not discrete (not even locally compact).

theorem realises_rat : Realises (TopCat.of ℚ) (data.baseRow 2)
Proof
:=
  realises_rationals (X := ℚ) (not_locallyConnectedSpace_of_not_discreteTopology
    fun _ ↦ Rationals.not_weaklyLocallyCompactSpace inferInstance)

theorem realises_unitInterval

TopologyByExample.Slices.S6.realises_unitInterval

The unit interval realises the row 1111000111.

theorem realises_unitInterval : Realises (TopCat.of unitInterval) (data.baseRow 11)
Proof
:=
  have := UnitInterval.locallyPathConnectedSpace
  realises_unitIntervalSpace (X := unitInterval) UnitInterval.not_totallyDisconnectedSpace

theorem realises_withTopology_bool_top

TopologyByExample.Slices.S6.realises_withTopology_bool_top

The two-point indiscrete space realises the row 1111001000.

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

The base library and the main theorems

structure BaseSpaces

TopologyByExample.Slices.S6.BaseSpaces

The base library of S6: a space in Type realising each base row, the top one nonempty. Five spaces are filled in by default; Mysior's space, the countable non-Urysohn space, the two-limit sequence, the lexicographic square, the comb, the cone over the lexicographic square, the Sierpiński space and the cofinite topology on ℝ are supplied by S6.baseSpaces in the companion file. The other base spaces are nonempty by their rows (S6.nonempty_of_realises).

structure BaseSpaces : Type 1 where
  /-- The one-point space (row `1111111111`). -/
  onePointSpace : TopCat.{0} := TopCat.of Unit
  onePointSpace_realises : Realises onePointSpace (data.baseRow 0) := by
    exact TopologyByExample.Slices.S6.realises_unit
  onePointSpace_nonempty : Nonempty onePointSpace := by exact ⟨()⟩
  /-- The discrete natural numbers (row `0011111111`). -/
  discreteNaturals : TopCat.{0} := TopCat.of ℕ
  discreteNaturals_realises : Realises discreteNaturals (data.baseRow 1) := by
    exact TopologyByExample.Slices.S6.realises_nat
  /-- The rational numbers (row `0000111111`). -/
  rationals : TopCat.{0} := TopCat.of ℚ
  rationals_realises : Realises rationals (data.baseRow 2) := by
    exact TopologyByExample.Slices.S6.realises_rat
  /-- Mysior's space (row `0000110111`). -/
  mysiorSpace : TopCat.{0}
  mysiorSpace_realises : Realises mysiorSpace (data.baseRow 3)
  /-- A countable Hausdorff space that is not Urysohn (row `0000100111`). -/
  nonUrysohnSpace : TopCat.{0}
  nonUrysohnSpace_realises : Realises nonUrysohnSpace (data.baseRow 4)
  /-- A convergent sequence with two limits (row `0000100110`). -/
  twoLimitSequence : TopCat.{0}
  twoLimitSequence_realises : Realises twoLimitSequence (data.baseRow 5)
  /-- The lexicographically ordered square (row `1010000111`). -/
  lexicographicSquare : TopCat.{0}
  lexicographicSquare_realises : Realises lexicographicSquare (data.baseRow 6)
  /-- The comb space (row `1100000111`). -/
  combSpace : TopCat.{0}
  combSpace_realises : Realises combSpace (data.baseRow 7)
  /-- The cone over the lexicographic square (row `1110000111`). -/
  coneLexicographicSquare : TopCat.{0}
  coneLexicographicSquare_realises : Realises coneLexicographicSquare (data.baseRow 8)
  /-- The Sierpiński space (row `1111000100`). -/
  sierpinskiSpace : TopCat.{0}
  sierpinskiSpace_realises : Realises sierpinskiSpace (data.baseRow 9)
  /-- The cofinite topology on the real numbers (row `1111000110`). -/
  cofiniteReals : TopCat.{0}
  cofiniteReals_realises : Realises cofiniteReals (data.baseRow 10)
  /-- The unit interval (row `1111000111`). -/
  unitInterval : TopCat.{0} := TopCat.of _root_.unitInterval
  unitInterval_realises : Realises unitInterval (data.baseRow 11) := by
    exact TopologyByExample.Slices.S6.realises_unitInterval
  /-- The two-point indiscrete space (row `1111001000`). -/
  indiscretePair : TopCat.{0} := TopCat.of (WithTopology Bool ⊤)
  indiscretePair_realises : Realises indiscretePair (data.baseRow 12) := by
    exact TopologyByExample.Slices.S6.realises_withTopology_bool_top

definition library

TopologyByExample.Slices.S6.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.discreteNaturals, B.rationals, B.mysiorSpace, B.nonUrysohnSpace,
    B.twoLimitSequence, B.lexicographicSquare, B.combSpace, B.coneLexicographicSquare,
    B.sierpinskiSpace, B.cofiniteReals, B.unitInterval, B.indiscretePair]
  realises b := by
    fin_cases b
    exacts [B.onePointSpace_realises, B.discreteNaturals_realises, B.rationals_realises,
      B.mysiorSpace_realises, B.nonUrysohnSpace_realises, B.twoLimitSequence_realises,
      B.lexicographicSquare_realises, B.combSpace_realises, B.coneLexicographicSquare_realises,
      B.sierpinskiSpace_realises, B.cofiniteReals_realises, B.unitInterval_realises,
      B.indiscretePair_realises]

theorem nonempty_library

TopologyByExample.Slices.S6.BaseSpaces.nonempty_library

Every base space is nonempty: the top one by hypothesis, the others because their rows have a property that the empty space has, set to false.

theorem BaseSpaces.nonempty_library (B : BaseSpaces) (b : Fin 13) :
    Nonempty (B.library.space b)
Proof
:= by
  by_cases hb : b = 0
  · subst hb
    exact B.onePointSpace_nonempty
  · obtain ⟨i, hi⟩ : ∃ i, data.baseRow b i = false := by
      revert b
      decide
    exact nonempty_of_realises (B.library.realises b) hi

theorem not_realises_of_solve_eq_refuted

TopologyByExample.Slices.S6.not_realises_of_solve_eq_refuted

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

theorem not_realises_of_solve_eq_refuted {r : Row 10} {c : Clause 10}
    (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 realises_of_solve_eq_witness

TopologyByExample.Slices.S6.realises_of_solve_eq_witness

Correctness of S6 witnesses, for any base library: the product a witness expression denotes realises the row.

theorem realises_of_solve_eq_witness (B : BaseSpaces) {r : Row 10} {e : Expr (Fin 13)}
    (h : data.solve r = .witness e) : Realises (e.evalBy .prod B.library.space) r
Proof
:=
  data.realises_of_solve_eq_witness_prod prodConjunctive B.library B.nonempty_library covers h

theorem solve_correct

TopologyByExample.Slices.S6.solve_correct

Correctness of the S6 algorithm, for any base library, with witness expressions read as products.

theorem solve_correct (B : BaseSpaces) (r : Row 10) :
    (data.solve r).CorrectBy .prod data prop B.library.space r
Proof
:=
  data.solve_correct_prod valid prodConjunctive B.library B.nonempty_library covers r

theorem exists_realises_iff_consistent

TopologyByExample.Slices.S6.exists_realises_iff_consistent

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

theorem exists_realises_iff_consistent (B : BaseSpaces) (r : Row 10) :
    (∃ 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_prod valid prodConjunctive B.library
    B.nonempty_library covers r).2 hr
  exact ⟨TopCat.of (ULift.{u} X), Realises.of_homeomorph Homeomorph.ulift.symm hX⟩