-- Lean 4 proof step from Mathlib.Topology.ContinuousMap.Bounded.ArzelaAscoli (goal)
Goal:
α : Type u
β : Type v
inst : TopologicalSpace α
inst_1 : CompactSpace α
inst_2 : PseudoMetricSpace β
inst_3 : CompactSpace β
A : Set (α →ᵇ β)
closed : IsClosed A
H :
  ∀ (x₀ : α),
    ∀ ε > 0,
      ∃ U ∈ nhds x₀,
        ∀ x ∈ U,
          ∀ x' ∈ U,
            ∀ (i : (↑A : Type (max u v))),
              dist.{v} (α := β) (((↑i : α →ᵇ β) : (a : α) → β) x : β) (((↑i : α →ᵇ β) : (a : α) → β) x' : β) < ε
ε : ℝ
ε0 : ε > 0
ε₁ : ℝ
ε₁0 : 0 < ε₁
εε₁ : ε₁ < ε
ε₂ : ℝ := ε₁ / 2 / 2
ε₂0 : ε₂ > 0
U : (x : α) → Set α
hU :
  ∀ (x : α),
    x ∈ U x ∧
      IsOpen (U x) ∧
        ∀ y ∈ U x,
          ∀ z ∈ U x, ∀ {f : α →ᵇ β}, f ∈ A → dist.{v} (α := β) ((f : (a : α) → β) y : β) ((f : (a : α) → β) z : β) < ε₂
tα : Set α
left : tα ⊆ univ
hfin_1 : tα.Finite
htα : Subset.{u} (α := Set α) univ (⋃ x ∈ tα, U x)
val : Fintype (↑tα : Type u)
tβ : Set β
left_1 : tβ ⊆ univ
hfin : tβ.Finite
htβ : Subset.{v} (α := Set β) univ (⋃ y ∈ tβ, ball y ε₂)
val_1 : Fintype (↑tβ : Type v)
F : (y : β) → β
hF : ∀ (y : β), F y ∈ tβ ∧ dist y (F y) < ε₂
refine :
  ∀ (x y : (↑A : Type (max u v))),
    Eq (α := (↑tα : Type u) → (↑tβ : Type v))
        ((fun (f : (↑A : Type (max u v))) (a : (↑tα : Type u)) ↦
            Subtype.mk (p := fun (x : β) ↦ x ∈ tβ) (F (((↑f : α →ᵇ β) : (a : α) → β) (↑a : α))) ⋯)
          x)
        ((fun (f : (↑A : Type (max u v))) (a : (↑tα : Type u)) ↦
            Subtype.mk (p := fun (x : β) ↦ x ∈ tβ) (F (((↑f : α →ᵇ β) : (a : α) → β) (↑a : α))) ⋯)
          y) →
      dist (↑x : α →ᵇ β) (↑y : α →ᵇ β) < ε
refine₁ :
  ∀ (f : α →ᵇ β) (hf : f ∈ A) (g : α →ᵇ β) (hg : g ∈ A)
    (f_eq_g :
      Eq (α := (↑tα : Type u) → (↑tβ : Type v))
        ((fun (f : (↑A : Type (max u v))) (a : (↑tα : Type u)) ↦
            Subtype.mk (p := fun (x : β) ↦ x ∈ tβ) (F (((↑f : α →ᵇ β) : (a : α) → β) (↑a : α))) ⋯)
          (Subtype.mk (p := fun (x : α →ᵇ β) ↦ x ∈ A) f hf))
        ((fun (f : (↑A : Type (max u v))) (a : (↑tα : Type u)) ↦
            Subtype.mk (p := fun (x : β) ↦ x ∈ tβ) (F (((↑f : α →ᵇ β) : (a : α) → β) (↑a : α))) ⋯)
          (Subtype.mk (p := fun (x : α →ᵇ β) ↦ x ∈ A) g hg))),
    dist (↑(Subtype.mk (p := fun (x : α →ᵇ β) ↦ x ∈ A) f hf) : α →ᵇ β)
        (↑(Subtype.mk (p := fun (x : α →ᵇ β) ↦ x ∈ A) g hg) : α →ᵇ β) <
      ε
⊢ ∃ (β_1 : Type (max u v)) (x : Fintype β_1) (F : (↑A : Type (max u v)) → β_1),
    ∀ (x y : (↑A : Type (max u v))), F x = F y → dist (↑x : α →ᵇ β) (↑y : α →ᵇ β) < ε
have refine₂ : ∀ (f : α →ᵇ β) (hf : f ∈ A) (g : α →ᵇ β) (hg : g ∈ A)
  (f_eq_g :
    Eq (α := (↑tα : Type u) → (↑tβ : Type v))
      ((fun (f : (↑A : Type (max u v))) (a : (↑tα : Type u)) ↦
          Subtype.mk (p := fun (x : β) ↦ x ∈ tβ) (F (((↑f : α →ᵇ β) : (a : α) → β) (↑a : α))) sorry)
        (Subtype.mk (p := fun (x : α →ᵇ β) ↦ x ∈ A) f hf))
      ((fun (f : (↑A : Type (max u v))) (a : (↑tα : Type u)) ↦
          Subtype.mk (p := fun (x : β) ↦ x ∈ tβ) (F (((↑f : α →ᵇ β) : (a : α) → β) (↑a : α))) sorry)
        (Subtype.mk (p := fun (x : α →ᵇ β) ↦ x ∈ A) g hg)))
  (x : α),
  dist.{v} (α := β) (((↑(Subtype.mk (p := fun (x : α →ᵇ β) ↦ x ∈ A) f hf) : α →ᵇ β) : (a : α) → β) x : β)
      (((↑(Subtype.mk (p := fun (x : α →ᵇ β) ↦ x ∈ A) g hg) : α →ᵇ β) : (a : α) → β) x : β) ≤
    ε₁
Tactic: classical
  refine ⟨tα → tβ, by infer_instance, fun f a => ⟨F (f.1 a), (hF (f.1 a)).1⟩, ?_⟩
  rintro ⟨f, hf⟩ ⟨g, hg⟩ f_eq_g
  -- If two functions have the same approximation, then they are within distance `ε`
  refine lt_of_le_of_lt ((dist_le <| le_of_lt ε₁0).2 fun x => ?_) εε₁
  obtain ⟨x', x'tα, hx'⟩ := mem_iUnion₂.1 (htα (mem_univ x))
  calc
    dist (f x) (g x) ≤ dist (f x) (f x') + dist (g x) (g x') + dist (f x') (g x') :=
      dist_triangle4_right _ _ _ _
    _ ≤ ε₂ + ε₂ + ε₁ / 2 := by
      refine le_of_lt (add_lt_add (add_lt_add ?_ ?_) ?_)
      · exact (hU x').2.2 _ hx' _ (hU x').1 hf
      · exact (hU x').2.2 _ hx' _ (hU x').1 hg
      · have F_f_g : F (f x') = F (g x') :=
          (congr_arg (fun f : tα → tβ => (f ⟨x', x'tα⟩ : β)) f_eq_g :)
        calc
          dist (f x') (g x') ≤ dist (f x') (F (f x')) + dist (g x') (F (f x')) :=
            dist_triangle_right _ _ _
          _ = dist (f x') (F (f x')) + dist (g x') (F (g x')) := by rw [F_f_g]
          _ < ε₂ + ε₂ := (add_lt_add (hF (f x')).2 (hF (g x')).2)
          _ = ε₁ / 2 := add_halves _
    _ = ε₁ := by rw [add_halves, add_halves]