Skip to content

Commit 07c7363

Browse files
bwangpjgirving
andcommitted
feat: countable metric spaces are totally disconnected (leanprover-community#29211)
Prove that countable metric spaces are totally disconnected. This can't be placed inside `Mathlib.Topology.MetricSpace.Basic` because it causes a circular import with `Mathlib.Analysis.Real.Cardinality`. See also [Rat.instTotallyDisconnectedSpace](https://leanprover-community.github.io/mathlib4_docs/Mathlib/Topology/Instances/RatLemmas.html#Rat.instTotallyDisconnectedSpace). There is a reference [here](https://people.math.harvard.edu/~ctm/home/text/class/harvard/131/01/html/home/course/course.pdf) for the mathematical statement and proof. This is upstreamed from [https://github.com/girving/ray](https://github.com/girving/ray). Co-authored-by: Geoffrey Irving <irving@naml.us> Co-authored-by: bwangpj <70694994+bwangpj@users.noreply.github.com>
1 parent ec58e7e commit 07c7363

5 files changed

Lines changed: 115 additions & 6 deletions

File tree

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6736,6 +6736,7 @@ import Mathlib.Topology.Separation.CountableSeparatingOn
67366736
import Mathlib.Topology.Separation.DisjointCover
67376737
import Mathlib.Topology.Separation.GDelta
67386738
import Mathlib.Topology.Separation.Hausdorff
6739+
import Mathlib.Topology.Separation.Lemmas
67396740
import Mathlib.Topology.Separation.LinearUpperLowerSetTopology
67406741
import Mathlib.Topology.Separation.NotNormal
67416742
import Mathlib.Topology.Separation.Profinite

Mathlib/Analysis/Real/Cardinality.lean

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,39 @@ theorem mk_Icc_real {a b : ℝ} (h : a < b) : #(Icc a b) = 𝔠 :=
260260
theorem mk_Ioc_real {a b : ℝ} (h : a < b) : #(Ioc a b) = 𝔠 :=
261261
le_antisymm (mk_real ▸ mk_set_le _) (mk_Ioo_real h ▸ mk_le_mk_of_subset Ioo_subset_Ioc_self)
262262

263+
@[simp]
264+
lemma Real.Ioo_countable_iff {x y : ℝ} :
265+
(Ioo x y).Countable ↔ y ≤ x := by
266+
refine ⟨fun h ↦ ?_, fun h ↦ by simp [h]⟩
267+
contrapose! h
268+
rw [← Cardinal.le_aleph0_iff_set_countable, Cardinal.mk_Ioo_real h, not_le]
269+
exact Cardinal.aleph0_lt_continuum
270+
271+
@[simp]
272+
lemma Real.Ico_countable_iff {x y : ℝ} :
273+
(Ico x y).Countable ↔ y ≤ x := by
274+
refine ⟨fun h ↦ ?_, fun h ↦ by simp [h]⟩
275+
contrapose! h
276+
rw [← Cardinal.le_aleph0_iff_set_countable, Cardinal.mk_Ico_real h, not_le]
277+
exact Cardinal.aleph0_lt_continuum
278+
279+
@[simp]
280+
lemma Real.Ioc_countable_iff {x y : ℝ} :
281+
(Ioc x y).Countable ↔ y ≤ x := by
282+
refine ⟨fun h ↦ ?_, fun h ↦ by simp [h]⟩
283+
contrapose! h
284+
rw [← Cardinal.le_aleph0_iff_set_countable, Cardinal.mk_Ioc_real h, not_le]
285+
exact Cardinal.aleph0_lt_continuum
286+
287+
@[simp]
288+
lemma Real.Icc_countable_iff {x y : ℝ} :
289+
(Icc x y).Countable ↔ y ≤ x := by
290+
refine ⟨fun h ↦ ?_, fun h ↦ by
291+
rcases le_iff_eq_or_lt.mp h with heq | hlt
292+
· simp [heq]
293+
· simp [hlt]⟩
294+
contrapose! h
295+
rw [← Cardinal.le_aleph0_iff_set_countable, Cardinal.mk_Icc_real h, not_le]
296+
exact Cardinal.aleph0_lt_continuum
297+
263298
end Cardinal

Mathlib/Topology/Separation/CompletelyRegular.lean

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Mathlib.Topology.UrysohnsLemma
77
import Mathlib.Topology.UnitInterval
88
import Mathlib.Topology.Compactification.StoneCech
99
import Mathlib.Topology.Order.Lattice
10+
import Mathlib.Analysis.Real.Cardinality
1011

1112
/-!
1213
# Completely regular topological spaces.
@@ -187,6 +188,28 @@ lemma completelyRegularSpace_iff_isInducing_stoneCechUnit :
187188
mp _ := isInducing_stoneCechUnit
188189
mpr hs := hs.completelyRegularSpace
189190

191+
open TopologicalSpace Cardinal in
192+
theorem CompletelyRegularSpace.isTopologicalBasis_clopens_of_cardinalMk_lt_continuum
193+
[CompletelyRegularSpace X] (hX : Cardinal.mk X < continuum) :
194+
IsTopologicalBasis {s : Set X | IsClopen s} := by
195+
refine isTopologicalBasis_of_isOpen_of_nhds (fun x s ↦ IsClopen.isOpen s) (fun x s hxs hs ↦ ?_)
196+
choose f hf using completely_regular_isOpen x s hs hxs
197+
obtain ⟨hfc, hf₀, hf₁⟩ := hf
198+
let R := Set.range f
199+
have hR : lift.{u, 0} (Cardinal.mk R) < lift.{0, u} continuum := by
200+
simpa [R] using mk_range_le_lift.trans_lt (lift_strictMono hX)
201+
rw [lift_continuum, ← lift_continuum.{u, 0}, lift_lt, ← mk_Icc_real zero_lt_one, ← unitInterval]
202+
at hR
203+
obtain ⟨r, hr⟩ : ∃ r : I, r ∈ Rᶜ := compl_nonempty_of_mk_lt_mk hR
204+
have hr' : ∀ (x : X), f x ≠ r := by simpa [R] using hr
205+
have hrclopen : f ⁻¹' Iio r = f ⁻¹' Iic r := by
206+
ext; simp [le_iff_lt_or_eq, hr']
207+
refine ⟨f ⁻¹' Iio r, ⟨hrclopen ▸ isClosed_Iic.preimage hfc, isOpen_Iio.preimage hfc⟩, ?_, ?_⟩
208+
· simp [hf₀, hrclopen]
209+
· refine preimage_subset_iff.mpr (fun x ↦ ?_)
210+
contrapose!; intro hxs
211+
simpa [hf₁ hxs] using le_one'
212+
190213
/-- A T₃.₅ space is a completely regular space that is also T₀. -/
191214
@[mk_iff]
192215
class T35Space (X : Type u) [TopologicalSpace X] : Prop extends T0Space X, CompletelyRegularSpace X
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/-
2+
Copyright (c) 2025 Bryan Wang. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Geoffrey Irving, Bryan Wang, Oliver Nash
5+
-/
6+
import Mathlib.Topology.GDelta.MetrizableSpace
7+
import Mathlib.Topology.Separation.CompletelyRegular
8+
import Mathlib.Topology.Separation.Profinite
9+
10+
/-!
11+
# Further separation lemmas
12+
-/
13+
14+
variable {X : Type*}
15+
16+
namespace CompletelyRegularSpace
17+
18+
variable [TopologicalSpace X] [T35Space X]
19+
20+
theorem totallySeparatedSpace_of_cardinalMk_lt_continuum (h : Cardinal.mk X < Cardinal.continuum) :
21+
TotallySeparatedSpace X :=
22+
totallySeparatedSpace_of_t0_of_basis_clopen <|
23+
CompletelyRegularSpace.isTopologicalBasis_clopens_of_cardinalMk_lt_continuum h
24+
25+
instance [Countable X] : TotallySeparatedSpace X :=
26+
totallySeparatedSpace_of_cardinalMk_lt_continuum <|
27+
(Cardinal.mk_le_aleph0_iff.mpr inferInstance).trans_lt Cardinal.aleph0_lt_continuum
28+
29+
protected lemma _root_.Set.Countable.totallySeparatedSpace {s : Set X} (h : s.Countable) :
30+
TotallySeparatedSpace s :=
31+
have : _root_.Countable s := h
32+
inferInstanceAs (TotallySeparatedSpace s)
33+
34+
end CompletelyRegularSpace
35+
36+
/-- Countable subsets of metric spaces are totally disconnected. -/
37+
theorem Set.Countable.isTotallyDisconnected [MetricSpace X] {s : Set X} (hs : s.Countable) :
38+
IsTotallyDisconnected s := by
39+
rw [← totallyDisconnectedSpace_subtype_iff]
40+
have : Countable s := hs
41+
infer_instance

Mathlib/Topology/Separation/Profinite.lean

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,23 @@ variable {X : Type*} {Y : Type*} [TopologicalSpace X]
1919

2020
section Profinite
2121

22-
/-- A T1 space with a clopen basis is totally separated. -/
23-
theorem totallySeparatedSpace_of_t1_of_basis_clopen [T1Space X]
22+
/-- A T0 space with a clopen basis is totally separated. -/
23+
theorem totallySeparatedSpace_of_t0_of_basis_clopen [T0Space X]
2424
(h : IsTopologicalBasis { s : Set X | IsClopen s }) : TotallySeparatedSpace X := by
2525
constructor
2626
rintro x - y - hxy
27-
rcases h.mem_nhds_iff.mp (isOpen_ne.mem_nhds hxy) with ⟨U, hU, hxU, hyU⟩
28-
exact ⟨U, Uᶜ, hU.isOpen, hU.compl.isOpen, hxU, fun h => hyU h rfl, (union_compl_self U).superset,
29-
disjoint_compl_right⟩
27+
choose U hU using exists_isOpen_xor'_mem hxy
28+
obtain ⟨hU₀, hU₁⟩ := hU
29+
rcases hU₁ with hx | hy
30+
· choose V hV using h.isOpen_iff.mp hU₀ x hx.1
31+
exact ⟨V, Vᶜ, hV.1.isOpen, hV.1.compl.isOpen, hV.2.1, notMem_subset hV.2.2 hx.2,
32+
(union_compl_self V).superset, disjoint_compl_right⟩
33+
· choose V hV using h.isOpen_iff.mp hU₀ y hy.1
34+
exact ⟨Vᶜ, V, hV.1.compl.isOpen, hV.1.isOpen, notMem_subset hV.2.2 hy.2, hV.2.1,
35+
(union_comm _ _ ▸ union_compl_self V).superset, disjoint_compl_left⟩
36+
37+
@[deprecated (since := "2025-09-11")]
38+
alias totallySeparatedSpace_of_t1_of_basis_clopen := totallySeparatedSpace_of_t0_of_basis_clopen
3039

3140
variable [T2Space X] [CompactSpace X] [TotallyDisconnectedSpace X]
3241

@@ -109,7 +118,7 @@ theorem loc_compact_t2_tot_disc_iff_tot_sep :
109118
TotallyDisconnectedSpace H ↔ TotallySeparatedSpace H := by
110119
constructor
111120
· intro h
112-
exact totallySeparatedSpace_of_t1_of_basis_clopen loc_compact_Haus_tot_disc_of_zero_dim
121+
exact totallySeparatedSpace_of_t0_of_basis_clopen loc_compact_Haus_tot_disc_of_zero_dim
113122
apply TotallySeparatedSpace.totallyDisconnectedSpace
114123

115124
/-- A totally disconnected compact Hausdorff space is totally separated. -/

0 commit comments

Comments
 (0)