File: Mathlib/Topology/MetricSpace/GromovHausdorff.lean

full_name: _aux_Mathlib_Topology_MetricSpace_GromovHausdorff___macroRules_termℓ_infty_ℝ_1
code: local notation "ℓ_infty_ℝ" => lp (fun n : ℕ => ℝ) ∞
goal: Lean.Macro

full_name: _aux_Mathlib_Topology_MetricSpace_GromovHausdorff___unexpand_lp_1
code: local notation "ℓ_infty_ℝ" => lp (fun n : ℕ => ℝ) ∞
goal: Lean.PrettyPrinter.Unexpander

full_name: _private.Mathlib.Topology.MetricSpace.GromovHausdorff.0.GromovHausdorff.IsometryRel
code: /-- Equivalence relation identifying two nonempty compact sets which are isometric -/
private def IsometryRel (x : NonemptyCompacts ℓ_infty_ℝ) (y : NonemptyCompacts ℓ_infty_ℝ) : Prop 
goal: Prop

full_name: _private.Mathlib.Topology.MetricSpace.GromovHausdorff.0.GromovHausdorff.equivalence_isometryRel
code: /-- This is indeed an equivalence relation -/
private theorem equivalence_isometryRel : Equivalence IsometryRel 
goal: Equivalence GromovHausdorff.IsometryRel

full_name: GromovHausdorff.IsometryRel.setoid
code: /-- setoid instance identifying two isometric nonempty compact subspaces of ℓ^∞(ℝ) -/
instance IsometryRel.setoid : Setoid (NonemptyCompacts ℓ_infty_ℝ) 
goal: Setoid (TopologicalSpace.NonemptyCompacts ↥(lp (fun n => ℝ) ⊤))

full_name: GromovHausdorff.GHSpace
code: /-- The Gromov-Hausdorff space -/
def GHSpace : Type 
goal: Type

full_name: GromovHausdorff.toGHSpace
code: /-- Map any nonempty compact type to `GHSpace` -/
def toGHSpace (X : Type u) [MetricSpace X] [CompactSpace X] [Nonempty X] : GHSpace 
goal: GromovHausdorff.GHSpace

full_name: GromovHausdorff.instInhabitedGHSpace
code: instance : Inhabited GHSpace 
goal: Inhabited GromovHausdorff.GHSpace

