/-- The Gromov-Hausdorff space is complete. -/
instance : CompleteSpace GHSpace := by
  set d := fun n : ℕ ↦ ((1 : ℝ) / 2) ^ n
  have : ∀ n : ℕ, 0 < d n := fun _ ↦ by positivity
  -- start from a sequence of nonempty compact metric spaces within distance `1/2^n` of each other
  refine' Metric.complete_of_convergent_controlled_sequences d this fun u hu => _
  -- `X n` is a representative of `u n`
  let X n := (u n).Rep
  -- glue them together successively in an optimal way, getting a sequence of metric spaces `Y n`
  let Y := auxGluing X
  -- this equality is true by definition but Lean unfolds some defs in the wrong order
  have E :
    ∀ n : ℕ,
      GlueSpace (Y n).isom (isometry_optimalGHInjl (X n) (X (n + 1))) = (Y (n + 1)).Space :=
    fun n => by dsimp only [auxGluing]; rfl
  let c n := cast (E n)
  have ic : ∀ n, Isometry (c n) := fun n x y => by dsimp only [auxGluing]; exact rfl
  -- there is a canonical embedding of `Y n` in `Y (n+1)`, by construction
  let f : ∀ n, (Y n).Space → (Y (n + 1)).Space := fun n =>
    c n ∘ toGlueL (Y n).isom (isometry_optimalGHInjl (X n) (X n.succ))
  have I : ∀ n, Isometry (f n) := fun n => (ic n).comp (toGlueL_isometry _ _)
  -- consider the inductive limit `Z0` of the `Y n`, and then its completion `Z`
  let Z0 := Metric.InductiveLimit I
  let Z := UniformSpace.Completion Z0
  let Φ := toInductiveLimit I
  let coeZ := ((↑) : Z0 → Z)
  -- let `X2 n` be the image of `X n` in the space `Z`
  let X2 n := range (coeZ ∘ Φ n ∘ (Y n).embed)
  have isom : ∀ n, Isometry (coeZ ∘ Φ n ∘ (Y n).embed) := by
    intro n
    refine' UniformSpace.Completion.coe_isometry.comp _
    exact (toInductiveLimit_isometry _ _).comp (Y n).isom
  -- The Hausdorff distance of `X2 n` and `X2 (n+1)` is by construction the distance between
  -- `u n` and `u (n+1)`, therefore bounded by `1/2^n`
  have X2n : ∀ n, X2 n =
    range ((coeZ ∘ Φ n.succ ∘ c n ∘ toGlueR (Y n).isom
      (isometry_optimalGHInjl (X n) (X n.succ))) ∘ optimalGHInjl (X n) (X n.succ)) := by
    intro n
    change X2 n = range (coeZ ∘ Φ n.succ ∘ c n ∘
      toGlueR (Y n).isom (isometry_optimalGHInjl (X n) (X n.succ)) ∘
      optimalGHInjl (X n) (X n.succ))
    simp only --[X2, Φ]
    rw [← toInductiveLimit_commute I]
    simp only --[f]
    rw [← toGlue_commute]
    

Proof state:
X✝ : ℕ → Type
inst✝² : (n : ℕ) → MetricSpace (X✝ n)
inst✝¹ : ∀ (n : ℕ), CompactSpace (X✝ n)
inst✝ : ∀ (n : ℕ), Nonempty (X✝ n)
d : ℕ → ℝ := fun n => (1 / 2) ^ n
this : ∀ (n : ℕ), 0 < d n
u : ℕ → GHSpace
hu : ∀ (N n m : ℕ), N ≤ n → N ≤ m → dist (u n) (u m) < d N
X : ℕ → Type := fun n => GHSpace.Rep (u n)
Y : (n : ℕ) → AuxGluingStruct (X n) := auxGluing X
E : ∀ (n : ℕ), GlueSpace (_ : Isometry (Y n).embed) (_ : Isometry (optimalGHInjl (X n) (X (n + 1)))) = (Y (n + 1)).Space
c : (n : ℕ) →
  GlueSpace (_ : Isometry (Y n).embed) (_ : Isometry (optimalGHInjl (X n) (X (n + 1)))) → (Y (n + 1)).Space :=
  fun n =>
    cast (_ : GlueSpace (_ : Isometry (Y n).embed) (_ : Isometry (optimalGHInjl (X n) (X (n + 1)))) = (Y (n + 1)).Space)
ic : ∀ (n : ℕ), Isometry (c n)
f : (n : ℕ) → (Y n).Space → (Y (n + 1)).Space :=
  fun n => c n ∘ toGlueL (_ : Isometry (Y n).embed) (_ : Isometry (optimalGHInjl (X n) (X (Nat.succ n))))
I : ∀ (n : ℕ), Isometry (f n)
Z0 : Type := InductiveLimit I
Z : Type := UniformSpace.Completion Z0
Φ : (n : ℕ) → (Y n).Space → InductiveLimit I := toInductiveLimit I
coeZ : Z0 → UniformSpace.Completion Z0 := ↑Z0
X2 : ℕ → Set (UniformSpace.Completion Z0) := fun n => range (coeZ ∘ Φ n ∘ (Y n).embed)
isom : ∀ (n : ℕ), Isometry (coeZ ∘ Φ n ∘ (Y n).embed)
n : ℕ
⊢ range
      (↑(InductiveLimit I) ∘
        (toInductiveLimit I (Nat.succ n) ∘
            cast
                (_ :
                  GlueSpace (_ : Isometry (Y n).embed) (_ : Isometry (optimalGHInjl (X n) (X (n + 1)))) =
                    (Y (n + 1)).Space) ∘
              toGlueL (_ : Isometry (auxGluing (fun n => GHSpace.Rep (u n)) n).embed)
                (_ : Isometry (optimalGHInjl (GHSpace.Rep (u n)) (GHSpace.Rep (u (Nat.succ n)))))) ∘
          (auxGluing (fun n => GHSpace.Rep (u n)) n).embed) =
    range
      (↑(InductiveLimit I) ∘
        toInductiveLimit I (Nat.succ n) ∘
          cast
              (_ :
                GlueSpace (_ : Isometry (Y n).embed) (_ : Isometry (optimalGHInjl (X n) (X (n + 1)))) =
                  (Y (n + 1)).Space) ∘
            toGlueL (_ : Isometry (auxGluing (fun n => GHSpace.Rep (u n)) n).embed)
                (_ : Isometry (optimalGHInjl (GHSpace.Rep (u n)) (GHSpace.Rep (u (Nat.succ n))))) ∘
              (auxGluing (fun n => GHSpace.Rep (u n)) n).embed)

Next tactic:
rfl