mathlib documentation

topology.​metric_space.​emetric_space

topology.​metric_space.​emetric_space

Extended metric spaces

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 ennreal.

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).

theorem uniformity_dist_of_mem_uniformity {α : Type u} {β : Type v} [linear_order β] {U : filter × α)} (z : β) (D : α → α → β) :
(∀ (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_1Type u_1

Instances
def uniform_space_of_edist {α : Type u} (edist : α → α → ennreal) :
(∀ (x : α), edist x x = 0)(∀ (x y : α), edist x y = edist y x)(∀ (x y z : α), edist x z edist x y + edist y z)uniform_space α

Creating a uniform space from an extended distance.

Equations
@[class]
structure emetric_space  :
Type uType u

Extended metric spaces, with an extended distance edist possibly taking the value ∞

Each 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 an 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 an emetric_space structure on a product.

Continuity of edist is proved in topology.instances.ennreal

Instances
@[simp]
theorem edist_eq_zero {α : Type u} [emetric_space α] {x y : α} :

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

@[simp]
theorem zero_eq_edist {α : Type u} [emetric_space α] {x y : α} :

theorem edist_le_zero {α : Type u} [emetric_space α] {x y : α} :

theorem edist_triangle_left {α : Type u} [emetric_space α] (x y z : α) :

Triangle inequality for the extended distance

theorem edist_triangle_right {α : Type u} [emetric_space α] (x y z : α) :

theorem edist_triangle4 {α : Type u} [emetric_space α] (x y z t : α) :

theorem edist_le_Ico_sum_edist {α : Type u} [emetric_space α] (f : → α) {m n : } :
m nhas_edist.edist (f m) (f n) (finset.Ico m 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} [emetric_space α] (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} [emetric_space α] {f : → α} {m n : } (hmn : m n) {d : ennreal} :
(∀ {k : }, m kk < nhas_edist.edist (f k) (f (k + 1)) d k)has_edist.edist (f m) (f n) (finset.Ico m 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} [emetric_space α] {f : → α} (n : ) {d : ennreal} :
(∀ {k : }, k < nhas_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 eq_of_forall_edist_le {α : Type u} [emetric_space α] {x y : α} :
(∀ (ε : ennreal), ε > 0has_edist.edist x y ε)x = y

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

theorem uniformity_edist {α : Type u} [emetric_space α] :
uniformity α = ⨅ (ε : ennreal) (H : ε > 0), filter.principal {p : α × α | has_edist.edist p.fst p.snd < ε}

Reformulation of the uniform structure in terms of the extended distance

theorem uniformity_basis_edist {α : Type u} [emetric_space α] :
(uniformity α).has_basis (λ (ε : ennreal), 0 < ε) (λ (ε : ennreal), {p : α × α | has_edist.edist p.fst p.snd < ε})

theorem mem_uniformity_edist {α : Type u} [emetric_space α] {s : set × α)} :
s uniformity α ∃ (ε : ennreal) (H : ε > 0), ∀ {a b : α}, has_edist.edist a b < ε(a, b) s

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

theorem emetric.​mk_uniformity_basis {α : Type u} [emetric_space α] {β : Type u_1} {p : β → Prop} {f : β → ennreal} :
(∀ (x : β), p x0 < f x)(∀ (ε : ennreal), 0 < ε(∃ (x : β) (hx : p x), f x ε))(uniformity α).has_basis p (λ (x : β), {p : α × α | has_edist.edist p.fst p.snd < f x})

Given f : β → ennreal, 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.

theorem emetric.​mk_uniformity_basis_le {α : Type u} [emetric_space α] {β : Type u_1} {p : β → Prop} {f : β → ennreal} :
(∀ (x : β), p x0 < f x)(∀ (ε : ennreal), 0 < ε(∃ (x : β) (hx : p x), f x ε))(uniformity α).has_basis p (λ (x : β), {p : α × α | has_edist.edist p.fst p.snd f x})

Given f : β → ennreal, 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} [emetric_space α] :
(uniformity α).has_basis (λ (ε : ennreal), 0 < ε) (λ (ε : ennreal), {p : α × α | has_edist.edist p.fst p.snd ε})

theorem uniformity_basis_edist' {α : Type u} [emetric_space α] (ε' : ennreal) :
0 < ε'(uniformity α).has_basis (λ (ε : ennreal), ε set.Ioo 0 ε') (λ (ε : ennreal), {p : α × α | has_edist.edist p.fst p.snd < ε})

