mathlib3documentation

topology.metric_space.emetric_space

Extended metric spaces #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file is devoted to the definition and study of `emetric_spaces`, i.e., metric spaces in which the distance is allowed to take the value ∞. This extended distance is called `edist`, and takes values in `ℝ≥0∞`.

Many definitions and theorems expected on emetric spaces are already introduced on uniform spaces and topological spaces. For example: open and closed sets, compactness, completeness, continuity and uniform continuity.

The class `emetric_space` therefore extends `uniform_space` (and `topological_space`).

Since a lot of elementary properties don't require `eq_of_edist_eq_zero` we start setting up the theory of `pseudo_emetric_space`, where we don't require `edist x y = 0 → x = y` and we specialize to `emetric_space` at the end.

theorem uniformity_dist_of_mem_uniformity {α : Type u} {β : Type v} [linear_order β] {U : filter × α)} (z : β) (D : α α β) (H : (s : set × α)), s U (ε : β) (H : ε > z), {a b : α}, D a b < ε (a, b) s) :
U = (ε : β) (H : ε > z), filter.principal {p : α × α | D p.fst p.snd < ε}

Characterizing uniformities associated to a (generalized) distance function `D` in terms of the elements of the uniformity.

@[class]
structure has_edist (α : Type u_2) :
Type u_2
• edist : α

`has_edist α` means that `α` is equipped with an extended distance.

Instances of this typeclass
Instances of other typeclasses for `has_edist`
• has_edist.has_sizeof_inst
noncomputable def uniform_space_of_edist {α : Type u} (edist : α ) (edist_self : (x : α), edist x x = 0) (edist_comm : (x y : α), edist x y = edist y x) (edist_triangle : (x y z : α), edist x z edist x y + edist y z) :

Creating a uniform space from an extended distance.

Equations
• edist_self edist_comm edist_triangle = uniform_space.of_fun edist edist_self edist_comm edist_triangle uniform_space_of_edist._proof_1
@[class]
structure pseudo_emetric_space (α : Type u) :
• to_has_edist :
• edist_self : (x : α), = 0
• edist_comm : (x y : α), =
• edist_triangle : (x y z : α), +
• to_uniform_space :
• uniformity_edist : = (ε : ennreal) (H : ε > 0), filter.principal {p : α × α | < ε}) . "control_laws_tac"

Extended (pseudo) metric spaces, with an extended distance `edist` possibly taking the value ∞

Each pseudo_emetric space induces a canonical `uniform_space` and hence a canonical `topological_space`. This is enforced in the type class definition, by extending the `uniform_space` structure. When instantiating a `pseudo_emetric_space` structure, the uniformity fields are not necessary, they will be filled in by default. There is a default value for the uniformity, that can be substituted in cases of interest, for instance when instantiating a `pseudo_emetric_space` structure on a product.

Continuity of `edist` is proved in `topology.instances.ennreal`

Instances of this typeclass
Instances of other typeclasses for `pseudo_emetric_space`
• pseudo_emetric_space.has_sizeof_inst
theorem edist_triangle_left {α : Type u} (x y z : α) :
+

Triangle inequality for the extended distance

theorem edist_triangle_right {α : Type u} (x y z : α) :
+
theorem edist_congr_right {α : Type u} {x y z : α} (h : = 0) :
=
theorem edist_congr_left {α : Type u} {x y z : α} (h : = 0) :
=
theorem edist_triangle4 {α : Type u} (x y z t : α) :
+ +
theorem edist_le_Ico_sum_edist {α : Type u} (f : α) {m n : } (h : m n) :
has_edist.edist (f m) (f n) n).sum (λ (i : ), has_edist.edist (f i) (f (i + 1)))

The triangle (polygon) inequality for sequences of points; `finset.Ico` version.

theorem edist_le_range_sum_edist {α : Type u} (f : α) (n : ) :
has_edist.edist (f 0) (f n) (finset.range n).sum (λ (i : ), has_edist.edist (f i) (f (i + 1)))

The triangle (polygon) inequality for sequences of points; `finset.range` version.

theorem edist_le_Ico_sum_of_edist_le {α : Type u} {f : α} {m n : } (hmn : m n) {d : ennreal} (hd : {k : }, m k k < n has_edist.edist (f k) (f (k + 1)) d k) :
has_edist.edist (f m) (f n) n).sum (λ (i : ), d i)

A version of `edist_le_Ico_sum_edist` with each intermediate distance replaced with an upper estimate.

