l3lab/ntp-mathlib huggingface dataset:
/-- `ιInvApp` is the left inverse of `D.ι i` on `U`. -/
theorem ιInvApp_π {i : D.J} (U : Opens (D.U i).carrier) :
    ∃ eq, D.ιInvApp U ≫ D.diagramOverOpenπ U i = (D.U i).presheaf.map (eqToHom eq) := by
  fconstructor
  -- Porting note: I don't know what the magic was in Lean3 proof, it just skipped the proof of `eq`
  · congr; ext1; change _ = _ ⁻¹' (_ '' _); ext1 x
    simp only [SetLike.mem_coe, diagram_l, diagram_r, unop_op, Set.mem_preimage, Set.mem_image]
    refine ⟨fun h => ⟨_, h, rfl⟩, ?_⟩
    rintro ⟨y, h1, h2⟩
    convert h1 using 1
    delta ι Multicoequalizer.π at h2
    apply_fun (D.ι _).base
    · exact h2.symm
    · have := D.ι_gluedIso_inv (PresheafedSpace.forget _) i
      dsimp at this
      rw [← this, coe_comp]
      refine Function.Injective.comp ?_ (TopCat.GlueData.ι_injective D.toTopGlueData i)
      rw [← TopCat.mono_iff_injective]
      infer_instance
  delta ιInvApp
  rw [limit.lift_π]
  change D.opensImagePreimageMap i i U = _
  dsimp [opensImagePreimageMap]
  rw [congr_app (D.t_id _), id_c_app, ← Functor.map_comp]
  erw [IsOpenImmersion.inv_naturality_assoc, IsOpenImmersion.app_inv_app'_assoc]
  · 

Proof state:
case h
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)
⊢ (CategoryTheory.GlueData.U D.toGlueData i).presheaf.map
        (eqToHom
            (_ :
              (IsOpenImmersion.openFunctor (_ : IsOpenImmersion (f D.toGlueData i i))).obj
                  ((Opens.map (f D.toGlueData i i).base).obj U) =
                U)).op ≫
      (CategoryTheory.GlueData.U D.toGlueData i).presheaf.map
          ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion (f D.toGlueData i i))).op.map
            (𝟙 (op ((Opens.map (f D.toGlueData i i).base).obj U)) ≫
              eqToHom
                (_ :
                  (Opens.map (𝟙 (V D.toGlueData (i, i))).base).op.obj
                      (op ((Opens.map (f D.toGlueData i i).base).obj U)) =
                    (Opens.map (t D.toGlueData i i).base).op.obj (op ((Opens.map (f D.toGlueData i i).base).obj U))))) ≫
        (CategoryTheory.GlueData.U D.toGlueData i).presheaf.map
          (eqToHom
              (_ :
                (Opens.map (ι D.toGlueData i).base).obj
                    ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U) =
                  (IsOpenImmersion.openFunctor (_ : IsOpenImmersion (f D.toGlueData i i))).obj
                    ((Opens.map (t D.toGlueData i i).base).obj ((Opens.map (f D.toGlueData i i).base).obj U)))).op =
    (CategoryTheory.GlueData.U D.toGlueData i).presheaf.map
      (eqToHom
        (_ :
          op U =
            op
              ((Opens.map
                    (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData)) (WalkingMultispan.right i)).base).obj
                ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))))