theorem uniformity_basis_edist_le' {α : Type u} [emetric_space α] (ε' : ennreal) :
0 < ε'(uniformity α).has_basis (λ (ε : ennreal), ε set.Ioo 0 ε') (λ (ε : ennreal), {p : α × α | has_edist.edist p.fst p.snd ε})

theorem uniformity_basis_edist_nnreal {α : Type u} [emetric_space α] :
(uniformity α).has_basis (λ (ε : nnreal), 0 < ε) (λ (ε : nnreal), {p : α × α | has_edist.edist p.fst p.snd < ε})

theorem uniformity_basis_edist_inv_nat {α : Type u} [emetric_space α] :
(uniformity α).has_basis (λ (_x : ), true) (λ (n : ), {p : α × α | has_edist.edist p.fst p.snd < (n)⁻¹})

theorem edist_mem_uniformity {α : Type u} [emetric_space α] {ε : ennreal} :
0 < ε{p : α × α | has_edist.edist p.fst p.snd < ε} uniformity α

Fixed size neighborhoods of the diagonal belong to the uniform structure

theorem emetric.​uniform_continuous_iff {α : Type u} {β : Type v} [emetric_space α] [emetric_space β] {f : α → β} :
uniform_continuous f ∀ (ε : ennreal), ε > 0(∃ (δ : ennreal) (H : δ > 0), ∀ {a b : α}, has_edist.edist a b < δhas_edist.edist (f a) (f b) < ε)

ε-δ characterization of uniform continuity on emetric spaces

theorem emetric.​uniform_embedding_iff {α : Type u} {β : Type v} [emetric_space α] [emetric_space β] {f : α → β} :
uniform_embedding f function.injective f uniform_continuous f ∀ (δ : ennreal), δ > 0(∃ (ε : ennreal) (H : ε > 0), ∀ {a b : α}, has_edist.edist (f a) (f b) < εhas_edist.edist a b < δ)

ε-δ characterization of uniform embeddings on emetric spaces

theorem emetric.​uniform_embedding_iff' {α : Type u} {β : Type v} [emetric_space α] [emetric_space β] {f : α → β} :
uniform_embedding f (∀ (ε : ennreal), ε > 0(∃ (δ : ennreal) (H : δ > 0), ∀ {a b : α}, has_edist.edist a b < δhas_edist.edist (f a) (f b) < ε)) ∀ (δ : ennreal), δ > 0(∃ (ε : ennreal) (H : ε > 0), ∀ {a b : α}, has_edist.edist (f a) (f b) < εhas_edist.edist a 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.

theorem emetric.​cauchy_iff {α : Type u} [emetric_space α] {f : filter α} :
cauchy f f ∀ (ε : ennreal), ε > 0(∃ (t : set α) (H : t f), ∀ (x y : α), x ty thas_edist.edist x y < ε)

ε-δ characterization of Cauchy sequences on emetric spaces

theorem emetric.​complete_of_convergent_controlled_sequences {α : Type u} [emetric_space α] (B : ennreal) :
(∀ (n : ), 0 < B n)(∀ (u : → α), (∀ (N n m : ), N nN mhas_edist.edist (u n) (u m) < B N)(∃ (x : α), filter.tendsto u filter.at_top (nhds x)))complete_space α

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} [emetric_space α] :
(∀ (u : → α), cauchy_seq u(∃ (a : α), filter.tendsto u filter.at_top (nhds a)))complete_space α