theorem edist_le_range_sum_of_edist_le {α : Type u} {f : α} (n : ) {d : ennreal} (hd : {k : }, k < n has_edist.edist (f k) (f (k + 1)) d k) :
has_edist.edist (f 0) (f n) (finset.range n).sum (λ (i : ), d i)

A version of `edist_le_range_sum_edist` with each intermediate distance replaced with an upper estimate.

theorem uniformity_pseudoedist {α : Type u}  :
= (ε : ennreal) (H : ε > 0), filter.principal {p : α × α | < ε}

Reformulation of the uniform structure in terms of the extended distance

theorem uniformity_basis_edist {α : Type u}  :
(uniformity α).has_basis (λ (ε : ennreal), 0 < ε) (λ (ε : ennreal), {p : α × α | < ε})
theorem mem_uniformity_edist {α : Type u} {s : set × α)} :
s (ε : ennreal) (H : ε > 0), {a b : α}, < ε (a, b) s

Characterization of the elements of the uniformity in terms of the extended distance

@[protected]
theorem emetric.mk_uniformity_basis {α : Type u} {β : Type u_1} {p : β Prop} {f : β ennreal} (hf₀ : (x : β), p x 0 < f x) (hf : (ε : ennreal), 0 < ε ( (x : β) (hx : p x), f x ε)) :
(uniformity α).has_basis p (λ (x : β), {p : α × α | < f x})

Given `f : β → ℝ≥0∞`, if `f` sends `{i | p i}` to a set of positive numbers accumulating to zero, then `f i`-neighborhoods of the diagonal form a basis of `𝓤 α`.

For specific bases see `uniformity_basis_edist`, `uniformity_basis_edist'`, `uniformity_basis_edist_nnreal`, and `uniformity_basis_edist_inv_nat`.

@[protected]
theorem emetric.mk_uniformity_basis_le {α : Type u} {β : Type u_1} {p : β Prop} {f : β ennreal} (hf₀ : (x : β), p x 0 < f x) (hf : (ε : ennreal), 0 < ε ( (x : β) (hx : p x), f x ε)) :
(uniformity α).has_basis p (λ (x : β), {p : α × α | f x})

Given `f : β → ℝ≥0∞`, if `f` sends `{i | p i}` to a set of positive numbers accumulating to zero, then closed `f i`-neighborhoods of the diagonal form a basis of `𝓤 α`.

For specific bases see `uniformity_basis_edist_le` and `uniformity_basis_edist_le'`.

