Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 0760b20

Browse files
committed
feat(topology/metric_space): metrizable spaces (#8759)
Define (pseudo)-metric space constructors for metrizable topological spaces.
1 parent bafe207 commit 0760b20

File tree

1 file changed

+66
-8
lines changed

1 file changed

+66
-8
lines changed

src/topology/metric_space/basic.lean

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ open_locale uniformity topological_space big_operators filter nnreal ennreal
5454
universes u v w
5555
variables {α : Type u} {β : Type v}
5656

57-
/-- Construct a uniform structure from a distance function and metric space axioms -/
58-
def uniform_space_of_dist
59-
(dist : α → α → ℝ)
57+
/-- Construct a uniform structure core from a distance function and metric space axioms.
58+
This is a technical construction that can be immediately used to construct a uniform structure
59+
from a distance function and metric space axioms but is also useful when discussing
60+
metrizable topologies, see `pseudo_metric_space.of_metrizable`. -/
61+
def uniform_space.core_of_dist {α : Type*} (dist : α → α → ℝ)
6062
(dist_self : ∀ x : α, dist x x = 0)
6163
(dist_comm : ∀ x y : α, dist x y = dist y x)
62-
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : uniform_space α :=
63-
uniform_space.of_core {
64-
uniformity := (⨅ ε>0, 𝓟 {p:α×α | dist p.1 p.2 < ε}),
64+
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : uniform_space.core α :=
65+
{ uniformity := (⨅ ε>0, 𝓟 {p:α×α | dist p.1 p.2 < ε}),
6566
refl := le_infi $ assume ε, le_infi $
6667
by simp [set.subset_def, id_rel, dist_self, (>)] {contextual := tt},
6768
comp := le_infi $ assume ε, le_infi $ assume h, lift'_le
@@ -75,6 +76,14 @@ uniform_space.of_core {
7576
symm := tendsto_infi.2 $ assume ε, tendsto_infi.2 $ assume h,
7677
tendsto_infi' ε $ tendsto_infi' h $ tendsto_principal_principal.2 $ by simp [dist_comm] }
7778

79+
/-- Construct a uniform structure from a distance function and metric space axioms -/
80+
def uniform_space_of_dist
81+
(dist : α → α → ℝ)
82+
(dist_self : ∀ x : α, dist x x = 0)
83+
(dist_comm : ∀ x y : α, dist x y = dist y x)
84+
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : uniform_space α :=
85+
uniform_space.of_core (uniform_space.core_of_dist dist dist_self dist_comm dist_triangle)
86+
7887
/-- The distance function (given an ambient metric space on `α`), which returns
7988
a nonnegative real number `dist x y` given `x y : α`. -/
8089
class has_dist (α : Type*) := (dist : α → α → ℝ)
@@ -110,6 +119,43 @@ pseudo_metric_space.to_uniform_space
110119
@[priority 200] -- see Note [lower instance priority]
111120
instance pseudo_metric_space.to_has_edist : has_edist α := ⟨pseudo_metric_space.edist⟩
112121

122+
/-- Construct a pseudo-metric space structure whose underlying topological space structure
123+
(definitionally) agrees which a pre-existing topology which is compatible with a given distance
124+
function. -/
125+
def pseudo_metric_space.of_metrizable {α : Type*} [topological_space α] (dist : α → α → ℝ)
126+
(dist_self : ∀ x : α, dist x x = 0)
127+
(dist_comm : ∀ x y : α, dist x y = dist y x)
128+
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
129+
(H : ∀ s : set α, is_open s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s) :
130+
pseudo_metric_space α :=
131+
{ dist := dist,
132+
dist_self := dist_self,
133+
dist_comm := dist_comm,
134+
dist_triangle := dist_triangle,
135+
to_uniform_space := { is_open_uniformity := begin
136+
dsimp only [uniform_space.core_of_dist],
137+
intros s,
138+
change is_open s ↔ _,
139+
rw H s,
140+
apply forall_congr, intro x,
141+
apply forall_congr, intro x_in,
142+
erw (has_basis_binfi_principal _ nonempty_Ioi).mem_iff,
143+
{ apply exists_congr, intros ε,
144+
apply exists_congr, intros ε_pos,
145+
simp only [prod.forall, set_of_subset_set_of],
146+
split,
147+
{ rintros h _ y H rfl,
148+
exact h y H },
149+
{ intros h y hxy,
150+
exact h _ _ hxy rfl } },
151+
{ exact λ r (hr : 0 < r) p (hp : 0 < p), ⟨min r p, lt_min hr hp,
152+
λ x (hx : dist _ _ < _), lt_of_lt_of_le hx (min_le_left r p),
153+
λ x (hx : dist _ _ < _), lt_of_lt_of_le hx (min_le_right r p)⟩ },
154+
{ apply_instance }
155+
end,
156+
..uniform_space.core_of_dist dist dist_self dist_comm dist_triangle },
157+
uniformity_dist := rfl }
158+
113159
@[simp] theorem dist_self (x : α) : dist x x = 0 := pseudo_metric_space.dist_self x
114160

115161
theorem dist_comm (x y : α) : dist x y = dist y x := pseudo_metric_space.dist_comm x y
@@ -704,8 +750,8 @@ theorem tendsto_at_top' [nonempty β] [semilattice_sup β] [no_top_order β] {u
704750
(at_top_basis_Ioi.tendsto_iff nhds_basis_ball).trans $
705751
by { simp only [exists_prop, true_and], refl }
706752

707-
lemma is_open_singleton_iff {X : Type*} [pseudo_metric_space X] {x : X} :
708-
is_open ({x} : set X) ↔ ∃ ε > 0, ∀ y, dist y x < ε → y = x :=
753+
lemma is_open_singleton_iff {α : Type*} [pseudo_metric_space α] {x : α} :
754+
is_open ({x} : set α) ↔ ∃ ε > 0, ∀ y, dist y x < ε → y = x :=
709755
by simp [is_open_iff, subset_singleton_iff, mem_ball]
710756

711757
/-- Given a point `x` in a discrete subset `s` of a pseudometric space, there is an open ball
@@ -1793,6 +1839,18 @@ end int
17931839
class metric_space (α : Type u) extends pseudo_metric_space α : Type u :=
17941840
(eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y)
17951841

1842+
/-- Construct a metric space structure whose underlying topological space structure
1843+
(definitionally) agrees which a pre-existing topology which is compatible with a given distance
1844+
function. -/
1845+
def metric_space.of_metrizable {α : Type*} [topological_space α] (dist : α → α → ℝ)
1846+
(dist_self : ∀ x : α, dist x x = 0)
1847+
(dist_comm : ∀ x y : α, dist x y = dist y x)
1848+
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
1849+
(H : ∀ s : set α, is_open s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s)
1850+
(eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : metric_space α :=
1851+
{ eq_of_dist_eq_zero := eq_of_dist_eq_zero,
1852+
..pseudo_metric_space.of_metrizable dist dist_self dist_comm dist_triangle H }
1853+
17961854
variables {γ : Type w} [metric_space γ]
17971855

17981856
theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y :=

0 commit comments

Comments
 (0)