A sequentially complete emetric space is complete.

theorem emetric.​tendsto_locally_uniformly_on_iff {α : Type u} {β : Type v} [emetric_space α] {ι : Type u_1} [topological_space β] {F : ι → β → α} {f : β → α} {p : filter ι} {s : set β} :
tendsto_locally_uniformly_on F f p s ∀ (ε : ennreal), ε > 0∀ (x : β), x s(∃ (t : set β) (H : t nhds_within x s), ∀ᶠ (n : ι) in p, ∀ (y : β), y thas_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} [emetric_space α] {ι : Type u_1} {F : ι → β → α} {f : β → α} {p : filter ι} {s : set β} :
tendsto_uniformly_on F f p s ∀ (ε : ennreal), ε > 0(∀ᶠ (n : ι) in p, ∀ (x : β), x shas_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} [emetric_space α] {ι : Type u_1} [topological_space β] {F : ι → β → α} {f : β → α} {p : filter ι} :
tendsto_locally_uniformly F f p ∀ (ε : ennreal), ε > 0∀ (x : β), ∃ (t : set β) (H : t nhds x), ∀ᶠ (n : ι) in p, ∀ (y : β), y thas_edist.edist (f y) (F n y) < ε

Expressing locally uniform convergence using edist.

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

Expressing uniform convergence using edist.

@[instance]
def to_separated {α : Type u} [emetric_space α] :

An emetric space is separated

Equations

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 : α → β) :

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

Equations
@[instance]
def subtype.​emetric_space {α : Type u_1} {p : α → Prop} [t : emetric_space α] :

Emetric space instance on subsets of emetric spaces

Equations
theorem subtype.​edist_eq {α : Type u} [emetric_space α] {p : α → Prop} (x y : subtype p) :

The extended distance on a subset of an emetric space is the restriction of the original distance, by definition

@[instance]
def prod.​emetric_space_max {α : Type u} {β : Type v} [emetric_space α] [emetric_space β] :

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 prod.​edist_eq {α : Type u} {β : Type v} [emetric_space α] [emetric_space β] (x y : α × β) :