theorem uniformity_basis_edist_le {α : Type u}  :
(uniformity α).has_basis (λ (ε : ennreal), 0 < ε) (λ (ε : ennreal), {p : α × α | ε})
theorem uniformity_basis_edist' {α : Type u} (ε' : ennreal) (hε' : 0 < ε') :
(uniformity α).has_basis (λ (ε : ennreal), ε ε') (λ (ε : ennreal), {p : α × α | < ε})
theorem uniformity_basis_edist_le' {α : Type u} (ε' : ennreal) (hε' : 0 < ε') :
(uniformity α).has_basis (λ (ε : ennreal), ε ε') (λ (ε : ennreal), {p : α × α | ε})
theorem uniformity_basis_edist_nnreal {α : Type u}  :
(uniformity α).has_basis (λ (ε : nnreal), 0 < ε) (λ (ε : nnreal), {p : α × α | < ε})
theorem uniformity_basis_edist_nnreal_le {α : Type u}  :
(uniformity α).has_basis (λ (ε : nnreal), 0 < ε) (λ (ε : nnreal), {p : α × α | ε})
theorem uniformity_basis_edist_inv_nat {α : Type u}  :
(uniformity α).has_basis (λ (_x : ), true) (λ (n : ), {p : α × α | < (n)⁻¹})
theorem uniformity_basis_edist_inv_two_pow {α : Type u}  :
(uniformity α).has_basis (λ (_x : ), true) (λ (n : ), {p : α × α | < 2⁻¹ ^ n})
theorem edist_mem_uniformity {α : Type u} {ε : ennreal} (ε0 : 0 < ε) :
{p : α × α | < ε}

Fixed size neighborhoods of the diagonal belong to the uniform structure

@[protected, instance]
theorem emetric.uniform_continuous_on_iff {α : Type u} {β : Type v} {f : α β} {s : set α} :
(ε : ennreal), ε > 0 ( (δ : ennreal) (H : δ > 0), {a : α} {H : a s} {b : α} {H : b s}, < δ has_edist.edist (f a) (f b) < ε)

ε-δ characterization of uniform continuity on a set for pseudoemetric spaces

theorem emetric.uniform_continuous_iff {α : Type u} {β : Type v} {f : α β} :
(ε : ennreal), ε > 0 ( (δ : ennreal) (H : δ > 0), {a b : α}, < δ has_edist.edist (f a) (f b) < ε)

ε-δ characterization of uniform continuity on pseudoemetric spaces

theorem emetric.uniform_embedding_iff {α : Type u} {β : Type v} {f : α β} :
(δ : ennreal), δ > 0 ( (ε : ennreal) (H : ε > 0), {a b : α}, has_edist.edist (f a) (f b) < ε < δ)

ε-δ characterization of uniform embeddings on pseudoemetric spaces

theorem emetric.controlled_of_uniform_embedding {α : Type u} {β : Type v} {f : α β} :
(( (ε : ennreal), ε > 0 ( (δ : ennreal) (H : δ > 0), {a b : α}, < δ has_edist.edist (f a) (f b) < ε)) (δ : ennreal), δ > 0 ( (ε : ennreal) (H : ε > 0), {a b : α}, has_edist.edist (f a) (f b) < ε < δ))

If a map between pseudoemetric spaces is a uniform embedding then the edistance between `f x` and `f y` is controlled in terms of the distance between `x` and `y`.

@[protected]
theorem emetric.cauchy_iff {α : Type u} {f : filter α} :
f (ε : ennreal), ε > 0 ( (t : set α) (H : t f), (x : α), x t (y : α), y t < ε)

ε-δ characterization of Cauchy sequences on pseudoemetric spaces

theorem emetric.complete_of_convergent_controlled_sequences {α : Type u} (B : ennreal) (hB : (n : ), 0 < B n) (H : (u : α), ( (N n m : ), N n N m has_edist.edist (u n) (u m) < B N) ( (x : α), (nhds x))) :

A very useful criterion to show that a space is complete is to show that all sequences which satisfy a bound of the form `edist (u n) (u m) < B N` for all `n m ≥ N` are converging. This is often applied for `B N = 2^{-N}`, i.e., with a very fast convergence to `0`, which makes it possible to use arguments of converging series, while this is impossible to do in general for arbitrary Cauchy sequences.

theorem emetric.complete_of_cauchy_seq_tendsto {α : Type u}  :
( (u : α), ( (a : α), (nhds a)))

A sequentially complete pseudoemetric space is complete.

theorem emetric.tendsto_locally_uniformly_on_iff {α : Type u} {β : Type v} {ι : Type u_1} {F : ι β α} {f : β α} {p : filter ι} {s : set β} :
s (ε : ennreal), ε > 0 (x : β), x s ( (t : set β) (H : t s), ∀ᶠ (n : ι) in p, (y : β), y t has_edist.edist (f y) (F n y) < ε)

Expressing locally uniform convergence on a set using `edist`.

theorem emetric.tendsto_uniformly_on_iff {α : Type u} {β : Type v} {ι : Type u_1} {F : ι β α} {f : β α} {p : filter ι} {s : set β} :
p s (ε : ennreal), ε > 0 (∀ᶠ (n : ι) in p, (x : β), x s has_edist.edist (f x) (F n x) < ε)

Expressing uniform convergence on a set using `edist`.

theorem emetric.tendsto_locally_uniformly_iff {α : Type u} {β : Type v} {ι : Type u_1} {F : ι β α} {f : β α} {p : filter ι} :
(ε : ennreal), ε > 0 (x : β), (t : set β) (H : t nhds x), ∀ᶠ (n : ι) in p, (y : β), y t has_edist.edist (f y) (F n y) < ε

Expressing locally uniform convergence using `edist`.

theorem emetric.tendsto_uniformly_iff {α : Type u} {β : Type v} {ι : Type u_1} {F : ι β α} {f : β α} {p : filter ι} :
p (ε : ennreal), ε > 0 (∀ᶠ (n : ι) in p, (x : β), has_edist.edist (f x) (F n x) < ε)

Expressing uniform convergence using `edist`.

Auxiliary function to replace the uniformity on a pseudoemetric space with a uniformity which is equal to the original one, but maybe not defeq. This is useful if one wants to construct a pseudoemetric space with a specified uniformity. See Note [forgetful inheritance] explaining why having definitionally the right uniformity is often important.

Equations
def pseudo_emetric_space.induced {α : Type u_1} {β : Type u_2} (f : α β) (m : pseudo_emetric_space β) :

The extended pseudometric induced by a function taking values in a pseudoemetric space.

Equations
@[protected, instance]
def subtype.pseudo_emetric_space {α : Type u_1} {p : α Prop}  :

Pseudoemetric space instance on subsets of pseudoemetric spaces

Equations
theorem subtype.edist_eq {α : Type u} {p : α Prop} (x y : subtype p) :

The extended psuedodistance on a subset of a pseudoemetric space is the restriction of the original pseudodistance, by definition

@[protected, instance]

Pseudoemetric space instance on the additive opposite of a pseudoemetric space.

Equations
@[protected, instance]

Pseudoemetric space instance on the multiplicative opposite of a pseudoemetric space.

Equations
theorem mul_opposite.edist_unop {α : Type u} (x y : αᵐᵒᵖ) :
theorem add_opposite.edist_unop {α : Type u} (x y : αᵃᵒᵖ) :
theorem add_opposite.edist_op {α : Type u} (x y : α) :
theorem mul_opposite.edist_op {α : Type u} (x y : α) :
@[protected, instance]
def ulift.pseudo_emetric_space {α : Type u}  :
Equations
theorem ulift.edist_eq {α : Type u} (x y : ulift α) :
=
@[simp]
theorem ulift.edist_up_up {α : Type u} (x y : α) :
has_edist.edist {down := x} {down := y} =
@[protected, instance]
def prod.pseudo_emetric_space_max {α : Type u} {β : Type v}  :

The product of two pseudoemetric spaces, with the max distance, is an extended pseudometric spaces. We make sure that the uniform structure thus constructed is the one corresponding to the product of uniform spaces, to avoid diamond problems.

Equations
theorem prod.edist_eq {α : Type u} {β : Type v} (x y : α × β) :
= y.snd)
@[protected, instance]
def pseudo_emetric_space_pi {β : Type v} {π : β Type u_2} [fintype β] [Π (b : β), pseudo_emetric_space (π b)] :
pseudo_emetric_space (Π (b : β), π b)