Next tactic:
simp only [eqToHom_op, eqToHom_trans, eqToHom_map (Functor.op _), ← Functor.map_comp]
/-- `ιInvApp` is the left inverse of `D.ι i` on `U`. -/
theorem ιInvApp_π {i : D.J} (U : Opens (D.U i).carrier) :
    ∃ eq, D.ιInvApp U ≫ D.diagramOverOpenπ U i = (D.U i).presheaf.map (eqToHom eq) := by
  fconstructor
  -- Porting note: I don't know what the magic was in Lean3 proof, it just skipped the proof of `eq`
  · congr; ext1; change _ = _ ⁻¹' (_ '' _); ext1 x
    simp only [SetLike.mem_coe, diagram_l, diagram_r, unop_op, Set.mem_preimage, Set.mem_image]
    refine ⟨fun h => ⟨_, h, rfl⟩, ?_⟩
    rintro ⟨y, h1, h2⟩
    convert h1 using 1
    delta ι Multicoequalizer.π at h2
    apply_fun (D.ι _).base
    · exact h2.symm
    · have := D.ι_gluedIso_inv (PresheafedSpace.forget _) i
      dsimp at this
      rw [← this, coe_comp]
      refine Function.Injective.comp ?_ (TopCat.GlueData.ι_injective D.toTopGlueData i)
      rw [← TopCat.mono_iff_injective]
      infer_instance
  delta ιInvApp
  rw [limit.lift_π]
  change D.opensImagePreimageMap i i U = _
  dsimp [opensImagePreimageMap]
  rw [congr_app (D.t_id _), id_c_app, ← Functor.map_comp]
  erw [IsOpenImmersion.inv_naturality_assoc, IsOpenImmersion.app_inv_app'_assoc]
  · simp only [eqToHom_op, eqToHom_trans, eqToHom_map (Functor.op _), ← Functor.map_comp]
    

Proof state:
case h
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)
⊢ (CategoryTheory.GlueData.U D.toGlueData i).presheaf.map
      (eqToHom
          (_ :
            op U =
              op
                ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion (f D.toGlueData i i))).obj
                  ((Opens.map (f D.toGlueData i i).base).obj U))) ≫
        (IsOpenImmersion.openFunctor (_ : IsOpenImmersion (f D.toGlueData i i))).op.map
            (𝟙 (op ((Opens.map (f D.toGlueData i i).base).obj U)) ≫
              eqToHom
                (_ :
                  (Opens.map (𝟙 (V D.toGlueData (i, i))).base).op.obj
                      (op ((Opens.map (f D.toGlueData i i).base).obj U)) =
                    (Opens.map (t D.toGlueData i i).base).op.obj (op ((Opens.map (f D.toGlueData i i).base).obj U)))) ≫
          eqToHom
            (_ :
              op
                  ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion (f D.toGlueData i i))).obj
                    ((Opens.map (t D.toGlueData i i).base).obj ((Opens.map (f D.toGlueData i i).base).obj U))) =
                op
                  ((Opens.map (ι D.toGlueData i).base).obj
                    ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U)))) =
    (CategoryTheory.GlueData.U D.toGlueData i).presheaf.map
      (eqToHom
        (_ :
          op U =
            op
              ((Opens.map
                    (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData)) (WalkingMultispan.right i)).base).obj
                ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))))

Next tactic:
rfl
/-- `ιInvApp` is the left inverse of `D.ι i` on `U`. -/
theorem ιInvApp_π {i : D.J} (U : Opens (D.U i).carrier) :
    ∃ eq, D.ιInvApp U ≫ D.diagramOverOpenπ U i = (D.U i).presheaf.map (eqToHom eq) := by
  fconstructor
  -- Porting note: I don't know what the magic was in Lean3 proof, it just skipped the proof of `eq`
  · congr; ext1; change _ = _ ⁻¹' (_ '' _); ext1 x
    simp only [SetLike.mem_coe, diagram_l, diagram_r, unop_op, Set.mem_preimage, Set.mem_image]
    refine ⟨fun h => ⟨_, h, rfl⟩, ?_⟩
    rintro ⟨y, h1, h2⟩
    convert h1 using 1
    delta ι Multicoequalizer.π at h2
    apply_fun (D.ι _).base
    · exact h2.symm
    · have := D.ι_gluedIso_inv (PresheafedSpace.forget _) i
      dsimp at this
      rw [← this, coe_comp]
      refine Function.Injective.comp ?_ (TopCat.GlueData.ι_injective D.toTopGlueData i)
      rw [← TopCat.mono_iff_injective]
      infer_instance
  delta ιInvApp
  rw [limit.lift_π]
  change D.opensImagePreimageMap i i U = _
  dsimp [opensImagePreimageMap]
  rw [congr_app (D.t_id _), id_c_app, ← Functor.map_comp]
  erw [IsOpenImmersion.inv_naturality_assoc, IsOpenImmersion.app_inv_app'_assoc]
  · simp only [eqToHom_op, eqToHom_trans, eqToHom_map (Functor.op _), ← Functor.map_comp]
    rfl
  · 

Proof state:
case h.hU
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)
⊢ ↑U ⊆ Set.range ⇑(f D.toGlueData i i).base

