set_option maxHeartbeats 600000 in
/-- (Implementation) The natural map `Γ(𝒪_{U_i}, U) ⟶ Γ(𝒪_X, 𝖣.ι i '' U)`.
This forms the inverse of `(𝖣.ι i).c.app (op U)`. -/
def ιInvApp {i : D.J} (U : Opens (D.U i).carrier) :
    (D.U i).presheaf.obj (op U) ⟶ limit (D.diagramOverOpen U) :=
  limit.lift (D.diagramOverOpen U)
    { pt := (D.U i).presheaf.obj (op U)
      π :=
        { app := fun j => D.ιInvAppπApp U (unop j)
          naturality := fun {X Y} f' => by
            induction X using Opposite.rec' with | h X => ?_
            induction Y using Opposite.rec' with | h Y => ?_
            let f : Y ⟶ X := f'.unop; have : f' = f.op := rfl; clear_value f; subst this
            rcases f with (_ | ⟨j, k⟩ | ⟨j, k⟩)
            · erw [Category.id_comp, CategoryTheory.Functor.map_id]
              rw [Category.comp_id]
            · erw [Category.id_comp]; congr 1
            erw [Category.id_comp]
            -- It remains to show that the blue is equal to red + green in the original diagram.
            -- The proof strategy is illustrated in ![this diagram](https://i.imgur.com/mBzV1Rx.png)
            -- where we prove red = pink = light-blue = green = blue.
            change
              D.opensImagePreimageMap i j U ≫
                  (D.f j k).c.app _ ≫ (D.V (j, k)).presheaf.map (eqToHom _) =
                D.opensImagePreimageMap _ _ _ ≫
                  ((D.f k j).c.app _ ≫ (D.t j k).c.app _) ≫ (D.V (j, k)).presheaf.map (eqToHom _)
            erw [opensImagePreimageMap_app_assoc]
            simp_rw [Category.assoc]
            erw [opensImagePreimageMap_app_assoc, (D.t j k).c.naturality_assoc]
            rw [snd_invApp_t_app_assoc]
            erw [← PresheafedSpace.comp_c_app_assoc]
            -- light-blue = green is relatively easy since the part that differs does not involve
            -- partial inverses.
            have :
              D.t' j k i ≫ (π₁ k, i, j) ≫ D.t k i ≫ 𝖣.f i k =
                (pullbackSymmetry _ _).hom ≫ (π₁ j, i, k) ≫ D.t j i ≫ D.f i j := by
              rw [← 𝖣.t_fac_assoc, 𝖣.t'_comp_eq_pullbackSymmetry_assoc,
                pullbackSymmetry_hom_comp_snd_assoc, pullback.condition, 𝖣.t_fac_assoc]
            rw [congr_app this]
            erw [PresheafedSpace.comp_c_app_assoc (pullbackSymmetry _ _).hom]
            simp_rw [Category.assoc]
            congr 1
            rw [← IsIso.eq_inv_comp]
            erw [IsOpenImmersion.inv_invApp]
            simp_rw [Category.assoc]
            erw [NatTrans.naturality_assoc, ← PresheafedSpace.comp_c_app_assoc,
              congr_app (pullbackSymmetry_hom_comp_snd _ _)]
            simp_rw [Category.assoc]
            erw [IsOpenImmersion.inv_naturality_assoc, IsOpenImmersion.inv_naturality_assoc,
              IsOpenImmersion.inv_naturality_assoc, IsOpenImmersion.app_invApp_assoc]
            repeat' 

Proof state:
case h.h.snd.mk.e_a
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
j k : D.J
this :
  t' D.toGlueData j k i ≫ pullback.fst ≫ t D.toGlueData k i ≫ f D.toGlueData i k =
    (pullbackSymmetry (f D.toGlueData j k) (f D.toGlueData j i)).hom ≫
      pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j
⊢ (V D.toGlueData (j, k)).presheaf.map
        (eqToHom
          (_ :
            op
                ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.snd)).obj
                  {
                      unop :=
                        { carrier := ⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹' ↑(op U).unop,
                          is_open' :=
                            (_ :
                              IsOpen
                                (⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹'
                                  ↑(op U).unop)) } }.unop) =
              (Opens.map (f D.toGlueData j k).base).op.obj
                (op
                  ((Opens.map (ι D.toGlueData j).base).obj
                    ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))))) ≫
      (V D.toGlueData (j, k)).presheaf.map
        (eqToHom
          (_ :
            (Opens.map (f D.toGlueData j k).base).op.obj
                (op
                  ((Opens.map (ι D.toGlueData j).base).obj
                    ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))) =
              op
                ((Opens.map
                      (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData))
                          (op (WalkingMultispan.left (j, k))).unop).base).obj
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U)))) =
    (V D.toGlueData (j, k)).presheaf.map
        (homOfLE
            (_ :
              ⇑pullback.fst.base ''
                  (⇑pullback.fst.base ⁻¹'
                    ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.snd)).obj
                        { carrier := ⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹' ↑(op U).unop,
                          is_open' :=
                            (_ :
                              IsOpen
                                (⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹'
                                  ↑(op U).unop)) }).carrier) ⊆
                ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.snd)).obj
                    { carrier := ⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹' ↑(op U).unop,
                      is_open' :=
                        (_ :
                          IsOpen
                            (⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹'
                              ↑(op U).unop)) }).carrier)).op ≫
      (V D.toGlueData (j, k)).presheaf.map
          ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.fst)).op.map
            (eqToHom
              (_ :
                (Opens.map pullback.fst.base).op.obj
                    (op
                      ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.snd)).obj
                        { carrier := ⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹' ↑(op U).unop,
                          is_open' :=
                            (_ :
                              IsOpen
                                (⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹' ↑(op U).unop)) })) =
                  (Opens.map
                          ((pullbackSymmetry (f D.toGlueData j k) (f D.toGlueData j i)).hom ≫ pullback.snd).base).op.obj
                    (op
                      ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.snd)).obj
                        { carrier := ⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹' ↑(op U).unop,
                          is_open' :=
                            (_ :
                              IsOpen
                                (⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹'
                                  ↑(op U).unop)) }))))) ≫
        (V D.toGlueData (j, k)).presheaf.map
            ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.fst)).op.map
              ((Opens.map (pullbackSymmetry (f D.toGlueData j k) (f D.toGlueData j i)).hom.base).op.map
                (eqToHom
                  (_ :
                    op
                        ((Opens.map pullback.snd.base).obj
                          (op
                              ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.snd)).obj
                                {
                                  carrier :=
                                    ⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹' ↑(op U).unop,
                                  is_open' :=
                                    (_ :
                                      IsOpen
                                        (⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹'
                                          ↑(op U).unop)) })).unop) =
                      op
                        { carrier := ⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹' ↑(op U).unop,
                          is_open' :=
                            (_ :
                              IsOpen
                                (⇑(pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base ⁻¹'
                                  ↑(op U).unop)) })))) ≫
          (V D.toGlueData (j, k)).presheaf.map
              ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.fst)).op.map
                (eqToHom
                  (_ :
                    (Opens.map
                              ((pullbackSymmetry (f D.toGlueData j k) (f D.toGlueData j i)).hom ≫
                                  pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base).op.obj
                        (op U) =
                      (Opens.map
                              (t' D.toGlueData j k i ≫
                                  pullback.fst ≫ t D.toGlueData k i ≫ f D.toGlueData i k).base).op.obj
                        (op U)))) ≫
            (V D.toGlueData (j, k)).presheaf.map
                (eqToHom
                  (_ :
                    op
                        ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.fst)).obj
                          {
                              unop :=
                                {
                                  carrier :=
                                    ⇑(t' D.toGlueData j k i).base ⁻¹'
                                      ↑(op
                                            {
                                                unop :=
                                                  {
                                                    carrier :=
                                                      ⇑(pullback.fst ≫ t D.toGlueData k i ≫ f D.toGlueData i k).base ⁻¹'
                                                        ↑(op U).unop,
                                                    is_open' :=
                                                      (_ :
                                                        IsOpen
                                                          (⇑(pullback.fst ≫
                                                                  t D.toGlueData k i ≫ f D.toGlueData i k).base ⁻¹'
                                                            ↑(op U).unop)) } }.unop).unop,
                                  is_open' :=
                                    (_ :
                                      IsOpen
                                        (⇑(t' D.toGlueData j k i).base ⁻¹'
                                          ↑(op
                                                {
                                                    unop :=
                                                      {
                                                        carrier :=
                                                          ⇑(pullback.fst ≫
                                                                  t D.toGlueData k i ≫ f D.toGlueData i k).base ⁻¹'
                                                            ↑(op U).unop,
                                                        is_open' :=
                                                          (_ :
                                                            IsOpen
                                                              (⇑(pullback.fst ≫
                                                                      t D.toGlueData k i ≫ f D.toGlueData i k).base ⁻¹'
                                                                ↑(op U).unop)) } }.unop).unop)) } }.unop) =
                      (Opens.map (t D.toGlueData j k).base).op.obj
                        (op
                          ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.snd)).obj
                            {
                                unop :=
                                  {
                                    carrier :=
                                      ⇑(pullback.fst ≫ t D.toGlueData k i ≫ f D.toGlueData i k).base ⁻¹' ↑(op U).unop,
                                    is_open' :=
                                      (_ :
                                        IsOpen
                                          (⇑(pullback.fst ≫ t D.toGlueData k i ≫ f D.toGlueData i k).base ⁻¹'
                                            ↑(op U).unop)) } }.unop)))) ≫
              ((t D.toGlueData j k).base _* (V D.toGlueData (j, k)).presheaf).map
                  (eqToHom
                    (_ :
                      op
                          ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion pullback.snd)).obj
                            {
                                unop :=
                                  {
                                    carrier :=
                                      ⇑(pullback.fst ≫ t D.toGlueData k i ≫ f D.toGlueData i k).base ⁻¹' ↑(op U).unop,
                                    is_open' :=
                                      (_ :
                                        IsOpen
                                          (⇑(pullback.fst ≫ t D.toGlueData k i ≫ f D.toGlueData i k).base ⁻¹'
                                            ↑(op U).unop)) } }.unop) =
                        (Opens.map (f D.toGlueData k j).base).op.obj
                          (op
                            ((Opens.map (ι D.toGlueData k).base).obj
                              ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))))) ≫
                (V D.toGlueData (j, k)).presheaf.map
                  (eqToHom
                    (_ :
                      (Opens.map
                                ((MultispanIndex.multispan (diagram D.toGlueData)).map
                                    (WalkingMultispan.Hom.snd (j, k)).op.unop).base).op.obj
                          (op
                            ((Opens.map
                                  (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData))
                                      (op
                                          (WalkingMultispan.right
                                            (MultispanIndex.sndFrom (diagram D.toGlueData) (j, k)))).unop).base).obj
                              ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))) =
                        op
                          ((Opens.map
                                (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData))
                                    (op (WalkingMultispan.left (j, k))).unop).base).obj
                            ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))))

Next tactic:
erw [← (D.V (j, k)).presheaf.map_comp]