The product of a finite number of pseudoemetric spaces, with the max distance, is still a pseudoemetric space. This construction would also work for infinite products, but it would not give rise to the product topology. Hence, we only formalize it in the good situation of finitely many spaces.

Equations
theorem edist_pi_def {β : Type v} {π : β Type u_2} [fintype β] [Π (b : β), pseudo_emetric_space (π b)] (f g : Π (b : β), π b) :
= finset.univ.sup (λ (b : β), has_edist.edist (f b) (g b))
theorem edist_le_pi_edist {β : Type v} {π : β Type u_2} [fintype β] [Π (b : β), pseudo_emetric_space (π b)] (f g : Π (b : β), π b) (b : β) :
has_edist.edist (f b) (g b)
theorem edist_pi_le_iff {β : Type v} {π : β Type u_2} [fintype β] [Π (b : β), pseudo_emetric_space (π b)] {f g : Π (b : β), π b} {d : ennreal} :
d (b : β), has_edist.edist (f b) (g b) d
theorem edist_pi_const_le {α : Type u} {β : Type v} [fintype β] (a b : α) :
has_edist.edist (λ (_x : β), a) (λ (_x : β), b)
@[simp]
theorem edist_pi_const {α : Type u} {β : Type v} [fintype β] [nonempty β] (a b : α) :
has_edist.edist (λ (x : β), a) (λ (_x : β), b) =
def emetric.ball {α : Type u} (x : α) (ε : ennreal) :
set α

`emetric.ball x ε` is the set of all points `y` with `edist y x < ε`

Equations
• ε = {y : α | < ε}
@[simp]
theorem emetric.mem_ball {α : Type u} {x y : α} {ε : ennreal} :
y ε < ε
theorem emetric.mem_ball' {α : Type u} {x y : α} {ε : ennreal} :
y ε < ε
def emetric.closed_ball {α : Type u} (x : α) (ε : ennreal) :
set α

`emetric.closed_ball x ε` is the set of all points `y` with `edist y x ≤ ε`

