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]
            

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
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
⊢ (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 j i ≫ f D.toGlueData i j).c.app (op U) ≫
        (pullbackSymmetry (f D.toGlueData j k) (f D.toGlueData j i)).hom.c.app
            (op ((Opens.map (pullback.fst ≫ t D.toGlueData j i ≫ f D.toGlueData i j).base).obj (op U).unop)) ≫
          (pullback (f D.toGlueData j k) (f D.toGlueData j i)).presheaf.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)))) ≫
      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:
simp_rw [Category.assoc]