-- Lean 4 proof step from Mathlib.Topology.ShrinkingLemma (goal)
Goal:
ι : Type u_1
X : Type u_2
inst : TopologicalSpace X
u : ι → Set X
s : Set X
inst_1 : T2Space X
inst_2 : LocallyCompactSpace X
v : PartialRefinement u s fun (w : Set X) ↦ IsCompact (closure w)
hs : IsCompact s
i : ι
hi : i ∉ v.carrier (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w))
si : Set X :=
  s ∩ (⋃ (j : ι), ⋃ (_ : j ≠ i), v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)) j)ᶜ
hsi :
  si =
    s ∩ ⋂ (i_1 : ι), ⋂ (_ : ¬i_1 = i), (v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)) i_1)ᶜ
hsic : IsCompact si
this : si ⊆ v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)) i
vi : Set X
hvi :
  IsOpen vi ∧
    si ⊆ vi ∧
      closure vi ⊆ v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)) i ∧ IsCompact (closure vi)
refine_1 :
  ∀ (i_1 : ι),
    IsOpen
      (update (β := fun (a : ι) ↦ Set X) (v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w))) i vi
        i_1)
refine_2 :
  s ⊆
    ⋃ (i_1 : ι),
      update (β := fun (a : ι) ↦ Set X) (v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w))) i vi
        i_1
refine_3 :
  ∀ {i_1 : ι},
    i_1 ∈ insert i (v.carrier (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w))) →
      closure
          (update (β := fun (a : ι) ↦ Set X) (v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)))
            i vi i_1) ⊆
        u i_1
refine_4 :
  ∀ {i_1 : ι} (hi : i_1 ∈ insert i (v.carrier (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)))),
    IsCompact
      (closure
        (update (β := fun (a : ι) ↦ Set X) (v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w))) i
          vi i_1))
refine_5 :
  ∀ {i_1 : ι},
    i_1 ∉ insert i (v.carrier (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w))) →
      update (β := fun (a : ι) ↦ Set X) (v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w))) i vi
          i_1 =
        u i_1
⊢ ∃ (v' : PartialRefinement u s fun (w : Set X) ↦ IsCompact (closure w)),
    v < v' ∧ IsCompact (closure (v'.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)) i))
have refine_6 : (fun (v₁ v₂ : PartialRefinement u s fun (w : Set X) ↦ IsCompact (closure w)) ↦
    v₁.carrier (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)) ⊆
        v₂.carrier (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)) ∧
      ∀ i ∈ v₁.carrier (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)),
        v₁.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)) i =
          v₂.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)) i)
  v
  (PartialRefinement.mk (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w))
    (update (β := fun (a : ι) ↦ Set X) (v.toFun (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w))) i vi)
    (insert i (v.carrier (u := u) (s := s) (p := fun (w : Set X) ↦ IsCompact (closure w)))) sorry sorry sorry sorry sorry)
Tactic: classical
  refine ⟨⟨update v i vi, insert i v.carrier, ?_, ?_, ?_, ?_, ?_⟩, ⟨?_, ?_⟩, ?_⟩
  · intro j
    rcases eq_or_ne j i with (rfl | hne) <;> simp [*, v.isOpen]
  · refine fun x hx => mem_iUnion.2 ?_
    by_cases! h : ∃ j ≠ i, x ∈ v j
    · rcases h with ⟨j, hji, hj⟩
      use j
      rwa [update_of_ne hji]
    · use i
      rw [update_self]
      apply hvi.2.1
      rw [hsi]
      exact ⟨hx, mem_iInter₂_of_mem h⟩
  · rintro j (rfl | hj)
    · rw [update_self]
      exact subset_trans hvi.2.2.1 <| PartialRefinement.subset v j
    · rw [update_of_ne (ne_of_mem_of_not_mem hj hi)]
      exact v.closure_subset hj
  · intro j hj
    rw [mem_insert_iff] at hj
    by_cases h : j = i
    · rw [← h]
      simp only [update_self]
      exact hvi.2.2.2
    · apply hj.elim
      · intro hji
        exact False.elim (h hji)
      · intro hjmemv
        rw [update_of_ne h]
        exact v.pred_of_mem hjmemv
  · intro j hj
    rw [mem_insert_iff, not_or] at hj
    rw [update_of_ne hj.1, v.apply_eq hj.2]
  · refine ⟨subset_insert _ _, fun j hj => ?_⟩
    exact (update_of_ne (ne_of_mem_of_not_mem hj hi) _ _).symm
  · exact fun hle => hi (hle.1 <| mem_insert _ _)
  · simp only [update_self]
    exact hvi.2.2.2