Equations
• = {y : α | ε}
@[simp]
theorem emetric.mem_closed_ball {α : Type u} {x y : α} {ε : ennreal} :
y ε
theorem emetric.mem_closed_ball' {α : Type u} {x y : α} {ε : ennreal} :
y ε
@[simp]
theorem emetric.closed_ball_top {α : Type u} (x : α) :
theorem emetric.ball_subset_closed_ball {α : Type u} {x : α} {ε : ennreal} :
ε
theorem emetric.pos_of_mem_ball {α : Type u} {x y : α} {ε : ennreal} (hy : y ε) :
0 < ε
theorem emetric.mem_ball_self {α : Type u} {x : α} {ε : ennreal} (h : 0 < ε) :
x ε
theorem emetric.mem_closed_ball_self {α : Type u} {x : α} {ε : ennreal} :
x
theorem emetric.mem_ball_comm {α : Type u} {x y : α} {ε : ennreal} :
x ε y ε
theorem emetric.mem_closed_ball_comm {α : Type u} {x y : α} {ε : ennreal} :
x y
theorem emetric.ball_subset_ball {α : Type u} {x : α} {ε₁ ε₂ : ennreal} (h : ε₁ ε₂) :
ε₁ ε₂
theorem emetric.closed_ball_subset_closed_ball {α : Type u} {x : α} {ε₁ ε₂ : ennreal} (h : ε₁ ε₂) :
theorem emetric.ball_disjoint {α : Type u} {x y : α} {ε₁ ε₂ : ennreal} (h : ε₁ + ε₂ ) :
disjoint ε₁) ε₂)
theorem emetric.ball_subset {α : Type u} {x y : α} {ε₁ ε₂ : ennreal} (h : + ε₁ ε₂) (h' : ) :
ε₁ ε₂
theorem emetric.exists_ball_subset_ball {α : Type u} {x y : α} {ε : ennreal} (h : y ε) :
(ε' : ennreal) (H : ε' > 0), ε' ε
theorem emetric.ball_eq_empty_iff {α : Type u} {x : α} {ε : ennreal} :
ε = ε = 0
theorem emetric.ord_connected_set_of_closed_ball_subset {α : Type u} (x : α) (s : set α) :
theorem emetric.ord_connected_set_of_ball_subset {α : Type u} (x : α) (s : set α) :

Relation “two points are at a finite edistance” is an equivalence relation.

Equations
@[simp]
theorem emetric.ball_zero {α : Type u} {x : α} :
0 =
theorem emetric.nhds_basis_eball {α : Type u} {x : α} :
(nhds x).has_basis (λ (ε : ennreal), 0 < ε) (emetric.ball x)
theorem emetric.nhds_within_basis_eball {α : Type u} {x : α} {s : set α} :
s).has_basis (λ (ε : ennreal), 0 < ε) (λ (ε : ennreal), ε s)
theorem emetric.nhds_basis_closed_eball {α : Type u} {x : α} :
(nhds x).has_basis (λ (ε : ennreal), 0 < ε)
theorem emetric.nhds_within_basis_closed_eball {α : Type u} {x : α} {s : set α} :
s).has_basis (λ (ε : ennreal), 0 < ε) (λ (ε : ennreal), s)
theorem emetric.nhds_eq {α : Type u} {x : α} :
nhds x = (ε : ennreal) (H : ε > 0),
theorem emetric.mem_nhds_iff {α : Type u} {x : α} {s : set α} :
s nhds x (ε : ennreal) (H : ε > 0), ε s
theorem emetric.mem_nhds_within_iff {α : Type u} {x : α} {s t : set α} :
s t (ε : ennreal) (H : ε > 0), ε t s
theorem emetric.tendsto_nhds_within_nhds_within {α : Type u} {β : Type v} {s : set α} {f : α β} {t : set β} {a : α} {b : β} :
s) t) (ε : ennreal), ε > 0 ( (δ : ennreal) (H : δ > 0), ⦃x : α⦄, x s < δ f x t has_edist.edist (f x) b < ε)
theorem emetric.tendsto_nhds_within_nhds {α : Type u} {β : Type v} {s : set α} {f : α β} {a : α} {b : β} :
s) (nhds b) (ε : ennreal), ε > 0 ( (δ : ennreal) (H : δ > 0), {x : α}, x s < δ has_edist.edist (f x) b < ε)
theorem emetric.tendsto_nhds_nhds {α : Type u} {β : Type v} {f : α β} {a : α} {b : β} :
(nhds a) (nhds b) (ε : ennreal), ε > 0 ( (δ : ennreal) (H : δ > 0), ⦃x : α⦄, < δ has_edist.edist (f x) b < ε)
theorem emetric.is_open_iff {α : Type u} {s : set α} :
(x : α), x s ( (ε : ennreal) (H : ε > 0), ε s)
theorem emetric.is_open_ball {α : Type u} {x : α} {ε : ennreal} :
theorem emetric.is_closed_ball_top {α : Type u} {x : α} :
theorem emetric.ball_mem_nhds {α : Type u} (x : α) {ε : ennreal} (ε0 : 0 < ε) :
ε nhds x
theorem emetric.closed_ball_mem_nhds {α : Type u} (x : α) {ε : ennreal} (ε0 : 0 < ε) :
theorem emetric.ball_prod_same {α : Type u} {β : Type v} (x : α) (y : β) (r : ennreal) :
r ×ˢ r = emetric.ball (x, y) r
theorem emetric.closed_ball_prod_same {α : Type u} {β : Type v} (x : α) (y : β) (r : ennreal) :
theorem emetric.mem_closure_iff {α : Type u} {x : α} {s : set α} :
x (ε : ennreal), ε > 0 ( (y : α) (H : y s), < ε)

