L^p
distance on finite products of metric spaces #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
Given finitely many metric spaces, one can put the max distance on their product, but there is also
a whole family of natural distances, indexed by a parameter p : ℝ≥0∞
, that also induce
the product topology. We define them in this file. For 0 < p < ∞
, the distance on Π i, α i
is given by
$$
d(x, y) = \left(\sum d(x_i, y_i)^p\right)^{1/p}.
$$,
whereas for p = 0
it is the cardinality of the set ${ i | x_i ≠ y_i}$. For p = ∞
the distance
is the supremum of the distances.
We give instances of this construction for emetric spaces, metric spaces, normed groups and normed spaces.
To avoid conflicting instances, all these are defined on a copy of the original Π-type, named
pi_Lp p α
. The assumpion [fact (1 ≤ p)]
is required for the metric and normed space instances.
We ensure that the topology, bornology and uniform structure on pi_Lp p α
are (defeq to) the
product topology, product bornology and product uniformity, to be able to use freely continuity
statements for the coordinate functions, for instance.
Implementation notes #
We only deal with the L^p
distance on a product of finitely many metric spaces, which may be
distinct. A closely related construction is lp
, the L^p
norm on a product of (possibly
infinitely many) normed spaces, where the norm is
$$
\left(\sum ‖f (x)‖^p \right)^{1/p}.
$$
However, the topology induced by this construction is not the product topology, and some functions
have infinite L^p
norm. These subtleties are not present in the case of finitely many metric
spaces, hence it is worth devoting a file to this specific case which is particularly well behaved.
Another related construction is measure_theory.Lp
, the L^p
norm on the space of functions from
a measure space to a normed space, where the norm is
$$
\left(\int ‖f (x)‖^p dμ\right)^{1/p}.
$$
This has all the same subtleties as lp
, and the further subtlety that this only
defines a seminorm (as almost everywhere zero functions have zero L^p
norm).
The construction pi_Lp
corresponds to the special case of measure_theory.Lp
in which the basis
is a finite space equipped with the counting measure.
To prove that the topology (and the uniform structure) on a finite product with the L^p
distance
are the same as those coming from the L^∞
distance, we could argue that the L^p
and L^∞
norms
are equivalent on ℝ^n
for abstract (norm equivalence) reasons. Instead, we give a more explicit
(easy) proof which provides a comparison between these two norms with explicit constants.
We also set up the theory for pseudo_emetric_space
and pseudo_metric_space
.
A copy of a Pi type, on which we will put the L^p
distance. Since the Pi type itself is
already endowed with the L^∞
distance, we need the type synonym to avoid confusing typeclass
resolution. Also, we let it depend on p
, to get a whole family of type on which we can put
different distances.
Instances for pi_Lp
- pi_Lp.inhabited
- pi_Lp.has_edist
- pi_Lp.has_dist
- pi_Lp.has_norm
- pi_Lp.uniform_space
- pi_Lp.bornology
- pi_Lp.pseudo_emetric_space
- pi_Lp.emetric_space
- pi_Lp.pseudo_metric_space
- pi_Lp.metric_space
- pi_Lp.seminormed_add_comm_group
- pi_Lp.normed_add_comm_group
- pi_Lp.normed_space
- pi_Lp.is_scalar_tower
- pi_Lp.smul_comm_class
- pi_Lp.finite_dimensional
- pi_Lp.inner_product_space
- euclidean_space.finite_dimensional
- euclidean_space.inner_product_space
- euclidean_space.measurable_space
- euclidean_space.borel_space
- metric.sphere.charted_space
- circle.charted_space
Equations
- pi_Lp.inhabited p α = {default := λ (i : ι), inhabited.default}
Canonical bijection between pi_Lp p α
and the original Pi type. We introduce it to be able
to compare the L^p
and L^∞
distances through it.
Equations
- pi_Lp.equiv p α = equiv.refl (pi_Lp p α)
Note that the unapplied versions of these lemmas are deliberately omitted, as they break the use of the type synonym.
Definition of edist
, dist
and norm
on pi_Lp
#
In this section we define the edist
, dist
and norm
functions on pi_Lp p α
without assuming
[fact (1 ≤ p)]
or metric properties of the spaces α i
. This allows us to provide the rewrite
lemmas for each of three cases p = 0
, p = ∞
and 0 < p.to_real
.
Endowing the space pi_Lp p β
with the L^p
edistance. We register this instance
separate from pi_Lp.pseudo_emetric
since the latter requires the type class hypothesis
[fact (1 ≤ p)]
in order to prove the triangle inequality.
Registering this separately allows for a future emetric-like structure on pi_Lp p β
for p < 1
satisfying a relaxed triangle inequality. The terminology for this varies throughout the
literature, but it is sometimes called a quasi-metric or semi-metric.
This holds independent of p
and does not require [fact (1 ≤ p)]
. We keep it separate
from pi_Lp.pseudo_emetric_space
so it can be used also for p < 1
.
This holds independent of p
and does not require [fact (1 ≤ p)]
. We keep it separate
from pi_Lp.pseudo_emetric_space
so it can be used also for p < 1
.
Endowing the space pi_Lp p β
with the L^p
distance. We register this instance
separate from pi_Lp.pseudo_metric
since the latter requires the type class hypothesis
[fact (1 ≤ p)]
in order to prove the triangle inequality.
Registering this separately allows for a future metric-like structure on pi_Lp p β
for p < 1
satisfying a relaxed triangle inequality. The terminology for this varies throughout the
literature, but it is sometimes called a quasi-metric or semi-metric.
Endowing the space pi_Lp p β
with the L^p
norm. We register this instance
separate from pi_Lp.seminormed_add_comm_group
since the latter requires the type class hypothesis
[fact (1 ≤ p)]
in order to prove the triangle inequality.
Registering this separately allows for a future norm-like structure on pi_Lp p β
for p < 1
satisfying a relaxed triangle inequality. These are called quasi-norms.
The uniformity on finite L^p
products is the product uniformity #
In this section, we put the L^p
edistance on pi_Lp p α
, and we check that the uniformity
coming from this edistance coincides with the product uniformity, by showing that the canonical
map to the Pi type (with the L^∞
distance) is a uniform embedding, as it is both Lipschitz and
antiLipschitz.
We only register this emetric space structure as a temporary instance, as the true instance (to be registered later) will have as uniformity exactly the product uniformity, instead of the one coming from the edistance (which is equal to it, but not defeq). See Note [forgetful inheritance] explaining why having definitionally the right uniformity is often important.
Endowing the space pi_Lp p β
with the L^p
pseudoemetric structure. This definition is not
satisfactory, as it does not register the fact that the topology and the uniform structure coincide
with the product one. Therefore, we do not register it as an instance. Using this as a temporary
pseudoemetric space instance, we will show that the uniform structure is equal (but not defeq) to
the product one, and then register an instance in which we replace the uniform structure by the
product one using this pseudoemetric space and pseudo_emetric_space.replace_uniformity
.
Equations
- pi_Lp.pseudo_emetric_aux p β = {to_has_edist := pi_Lp.has_edist p β (λ (i : ι), pseudo_emetric_space.to_has_edist), edist_self := _, edist_comm := _, edist_triangle := _, to_uniform_space := uniform_space_of_edist (λ (f g : pi_Lp p β), dite (p = 0) (λ (hp : p = 0), ↑(_.to_finset.card)) (λ (hp : ¬p = 0), ite (p = ⊤) (⨆ (i : ι), has_edist.edist (f i) (g i)) (finset.univ.sum (λ (i : ι), has_edist.edist (f i) (g i) ^ p.to_real) ^ (1 / p.to_real)))) _ _ _, uniformity_edist := _}
An auxiliary lemma used twice in the proof of pi_Lp.pseudo_metric_aux
below. Not intended for
use outside this file.
Endowing the space pi_Lp p α
with the L^p
pseudometric structure. This definition is not
satisfactory, as it does not register the fact that the topology, the uniform structure, and the
bornology coincide with the product ones. Therefore, we do not register it as an instance. Using
this as a temporary pseudoemetric space instance, we will show that the uniform structure is equal
(but not defeq) to the product one, and then register an instance in which we replace the uniform
structure and the bornology by the product ones using this pseudometric space,
pseudo_metric_space.replace_uniformity
, and pseudo_metric_space.replace_bornology
.
Instances on finite L^p
products #
Equations
- pi_Lp.uniform_space p β = Pi.uniform_space (λ (i : ι), β i)
pseudoemetric space instance on the product of finitely many pseudoemetric spaces, using the
L^p
pseudoedistance, and having as uniformity the product uniformity.
Equations
emetric space instance on the product of finitely many emetric spaces, using the L^p
edistance, and having as uniformity the product uniformity.
Equations
pseudometric space instance on the product of finitely many psuedometric spaces, using the
L^p
distance, and having as uniformity the product uniformity.
Equations
metric space instance on the product of finitely many metric spaces, using the L^p
distance,
and having as uniformity the product uniformity.
Equations
seminormed group instance on the product of finitely many normed groups, using the L^p
norm.
Equations
- pi_Lp.seminormed_add_comm_group p β = {to_has_norm := pi_Lp.has_norm p β (λ (i : ι), add_zero_class.to_has_zero (β i)), to_add_comm_group := {add := add_comm_group.add pi.add_comm_group, add_assoc := _, zero := add_comm_group.zero pi.add_comm_group, zero_add := _, add_zero := _, nsmul := add_comm_group.nsmul pi.add_comm_group, nsmul_zero' := _, nsmul_succ' := _, neg := add_comm_group.neg pi.add_comm_group, sub := add_comm_group.sub pi.add_comm_group, sub_eq_add_neg := _, zsmul := add_comm_group.zsmul pi.add_comm_group, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _}, to_pseudo_metric_space := pi_Lp.pseudo_metric_space p β (λ (i : ι), seminormed_add_comm_group.to_pseudo_metric_space), dist_eq := _}
normed group instance on the product of finitely many normed groups, using the L^p
norm.
Equations
- pi_Lp.normed_add_comm_group p α = {to_has_norm := seminormed_add_comm_group.to_has_norm (pi_Lp.seminormed_add_comm_group p α), to_add_comm_group := seminormed_add_comm_group.to_add_comm_group (pi_Lp.seminormed_add_comm_group p α), to_metric_space := pi_Lp.metric_space p α (λ (i : ι), normed_add_comm_group.to_metric_space), dist_eq := _}
The product of finitely many normed spaces is a normed space, with the L^p
norm.
Equations
- pi_Lp.normed_space p 𝕜 β = {to_module := {to_distrib_mul_action := module.to_distrib_mul_action (pi.module ι β 𝕜), add_smul := _, zero_smul := _}, norm_smul_le := _}
The canonical map pi_Lp.equiv
between pi_Lp ∞ β
and Π i, β i
as a linear isometric
equivalence.
Equations
- pi_Lp.equivₗᵢ β = {to_linear_equiv := {to_fun := (pi_Lp.equiv ⊤ β).to_fun, map_add' := _, map_smul' := _, inv_fun := (pi_Lp.equiv ⊤ β).inv_fun, left_inv := _, right_inv := _}, norm_map' := _}
An equivalence of finite domains induces a linearly isometric equivalence of finitely supported functions
Equations
- linear_isometry_equiv.pi_Lp_congr_left p 𝕜 E e = {to_linear_equiv := linear_equiv.Pi_congr_left' 𝕜 (λ (i : ι), E) e, norm_map' := _}
When p = ∞
, this lemma does not hold without the additional assumption nonempty ι
because
the left-hand side simplifies to 0
, while the right-hand side simplifies to ‖b‖₊
. See
pi_Lp.nnnorm_equiv_symm_const'
for a version which exchanges the hypothesis p ≠ ∞
for
nonempty ι
.
When is_empty ι
, this lemma does not hold without the additional assumption p ≠ ∞
because
the left-hand side simplifies to 0
, while the right-hand side simplifies to ‖b‖₊
. See
pi_Lp.nnnorm_equiv_symm_const
for a version which exchanges the hypothesis nonempty ι
.
for p ≠ ∞
.
When p = ∞
, this lemma does not hold without the additional assumption nonempty ι
because
the left-hand side simplifies to 0
, while the right-hand side simplifies to ‖b‖₊
. See
pi_Lp.norm_equiv_symm_const'
for a version which exchanges the hypothesis p ≠ ∞
for
nonempty ι
.
When is_empty ι
, this lemma does not hold without the additional assumption p ≠ ∞
because
the left-hand side simplifies to 0
, while the right-hand side simplifies to ‖b‖₊
. See
pi_Lp.norm_equiv_symm_const
for a version which exchanges the hypothesis nonempty ι
.
for p ≠ ∞
.
pi_Lp.equiv
as a linear equivalence.
Equations
- pi_Lp.linear_equiv p 𝕜 β = {to_fun := ⇑(pi_Lp.equiv p β), map_add' := _, map_smul' := _, inv_fun := ⇑((pi_Lp.equiv p (λ (i : ι), β i)).symm), left_inv := _, right_inv := _}
pi_Lp.equiv
as a continuous linear equivalence.
Equations
- pi_Lp.continuous_linear_equiv p 𝕜 β = {to_linear_equiv := pi_Lp.linear_equiv p 𝕜 β (λ (i : ι), _inst_6 i), continuous_to_fun := _, continuous_inv_fun := _}
A version of pi.basis_fun
for pi_Lp
.
Equations
- pi_Lp.basis_fun p 𝕜 ι = basis.of_equiv_fun (pi_Lp.linear_equiv p 𝕜 (λ (_x : ι), 𝕜))