@[instance]
def emetric_space_pi {β : Type v} {π : β → Type u_1} [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
def emetric.​ball {α : Type u} [emetric_space α] :
α → ennrealset α

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

Equations
@[simp]
theorem emetric.​mem_ball {α : Type u} [emetric_space α] {x y : α} {ε : ennreal} :

theorem emetric.​mem_ball' {α : Type u} [emetric_space α] {x y : α} {ε : ennreal} :

def emetric.​closed_ball {α : Type u} [emetric_space α] :
α → ennrealset α

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

Equations
@[simp]
theorem emetric.​mem_closed_ball {α : Type u} [emetric_space α] {x y : α} {ε : ennreal} :

theorem emetric.​ball_subset_closed_ball {α : Type u} [emetric_space α] {x : α} {ε : ennreal} :

theorem emetric.​pos_of_mem_ball {α : Type u} [emetric_space α] {x y : α} {ε : ennreal} :
y emetric.ball x ε0 < ε

theorem emetric.​mem_ball_self {α : Type u} [emetric_space α] {x : α} {ε : ennreal} :
0 < εx emetric.ball x ε

theorem emetric.​mem_closed_ball_self {α : Type u} [emetric_space α] {x : α} {ε : ennreal} :

theorem emetric.​mem_ball_comm {α : Type u} [emetric_space α] {x y : α} {ε : ennreal} :

theorem emetric.​ball_subset_ball {α : Type u} [emetric_space α] {x : α} {ε₁ ε₂ : ennreal} :
ε₁ ε₂emetric.ball x ε₁ emetric.ball x ε₂

theorem emetric.​closed_ball_subset_closed_ball {α : Type u} [emetric_space α] {x : α} {ε₁ ε₂ : ennreal} :
ε₁ ε₂emetric.closed_ball x ε₁ emetric.closed_ball x ε₂

theorem emetric.​ball_disjoint {α : Type u} [emetric_space α] {x y : α} {ε₁ ε₂ : ennreal} :
ε₁ + ε₂ has_edist.edist x yemetric.ball x ε₁ emetric.ball y ε₂ =

theorem emetric.​ball_subset {α : Type u} [emetric_space α] {x y : α} {ε₁ ε₂ : ennreal} :
has_edist.edist x y + ε₁ ε₂has_edist.edist x y < emetric.ball x ε₁ emetric.ball y ε₂

theorem emetric.​exists_ball_subset_ball {α : Type u} [emetric_space α] {x y : α} {ε : ennreal} :
y emetric.ball x ε(∃ (ε' : ennreal) (H : ε' > 0), emetric.ball y ε' emetric.ball x ε)

theorem emetric.​ball_eq_empty_iff {α : Type u} [emetric_space α] {x : α} {ε : ennreal} :
emetric.ball x ε = ε = 0

def emetric.​edist_lt_top_setoid {α : Type u} [emetric_space α] :

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

Equations
@[simp]
theorem emetric.​ball_zero {α : Type u} [emetric_space α] {x : α} :

theorem emetric.​nhds_basis_eball {α : Type u} [emetric_space α] {x : α} :
(nhds x).has_basis (λ (ε : ennreal), 0 < ε) (emetric.ball x)

theorem emetric.​nhds_basis_closed_eball {α : Type u} [emetric_space α] {x : α} :
(nhds x).has_basis (λ (ε : ennreal), 0 < ε) (emetric.closed_ball x)

theorem emetric.​nhds_eq {α : Type u} [emetric_space α] {x : α} :
nhds x = ⨅ (ε : ennreal) (H : ε > 0), filter.principal (emetric.ball x ε)

theorem emetric.​mem_nhds_iff {α : Type u} [emetric_space α] {x : α} {s : set α} :
s nhds x ∃ (ε : ennreal) (H : ε > 0), emetric.ball x ε s

theorem emetric.​is_open_iff {α : Type u} [emetric_space α] {s : set α} :
is_open s ∀ (x : α), x s(∃ (ε : ennreal) (H : ε > 0), emetric.ball x ε s)

theorem emetric.​is_open_ball {α : Type u} [emetric_space α] {x : α} {ε : ennreal} :

theorem emetric.​is_closed_ball_top {α : Type u} [emetric_space α] {x : α} :

theorem emetric.​ball_mem_nhds {α : Type u} [emetric_space α] (x : α) {ε : ennreal} :
0 < εemetric.ball x ε nhds x

theorem emetric.​mem_closure_iff {α : Type u} [emetric_space α] {x : α} {s : set α} :
x closure s ∀ (ε : ennreal), ε > 0(∃ (y : α) (H : y s), has_edist.edist x y < ε)

ε-characterization of the closure in emetric spaces

theorem emetric.​tendsto_nhds {α : Type u} {β : Type v} [emetric_space α] {f : filter β} {u : β → α} {a : α} :
filter.tendsto u f (nhds a) ∀ (ε : ennreal), ε > 0(∀ᶠ (x : β) in f, has_edist.edist (u x) a < ε)

theorem emetric.​tendsto_at_top {α : Type u} {β : Type v} [emetric_space α] [nonempty β] [semilattice_sup β] (u : β → α) {a : α} :
filter.tendsto u filter.at_top (nhds a) ∀ (ε : ennreal), ε > 0(∃ (N : β), ∀ (n : β), n Nhas_edist.edist (u n) a < ε)

@[nolint]
theorem emetric.​cauchy_seq_iff {α : Type u} {β : Type v} [emetric_space α] [nonempty β] [semilattice_sup β] {u : β → α} :
cauchy_seq u ∀ (ε : ennreal), ε > 0(∃ (N : β), ∀ (m n : β), m Nn Nhas_edist.edist (u m) (u n) < ε)

In an emetric space, Cauchy sequences are characterized by the fact that, eventually, the edistance between its elements is arbitrarily small

theorem emetric.​cauchy_seq_iff' {α : Type u} {β : Type v} [emetric_space α] [nonempty β] [semilattice_sup β] {u : β → α} :
cauchy_seq u ∀ (ε : ennreal), ε > 0(∃ (N : β), ∀ (n : β), n Nhas_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} [emetric_space α] [nonempty β] [semilattice_sup β] {u : β → α} :
cauchy_seq u ∀ (ε : nnreal), 0 < ε(∃ (N : β), ∀ (n : β), N nhas_edist.edist (u n) (u N) < ε)

A variation of the emetric characterization of Cauchy sequences that deals with nnreal upper bounds.

theorem emetric.​totally_bounded_iff {α : Type u} [emetric_space α] {s : set α} :
totally_bounded s ∀ (ε : ennreal), ε > 0(∃ (t : set α), t.finite s ⋃ (y : α) (H : y t), emetric.ball y ε)

theorem emetric.​totally_bounded_iff' {α : Type u} [emetric_space α] {s : set α} :
totally_bounded s ∀ (ε : ennreal), ε > 0(∃ (t : set α) (H : t s), t.finite s ⋃ (y : α) (H : y t), emetric.ball y ε)

theorem emetric.​countable_closure_of_compact {α : Type u} [emetric_space α] {s : set α} :
is_compact s(∃ (t : set α) (H : t s), t.countable s = closure t)

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

A separable emetric space is second countable: one obtains a countable basis by taking the balls centered at points in a dense subset, and with rational radii. We do not register this as an instance, as there is already an instance going in the other direction from second countable spaces to separable spaces, and we want to avoid loops.

def emetric.​diam {α : Type u} [emetric_space α] :
set αennreal

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

Equations
theorem emetric.​diam_le_iff_forall_edist_le {α : Type u} [emetric_space α] {s : set α} {d : ennreal} :
emetric.diam s d ∀ (x : α), x s∀ (y : α), y shas_edist.edist x y d

theorem emetric.​edist_le_diam_of_mem {α : Type u} [emetric_space α] {x y : α} {s : set α} :
x sy shas_edist.edist x y emetric.diam s

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

theorem emetric.​diam_le_of_forall_edist_le {α : Type u} [emetric_space α] {s : set α} {d : ennreal} :
(∀ (x : α), x s∀ (y : α), y shas_edist.edist x y d)emetric.diam 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} [emetric_space α] {s : set α} :

The diameter of a subsingleton vanishes.

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

The diameter of the empty set vanishes

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

The diameter of a singleton vanishes

theorem emetric.​diam_eq_zero_iff {α : Type u} [emetric_space α] {s : set α} :

theorem emetric.​diam_pos_iff {α : Type u} [emetric_space α] {s : set α} :
0 < emetric.diam s ∃ (x : α) (H : x s) (y : α) (H : y s), x y

theorem emetric.​diam_insert {α : Type u} [emetric_space α] {x : α} {s : set α} :
emetric.diam (has_insert.insert x s) = max (⨆ (y : α) (H : y s), has_edist.edist x y) (emetric.diam s)

theorem emetric.​diam_pair {α : Type u} [emetric_space α] {x y : α} :

theorem emetric.​diam_triple {α : Type u} [emetric_space α] {x y z : α} :

theorem emetric.​diam_mono {α : Type u} [emetric_space α] {s t : set α} :

The diameter is monotonous with respect to inclusion

theorem emetric.​diam_union {α : Type u} [emetric_space α] {x y : α} {s t : set α} :

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} [emetric_space α] {s t : set α} :

theorem emetric.​diam_closed_ball {α : Type u} [emetric_space α] {x : α} {r : ennreal} :

theorem emetric.​diam_ball {α : Type u} [emetric_space α] {x : α} {r : ennreal} :