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]
            

Proof state:
case h.h.snd.mk
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
⊢ (pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).c.app (op U) ≫
      IsOpenImmersion.invApp (_ : IsOpenImmersion pullback.snd)
          { 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
            (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)))) =
    (pullback.fst ≫ t D.toGlueData k i ≫ f D.toGlueData i k).c.app (op U) ≫
      (t' D.toGlueData j k i).c.app
          (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) ≫
        IsOpenImmersion.invApp (_ : IsOpenImmersion pullback.fst)
            {
              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)) } ≫
          (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 [← PresheafedSpace.comp_c_app_assoc]