Next tactic:
rw [Set.range_iff_surjective.mpr _]
/-- `ιInvApp` is the left inverse of `D.ι i` on `U`. -/
theorem ιInvApp_π {i : D.J} (U : Opens (D.U i).carrier) :
    ∃ eq, D.ιInvApp U ≫ D.diagramOverOpenπ U i = (D.U i).presheaf.map (eqToHom eq) := by
  fconstructor
  -- Porting note: I don't know what the magic was in Lean3 proof, it just skipped the proof of `eq`
  · congr; ext1; change _ = _ ⁻¹' (_ '' _); ext1 x
    simp only [SetLike.mem_coe, diagram_l, diagram_r, unop_op, Set.mem_preimage, Set.mem_image]
    refine ⟨fun h => ⟨_, h, rfl⟩, ?_⟩
    rintro ⟨y, h1, h2⟩
    convert h1 using 1
    delta ι Multicoequalizer.π at h2
    apply_fun (D.ι _).base
    · exact h2.symm
    · have := D.ι_gluedIso_inv (PresheafedSpace.forget _) i
      dsimp at this
      rw [← this, coe_comp]
      refine Function.Injective.comp ?_ (TopCat.GlueData.ι_injective D.toTopGlueData i)
      rw [← TopCat.mono_iff_injective]
      infer_instance
  delta ιInvApp
  rw [limit.lift_π]
  change D.opensImagePreimageMap i i U = _
  dsimp [opensImagePreimageMap]
  rw [congr_app (D.t_id _), id_c_app, ← Functor.map_comp]
  erw [IsOpenImmersion.inv_naturality_assoc, IsOpenImmersion.app_inv_app'_assoc]
  · simp only [eqToHom_op, eqToHom_trans, eqToHom_map (Functor.op _), ← Functor.map_comp]
    rfl
  · rw [Set.range_iff_surjective.mpr _]
    · 

Proof state:
case h.hU
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)
⊢ ↑U ⊆ Set.univ

Next tactic:
simp
/-- `ιInvApp` is the left inverse of `D.ι i` on `U`. -/
theorem ιInvApp_π {i : D.J} (U : Opens (D.U i).carrier) :
    ∃ eq, D.ιInvApp U ≫ D.diagramOverOpenπ U i = (D.U i).presheaf.map (eqToHom eq) := by
  fconstructor
  -- Porting note: I don't know what the magic was in Lean3 proof, it just skipped the proof of `eq`
  · congr; ext1; change _ = _ ⁻¹' (_ '' _); ext1 x
    simp only [SetLike.mem_coe, diagram_l, diagram_r, unop_op, Set.mem_preimage, Set.mem_image]
    refine ⟨fun h => ⟨_, h, rfl⟩, ?_⟩
    rintro ⟨y, h1, h2⟩
    convert h1 using 1
    delta ι Multicoequalizer.π at h2
    apply_fun (D.ι _).base
    · exact h2.symm
    · have := D.ι_gluedIso_inv (PresheafedSpace.forget _) i
      dsimp at this
      rw [← this, coe_comp]
      refine Function.Injective.comp ?_ (TopCat.GlueData.ι_injective D.toTopGlueData i)
      rw [← TopCat.mono_iff_injective]
      infer_instance
  delta ιInvApp
  rw [limit.lift_π]
  change D.opensImagePreimageMap i i U = _
  dsimp [opensImagePreimageMap]
  rw [congr_app (D.t_id _), id_c_app, ← Functor.map_comp]
  erw [IsOpenImmersion.inv_naturality_assoc, IsOpenImmersion.app_inv_app'_assoc]
  · simp only [eqToHom_op, eqToHom_trans, eqToHom_map (Functor.op _), ← Functor.map_comp]
    rfl
  · rw [Set.range_iff_surjective.mpr _]
    · simp
    · 

Proof state:
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)
⊢ Function.Surjective ⇑(f D.toGlueData i i).base

