Metric spaces #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines metric spaces. Many definitions and theorems expected on metric spaces are already introduced on uniform spaces and topological spaces. For example: open and closed sets, compactness, completeness, continuity and uniform continuity
Main definitions #
has_dist α
: Endows a spaceα
with a functiondist a b
.pseudo_metric_space α
: A space endowed with a distance function, which can be zero even if the two elements are non-equal.metric.ball x ε
: The set of all pointsy
withdist y x < ε
.metric.bounded s
: Whether a subset of apseudo_metric_space
is bounded.metric_space α
: Apseudo_metric_space
with the guaranteedist x y = 0 → x = y
.
Additional useful definitions:
nndist a b
:dist
as a function to the non-negative reals.metric.closed_ball x ε
: The set of all pointsy
withdist y x ≤ ε
.metric.sphere x ε
: The set of all pointsy
withdist y x = ε
.proper_space α
: Apseudo_metric_space
where all closed balls are compact.metric.diam s
: Thesupr
of the distances of members ofs
. Defined in terms ofemetric.diam
, for better handling of the case when it should be infinite.
TODO (anyone): Add "Main results" section.
Implementation notes #
Since a lot of elementary properties don't require eq_of_dist_eq_zero
we start setting up the
theory of pseudo_metric_space
, where we don't require dist x y = 0 → x = y
and we specialize
to metric_space
at the end.
Tags #
metric, pseudo_metric, dist
Construct a uniform structure from a distance function and metric space axioms
Equations
- uniform_space_of_dist dist dist_self dist_comm dist_triangle = uniform_space.of_fun dist dist_self dist_comm dist_triangle uniform_space_of_dist._proof_1
The distance function (given an ambient metric space on α
), which returns
a nonnegative real number dist x y
given x y : α
.
Instances of this typeclass
- pseudo_metric_space.to_has_dist
- uniform_space.separation_quotient.has_dist
- additive.has_dist
- multiplicative.has_dist
- order_dual.has_dist
- int.has_dist
- nat.has_dist
- uniform_space.completion.has_dist
- pi_Lp.has_dist
- bounded_continuous_function.has_dist
- measure_theory.Lp.has_dist
- Gromov_Hausdorff.GH_space.has_dist
- upper_half_plane.has_dist
- padic.has_dist
- hamming.has_dist
Instances of other typeclasses for has_dist
- has_dist.has_sizeof_inst
- to_has_dist : has_dist α
- dist_self : ∀ (x : α), has_dist.dist x x = 0
- dist_comm : ∀ (x y : α), has_dist.dist x y = has_dist.dist y x
- dist_triangle : ∀ (x y z : α), has_dist.dist x z ≤ has_dist.dist x y + has_dist.dist y z
- edist : α → α → ennreal
- edist_dist : (∀ (x y : α), pseudo_metric_space.edist x y = ennreal.of_real (has_dist.dist x y)) . "edist_dist_tac"
- to_uniform_space : uniform_space α
- uniformity_dist : (uniformity α = ⨅ (ε : ℝ) (H : ε > 0), filter.principal {p : α × α | has_dist.dist p.fst p.snd < ε}) . "control_laws_tac"
- to_bornology : bornology α
- cobounded_sets : (bornology.cobounded α).sets = {s : set α | ∃ (C : ℝ), ∀ ⦃x : α⦄, x ∈ sᶜ → ∀ ⦃y : α⦄, y ∈ sᶜ → has_dist.dist x y ≤ C} . "control_laws_tac"
Pseudo metric and Metric spaces
A pseudo metric space is endowed with a distance for which the requirement d(x,y)=0 → x = y
might
not hold. A metric space is a pseudo metric space such that d(x,y)=0 → x = y
.
Each pseudo metric 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_metric_space
structure, the uniformity fields are not
necessary, they will be filled in by default. In the same way, each (pseudo) metric space induces a
(pseudo) emetric space structure. It is included in the structure, but filled in by default.
Instances of this typeclass
- metric_space.to_pseudo_metric_space
- seminormed_add_group.to_pseudo_metric_space
- seminormed_group.to_pseudo_metric_space
- seminormed_add_comm_group.to_pseudo_metric_space
- seminormed_comm_group.to_pseudo_metric_space
- non_unital_semi_normed_ring.to_pseudo_metric_space
- semi_normed_ring.to_pseudo_metric_space
- real.pseudo_metric_space
- subtype.pseudo_metric_space
- mul_opposite.pseudo_metric_space
- add_opposite.pseudo_metric_space
- nnreal.pseudo_metric_space
- ulift.pseudo_metric_space
- prod.pseudo_metric_space_max
- pseudo_metric_space_pi
- additive.pseudo_metric_space
- multiplicative.pseudo_metric_space
- order_dual.pseudo_metric_space
- continuous_linear_map.to_pseudo_metric_space
- pi_Lp.pseudo_metric_space
- bounded_continuous_function.pseudo_metric_space
- convex_body.pseudo_metric_space
- hamming.pseudo_metric_space
Instances of other typeclasses for pseudo_metric_space
- pseudo_metric_space.has_sizeof_inst
Two pseudo metric space structures with the same distance function coincide.
Equations
Construct a pseudo-metric space structure whose underlying topological space structure (definitionally) agrees which a pre-existing topology which is compatible with a given distance function.
Equations
- pseudo_metric_space.of_dist_topology dist dist_self dist_comm dist_triangle H = {to_has_dist := {dist := dist}, dist_self := dist_self, dist_comm := dist_comm, dist_triangle := dist_triangle, edist := λ (x y : α), ↑⟨dist x y, _⟩, edist_dist := _, to_uniform_space := {to_topological_space := _inst_2, to_core := uniform_space.to_core (uniform_space_of_dist dist dist_self dist_comm dist_triangle), is_open_uniformity := _}, uniformity_dist := _, to_bornology := bornology.of_dist dist dist_self dist_comm dist_triangle, cobounded_sets := _}
The triangle (polygon) inequality for sequences of points; finset.Ico
version.
The triangle (polygon) inequality for sequences of points; finset.range
version.
A version of dist_le_Ico_sum_dist
with each intermediate distance replaced
with an upper estimate.
A version of dist_le_range_sum_dist
with each intermediate distance replaced
with an upper estimate.
A version of has_dist
that takes value in ℝ≥0
.
Instances of this typeclass
Instances of other typeclasses for has_nndist
- has_nndist.has_sizeof_inst
Distance as a nonnegative real number.
Equations
- pseudo_metric_space.to_has_nndist = {nndist := λ (a b : α), ⟨has_dist.dist a b, _⟩}
Express nndist
in terms of edist
Express edist
in terms of nndist
In a pseudometric space, the extended distance is always finite
In a pseudometric space, the extended distance is always finite
nndist x x
vanishes
Express dist
in terms of nndist
Express nndist
in terms of dist
Triangle inequality for the nonnegative distance
Express dist
in terms of edist
ball x ε
is the set of all points y
with dist y x < ε
Equations
- metric.ball x ε = {y : α | has_dist.dist y x < ε}
Instances for ↥metric.ball
- metric.ball.has_involutive_neg
- metric.ball.has_continuous_neg
- metric.ball.semigroup
- metric.ball.has_continuous_mul
- metric.ball.comm_semigroup
- metric.ball.has_distrib_neg
- mul_action_closed_ball_ball
- has_continuous_smul_closed_ball_ball
- mul_action_sphere_ball
- has_continuous_smul_sphere_ball
- is_scalar_tower_closed_ball_closed_ball_ball
- is_scalar_tower_sphere_closed_ball_ball
- is_scalar_tower_sphere_sphere_ball
- is_scalar_tower_sphere_ball_ball
- is_scalar_tower_closed_ball_ball_ball
- smul_comm_class_closed_ball_closed_ball_ball
- smul_comm_class_sphere_closed_ball_ball
- smul_comm_class_sphere_ball_ball
- smul_comm_class_sphere_sphere_ball
If a point belongs to an open ball, then there is a strictly smaller radius whose ball also contains it.
See also exists_lt_subset_ball
.
closed_ball x ε
is the set of all points y
with dist y x ≤ ε
Equations
- metric.closed_ball x ε = {y : α | has_dist.dist y x ≤ ε}
Instances for ↥metric.closed_ball
- metric.closed_ball.has_involutive_neg
- metric.closed_ball.has_continuous_neg
- metric.closed_ball.semigroup
- metric.closed_ball.has_distrib_neg
- metric.closed_ball.has_continuous_mul
- metric.closed_ball.monoid
- metric.closed_ball.comm_monoid
- mul_action_closed_ball_ball
- has_continuous_smul_closed_ball_ball
- mul_action_closed_ball_closed_ball
- has_continuous_smul_closed_ball_closed_ball
- mul_action_sphere_closed_ball
- has_continuous_smul_sphere_closed_ball
- is_scalar_tower_closed_ball_closed_ball_closed_ball
- is_scalar_tower_closed_ball_closed_ball_ball
- is_scalar_tower_sphere_closed_ball_closed_ball
- is_scalar_tower_sphere_closed_ball_ball
- is_scalar_tower_sphere_sphere_closed_ball
- is_scalar_tower_closed_ball_ball_ball
- smul_comm_class_closed_ball_closed_ball_closed_ball
- smul_comm_class_closed_ball_closed_ball_ball
- smul_comm_class_sphere_closed_ball_closed_ball
- smul_comm_class_sphere_closed_ball_ball
- smul_comm_class_sphere_sphere_closed_ball
- complex.unit_disc.closed_ball_action
- complex.unit_disc.is_scalar_tower_closed_ball_closed_ball
- complex.unit_disc.is_scalar_tower_closed_ball
- complex.unit_disc.smul_comm_class_closed_ball
- complex.unit_disc.smul_comm_class_closed_ball'
- complex.unit_disc.smul_comm_class_circle_closed_ball
- complex.unit_disc.smul_comm_class_closed_ball_circle
sphere x ε
is the set of all points y
with dist y x = ε
Equations
- metric.sphere x ε = {y : α | has_dist.dist y x = ε}
Instances for ↥metric.sphere
- metric.sphere.compact_space
- metric.sphere.has_involutive_neg
- metric.sphere.has_continuous_neg
- metric.sphere.has_inv
- metric.sphere.has_div
- int.has_pow
- metric.sphere.monoid
- metric.sphere.group
- metric.sphere.has_distrib_neg
- metric.sphere.topological_group
- metric.sphere.comm_group
- mul_action_sphere_ball
- has_continuous_smul_sphere_ball
- mul_action_sphere_closed_ball
- has_continuous_smul_sphere_closed_ball
- mul_action_sphere_sphere
- has_continuous_smul_sphere_sphere
- is_scalar_tower_sphere_closed_ball_closed_ball
- is_scalar_tower_sphere_closed_ball_ball
- is_scalar_tower_sphere_sphere_closed_ball
- is_scalar_tower_sphere_sphere_ball
- is_scalar_tower_sphere_sphere_sphere
- is_scalar_tower_sphere_ball_ball
- smul_comm_class_sphere_closed_ball_closed_ball
- smul_comm_class_sphere_closed_ball_ball
- smul_comm_class_sphere_ball_ball
- smul_comm_class_sphere_sphere_closed_ball
- smul_comm_class_sphere_sphere_ball
- smul_comm_class_sphere_sphere_sphere
- metric.sphere.charted_space
- metric.sphere.smooth_manifold_with_corners
Closed balls and spheres coincide when the radius is non-positive
If a property holds for all points in closed balls of arbitrarily large radii, then it holds for all points.
If a property holds for all points in balls of arbitrarily large radii, then it holds for all points.
Given f : β → ℝ
, 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_dist
, uniformity_basis_dist_inv_nat_succ
,
and uniformity_basis_dist_inv_nat_pos
.
Given f : β → ℝ
, if f
sends {i | p i}
to a set of positive numbers
accumulating to zero, then closed neighborhoods of the diagonal of sizes {f i | p i}
form a basis of 𝓤 α
.
Currently we have only one specific basis uniformity_basis_dist_le
based on this constructor.
More can be easily added if needed in the future.
Contant size closed neighborhoods of the diagonal form a basis of the uniformity filter.
A constant size neighborhood of the diagonal is an entourage.
If a map between pseudometric spaces is a uniform embedding then the distance between f x
and f y
is controlled in terms of the distance between x
and y
.
A pseudometric space is totally bounded if one can reconstruct up to any ε>0 any element of the space from finitely many data.
Expressing uniform convergence using dist
Expressing locally uniform convergence on a set using dist
.
Expressing uniform convergence on a set using dist
.
Expressing locally uniform convergence using dist
.
Expressing uniform convergence using dist
.
A version of filter.eventually_prod_iff
where the second filter consists of neighborhoods
in a pseudo-metric space.
A version of filter.eventually_prod_iff
where the first filter consists of neighborhoods
in a pseudo-metric space.
A variant of tendsto_at_top
that
uses ∃ N, ∀ n > N, ...
rather than ∃ N, ∀ n ≥ N, ...
Given a point x
in a discrete subset s
of a pseudometric space, there is an open ball
centered at x
and intersecting s
only at x
.
Given a point x
in a discrete subset s
of a pseudometric space, there is a closed ball
of positive radius centered at x
and intersecting s
only at x
.
Expressing the uniformity in terms of edist
A pseudometric space induces a pseudoemetric space
Equations
- pseudo_metric_space.to_pseudo_emetric_space = {to_has_edist := {edist := has_edist.edist pseudo_metric_space.to_has_edist}, edist_self := _, edist_comm := _, edist_triangle := _, to_uniform_space := pseudo_metric_space.to_uniform_space _inst_1, uniformity_edist := _}
In a pseudometric space, an open ball of infinite radius is the whole space
Balls defined using the distance or the edistance coincide
Balls defined using the distance or the edistance coincide
Closed balls defined using the distance or the edistance coincide
Closed balls defined using the distance or the edistance coincide
Build a new pseudometric space from an old one where the bundled uniform structure is provably (but typically non-definitionaly) equal to some given uniform structure. See Note [forgetful inheritance].
Equations
- m.replace_uniformity H = {to_has_dist := {dist := has_dist.dist pseudo_metric_space.to_has_dist}, dist_self := _, dist_comm := _, dist_triangle := _, edist := has_edist.edist pseudo_metric_space.to_has_edist, edist_dist := _, to_uniform_space := U, uniformity_dist := _, to_bornology := bornology.of_dist has_dist.dist dist_self dist_comm dist_triangle, cobounded_sets := _}
Build a new pseudo metric space from an old one where the bundled topological structure is provably (but typically non-definitionaly) equal to some given topological structure. See Note [forgetful inheritance].
Equations
- m.replace_topology H = m.replace_uniformity _
One gets a pseudometric space from an emetric space if the edistance is everywhere finite, by pushing the edistance to reals. We set it up so that the edist and the uniformity are defeq in the pseudometric space and the pseudoemetric space. In this definition, the distance is given separately, to be able to prescribe some expression which is not defeq to the push-forward of the edistance to reals.
Equations
- pseudo_emetric_space.to_pseudo_metric_space_of_dist dist edist_ne_top h = let m : pseudo_metric_space α := {to_has_dist := {dist := dist}, dist_self := _, dist_comm := _, dist_triangle := _, edist := has_edist.edist pseudo_emetric_space.to_has_edist, edist_dist := _, to_uniform_space := uniform_space_of_dist dist _ _ _, uniformity_dist := _, to_bornology := bornology.of_dist dist _ _ _, cobounded_sets := _} in m.replace_uniformity _
One gets a pseudometric space from an emetric space if the edistance is everywhere finite, by pushing the edistance to reals. We set it up so that the edist and the uniformity are defeq in the pseudometric space and the emetric space.
Equations
- pseudo_emetric_space.to_pseudo_metric_space h = pseudo_emetric_space.to_pseudo_metric_space_of_dist (λ (x y : α), (has_edist.edist x y).to_real) h pseudo_emetric_space.to_pseudo_metric_space._proof_1
Build a new pseudometric space from an old one where the bundled bornology structure is provably (but typically non-definitionaly) equal to some given bornology structure. See Note [forgetful inheritance].
Equations
- m.replace_bornology H = {to_has_dist := pseudo_metric_space.to_has_dist m, dist_self := _, dist_comm := _, dist_triangle := _, edist := pseudo_metric_space.edist m, edist_dist := _, to_uniform_space := pseudo_metric_space.to_uniform_space m, uniformity_dist := _, to_bornology := B, cobounded_sets := _}
A very useful criterion to show that a space is complete is to show that all sequences
which satisfy a bound of the form dist (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.
Instantiate the reals as a pseudometric space.
Equations
- real.pseudo_metric_space = {to_has_dist := {dist := λ (x y : ℝ), |x - y|}, dist_self := real.pseudo_metric_space._proof_1, dist_comm := real.pseudo_metric_space._proof_2, dist_triangle := real.pseudo_metric_space._proof_3, edist := λ (x y : ℝ), ↑⟨(λ (x y : ℝ), |x - y|) x y, _⟩, edist_dist := real.pseudo_metric_space._proof_5, to_uniform_space := uniform_space_of_dist (λ (x y : ℝ), |x - y|) real.pseudo_metric_space._proof_6 real.pseudo_metric_space._proof_7 real.pseudo_metric_space._proof_8, uniformity_dist := real.pseudo_metric_space._proof_9, to_bornology := bornology.of_dist (λ (x y : ℝ), |x - y|) real.pseudo_metric_space._proof_10 real.pseudo_metric_space._proof_11 real.pseudo_metric_space._proof_12, cobounded_sets := real.pseudo_metric_space._proof_13}
Special case of the sandwich theorem; see tendsto_of_tendsto_of_tendsto_of_le_of_le'
for the
general case.
Special case of the sandwich theorem; see tendsto_of_tendsto_of_tendsto_of_le_of_le
and tendsto_of_tendsto_of_tendsto_of_le_of_le'
for the general case.
Alias of filter.tendsto.congr_dist
.
If u
is a neighborhood of x
, then for small enough r
, the closed ball
closed_ball x r
is contained in u
.
In a pseudometric space, Cauchy sequences are characterized by the fact that, eventually, the distance between its elements is arbitrarily small
A variation around the pseudometric characterization of Cauchy sequences
In a pseudometric space, unifom Cauchy sequences are characterized by the fact that, eventually, the distance between all its elements is uniformly, arbitrarily small
If the distance between s n
and s m
, n ≤ m
is bounded above by b n
and b
converges to zero, then s
is a Cauchy sequence.
If the distance between s n
and s m
, n, m ≥ N
is bounded above by b N
and b
converges to zero, then s
is a Cauchy sequence.
A Cauchy sequence on the natural numbers is bounded.
Yet another metric characterization of Cauchy sequences on integers. This one is often the most efficient.
Pseudometric space structure pulled back by a function.
Equations
- pseudo_metric_space.induced f m = {to_has_dist := {dist := λ (x y : α), has_dist.dist (f x) (f y)}, dist_self := _, dist_comm := _, dist_triangle := _, edist := λ (x y : α), has_edist.edist (f x) (f y), edist_dist := _, to_uniform_space := uniform_space.comap f pseudo_metric_space.to_uniform_space, uniformity_dist := _, to_bornology := bornology.induced f, cobounded_sets := _}
Pull back a pseudometric space structure by an inducing map. This is a version of
pseudo_metric_space.induced
useful in case if the domain already has a topological_space
structure.
Equations
- hf.comap_pseudo_metric_space = (pseudo_metric_space.induced f _inst_3).replace_topology _
Pull back a pseudometric space structure by a uniform inducing map. This is a version of
pseudo_metric_space.induced
useful in case if the domain already has a uniform_space
structure.
Equations
Equations
Equations
Equations
Equations
Equations
- prod.pseudo_metric_space_max = (pseudo_emetric_space.to_pseudo_metric_space_of_dist (λ (x y : α × β), has_dist.dist x.fst y.fst ⊔ has_dist.dist x.snd y.snd) prod.pseudo_metric_space_max._proof_1 prod.pseudo_metric_space_max._proof_2).replace_bornology prod.pseudo_metric_space_max._proof_3
If a set s
is separable, then the corresponding subtype is separable in a metric space.
This is not obvious, as the countable set whose closure covers s
does not need in general to
be contained in s
.
The preimage of a separable set by an inducing map is separable.
If a map is continuous on a separable set s
, then the image of s
is also separable.
A finite product of pseudometric spaces is a pseudometric space, with the sup distance.
Equations
- pseudo_metric_space_pi = (pseudo_emetric_space.to_pseudo_metric_space_of_dist (λ (f g : Π (b : β), π b), ↑(finset.univ.sup (λ (b : β), has_nndist.nndist (f b) (g b)))) pseudo_metric_space_pi._proof_1 pseudo_metric_space_pi._proof_2).replace_bornology pseudo_metric_space_pi._proof_3
An open ball in a product space is a product of open balls. See also metric.ball_pi'
for a version assuming nonempty β
instead of 0 < r
.
An open ball in a product space is a product of open balls. See also metric.ball_pi
for a version assuming 0 < r
instead of nonempty β
.
A closed ball in a product space is a product of closed balls. See also metric.closed_ball_pi'
for a version assuming nonempty β
instead of 0 ≤ r
.
A closed ball in a product space is a product of closed balls. See also metric.closed_ball_pi
for a version assuming 0 ≤ r
instead of nonempty β
.
A sphere in a product space is a union of spheres on each component restricted to the closed ball.
Any compact set in a pseudometric space can be covered by finitely many balls of a given positive radius
Alias of finite_cover_balls_of_compact
.
- is_compact_closed_ball : ∀ (x : α) (r : ℝ), is_compact (metric.closed_ball x r)
A pseudometric space is proper if all closed balls are compact.
Instances of this typeclass
- proper_of_compact
- finite_dimensional.proper_real
- prod_proper_space
- pi_proper_space
- additive.proper_space
- multiplicative.proper_space
- order_dual.proper_space
- int.proper_space
- real.proper_space
- nat.proper_space
- complex.proper_space
- finite_dimensional.is_R_or_C.proper_space_submodule
- upper_half_plane.proper_space
In a proper pseudometric space, all spheres are compact.
In a proper pseudometric space, any sphere is a compact_space
when considered as a subtype.
A proper pseudo metric space is sigma compact, and therefore second countable.
If all closed balls of large enough radius are compact, then the space is proper. Especially useful when the lower bound for the radius is 0.
A proper space is locally compact
A proper space is complete
A binary product of proper spaces is proper.
A finite product of proper spaces is proper.
If a nonempty ball in a proper space includes a closed set s
, then there exists a nonempty
ball with the same center and a strictly smaller radius that includes s
.
If a ball in a proper space includes a closed set s
, then there exists a ball with the same
center and a strictly smaller radius that includes s
.
A pseudometric space is second countable if, for every ε > 0
, there is a countable set which
is ε
-dense.
Boundedness of a subset of a pseudometric space. We formulate the definition to work even in the empty space.
Subsets of a bounded set are also bounded
Closed balls are bounded
Open balls are bounded
Spheres are bounded
Given a point, a bounded subset is included in some ball around this point
Alias of metric.bounded_closure_of_bounded
.
The union of two bounded sets is bounded.
The union of two sets is bounded iff each of the sets is bounded.
A finite union of bounded sets is bounded
A totally bounded set is bounded
A compact set is bounded
A finite set is bounded
Alias of metric.bounded_of_finite
.
A singleton is bounded
Characterization of the boundedness of the range of a function
In a compact space, all sets are bounded
If a function is continuous within a set s
at every point of a compact set k
, then it is
bounded on some open neighborhood of k
in s
.
If a function is continuous at every point of a compact set k
, then it is bounded on
some open neighborhood of k
.
If a function is continuous on a set s
containing a compact set k
, then it is bounded on
some open neighborhood of k
in s
.
If a function is continuous on a neighborhood of a compact set k
, then it is bounded on
some open neighborhood of k
.
The Heine–Borel theorem: In a proper space, a closed bounded set is compact.
The Heine–Borel theorem: In a proper space, the closure of a bounded set is compact.
The Heine–Borel theorem: In a proper Hausdorff space, a set is compact if and only if it is closed and bounded.
In a pseudo metric space with a conditionally complete linear order such that the order and the metric structure give the same topology, any order-bounded set is metric-bounded.
The diameter of a set in a metric space. To get controllable behavior even when the diameter should be infinite, we express it in terms of the emetric.diameter
Equations
- metric.diam s = (emetric.diam s).to_real
The diameter of a set is always nonnegative
The empty set has zero diameter
A singleton has zero diameter
If the distance between any two points in a set is bounded by some constant C
,
then ennreal.of_real C
bounds the emetric diameter of this set.
If the distance between any two points in a set is bounded by some non-negative constant, this constant bounds the diameter.
If the distance between any two points in a nonempty set is bounded by some constant, this constant bounds the diameter.
The distance between two points in a set is controlled by the diameter of the set.
Characterize the boundedness of a set in terms of the finiteness of its emetric.diameter.
The distance between two points in a set is controlled by the diameter of the set.
An unbounded set has zero diameter. If you would prefer to get the value ∞, use emetric.diam
.
This lemma makes it possible to avoid side conditions in some situations
If s ⊆ t
, then the diameter of s
is bounded by that of t
, provided t
is bounded.
The diameter of a union is controlled by the sum of the diameters, and the distance between
any two points in each of the sets. This lemma is true without any side condition, since it is
obviously true if s ∪ t
is unbounded.
If two sets intersect, the diameter of the union is bounded by the sum of the diameters.
The diameter of a closed ball of radius r
is at most 2 r
.
The diameter of a ball of radius r
is at most 2 r
.
If a family of complete sets with diameter tending to 0
is such that each finite intersection
is nonempty, then the total intersection is also nonempty.
In a complete space, if a family of closed sets with diameter tending to 0
is such that each
finite intersection is nonempty, then the total intersection is also nonempty.
- to_pseudo_metric_space : pseudo_metric_space α
- eq_of_dist_eq_zero : ∀ {x y : α}, has_dist.dist x y = 0 → x = y
We now define metric_space
, extending pseudo_metric_space
.
Instances of this typeclass
- normed_add_group.to_metric_space
- normed_group.to_metric_space
- normed_add_comm_group.to_metric_space
- normed_comm_group.to_metric_space
- non_unital_normed_ring.to_metric_space
- normed_ring.to_metric_space
- normed_division_ring.to_metric_space
- normed_field.to_metric_space
- normed_ordered_add_group.to_metric_space
- normed_ordered_group.to_metric_space
- normed_linear_ordered_add_group.to_metric_space
- normed_linear_ordered_group.to_metric_space
- normed_linear_ordered_field.to_metric_space
- upgraded_polish_space.to_metric_space
- subtype.metric_space
- mul_opposite.metric_space
- add_opposite.metric_space
- empty.metric_space
- punit.metric_space
- real.metric_space
- nnreal.metric_space
- ulift.metric_space
- prod.metric_space_max
- metric_space_pi
- uniform_space.separation_quotient.metric_space
- additive.metric_space
- multiplicative.metric_space
- order_dual.metric_space
- int.metric_space
- nat.metric_space
- rat.metric_space
- uniform_space.completion.metric_space
- pi_Lp.metric_space
- bounded_continuous_function.metric_space
- continuous_map.metric_space
- metric.glue_space.metric_space
- metric.inductive_limit.metric_space
- metric.nonempty_compacts.metric_space
- Gromov_Hausdorff.optimal_GH_coupling.metric_space
- Gromov_Hausdorff.rep_GH_space_metric_space
- Gromov_Hausdorff.GH_space.metric_space
- zero_at_infty_continuous_map.metric_space
- picard_lindelof.fun_space.metric_space
- enorm.finite_subspace.metric_space
- upper_half_plane.metric_space
- convex_body.metric_space
- padic.metric_space
- padic_int.metric_space
- hamming.metric_space
Instances of other typeclasses for metric_space
- metric_space.has_sizeof_inst
Two metric space structures with the same distance coincide.
Construct a metric space structure whose underlying topological space structure (definitionally) agrees which a pre-existing topology which is compatible with a given distance function.
Equations
- metric_space.of_dist_topology dist dist_self dist_comm dist_triangle H eq_of_dist_eq_zero = {to_pseudo_metric_space := {to_has_dist := pseudo_metric_space.to_has_dist (pseudo_metric_space.of_dist_topology dist dist_self dist_comm dist_triangle H), dist_self := _, dist_comm := _, dist_triangle := _, edist := pseudo_metric_space.edist (pseudo_metric_space.of_dist_topology dist dist_self dist_comm dist_triangle H), edist_dist := _, to_uniform_space := pseudo_metric_space.to_uniform_space (pseudo_metric_space.of_dist_topology dist dist_self dist_comm dist_triangle H), uniformity_dist := _, to_bornology := pseudo_metric_space.to_bornology (pseudo_metric_space.of_dist_topology dist dist_self dist_comm dist_triangle H), cobounded_sets := _}, eq_of_dist_eq_zero := eq_of_dist_eq_zero}
Deduce the equality of points with the vanishing of the nonnegative distance
Characterize the equality of points with the vanishing of the nonnegative distance
A map between metric spaces is a uniform embedding if and only if the distance between f x
and f y
is controlled in terms of the distance between x
and y
and conversely.
If a pseudo_metric_space
is a T₀ space, then it is a metric_space
.
Equations
- metric_space.of_t0_pseudo_metric_space α = {to_pseudo_metric_space := {to_has_dist := pseudo_metric_space.to_has_dist _inst_3, dist_self := _, dist_comm := _, dist_triangle := _, edist := pseudo_metric_space.edist _inst_3, edist_dist := _, to_uniform_space := pseudo_metric_space.to_uniform_space _inst_3, uniformity_dist := _, to_bornology := pseudo_metric_space.to_bornology _inst_3, cobounded_sets := _}, eq_of_dist_eq_zero := _}
A metric space induces an emetric space
If f : β → α
sends any two distinct points to points at distance at least ε > 0
, then
f
is a uniform embedding with respect to the discrete uniformity on β
.
Build a new metric space from an old one where the bundled uniform structure is provably (but typically non-definitionaly) equal to some given uniform structure. See Note [forgetful inheritance].
Equations
- m.replace_uniformity H = {to_pseudo_metric_space := {to_has_dist := pseudo_metric_space.to_has_dist (metric_space.to_pseudo_metric_space.replace_uniformity H), dist_self := _, dist_comm := _, dist_triangle := _, edist := pseudo_metric_space.edist (metric_space.to_pseudo_metric_space.replace_uniformity H), edist_dist := _, to_uniform_space := pseudo_metric_space.to_uniform_space (metric_space.to_pseudo_metric_space.replace_uniformity H), uniformity_dist := _, to_bornology := pseudo_metric_space.to_bornology (metric_space.to_pseudo_metric_space.replace_uniformity H), cobounded_sets := _}, eq_of_dist_eq_zero := _}
Build a new metric space from an old one where the bundled topological structure is provably (but typically non-definitionaly) equal to some given topological structure. See Note [forgetful inheritance].
Equations
- m.replace_topology H = m.replace_uniformity _
One gets a metric space from an emetric space if the edistance is everywhere finite, by pushing the edistance to reals. We set it up so that the edist and the uniformity are defeq in the metric space and the emetric space. In this definition, the distance is given separately, to be able to prescribe some expression which is not defeq to the push-forward of the edistance to reals.
Equations
- emetric_space.to_metric_space_of_dist dist edist_ne_top h = metric_space.of_t0_pseudo_metric_space α
One gets a metric space from an emetric space if the edistance is everywhere finite, by pushing the edistance to reals. We set it up so that the edist and the uniformity are defeq in the metric space and the emetric space.
Equations
- emetric_space.to_metric_space h = emetric_space.to_metric_space_of_dist (λ (x y : α), (has_edist.edist x y).to_real) h emetric_space.to_metric_space._proof_1
Build a new metric space from an old one where the bundled bornology structure is provably (but typically non-definitionaly) equal to some given bornology structure. See Note [forgetful inheritance].
Equations
- m.replace_bornology H = {to_pseudo_metric_space := {to_has_dist := pseudo_metric_space.to_has_dist (metric_space.to_pseudo_metric_space.replace_bornology H), dist_self := _, dist_comm := _, dist_triangle := _, edist := pseudo_metric_space.edist (metric_space.to_pseudo_metric_space.replace_bornology H), edist_dist := _, to_uniform_space := pseudo_metric_space.to_uniform_space (metric_space.to_pseudo_metric_space.replace_bornology H), uniformity_dist := _, to_bornology := B, cobounded_sets := _}, eq_of_dist_eq_zero := _}
Metric space structure pulled back by an injective function. Injectivity is necessary to
ensure that dist x y = 0
only if x = y
.
Equations
- metric_space.induced f hf m = {to_pseudo_metric_space := {to_has_dist := pseudo_metric_space.to_has_dist (pseudo_metric_space.induced f metric_space.to_pseudo_metric_space), dist_self := _, dist_comm := _, dist_triangle := _, edist := pseudo_metric_space.edist (pseudo_metric_space.induced f metric_space.to_pseudo_metric_space), edist_dist := _, to_uniform_space := pseudo_metric_space.to_uniform_space (pseudo_metric_space.induced f metric_space.to_pseudo_metric_space), uniformity_dist := _, to_bornology := pseudo_metric_space.to_bornology (pseudo_metric_space.induced f metric_space.to_pseudo_metric_space), cobounded_sets := _}, eq_of_dist_eq_zero := _}
Pull back a metric space structure by a uniform embedding. This is a version of
metric_space.induced
useful in case if the domain already has a uniform_space
structure.
Equations
- uniform_embedding.comap_metric_space f h = (metric_space.induced f _ _inst_4).replace_uniformity _
Pull back a metric space structure by an embedding. This is a version of
metric_space.induced
useful in case if the domain already has a topological_space
structure.
Equations
- embedding.comap_metric_space f h = let _inst : uniform_space α := embedding.comap_uniform_space f h in uniform_embedding.comap_metric_space f _
Equations
Equations
- empty.metric_space = {to_pseudo_metric_space := {to_has_dist := {dist := λ (_x _x : empty), 0}, dist_self := empty.metric_space._proof_1, dist_comm := empty.metric_space._proof_2, dist_triangle := empty.metric_space._proof_3, edist := λ (_x _x : empty), 0, edist_dist := empty.metric_space._proof_4, to_uniform_space := empty.uniform_space, uniformity_dist := empty.metric_space._proof_5, to_bornology := bornology.of_dist (λ (_x _x : empty), 0) empty.metric_space._proof_6 empty.metric_space._proof_7 empty.metric_space._proof_8, cobounded_sets := empty.metric_space._proof_9}, eq_of_dist_eq_zero := empty.metric_space._proof_10}
Equations
- punit.metric_space = {to_pseudo_metric_space := {to_has_dist := {dist := λ (_x _x : punit), 0}, dist_self := punit.metric_space._proof_1, dist_comm := punit.metric_space._proof_2, dist_triangle := punit.metric_space._proof_3, edist := λ (_x _x : punit), 0, edist_dist := punit.metric_space._proof_4, to_uniform_space := punit.uniform_space, uniformity_dist := punit.metric_space._proof_5, to_bornology := bornology.of_dist (λ (_x _x : punit), 0) punit.metric_space._proof_6 punit.metric_space._proof_7 punit.metric_space._proof_8, cobounded_sets := punit.metric_space._proof_9}, eq_of_dist_eq_zero := punit.metric_space._proof_10}
Instantiate the reals as a metric space.
Equations
- real.metric_space = {to_pseudo_metric_space := {to_has_dist := pseudo_metric_space.to_has_dist real.pseudo_metric_space, dist_self := _, dist_comm := _, dist_triangle := _, edist := pseudo_metric_space.edist real.pseudo_metric_space, edist_dist := _, to_uniform_space := pseudo_metric_space.to_uniform_space real.pseudo_metric_space, uniformity_dist := _, to_bornology := pseudo_metric_space.to_bornology real.pseudo_metric_space, cobounded_sets := _}, eq_of_dist_eq_zero := real.metric_space._proof_1}
Equations
Equations
Equations
- prod.metric_space_max = {to_pseudo_metric_space := {to_has_dist := pseudo_metric_space.to_has_dist prod.pseudo_metric_space_max, dist_self := _, dist_comm := _, dist_triangle := _, edist := pseudo_metric_space.edist prod.pseudo_metric_space_max, edist_dist := _, to_uniform_space := pseudo_metric_space.to_uniform_space prod.pseudo_metric_space_max, uniformity_dist := _, to_bornology := pseudo_metric_space.to_bornology prod.pseudo_metric_space_max, cobounded_sets := _}, eq_of_dist_eq_zero := _}
A finite product of metric spaces is a metric space, with the sup distance.
Equations
- metric_space_pi = {to_pseudo_metric_space := {to_has_dist := pseudo_metric_space.to_has_dist pseudo_metric_space_pi, dist_self := _, dist_comm := _, dist_triangle := _, edist := pseudo_metric_space.edist pseudo_metric_space_pi, edist_dist := _, to_uniform_space := pseudo_metric_space.to_uniform_space pseudo_metric_space_pi, uniformity_dist := _, to_bornology := pseudo_metric_space.to_bornology pseudo_metric_space_pi, cobounded_sets := _}, eq_of_dist_eq_zero := _}
A metric space is second countable if one can reconstruct up to any ε>0
any element of the
space from countably many data.
Equations
- uniform_space.separation_quotient.has_dist = {dist := λ (p q : uniform_space.separation_quotient α), quotient.lift_on₂' p q has_dist.dist uniform_space.separation_quotient.has_dist._proof_1}
Equations
- uniform_space.separation_quotient.metric_space = emetric_space.to_metric_space_of_dist has_dist.dist uniform_space.separation_quotient.metric_space._proof_1 uniform_space.separation_quotient.metric_space._proof_2
additive
, multiplicative
#
The distance on those type synonyms is inherited without change.
Equations
- additive.has_dist = _inst_3
Equations
- multiplicative.has_dist = _inst_3
Equations
- additive.pseudo_metric_space = _inst_3
Equations
- multiplicative.pseudo_metric_space = _inst_3
Equations
- additive.metric_space = _inst_3
Equations
- multiplicative.metric_space = _inst_3
Order dual #
The distance on this type synonym is inherited without change.
Equations
- order_dual.has_dist = _inst_3
Equations
- order_dual.pseudo_metric_space = _inst_3
Equations
- order_dual.metric_space = _inst_3