full_name: GromovHausdorff.GHSpace.Rep
code: /-- A metric space representative of any abstract point in `GHSpace` -/
-- Porting note(#5171): linter not yet ported; removed @[nolint has_nonempty_instance]; why?
def GHSpace.Rep (p : GHSpace) : Type 
goal: Type

full_name: GromovHausdorff.eq_toGHSpace_iff
code: theorem eq_toGHSpace_iff {X : Type u} [MetricSpace X] [CompactSpace X] [Nonempty X]
    {p : NonemptyCompacts ℓ_infty_ℝ} :
    ⟦p⟧ = toGHSpace X ↔ ∃ Ψ : X → ℓ_infty_ℝ, Isometry Ψ ∧ range Ψ = p 
goal: ⟦p⟧ = GromovHausdorff.toGHSpace X ↔ ∃ Ψ, Isometry Ψ ∧ Set.range Ψ = ↑p

full_name: GromovHausdorff.eq_toGHSpace
code: theorem eq_toGHSpace {p : NonemptyCompacts ℓ_infty_ℝ} : ⟦p⟧ = toGHSpace p 
goal: ⟦p⟧ = GromovHausdorff.toGHSpace ↥p

full_name: GromovHausdorff.repGHSpaceMetricSpace
code: instance repGHSpaceMetricSpace {p : GHSpace} : MetricSpace p.Rep 
goal: MetricSpace p.Rep

full_name: GromovHausdorff.rep_gHSpace_compactSpace
code: instance rep_gHSpace_compactSpace {p : GHSpace} : CompactSpace p.Rep 
goal: CompactSpace p.Rep

full_name: GromovHausdorff.rep_gHSpace_nonempty
code: instance rep_gHSpace_nonempty {p : GHSpace} : Nonempty p.Rep 
goal: Nonempty p.Rep

full_name: GromovHausdorff.GHSpace.toGHSpace_rep
code: theorem GHSpace.toGHSpace_rep (p : GHSpace) : toGHSpace p.Rep = p 
goal: GromovHausdorff.toGHSpace p.Rep = p

full_name: GromovHausdorff.toGHSpace_eq_toGHSpace_iff_isometryEquiv
code: /-- Two nonempty compact spaces have the same image in `GHSpace` if and only if they are
isometric. -/
theorem toGHSpace_eq_toGHSpace_iff_isometryEquiv {X : Type u} [MetricSpace X] [CompactSpace X]
    [Nonempty X] {Y : Type v} [MetricSpace Y] [CompactSpace Y] [Nonempty Y] :
    toGHSpace X = toGHSpace Y ↔ Nonempty (X ≃ᵢ Y) 
goal: GromovHausdorff.toGHSpace X = GromovHausdorff.toGHSpace Y ↔ Nonempty (X ≃ᵢ Y)

full_name: GromovHausdorff.instDistGHSpace
code: /-- Distance on `GHSpace`: the distance between two nonempty compact spaces is the infimum
Hausdorff distance between isometric copies of the two spaces in a metric space. For the definition,
we only consider embeddings in `ℓ^∞(ℝ)`, but we will prove below that it works for all spaces. -/
instance : Dist GHSpace 
goal: Dist GromovHausdorff.GHSpace

full_name: GromovHausdorff.ghDist
code: /-- The Gromov-Hausdorff distance between two nonempty compact metric spaces, equal by definition to
the distance of the equivalence classes of these spaces in the Gromov-Hausdorff space. -/
def ghDist (X : Type u) (Y : Type v) [MetricSpace X] [Nonempty X] [CompactSpace X] [MetricSpace Y]
    [Nonempty Y] [CompactSpace Y] : ℝ 
goal: ℝ

full_name: GromovHausdorff.dist_ghDist
code: theorem dist_ghDist (p q : GHSpace) : dist p q = ghDist p.Rep q.Rep 
goal: dist p q = GromovHausdorff.ghDist p.Rep q.Rep

full_name: GromovHausdorff.ghDist_le_hausdorffDist
code: /-- The Gromov-Hausdorff distance between two spaces is bounded by the Hausdorff distance
of isometric copies of the spaces, in any metric space. -/
theorem ghDist_le_hausdorffDist {X : Type u} [MetricSpace X] [CompactSpace X] [Nonempty X]
    {Y : Type v} [MetricSpace Y] [CompactSpace Y] [Nonempty Y] {γ : Type w} [MetricSpace γ]
    {Φ : X → γ} {Ψ : Y → γ} (ha : Isometry Φ) (hb : Isometry Ψ) :
    ghDist X Y ≤ hausdorffDist (range Φ) (range Ψ) 
goal: GromovHausdorff.ghDist X Y ≤ Metric.hausdorffDist (Set.range Φ) (Set.range Ψ)

full_name: GromovHausdorff.hausdorffDist_optimal
code: /-- The optimal coupling constructed above realizes exactly the Gromov-Hausdorff distance,
essentially by design. -/
theorem hausdorffDist_optimal {X : Type u} [MetricSpace X] [CompactSpace X] [Nonempty X]
    {Y : Type v} [MetricSpace Y] [CompactSpace Y] [Nonempty Y] :
    hausdorffDist (range (optimalGHInjl X Y)) (range (optimalGHInjr X Y)) = ghDist X Y 
goal: Metric.hausdorffDist (Set.range (GromovHausdorff.optimalGHInjl X Y)) (Set.range (GromovHausdorff.optimalGHInjr X Y)) =
  GromovHausdorff.ghDist X Y

full_name: GromovHausdorff.ghDist_eq_hausdorffDist
code: /-- The Gromov-Hausdorff distance can also be realized by a coupling in `ℓ^∞(ℝ)`, by embedding
the optimal coupling through its Kuratowski embedding. -/
theorem ghDist_eq_hausdorffDist (X : Type u) [MetricSpace X] [CompactSpace X] [Nonempty X]
    (Y : Type v) [MetricSpace Y] [CompactSpace Y] [Nonempty Y] :
    ∃ Φ : X → ℓ_infty_ℝ,
      ∃ Ψ : Y → ℓ_infty_ℝ,
        Isometry Φ ∧ Isometry Ψ ∧ ghDist X Y = hausdorffDist (range Φ) (range Ψ) 
goal: ∃ Φ Ψ, Isometry Φ ∧ Isometry Ψ ∧ GromovHausdorff.ghDist X Y = Metric.hausdorffDist (Set.range Φ) (Set.range Ψ)

full_name: GromovHausdorff.instMetricSpaceGHSpace
code: /-- The Gromov-Hausdorff distance defines a genuine distance on the Gromov-Hausdorff space. -/
instance : MetricSpace GHSpace 
goal: MetricSpace GromovHausdorff.GHSpace

full_name: TopologicalSpace.NonemptyCompacts.toGHSpace
code: /-- In particular, nonempty compacts of a metric space map to `GHSpace`.
    We register this in the `TopologicalSpace` namespace to take advantage
    of the notation `p.toGHSpace`. -/
def TopologicalSpace.NonemptyCompacts.toGHSpace {X : Type u} [MetricSpace X]
    (p : NonemptyCompacts X) : GromovHausdorff.GHSpace 
goal: GromovHausdorff.GHSpace

full_name: GromovHausdorff.ghDist_le_nonemptyCompacts_dist
code: theorem ghDist_le_nonemptyCompacts_dist (p q : NonemptyCompacts X) :
    dist p.toGHSpace q.toGHSpace ≤ dist p q 
goal: dist p.toGHSpace q.toGHSpace ≤ dist p q

full_name: GromovHausdorff.toGHSpace_lipschitz
code: theorem toGHSpace_lipschitz :
    LipschitzWith 1 (NonemptyCompacts.toGHSpace : NonemptyCompacts X → GHSpace) 
goal: LipschitzWith 1 TopologicalSpace.NonemptyCompacts.toGHSpace

full_name: GromovHausdorff.toGHSpace_continuous
code: theorem toGHSpace_continuous :
    Continuous (NonemptyCompacts.toGHSpace : NonemptyCompacts X → GHSpace) 
goal: Continuous TopologicalSpace.NonemptyCompacts.toGHSpace

full_name: GromovHausdorff.ghDist_le_of_approx_subsets
code: /-- If there are subsets which are `ε₁`-dense and `ε₃`-dense in two spaces, and
isometric up to `ε₂`, then the Gromov-Hausdorff distance between the spaces is bounded by
`ε₁ + ε₂/2 + ε₃`. -/
theorem ghDist_le_of_approx_subsets {s : Set X} (Φ : s → Y) {ε₁ ε₂ ε₃ : ℝ}
    (hs : ∀ x : X, ∃ y ∈ s, dist x y ≤ ε₁) (hs' : ∀ x : Y, ∃ y : s, dist x (Φ y) ≤ ε₃)
    (H : ∀ x y : s, |dist x y - dist (Φ x) (Φ y)| ≤ ε₂) : ghDist X Y ≤ ε₁ + ε₂ / 2 + ε₃ 
goal: GromovHausdorff.ghDist X Y ≤ ε₁ + ε₂ / 2 + ε₃

full_name: GromovHausdorff.instSecondCountableTopologyGHSpace
code: /-- The Gromov-Hausdorff space is second countable. -/
instance : SecondCountableTopology GHSpace 
goal: SecondCountableTopology GromovHausdorff.GHSpace

full_name: GromovHausdorff.totallyBounded
code: /-- Compactness criterion: a closed set of compact metric spaces is compact if the spaces have
a uniformly bounded diameter, and for all `ε` the number of balls of radius `ε` required
to cover the spaces is uniformly bounded. This is an equivalence, but we only prove the
interesting direction that these conditions imply compactness. -/
theorem totallyBounded {t : Set GHSpace} {C : ℝ} {u : ℕ → ℝ} {K : ℕ → ℕ}
    (ulim : Tendsto u atTop (𝓝 0)) (hdiam : ∀ p ∈ t, diam (univ : Set (GHSpace.Rep p)) ≤ C)
    (hcov : ∀ p ∈ t, ∀ n : ℕ, ∃ s : Set (GHSpace.Rep p),
      (#s) ≤ K n ∧ univ ⊆ ⋃ x ∈ s, ball x (u n)) :
    TotallyBounded t 
goal: TotallyBounded t

full_name: GromovHausdorff.AuxGluingStruct.Space
code: /-- Auxiliary structure used to glue metric spaces below, recording an isometric embedding
of a type `A` in another metric space. -/
structure AuxGluingStruct (A : Type) [MetricSpace A] : Type 1 where
  Space : Type
  metric : MetricSpace Space
  embed : A → Space
  isom : Isometry embed
goal: Type

full_name: GromovHausdorff.AuxGluingStruct.embed
code: /-- Auxiliary structure used to glue metric spaces below, recording an isometric embedding
of a type `A` in another metric space. -/
structure AuxGluingStruct (A : Type) [MetricSpace A] : Type 1 where
  Space : Type
  metric : MetricSpace Space
  embed : A → Space
  isom : Isometry embed
goal: A → self.Space

full_name: GromovHausdorff.AuxGluingStruct
code: /-- Auxiliary structure used to glue metric spaces below, recording an isometric embedding
of a type `A` in another metric space. -/
structure AuxGluingStruct (A : Type) [MetricSpace A] : Type 1 where
  Space : Type
  metric : MetricSpace Space
  embed : A → Space
  isom : Isometry embed
goal: Type 1

full_name: GromovHausdorff.AuxGluingStruct.metric
code: /-- Auxiliary structure used to glue metric spaces below, recording an isometric embedding
of a type `A` in another metric space. -/
structure AuxGluingStruct (A : Type) [MetricSpace A] : Type 1 where
  Space : Type
  metric : MetricSpace Space
  embed : A → Space
  isom : Isometry embed
goal: MetricSpace self.Space

full_name: GromovHausdorff.AuxGluingStruct.isom
code: /-- Auxiliary structure used to glue metric spaces below, recording an isometric embedding
of a type `A` in another metric space. -/
structure AuxGluingStruct (A : Type) [MetricSpace A] : Type 1 where
  Space : Type
  metric : MetricSpace Space
  embed : A → Space
  isom : Isometry embed
goal: Isometry self.embed

full_name: GromovHausdorff.instInhabitedAuxGluingStruct
code: instance (A : Type) [MetricSpace A] : Inhabited (AuxGluingStruct A) 
goal: Inhabited (GromovHausdorff.AuxGluingStruct A)

full_name: GromovHausdorff.auxGluing
code: /-- Auxiliary sequence of metric spaces, containing copies of `X 0`, ..., `X n`, where each
`X i` is glued to `X (i+1)` in an optimal way. The space at step `n+1` is obtained from the space
at step `n` by adding `X (n+1)`, glued in an optimal way to the `X n` already sitting there. -/
def auxGluing (n : ℕ) : AuxGluingStruct (X n) 
goal: GromovHausdorff.AuxGluingStruct (X n)

full_name: GromovHausdorff.instCompleteSpaceGHSpace
code: /-- The Gromov-Hausdorff space is complete. -/
instance : CompleteSpace GHSpace 
goal: CompleteSpace GromovHausdorff.GHSpace