Next tactic:
rw [← TopCat.epi_iff_surjective]
/-- `ιInvApp` is the left inverse of `D.ι i` on `U`. -/
theorem ιInvApp_π {i : D.J} (U : Opens (D.U i).carrier) :
    ∃ eq, D.ιInvApp U ≫ D.diagramOverOpenπ U i = (D.U i).presheaf.map (eqToHom eq) := by
  fconstructor
  -- Porting note: I don't know what the magic was in Lean3 proof, it just skipped the proof of `eq`
  · congr; ext1; change _ = _ ⁻¹' (_ '' _); ext1 x
    simp only [SetLike.mem_coe, diagram_l, diagram_r, unop_op, Set.mem_preimage, Set.mem_image]
    refine ⟨fun h => ⟨_, h, rfl⟩, ?_⟩
    rintro ⟨y, h1, h2⟩
    convert h1 using 1
    delta ι Multicoequalizer.π at h2
    apply_fun (D.ι _).base
    · exact h2.symm
    · have := D.ι_gluedIso_inv (PresheafedSpace.forget _) i
      dsimp at this
      rw [← this, coe_comp]
      refine Function.Injective.comp ?_ (TopCat.GlueData.ι_injective D.toTopGlueData i)
      rw [← TopCat.mono_iff_injective]
      infer_instance
  delta ιInvApp
  rw [limit.lift_π]
  change D.opensImagePreimageMap i i U = _
  dsimp [opensImagePreimageMap]
  rw [congr_app (D.t_id _), id_c_app, ← Functor.map_comp]
  erw [IsOpenImmersion.inv_naturality_assoc, IsOpenImmersion.app_inv_app'_assoc]
  · simp only [eqToHom_op, eqToHom_trans, eqToHom_map (Functor.op _), ← Functor.map_comp]
    rfl
  · rw [Set.range_iff_surjective.mpr _]
    · simp
    · rw [← TopCat.epi_iff_surjective]
      

Proof state:
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)
⊢ Epi (f D.toGlueData i i).base

Next tactic:
infer_instance
/-- `ιInvApp` is the right inverse of `D.ι i` on `U`. -/
theorem π_ιInvApp_π (i j : D.J) (U : Opens (D.U i).carrier) :
    D.diagramOverOpenπ U i ≫ D.ιInvAppπEqMap U ≫ D.ιInvApp U ≫ D.diagramOverOpenπ U j =
      D.diagramOverOpenπ U j := by
  -- Porting note : originally, the proof of monotonicity was left a blank and proved in the end
  -- but Lean 4 doesn't like this any more, so the proof is restructured
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i j : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
⊢ diagramOverOpenπ D U i ≫ ιInvAppπEqMap D U ≫ ιInvApp D U ≫ diagramOverOpenπ D U j = diagramOverOpenπ D U j

Next tactic:
rw [← @cancel_mono (f := (componentwiseDiagram 𝖣.diagram.multispan _).map
    (Quiver.Hom.op (WalkingMultispan.Hom.snd (i, j))) ≫ 𝟙 _) _ _ (by
    rw [Category.comp_id]
    apply (config := { allowSynthFailures := true }) mono_comp
    change Mono ((_ ≫ D.f j i).c.app _)
    rw [comp_c_app]
    apply (config := { allowSynthFailures := true }) mono_comp
    erw [D.ι_image_preimage_eq i j U]
    · infer_instance
    · have : IsIso (D.t i j).c := by apply c_isIso_of_iso
      infer_instance)]
/-- `ιInvApp` is the right inverse of `D.ι i` on `U`. -/
theorem π_ιInvApp_π (i j : D.J) (U : Opens (D.U i).carrier) :
    D.diagramOverOpenπ U i ≫ D.ιInvAppπEqMap U ≫ D.ιInvApp U ≫ D.diagramOverOpenπ U j =
      D.diagramOverOpenπ U j := by
  -- Porting note : originally, the proof of monotonicity was left a blank and proved in the end
  -- but Lean 4 doesn't like this any more, so the proof is restructured
  rw [← @cancel_mono (f := (componentwiseDiagram 𝖣.diagram.multispan _).map
    (Quiver.Hom.op (WalkingMultispan.Hom.snd (i, j))) ≫ 𝟙 _) _ _ (by
    

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i j : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
⊢ Mono
    ((componentwiseDiagram (MultispanIndex.multispan (diagram D.toGlueData))
            ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U)).map
        (WalkingMultispan.Hom.snd (i, j)).op ≫
      𝟙
        ((componentwiseDiagram (MultispanIndex.multispan (diagram D.toGlueData))
              ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U)).obj
          (op (WalkingMultispan.left (i, j)))))

