@@ -3,6 +3,7 @@ Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
33Released under Apache 2.0 license as described in the file LICENSE.
44Authors: Sébastien Gouëzel
55-/
6+ import Mathlib.Analysis.Normed.Group.FunctionSeries
67import Mathlib.Topology.Algebra.MetricSpace.Lipschitz
78import Mathlib.Topology.MetricSpace.HausdorffDistance
89
@@ -46,6 +47,10 @@ in general), and `ι` is countable.
4647 `dist x y = ∑' i, min (1/2)^(encode i) (dist (x i) (y i))`.
4748* `PiCountable.metricSpace` is the corresponding metric space structure, adjusted so that
4849 the uniformity is definitionally the product uniformity. Not registered as an instance.
50+ * `PiNatEmbed` gives an equivalence between a space and itself in a sequence of spaces
51+ * `Metric.PiNatEmbed.metricSpace` proves that a topological `X` separated by countably many
52+ continuous functions to metric spaces, can be embedded inside their product.
53+
4954 -/
5055
5156noncomputable section
@@ -757,14 +762,15 @@ theorem exists_nat_nat_continuous_surjective_of_completeSpace (α : Type*) [Metr
757762 simpa only [nonempty_coe_sort] using g_surj.nonempty
758763 exact ⟨g ∘ f, g_cont.comp f_cont, g_surj.comp f_surj⟩
759764
765+ open Encodable ENNReal
760766namespace PiCountable
761767
762768/-!
763769### Products of (possibly non-discrete) metric spaces
764770-/
765771
766772variable {ι : Type *} [Encodable ι] {F : ι → Type *}
767- open Encodable ENNReal
773+
768774section EDist
769775variable [∀ i, EDist (F i)] {x y : ∀ i, F i} {i : ι} {r : ℝ≥0 ∞}
770776
@@ -934,3 +940,142 @@ protected def metricSpace : MetricSpace (∀ i, F i) :=
934940
935941end MetricSpace
936942end PiCountable
943+
944+ /-! ### Embedding a countably separated space inside a space of sequences -/
945+
946+ namespace Metric
947+
948+ open scoped PiCountable
949+
950+ variable {ι X : Type *} {Y : ι → Type *} {f : ∀ i, X → Y i}
951+
952+ include f in
953+ variable (X Y f) in
954+ /-- Given a type `X` and a sequence `Y` of metric spaces and a sequence `f : : ∀ i, X → Y i` of
955+ separating functions, `PiNatEmbed X Y f` is a type synonym for `X` seen as a subset of `∀ i, Y i`.
956+ -/
957+ structure PiNatEmbed (X : Type *) (Y : ι → Type *) (f : ∀ i, X → Y i) where
958+ /-- The map from `X` to the subset of `∀ i, Y i`. -/
959+ toPiNat ::
960+ /-- The map from the subset of `∀ i, Y i` to `X`. -/
961+ ofPiNat : X
962+
963+ namespace PiNatEmbed
964+
965+ @[ext] lemma ext {x y : PiNatEmbed X Y f} (hxy : x.ofPiNat = y.ofPiNat) : x = y := by
966+ cases x; congr!
967+
968+ variable (X Y f) in
969+ /-- Equivalence between `X` and its embedding into `∀ i, Y i`. -/
970+ @[simps]
971+ def toPiNatEquiv : X ≃ PiNatEmbed X Y f where
972+ toFun := toPiNat
973+ invFun := ofPiNat
974+ left_inv _ := rfl
975+ right_inv _ := rfl
976+
977+ @[simp] lemma ofPiNat_inj {x y : PiNatEmbed X Y f} : x.ofPiNat = y.ofPiNat ↔ x = y :=
978+ (toPiNatEquiv X Y f).symm.injective.eq_iff
979+
980+ @[simp] lemma «forall » {P : PiNatEmbed X Y f → Prop } : (∀ x, P x) ↔ ∀ x, P (toPiNat x) :=
981+ (toPiNatEquiv X Y f).symm.forall_congr_left
982+
983+ variable (X Y f) in
984+ /-- `X` equipped with the distance coming from `∀ i, Y i` embeds in `∀ i, Y i`. -/
985+ noncomputable def embed : PiNatEmbed X Y f → ∀ i, Y i := fun x i ↦ f i x.ofPiNat
986+
987+ lemma embed_injective (separating_f : Pairwise fun x y ↦ ∃ i, f i x ≠ f i y) :
988+ Injective (embed X Y f) := by
989+ simpa [Pairwise, not_imp_comm (a := _ = _), funext_iff, Function.Injective] using separating_f
990+
991+ variable [Encodable ι]
992+
993+ section PseudoEMetricSpace
994+ variable [∀ i, PseudoEMetricSpace (Y i)]
995+
996+ noncomputable instance : PseudoEMetricSpace (PiNatEmbed X Y f) :=
997+ .induced (embed X Y f) PiCountable.pseudoEMetricSpace
998+
999+ lemma edist_def (x y : PiNatEmbed X Y f) :
1000+ edist x y = ∑' i, min (2 ⁻¹ ^ encode i) (edist (f i x.ofPiNat) (f i y.ofPiNat)) := rfl
1001+
1002+ lemma isometry_embed : Isometry (embed X Y f) := PseudoEMetricSpace.isometry_induced _
1003+
1004+ end PseudoEMetricSpace
1005+
1006+ section PseudoMetricSpace
1007+ variable [∀ i, PseudoMetricSpace (Y i)]
1008+
1009+ noncomputable instance : PseudoMetricSpace (PiNatEmbed X Y f) :=
1010+ .induced (embed X Y f) PiCountable.pseudoMetricSpace
1011+
1012+ lemma dist_def (x y : PiNatEmbed X Y f) :
1013+ dist x y = ∑' i, min (2 ⁻¹ ^ encode i) (dist (f i x.ofPiNat) (f i y.ofPiNat)) := rfl
1014+
1015+ variable [TopologicalSpace X]
1016+
1017+ lemma continuous_toPiNat (continuous_f : ∀ i, Continuous (f i)) :
1018+ Continuous (toPiNat : X → PiNatEmbed X Y f) := by
1019+ rw [continuous_iff_continuous_dist]
1020+ simp only [dist_def]
1021+ apply continuous_tsum (by fun_prop) summable_geometric_two_encode <| by simp [abs_of_nonneg]
1022+
1023+ end PseudoMetricSpace
1024+
1025+ section EMetricSpace
1026+ variable [∀ i, EMetricSpace (Y i)]
1027+
1028+ /-- If the functions `f i : X → Y i` separate points of `X`, then `X` can be embedded into
1029+ `∀ i, Y i`. -/
1030+ noncomputable abbrev emetricSpace (separating_f : Pairwise fun x y ↦ ∃ i, f i x ≠ f i y) :
1031+ EMetricSpace (PiNatEmbed X Y f) :=
1032+ .induced (embed X Y f) (embed_injective separating_f) PiCountable.emetricSpace
1033+
1034+ lemma isUniformEmbedding_embed (separating_f : Pairwise fun x y ↦ ∃ i, f i x ≠ f i y) :
1035+ IsUniformEmbedding (embed X Y f) :=
1036+ let := emetricSpace separating_f; isometry_embed.isUniformEmbedding
1037+
1038+ end EMetricSpace
1039+
1040+
1041+ section MetricSpace
1042+ variable [∀ i, MetricSpace (Y i)]
1043+
1044+ /-- If the functions `f i : X → Y i` separate points of `X`, then `X` can be embedded into
1045+ `∀ i, Y i`. -/
1046+ noncomputable abbrev metricSpace (separating_f : Pairwise fun x y ↦ ∃ i, f i x ≠ f i y) :
1047+ MetricSpace (PiNatEmbed X Y f) :=
1048+ (emetricSpace separating_f).toMetricSpace fun x y ↦ by simp [edist_dist]
1049+
1050+ section CompactSpace
1051+ variable [TopologicalSpace X] [CompactSpace X]
1052+
1053+ lemma isHomeomorph_toPiNat (continuous_f : ∀ i, Continuous (f i))
1054+ (separating_f : Pairwise fun x y ↦ ∃ i, f i x ≠ f i y) :
1055+ IsHomeomorph (toPiNat : X → PiNatEmbed X Y f) := by
1056+ letI := emetricSpace separating_f
1057+ rw [isHomeomorph_iff_continuous_bijective]
1058+ exact ⟨continuous_toPiNat continuous_f, (toPiNatEquiv X Y f).bijective⟩
1059+
1060+ variable (X Y f) in
1061+ /-- Homeomorphism between `X` and its embedding into `∀ i, Y i` induced by a separating family of
1062+ continuous functions `f i : X → Y i`. -/
1063+ @[simps!]
1064+ noncomputable def toPiNatHomeo (continuous_f : ∀ i, Continuous (f i))
1065+ (separating_f : Pairwise fun x y ↦ ∃ i, f i x ≠ f i y) :
1066+ X ≃ₜ PiNatEmbed X Y f :=
1067+ (toPiNatEquiv X Y f).toHomeomorphOfIsInducing
1068+ (isHomeomorph_toPiNat continuous_f separating_f).isInducing
1069+
1070+ /-- If `X` is compact, and there exists a sequence of continuous functions `f i : X → Y i` to
1071+ metric spaces `Y i` that separate points on `X`, then `X` is metrizable. -/
1072+ lemma TopologicalSpace.MetrizableSpace.of_countable_separating (f : ∀ i, X → Y i)
1073+ (continuous_f : ∀ i, Continuous (f i)) (separating_f : Pairwise fun x y ↦ ∃ i, f i x ≠ f i y) :
1074+ MetrizableSpace X :=
1075+ letI := Metric.PiNatEmbed.metricSpace separating_f
1076+ (Metric.PiNatEmbed.toPiNatHomeo X Y f continuous_f separating_f).isEmbedding.metrizableSpace
1077+
1078+ end CompactSpace
1079+ end MetricSpace
1080+ end PiNatEmbed
1081+ end Metric
0 commit comments