-- Lean 4 proof step from Mathlib.Topology.Sheaves.Stalks (goal)
Goal:
C : Type u
inst : Category.{v, u} C
inst_1 : HasColimits.{v, u} C
X : TopCat
FC : C → C → Type u_1
CC : C → Type v
inst_2 : (X Y : C) → FunLike.{u_1 + 1, v + 1, v + 1} (FC X Y) (CC X) (CC Y)
instCC : ConcreteCategory C FC (CC := CC)
inst_3 : PreservesFilteredColimits (forget C (FC := FC) (CC := CC))
inst_4 : HasLimits.{v, u} C
inst_5 : PreservesLimits (forget C (FC := FC) (CC := CC))
inst_6 : ReflectsIsomorphisms (forget C (FC := FC) (CC := CC))
F G : Sheaf C X
f : F ⟶ G
U : Opens (↑X : Type v)
hinj :
  ∀ x ∈ U,
    Function.Injective.{v + 1, v + 1} (α :=
      CC
        (obj (stalkFunctor C x)
          (F.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))))))
      (β :=
      CC
        (obj (stalkFunctor C x)
          (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))))))
      (⇑(ConcreteCategory.hom (FC := FC) (CC := CC) (map (stalkFunctor C x) f.hom)) :
        (a : CC ((stalkFunctor C x).obj F.obj)) → CC ((stalkFunctor C x).obj G.obj))
hsurj :
  ∀ (t : CC (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op U)))
    (x : ↥U),
    ∃ (V : Opens (↑X : Type v)) (_ : (↑x : (↑X : Type v)) ∈ V) (iVU : V ⟶ U) (s :
      ToType (FC := FC) (CC := CC)
        (F.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op V))),
      Eq (α := CC (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op V)))
        ((ConcreteCategory.hom (FC := FC) (CC := CC) (f.hom.app (op V)) :
              (a : CC (F.obj.obj (op V))) → CC (G.obj.obj (op V)))
            s :
          CC (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op V)))
        ((ConcreteCategory.hom (FC := FC) (CC := CC)
                (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).map iVU.op) :
              (a : CC (G.obj.obj (op U))) → CC (G.obj.obj (op V)))
            t :
          CC (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op V)))
t : CC (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op U))
V : (x : ↥U) → Opens (↑X : Type v)
mV : ∀ (x : ↥U), (↑x : (↑X : Type v)) ∈ V x
iVU : (x : ↥U) → V x ⟶ U
sf :
  (x : ↥U) →
    ToType (FC := FC) (CC := CC)
      (F.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op (V x)))
heq :
  ∀ (x : ↥U),
    Eq (α :=
      CC (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op (V x))))
      ((ConcreteCategory.hom (FC := FC) (CC := CC) (f.hom.app (op (V x))) :
            (a : CC (F.obj.obj (op (V x)))) → CC (G.obj.obj (op (V x))))
          (sf x) :
        CC (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op (V x))))
      ((ConcreteCategory.hom (FC := FC) (CC := CC)
              (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).map (iVU x).op) :
            (a : CC (G.obj.obj (op U))) → CC (G.obj.obj (op (V x))))
          t :
        CC (G.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op (V x))))
V_cover : U ≤ iSup V
⊢ ∃ (a : CC (F.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v))).obj (op U))),
    (ConcreteCategory.hom (FC := FC) (CC := CC) (f.hom.app (op U)) :
          (a : CC (F.obj.obj (op U))) → CC (G.obj.obj (op U)))
        a =
      t
have suffices : IsCompatible (FC := FC) (CC := CC)
  (F.obj (P := CategoryTheory.Presheaf.IsSheaf (Opens.grothendieckTopology (↑X : Type v)))) V sf
Tactic: suffices IsCompatible F.obj V sf by
    -- Since `F` is a sheaf, we can glue all the local preimages together to get a global preimage.
    obtain ⟨s, s_spec, -⟩ := F.existsUnique_gluing' V U iVU V_cover sf this
    · use s
      apply G.eq_of_locally_eq' V U iVU V_cover
      intro x
      rw [← ConcreteCategory.comp_apply, ← f.1.naturality, ConcreteCategory.comp_apply, s_spec, heq]