Next tactic:
rw [Category.comp_id]
/-- `ιInvApp` is the right inverse of `D.ι i` on `U`. -/
theorem π_ιInvApp_π (i j : D.J) (U : Opens (D.U i).carrier) :
    D.diagramOverOpenπ U i ≫ D.ιInvAppπEqMap U ≫ D.ιInvApp U ≫ D.diagramOverOpenπ U j =
      D.diagramOverOpenπ U j := by
  -- Porting note : originally, the proof of monotonicity was left a blank and proved in the end
  -- but Lean 4 doesn't like this any more, so the proof is restructured
  rw [← @cancel_mono (f := (componentwiseDiagram 𝖣.diagram.multispan _).map
    (Quiver.Hom.op (WalkingMultispan.Hom.snd (i, j))) ≫ 𝟙 _) _ _ (by
    rw [Category.comp_id]
    

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i j : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
⊢ Mono
    ((componentwiseDiagram (MultispanIndex.multispan (diagram D.toGlueData))
          ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U)).map
      (WalkingMultispan.Hom.snd (i, j)).op)

Next tactic:
apply (config := { allowSynthFailures := true }) mono_comp
/-- `ιInvApp` is the right inverse of `D.ι i` on `U`. -/
theorem π_ιInvApp_π (i j : D.J) (U : Opens (D.U i).carrier) :
    D.diagramOverOpenπ U i ≫ D.ιInvAppπEqMap U ≫ D.ιInvApp U ≫ D.diagramOverOpenπ U j =
      D.diagramOverOpenπ U j := by
  -- Porting note : originally, the proof of monotonicity was left a blank and proved in the end
  -- but Lean 4 doesn't like this any more, so the proof is restructured
  rw [← @cancel_mono (f := (componentwiseDiagram 𝖣.diagram.multispan _).map
    (Quiver.Hom.op (WalkingMultispan.Hom.snd (i, j))) ≫ 𝟙 _) _ _ (by
    rw [Category.comp_id]
    apply (config := { allowSynthFailures := true }) mono_comp
    

Proof state:
case inst
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i j : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
⊢ Mono
    (((MultispanIndex.multispan (diagram D.toGlueData)).map (WalkingMultispan.Hom.snd (i, j)).op.unop).c.app
      (op
        ((Opens.map
              (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData))
                  (op (WalkingMultispan.right (MultispanIndex.sndFrom (diagram D.toGlueData) (i, j)))).unop).base).obj
          ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))))

Next tactic:
change Mono ((_ ≫ D.f j i).c.app _)
/-- `ιInvApp` is the right inverse of `D.ι i` on `U`. -/
theorem π_ιInvApp_π (i j : D.J) (U : Opens (D.U i).carrier) :
    D.diagramOverOpenπ U i ≫ D.ιInvAppπEqMap U ≫ D.ιInvApp U ≫ D.diagramOverOpenπ U j =
      D.diagramOverOpenπ U j := by
  -- Porting note : originally, the proof of monotonicity was left a blank and proved in the end
  -- but Lean 4 doesn't like this any more, so the proof is restructured
  rw [← @cancel_mono (f := (componentwiseDiagram 𝖣.diagram.multispan _).map
    (Quiver.Hom.op (WalkingMultispan.Hom.snd (i, j))) ≫ 𝟙 _) _ _ (by
    rw [Category.comp_id]
    apply (config := { allowSynthFailures := true }) mono_comp
    change Mono ((_ ≫ D.f j i).c.app _)
    

Proof state:
case inst
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i j : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
⊢ Mono
    ((t D.toGlueData i j ≫ f D.toGlueData j i).c.app
      (op
        ((Opens.map
              (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData))
                  (op (WalkingMultispan.right (MultispanIndex.sndFrom (diagram D.toGlueData) (i, j)))).unop).base).obj
          ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))))

Next tactic:
rw [comp_c_app]
/-- `ιInvApp` is the right inverse of `D.ι i` on `U`. -/
theorem π_ιInvApp_π (i j : D.J) (U : Opens (D.U i).carrier) :
    D.diagramOverOpenπ U i ≫ D.ιInvAppπEqMap U ≫ D.ιInvApp U ≫ D.diagramOverOpenπ U j =
      D.diagramOverOpenπ U j := by
  -- Porting note : originally, the proof of monotonicity was left a blank and proved in the end
  -- but Lean 4 doesn't like this any more, so the proof is restructured
  rw [← @cancel_mono (f := (componentwiseDiagram 𝖣.diagram.multispan _).map
    (Quiver.Hom.op (WalkingMultispan.Hom.snd (i, j))) ≫ 𝟙 _) _ _ (by
    rw [Category.comp_id]
    apply (config := { allowSynthFailures := true }) mono_comp
    change Mono ((_ ≫ D.f j i).c.app _)
    rw [comp_c_app]
    

Proof state:
case inst
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i j : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
⊢ Mono
    ((f D.toGlueData j i).c.app
        (op
          ((Opens.map
                (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData))
                    (op (WalkingMultispan.right (MultispanIndex.sndFrom (diagram D.toGlueData) (i, j)))).unop).base).obj
            ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))) ≫
      (t D.toGlueData i j).c.app
        (op
          ((Opens.map (f D.toGlueData j i).base).obj
            (op
                ((Opens.map
                      (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData))
                          (op
                              (WalkingMultispan.right
                                (MultispanIndex.sndFrom (diagram D.toGlueData) (i, j)))).unop).base).obj
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))).unop)))

