-- Lean 4 proof step from Mathlib.CategoryTheory.Topos.Sheaf (goal)
Goal:
C : Type u
inst : Category.{v, u} C
J : GrothendieckTopology.{v, u} C
F G : Cᵒᵖ ⥤ Type (max u v)
m : F ⟶ G
inst_1 : Mono m
hF : Presieve.IsSheaf J F
hG : Presieve.IsSeparated J G
X : Cᵒᵖ
x : G.obj X
Y : C
f : Y ⟶ Opposite.unop X
hf :
  J.Covers
    ((ConcreteCategory.hom (FC := TypeCat.Fun)
          (↾fun (x : G.obj X) ↦
            {
              arrows := fun (Y : C) (f : Y ⟶ Opposite.unop X) ↦
                ∃ (a : F.obj (Opposite.op Y)),
                  Eq (α := G.obj (Opposite.op Y))
                    ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map f.op) : (a : G.obj X) → G.obj (Opposite.op Y)) x :
                      G.obj (Opposite.op Y))
                    ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Y)) :
                          (a : F.obj (Opposite.op Y)) → G.obj (Opposite.op Y))
                        a :
                      G.obj (Opposite.op Y)),
              downward_closed := ⋯ : Sieve.{v, u} (Opposite.unop X) }) :
        (a : G.obj X) → (Functor.sieves C).obj X)
      x)
    f
a :
  (Z : C) →
    (g : Z ⟶ Y) →
      (hg :
          (Sieve.pullback f
                ((ConcreteCategory.hom (FC := TypeCat.Fun) ((χ m).app X) :
                    (a : (fun (X : Type (max u v)) ↦ X) (G.obj X)) →
                      (fun (X : Type (max u v)) ↦ X) ((Functor.sieves C).obj X))
                  x)).arrows
            g) →
        (fun (X : Type (max u v)) ↦ X) (F.obj (Opposite.op Z))
ha :
  ∀ (Z : C) (g : Z ⟶ Y)
    (hg :
      (Sieve.pullback f
            ((ConcreteCategory.hom (FC := TypeCat.Fun) ((χ m).app X) :
                (a : (fun (X : Type (max u v)) ↦ X) (G.obj X)) →
                  (fun (X : Type (max u v)) ↦ X) ((Functor.sieves C).obj X))
              x)).arrows
        g),
    Eq (α := (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
      ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map (g ≫ f).op) :
            (a : (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op (Opposite.unop X)))) →
              (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
          x :
        (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
      ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Z)) :
            (a : (fun (X : Type (max u v)) ↦ X) (F.obj (Opposite.op Z))) →
              (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
          (a Z g hg) :
        (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
Y₁ Y₂ Z : C
g₁ : Z ⟶ Y₁
g₂ : Z ⟶ Y₂
f₁ : Y₁ ⟶ Y
f₂ : Y₂ ⟶ Y
h₁ :
  (Sieve.pullback f
        ((ConcreteCategory.hom (FC := TypeCat.Fun)
              (↾fun (x : G.obj X) ↦
                {
                  arrows := fun (Y : C) (f : Y ⟶ Opposite.unop X) ↦
                    ∃ (a : F.obj (Opposite.op Y)),
                      Eq (α := G.obj (Opposite.op Y))
                        ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map f.op) : (a : G.obj X) → G.obj (Opposite.op Y))
                            x :
                          G.obj (Opposite.op Y))
                        ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Y)) :
                              (a : F.obj (Opposite.op Y)) → G.obj (Opposite.op Y))
                            a :
                          G.obj (Opposite.op Y)),
                  downward_closed := ⋯ : Sieve.{v, u} (Opposite.unop X) }) :
            (a : G.obj X) → (Functor.sieves C).obj X)
          x)).arrows
    f₁
h₂ :
  (Sieve.pullback f
        ((ConcreteCategory.hom (FC := TypeCat.Fun)
              (↾fun (x : G.obj X) ↦
                {
                  arrows := fun (Y : C) (f : Y ⟶ Opposite.unop X) ↦
                    ∃ (a : F.obj (Opposite.op Y)),
                      Eq (α := G.obj (Opposite.op Y))
                        ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map f.op) : (a : G.obj X) → G.obj (Opposite.op Y))
                            x :
                          G.obj (Opposite.op Y))
                        ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Y)) :
                              (a : F.obj (Opposite.op Y)) → G.obj (Opposite.op Y))
                            a :
                          G.obj (Opposite.op Y)),
                  downward_closed := ⋯ : Sieve.{v, u} (Opposite.unop X) }) :
            (a : G.obj X) → (Functor.sieves C).obj X)
          x)).arrows
    f₂