ε-characterization of the closure in pseudoemetric spaces

theorem emetric.tendsto_nhds {α : Type u} {β : Type v} {f : filter β} {u : β α} {a : α} :
(nhds a) (ε : ennreal), ε > 0 (∀ᶠ (x : β) in f, has_edist.edist (u x) a < ε)
theorem emetric.tendsto_at_top {α : Type u} {β : Type v} [nonempty β] {u : β α} {a : α} :
(ε : ennreal), ε > 0 ( (N : β), (n : β), n N has_edist.edist (u n) a < ε)
theorem emetric.inseparable_iff {α : Type u} {x y : α} :
y = 0
@[nolint]
theorem emetric.cauchy_seq_iff {α : Type u} {β : Type v} [nonempty β] {u : β α} :
(ε : ennreal), ε > 0 ( (N : β), (m : β), m N (n : β), n N has_edist.edist (u m) (u n) < ε)

In a pseudoemetric space, Cauchy sequences are characterized by the fact that, eventually, the pseudoedistance between its elements is arbitrarily small

theorem emetric.cauchy_seq_iff' {α : Type u} {β : Type v} [nonempty β] {u : β α} :
(ε : ennreal), ε > 0 ( (N : β), (n : β), n N has_edist.edist (u n) (u N) < ε)

A variation around the emetric characterization of Cauchy sequences

theorem emetric.cauchy_seq_iff_nnreal {α : Type u} {β : Type v} [nonempty β] {u : β α} :
(ε : nnreal), 0 < ε ( (N : β), (n : β), N n has_edist.edist (u n) (u N) < ε)

A variation of the emetric characterization of Cauchy sequences that deals with `ℝ≥0` upper bounds.