Next tactic:
apply (config := { allowSynthFailures := true }) mono_comp
/-- `ιInvApp` is the right inverse of `D.ι i` on `U`. -/
theorem π_ιInvApp_π (i j : D.J) (U : Opens (D.U i).carrier) :
    D.diagramOverOpenπ U i ≫ D.ιInvAppπEqMap U ≫ D.ιInvApp U ≫ D.diagramOverOpenπ U j =
      D.diagramOverOpenπ U j := by
  -- Porting note : originally, the proof of monotonicity was left a blank and proved in the end
  -- but Lean 4 doesn't like this any more, so the proof is restructured
  rw [← @cancel_mono (f := (componentwiseDiagram 𝖣.diagram.multispan _).map
    (Quiver.Hom.op (WalkingMultispan.Hom.snd (i, j))) ≫ 𝟙 _) _ _ (by
    rw [Category.comp_id]
    apply (config := { allowSynthFailures := true }) mono_comp
    change Mono ((_ ≫ D.f j i).c.app _)
    rw [comp_c_app]
    apply (config := { allowSynthFailures := true }) mono_comp
    

Proof state:
case inst
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i j : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
⊢ Mono
    ((f D.toGlueData j i).c.app
      (op
        ((Opens.map
              (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData))
                  (op (WalkingMultispan.right (MultispanIndex.sndFrom (diagram D.toGlueData) (i, j)))).unop).base).obj
          ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))))
case inst
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i j : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
⊢ Mono
    ((t D.toGlueData i j).c.app
      (op
        ((Opens.map (f D.toGlueData j i).base).obj
          (op
              ((Opens.map
                    (colimit.ι (MultispanIndex.multispan (diagram D.toGlueData))
                        (op
                            (WalkingMultispan.right
                              (MultispanIndex.sndFrom (diagram D.toGlueData) (i, j)))).unop).base).obj
                ((IsOpenMap.functor (_ : IsOpenMap ⇑(ι D.toGlueData i).base)).obj U))).unop)))

Next tactic:
erw [D.ι_image_preimage_eq i j U]
/-- `ιInvApp` is the right inverse of `D.ι i` on `U`. -/
theorem π_ιInvApp_π (i j : D.J) (U : Opens (D.U i).carrier) :
    D.diagramOverOpenπ U i ≫ D.ιInvAppπEqMap U ≫ D.ιInvApp U ≫ D.diagramOverOpenπ U j =
      D.diagramOverOpenπ U j := by
  -- Porting note : originally, the proof of monotonicity was left a blank and proved in the end
  -- but Lean 4 doesn't like this any more, so the proof is restructured
  rw [← @cancel_mono (f := (componentwiseDiagram 𝖣.diagram.multispan _).map
    (Quiver.Hom.op (WalkingMultispan.Hom.snd (i, j))) ≫ 𝟙 _) _ _ (by
    rw [Category.comp_id]
    apply (config := { allowSynthFailures := true }) mono_comp
    change Mono ((_ ≫ D.f j i).c.app _)
    rw [comp_c_app]
    apply (config := { allowSynthFailures := true }) mono_comp
    erw [D.ι_image_preimage_eq i j U]
    · 

Proof state:
case inst
C : Type u
inst✝¹ : Category.{v, u} C
D : GlueData C
inst✝ : HasLimits C
i j : D.J
U : Opens ↑↑(CategoryTheory.GlueData.U D.toGlueData i)
⊢ Mono
    ((f D.toGlueData j i).c.app
      (op
        ((IsOpenImmersion.openFunctor (_ : IsOpenImmersion (f D.toGlueData j i))).obj
          ((Opens.map (t D.toGlueData j i).base).obj ((Opens.map (f D.toGlueData i j).base).obj U)))))

Next tactic:
infer_instance