h : g₁ ≫ f₁ = g₂ ≫ f₂
refine_1 refine_1₁ :
  Eq (α := G.obj (Opposite.op Z))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Z)) :
          (a : F.obj (Opposite.op Z)) → G.obj (Opposite.op Z))
        ((ConcreteCategory.hom (FC := TypeCat.Fun) (F.map g₁.op) : (a : F.obj (Opposite.op Y₁)) → F.obj (Opposite.op Z))
          (a Y₁ f₁ h₁)) :
      G.obj (Opposite.op Z))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Z)) :
          (a : F.obj (Opposite.op Z)) → G.obj (Opposite.op Z))
        ((ConcreteCategory.hom (FC := TypeCat.Fun) (F.map g₂.op) : (a : F.obj (Opposite.op Y₂)) → F.obj (Opposite.op Z))
          (a Y₂ f₂ h₂)) :
      G.obj (Opposite.op Z))
refine_1₂ :
  Eq (α := G.obj (Opposite.op Z))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map g₁.op) : (a : G.obj (Opposite.op Y₁)) → G.obj (Opposite.op Z))
        ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Y₁)) :
            (a : F.obj (Opposite.op Y₁)) → G.obj (Opposite.op Y₁))
          (a Y₁ f₁ h₁)) :
      G.obj (Opposite.op Z))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map g₂.op) : (a : G.obj (Opposite.op Y₂)) → G.obj (Opposite.op Z))
        ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Y₂)) :
            (a : F.obj (Opposite.op Y₂)) → G.obj (Opposite.op Y₂))
          (a Y₂ f₂ h₂)) :
      G.obj (Opposite.op Z))
refine_1₃ :
  Eq (α := G.obj (Opposite.op Z))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map g₁.op) : (a : G.obj (Opposite.op Y₁)) → G.obj (Opposite.op Z))
        ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map (f₁ ≫ f).op) :
            (a : G.obj (Opposite.op (Opposite.unop X))) → G.obj (Opposite.op Y₁))
          x) :
      G.obj (Opposite.op Z))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map g₂.op) : (a : G.obj (Opposite.op Y₂)) → G.obj (Opposite.op Z))
        ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map (f₂ ≫ f).op) :
            (a : G.obj (Opposite.op (Opposite.unop X))) → G.obj (Opposite.op Y₂))
          x) :
      G.obj (Opposite.op Z))
refine_1₄ :
  Eq (α := G.obj (Opposite.op Z))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map ((f₁ ≫ f).op ≫ g₁.op)) :
          (a : G.obj (Opposite.op (Opposite.unop X))) → G.obj (Opposite.op Z))
        x :
      G.obj (Opposite.op Z))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map ((f₂ ≫ f).op ≫ g₂.op)) :
          (a : G.obj (Opposite.op (Opposite.unop X))) → G.obj (Opposite.op Z))
        x :
      G.obj (Opposite.op Z))
⊢ Eq (α := (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Z)) :
          (a : (fun (X : Type (max u v)) ↦ X) (F.obj (Opposite.op Z))) →
            (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
        ((ConcreteCategory.hom (FC := TypeCat.Fun) (F.map g₁.op) :
            (a : (fun (X : Type (max u v)) ↦ X) (F.obj (Opposite.op Y₁))) →
              (fun (X : Type (max u v)) ↦ X) (F.obj (Opposite.op Z)))
          (a Y₁ f₁ h₁)) :
      (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
    ((ConcreteCategory.hom (FC := TypeCat.Fun) (m.app (Opposite.op Z)) :
          (a : (fun (X : Type (max u v)) ↦ X) (F.obj (Opposite.op Z))) →
            (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
        ((ConcreteCategory.hom (FC := TypeCat.Fun) (F.map g₂.op) :
            (a : (fun (X : Type (max u v)) ↦ X) (F.obj (Opposite.op Y₂))) →
              (fun (X : Type (max u v)) ↦ X) (F.obj (Opposite.op Z)))
          (a Y₂ f₂ h₂)) :
      (fun (X : Type (max u v)) ↦ X) (G.obj (Opposite.op Z)))
have refine_1₅ : Eq (α := G.obj (Opposite.op Z))
  ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map (g₁ ≫ f₁ ≫ f).op) :
        (a : G.obj (Opposite.op (Opposite.unop X))) → G.obj (Opposite.op Z))
      x :
    G.obj (Opposite.op Z))
  ((ConcreteCategory.hom (FC := TypeCat.Fun) (G.map (g₂ ≫ f₂ ≫ f).op) :
        (a : G.obj (Opposite.op (Opposite.unop X))) → G.obj (Opposite.op Z))
      x :
    G.obj (Opposite.op Z))
Tactic: simp_rw [NatTrans.naturality_apply, ← ha, ← Functor.map_comp_apply, ← op_comp,
      reassoc_of% h]