theorem emetric.totally_bounded_iff {α : Type u} {s : set α} :
(ε : ennreal), ε > 0 ( (t : set α), t.finite s (y : α) (H : y t), ε)
theorem emetric.totally_bounded_iff' {α : Type u} {s : set α} :
(ε : ennreal), ε > 0 ( (t : set α) (H : t s), t.finite s (y : α) (H : y t), ε)
theorem emetric.subset_countable_closure_of_almost_dense_set {α : Type u} (s : set α) (hs : (ε : ennreal), ε > 0 ( (t : set α), t.countable s (x : α) (H : x t), ) :
(t : set α) (H : t s), t.countable s

For a set `s` in a pseudo emetric space, if for every `ε > 0` there exists a countable set that is `ε`-dense in `s`, then there exists a countable subset `t ⊆ s` that is dense in `s`.

theorem emetric.subset_countable_closure_of_compact {α : Type u} {s : set α} (hs : is_compact s) :
(t : set α) (H : t s), t.countable s

A compact set in a pseudo emetric space is separable, i.e., it is a subset of the closure of a countable set.

A sigma compact pseudo emetric space has second countable topology. This is not an instance to avoid a loop with `sigma_compact_space_of_locally_compact_second_countable`.

theorem emetric.second_countable_of_almost_dense_set {α : Type u} (hs : (ε : ennreal), ε > 0 ( (t : set α), t.countable ( (x : α) (H : x t), = set.univ)) :
noncomputable def emetric.diam {α : Type u} (s : set α) :

The diameter of a set in a pseudoemetric space, named `emetric.diam`

Equations
theorem emetric.diam_le_iff {α : Type u} {s : set α} {d : ennreal} :
(x : α), x s (y : α), y s d
theorem emetric.diam_image_le_iff {α : Type u} {β : Type v} {d : ennreal} {f : β α} {s : set β} :
emetric.diam (f '' s) d (x : β), x s (y : β), y s has_edist.edist (f x) (f y) d
theorem emetric.edist_le_of_diam_le {α : Type u} {x y : α} {s : set α} {d : ennreal} (hx : x s) (hy : y s) (hd : d) :
d
theorem emetric.edist_le_diam_of_mem {α : Type u} {x y : α} {s : set α} (hx : x s) (hy : y s) :

If two points belong to some set, their edistance is bounded by the diameter of the set

theorem emetric.diam_le {α : Type u} {s : set α} {d : ennreal} (h : (x : α), x s (y : α), y s d) :

If the distance between any two points in a set is bounded by some constant, this constant bounds the diameter.

theorem emetric.diam_subsingleton {α : Type u} {s : set α} (hs : s.subsingleton) :

The diameter of a subsingleton vanishes.

@[simp]
theorem emetric.diam_empty {α : Type u}  :

The diameter of the empty set vanishes

@[simp]
theorem emetric.diam_singleton {α : Type u} {x : α} :

The diameter of a singleton vanishes

@[simp]
theorem emetric.diam_one {α : Type u} [has_one α] :
@[simp]
theorem emetric.diam_zero {α : Type u} [has_zero α] :
theorem emetric.diam_Union_mem_option {α : Type u} {ι : Type u_1} (o : option ι) (s : ι set α) :
emetric.diam ( (i : ι) (H : i o), s i) = (i : ι) (H : i o), emetric.diam (s i)
theorem emetric.diam_insert {α : Type u} {x : α} {s : set α} :
= linear_order.max ( (y : α) (H : y s), y) (emetric.diam s)
theorem emetric.diam_pair {α : Type u} {x y : α} :
emetric.diam {x, y} =
theorem emetric.diam_triple {α : Type u} {x y z : α} :
theorem emetric.diam_mono {α : Type u} {s t : set α} (h : s t) :

The diameter is monotonous with respect to inclusion

theorem emetric.diam_union {α : Type u} {x y : α} {s t : set α} (xs : x s) (yt : y t) :

The diameter of a union is controlled by the diameter of the sets, and the edistance between two points in the sets.

theorem emetric.diam_union' {α : Type u} {s t : set α} (h : (s t).nonempty) :
theorem emetric.diam_closed_ball {α : Type u} {x : α} {r : ennreal} :
2 * r
theorem emetric.diam_ball {α : Type u} {x : α} {r : ennreal} :
theorem emetric.diam_pi_le_of_le {β : Type v} {π : β Type u_1} [fintype β] [Π (b : β), pseudo_emetric_space (π b)] {s : Π (b : β), set (π b)} {c : ennreal} (h : (b : β), emetric.diam (s b) c) :
c
@[class]
structure emetric_space (α : Type u) :
• to_pseudo_emetric_space :
• eq_of_edist_eq_zero : {x y : α}, = 0 x = y

We now define `emetric_space`, extending `pseudo_emetric_space`.

Instances of this typeclass
Instances of other typeclasses for `emetric_space`
• emetric_space.has_sizeof_inst
@[simp]
theorem edist_eq_zero {γ : Type w} {x y : γ} :
= 0 x = y

Characterize the equality of points by the vanishing of their extended distance

@[simp]
theorem zero_eq_edist {γ : Type w} {x y : γ} :
0 = x = y
theorem edist_le_zero {γ : Type w} {x y : γ} :
0 x = y
@[simp]
theorem edist_pos {γ : Type w} {x y : γ} :
0 < x y
theorem eq_of_forall_edist_le {γ : Type w} {x y : γ} (h : (ε : ennreal), ε > 0 ε) :
x = y

Two points coincide if their distance is `< ε` for all positive ε

@[protected, instance]
def to_separated {γ : Type w}  :

An emetric space is separated

theorem emetric.uniform_embedding_iff' {β : Type v} {γ : Type w} {f : γ β} :
( (ε : ennreal), ε > 0 ( (δ : ennreal) (H : δ > 0), {a b : γ}, < δ has_edist.edist (f a) (f b) < ε)) (δ : ennreal), δ > 0 ( (ε : ennreal) (H : ε > 0), {a b : γ}, has_edist.edist (f a) (f b) < ε < δ)

A map between emetric spaces is a uniform embedding if and only if the edistance between `f x` and `f y` is controlled in terms of the distance between `x` and `y` and conversely.

If a `pseudo_emetric_space` is a T₀ space, then it is an `emetric_space`.

Equations
def emetric_space.replace_uniformity {γ : Type u_1} [U : uniform_space γ] (m : emetric_space γ) (H : = ) :

Auxiliary function to replace the uniformity on an emetric space with a uniformity which is equal to the original one, but maybe not defeq. This is useful if one wants to construct an emetric space with a specified uniformity. See Note [forgetful inheritance] explaining why having definitionally the right uniformity is often important.

Equations
def emetric_space.induced {γ : Type u_1} {β : Type u_2} (f : γ β) (hf : function.injective f) (m : emetric_space β) :

The extended metric induced by an injective function taking values in a emetric space.

Equations
@[protected, instance]
def subtype.emetric_space {α : Type u_1} {p : α Prop}  :

Emetric space instance on subsets of emetric spaces

Equations
@[protected, instance]
def mul_opposite.emetric_space {α : Type u_1}  :

Emetric space instance on the multiplicative opposite of an emetric space.

Equations
@[protected, instance]
def add_opposite.emetric_space {α : Type u_1}  :

Emetric space instance on the additive opposite of an emetric space.

Equations
@[protected, instance]
def ulift.emetric_space {α : Type u_1}  :
Equations
@[protected, instance]
def prod.emetric_space_max {β : Type v} {γ : Type w}  :

The product of two emetric spaces, with the max distance, is an extended metric spaces. We make sure that the uniform structure thus constructed is the one corresponding to the product of uniform spaces, to avoid diamond problems.

Equations
theorem uniformity_edist {γ : Type w}  :
= (ε : ennreal) (H : ε > 0), filter.principal {p : γ × γ | < ε}

Reformulation of the uniform structure in terms of the extended distance

@[protected, instance]
def emetric_space_pi {β : Type v} {π : β Type u_2} [fintype β] [Π (b : β), emetric_space (π b)] :
emetric_space (Π (b : β), π b)

The product of a finite number of emetric spaces, with the max distance, is still an emetric space. This construction would also work for infinite products, but it would not give rise to the product topology. Hence, we only formalize it in the good situation of finitely many spaces.

Equations
theorem emetric.countable_closure_of_compact {γ : Type w} {s : set γ} (hs : is_compact s) :
(t : set γ) (H : t s), t.countable s =

A compact set in an emetric space is separable, i.e., it is the closure of a countable set.

theorem emetric.diam_eq_zero_iff {γ : Type w} {s : set γ} :
theorem emetric.diam_pos_iff {γ : Type w} {s : set γ} :
(x : γ) (H : x s) (y : γ) (H : y s), x y

Separation quotient #

@[protected, instance]
Equations
@[simp]
theorem uniform_space.separation_quotient.edist_mk {X : Type u_1} (x y : X) :
has_edist.edist (quot.mk setoid.r x) (quot.mk setoid.r y) =
@[protected, instance]
Equations

`additive`, `multiplicative`#

The distance on those type synonyms is inherited without change.

@[protected, instance]
def additive.has_edist {X : Type u_1} [has_edist X] :
Equations
@[protected, instance]
def multiplicative.has_edist {X : Type u_1} [has_edist X] :
Equations
@[simp]
theorem edist_of_mul {X : Type u_1} [has_edist X] (a b : X) :
@[simp]
theorem edist_of_add {X : Type u_1} [has_edist X] (a b : X) :
@[simp]
theorem edist_to_mul {X : Type u_1} [has_edist X] (a b : additive X) :
@[simp]
theorem edist_to_add {X : Type u_1} [has_edist X] (a b : multiplicative X) :
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]
def additive.emetric_space {X : Type u_1}  :
Equations
@[protected, instance]
Equations

Order dual #

The distance on this type synonym is inherited without change.

@[protected, instance]
def order_dual.has_edist {X : Type u_1} [has_edist X] :
Equations
@[simp]
theorem edist_to_dual {X : Type u_1} [has_edist X] (a b : X) :
@[simp]
theorem edist_of_dual {X : Type u_1} [has_edist X] (a b : Xᵒᵈ) :
@[protected, instance]
Equations
@[protected, instance]
def order_dual.emetric_space {X : Type u_1}  :
Equations