l3lab/ntp-mathlib huggingface dataset:
/-- The first projection from the glued scheme into `X`. -/
def p1 : (gluing 𝒰 f g).glued ⟶ X := by
  fapply Multicoequalizer.desc
  exact fun i => pullback.fst ≫ 𝒰.map i
  rintro ⟨i, j⟩
  change pullback.fst ≫ _ ≫ 𝒰.map i = (_ ≫ _) ≫ _ ≫ 𝒰.map j
  -- Porting note : change `rw` to `erw`
  erw [pullback.condition]
  rw [← Category.assoc]
  

Proof state:
case h.mk
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
i j : (gluing 𝒰 f g).toGlueData.J
⊢ pullback.snd ≫ OpenCover.map 𝒰 j =
    ((GlueData.t (gluing 𝒰 f g).toGlueData i j ≫ GlueData.f (gluing 𝒰 f g).toGlueData j i) ≫ pullback.fst) ≫
      OpenCover.map 𝒰 j

Next tactic:
congr 1
/-- The first projection from the glued scheme into `X`. -/
def p1 : (gluing 𝒰 f g).glued ⟶ X := by
  fapply Multicoequalizer.desc
  exact fun i => pullback.fst ≫ 𝒰.map i
  rintro ⟨i, j⟩
  change pullback.fst ≫ _ ≫ 𝒰.map i = (_ ≫ _) ≫ _ ≫ 𝒰.map j
  -- Porting note : change `rw` to `erw`
  erw [pullback.condition]
  rw [← Category.assoc]
  congr 1
  

Proof state:
case h.mk.e_a
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
i j : (gluing 𝒰 f g).toGlueData.J
⊢ pullback.snd = (GlueData.t (gluing 𝒰 f g).toGlueData i j ≫ GlueData.f (gluing 𝒰 f g).toGlueData j i) ≫ pullback.fst

Next tactic:
rw [Category.assoc]
/-- The first projection from the glued scheme into `X`. -/
def p1 : (gluing 𝒰 f g).glued ⟶ X := by
  fapply Multicoequalizer.desc
  exact fun i => pullback.fst ≫ 𝒰.map i
  rintro ⟨i, j⟩
  change pullback.fst ≫ _ ≫ 𝒰.map i = (_ ≫ _) ≫ _ ≫ 𝒰.map j
  -- Porting note : change `rw` to `erw`
  erw [pullback.condition]
  rw [← Category.assoc]
  congr 1
  rw [Category.assoc]
  

Proof state:
case h.mk.e_a
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
i j : (gluing 𝒰 f g).toGlueData.J
⊢ pullback.snd = GlueData.t (gluing 𝒰 f g).toGlueData i j ≫ GlueData.f (gluing 𝒰 f g).toGlueData j i ≫ pullback.fst

Next tactic:
exact (t_fst_fst _ _ _ _ _).symm
/-- The second projection from the glued scheme into `Y`. -/
def p2 : (gluing 𝒰 f g).glued ⟶ Y := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
⊢ GlueData.glued (gluing 𝒰 f g) ⟶ Y

Next tactic:
fapply Multicoequalizer.desc
/-- The second projection from the glued scheme into `Y`. -/
def p2 : (gluing 𝒰 f g).glued ⟶ Y := by
  fapply Multicoequalizer.desc
  

Proof state:
case k
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
⊢ (b : (GlueData.diagram (gluing 𝒰 f g).toGlueData).R) →
    MultispanIndex.right (GlueData.diagram (gluing 𝒰 f g).toGlueData) b ⟶ Y
case h
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
⊢ ∀ (a : (GlueData.diagram (gluing 𝒰 f g).toGlueData).L),
    MultispanIndex.fst (GlueData.diagram (gluing 𝒰 f g).toGlueData) a ≫
        ?k (MultispanIndex.fstFrom (GlueData.diagram (gluing 𝒰 f g).toGlueData) a) =
      MultispanIndex.snd (GlueData.diagram (gluing 𝒰 f g).toGlueData) a ≫
        ?k (MultispanIndex.sndFrom (GlueData.diagram (gluing 𝒰 f g).toGlueData) a)

Next tactic:
exact fun i => pullback.snd
/-- The second projection from the glued scheme into `Y`. -/
def p2 : (gluing 𝒰 f g).glued ⟶ Y := by
  fapply Multicoequalizer.desc
  exact fun i => pullback.snd
  

Proof state:
case h
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
⊢ ∀ (a : (GlueData.diagram (gluing 𝒰 f g).toGlueData).L),
    MultispanIndex.fst (GlueData.diagram (gluing 𝒰 f g).toGlueData) a ≫ pullback.snd =
      MultispanIndex.snd (GlueData.diagram (gluing 𝒰 f g).toGlueData) a ≫ pullback.snd

Next tactic:
rintro ⟨i, j⟩
/-- The second projection from the glued scheme into `Y`. -/
def p2 : (gluing 𝒰 f g).glued ⟶ Y := by
  fapply Multicoequalizer.desc
  exact fun i => pullback.snd
  rintro ⟨i, j⟩
  

Proof state:
case h.mk
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
i j : (gluing 𝒰 f g).toGlueData.J
⊢ MultispanIndex.fst (GlueData.diagram (gluing 𝒰 f g).toGlueData) (i, j) ≫ pullback.snd =
    MultispanIndex.snd (GlueData.diagram (gluing 𝒰 f g).toGlueData) (i, j) ≫ pullback.snd

Next tactic:
change pullback.fst ≫ _ = (_ ≫ _) ≫ _
/-- The second projection from the glued scheme into `Y`. -/
def p2 : (gluing 𝒰 f g).glued ⟶ Y := by
  fapply Multicoequalizer.desc
  exact fun i => pullback.snd
  rintro ⟨i, j⟩
  change pullback.fst ≫ _ = (_ ≫ _) ≫ _
  

Proof state:
case h.mk
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
i j : (gluing 𝒰 f g).toGlueData.J
⊢ pullback.fst ≫ pullback.snd =
    (GlueData.t (gluing 𝒰 f g).toGlueData i j ≫ GlueData.f (gluing 𝒰 f g).toGlueData j i) ≫ pullback.snd

Next tactic:
rw [Category.assoc]
/-- The second projection from the glued scheme into `Y`. -/
def p2 : (gluing 𝒰 f g).glued ⟶ Y := by
  fapply Multicoequalizer.desc
  exact fun i => pullback.snd
  rintro ⟨i, j⟩
  change pullback.fst ≫ _ = (_ ≫ _) ≫ _
  rw [Category.assoc]
  

Proof state:
case h.mk
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
i j : (gluing 𝒰 f g).toGlueData.J
⊢ pullback.fst ≫ pullback.snd =
    GlueData.t (gluing 𝒰 f g).toGlueData i j ≫ GlueData.f (gluing 𝒰 f g).toGlueData j i ≫ pullback.snd

Next tactic:
exact (t_fst_snd _ _ _ _ _).symm
theorem p_comm : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
⊢ p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g

Next tactic:
apply Multicoequalizer.hom_ext
theorem p_comm : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g := by
  apply Multicoequalizer.hom_ext
  

Proof state:
case h
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
⊢ ∀ (b : (GlueData.diagram (gluing 𝒰 f g).toGlueData).R),
    Multicoequalizer.π (GlueData.diagram (gluing 𝒰 f g).toGlueData) b ≫ p1 𝒰 f g ≫ f =
      Multicoequalizer.π (GlueData.diagram (gluing 𝒰 f g).toGlueData) b ≫ p2 𝒰 f g ≫ g

Next tactic:
intro i
theorem p_comm : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g := by
  apply Multicoequalizer.hom_ext
  intro i
  

Proof state:
case h
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
i : (GlueData.diagram (gluing 𝒰 f g).toGlueData).R
⊢ Multicoequalizer.π (GlueData.diagram (gluing 𝒰 f g).toGlueData) i ≫ p1 𝒰 f g ≫ f =
    Multicoequalizer.π (GlueData.diagram (gluing 𝒰 f g).toGlueData) i ≫ p2 𝒰 f g ≫ g

Next tactic:
erw [Multicoequalizer.π_desc_assoc, Multicoequalizer.π_desc_assoc]
theorem p_comm : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g := by
  apply Multicoequalizer.hom_ext
  intro i
  erw [Multicoequalizer.π_desc_assoc, Multicoequalizer.π_desc_assoc]
  

Proof state:
case h
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
i : (GlueData.diagram (gluing 𝒰 f g).toGlueData).R
⊢ (pullback.fst ≫ OpenCover.map 𝒰 i) ≫ f = pullback.snd ≫ g

Next tactic:
rw [Category.assoc, pullback.condition]
/-- (Implementation)
The canonical map `(s.X ×[X] Uᵢ) ×[s.X] (s.X ×[X] Uⱼ) ⟶ (Uᵢ ×[Z] Y) ×[X] Uⱼ`

This is used in `gluedLift`. -/
def gluedLiftPullbackMap (i j : 𝒰.J) :
    pullback ((𝒰.pullbackCover s.fst).map i) ((𝒰.pullbackCover s.fst).map j) ⟶
      (gluing 𝒰 f g).V ⟨i, j⟩ := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ pullback (OpenCover.map (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)) i)
      (OpenCover.map (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)) j) ⟶
    GlueData.V (gluing 𝒰 f g).toGlueData (i, j)

Next tactic:
change pullback pullback.fst pullback.fst ⟶ pullback _ _
/-- (Implementation)
The canonical map `(s.X ×[X] Uᵢ) ×[s.X] (s.X ×[X] Uⱼ) ⟶ (Uᵢ ×[Z] Y) ×[X] Uⱼ`

This is used in `gluedLift`. -/
def gluedLiftPullbackMap (i j : 𝒰.J) :
    pullback ((𝒰.pullbackCover s.fst).map i) ((𝒰.pullbackCover s.fst).map j) ⟶
      (gluing 𝒰 f g).V ⟨i, j⟩ := by
  change pullback pullback.fst pullback.fst ⟶ pullback _ _
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ pullback pullback.fst pullback.fst ⟶ pullback (pullback.fst ≫ OpenCover.map 𝒰 i) (OpenCover.map 𝒰 j)

Next tactic:
refine' (pullbackRightPullbackFstIso _ _ _).hom ≫ _
/-- (Implementation)
The canonical map `(s.X ×[X] Uᵢ) ×[s.X] (s.X ×[X] Uⱼ) ⟶ (Uᵢ ×[Z] Y) ×[X] Uⱼ`

This is used in `gluedLift`. -/
def gluedLiftPullbackMap (i j : 𝒰.J) :
    pullback ((𝒰.pullbackCover s.fst).map i) ((𝒰.pullbackCover s.fst).map j) ⟶
      (gluing 𝒰 f g).V ⟨i, j⟩ := by
  change pullback pullback.fst pullback.fst ⟶ pullback _ _
  refine' (pullbackRightPullbackFstIso _ _ _).hom ≫ _
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ pullback (pullback.fst ≫ PullbackCone.fst s) (OpenCover.map 𝒰 j) ⟶
    pullback (pullback.fst ≫ OpenCover.map 𝒰 i) (OpenCover.map 𝒰 j)

Next tactic:
refine' pullback.map _ _ _ _ _ (𝟙 _) (𝟙 _) _ _
/-- (Implementation)
The canonical map `(s.X ×[X] Uᵢ) ×[s.X] (s.X ×[X] Uⱼ) ⟶ (Uᵢ ×[Z] Y) ×[X] Uⱼ`

This is used in `gluedLift`. -/
def gluedLiftPullbackMap (i j : 𝒰.J) :
    pullback ((𝒰.pullbackCover s.fst).map i) ((𝒰.pullbackCover s.fst).map j) ⟶
      (gluing 𝒰 f g).V ⟨i, j⟩ := by
  change pullback pullback.fst pullback.fst ⟶ pullback _ _
  refine' (pullbackRightPullbackFstIso _ _ _).hom ≫ _
  refine' pullback.map _ _ _ _ _ (𝟙 _) (𝟙 _) _ _
  · 

Proof state:
case refine'_1
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ pullback (PullbackCone.fst s) (OpenCover.map 𝒰 i) ⟶ pullback (OpenCover.map 𝒰 i ≫ f) g

Next tactic:
exact (pullbackSymmetry _ _).hom ≫
      pullback.map _ _ _ _ (𝟙 _) s.snd f (Category.id_comp _).symm s.condition
/-- (Implementation)
The canonical map `(s.X ×[X] Uᵢ) ×[s.X] (s.X ×[X] Uⱼ) ⟶ (Uᵢ ×[Z] Y) ×[X] Uⱼ`

This is used in `gluedLift`. -/
def gluedLiftPullbackMap (i j : 𝒰.J) :
    pullback ((𝒰.pullbackCover s.fst).map i) ((𝒰.pullbackCover s.fst).map j) ⟶
      (gluing 𝒰 f g).V ⟨i, j⟩ := by
  change pullback pullback.fst pullback.fst ⟶ pullback _ _
  refine' (pullbackRightPullbackFstIso _ _ _).hom ≫ _
  refine' pullback.map _ _ _ _ _ (𝟙 _) (𝟙 _) _ _
  · exact (pullbackSymmetry _ _).hom ≫
      pullback.map _ _ _ _ (𝟙 _) s.snd f (Category.id_comp _).symm s.condition
  · 

Proof state:
case refine'_2
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ (pullback.fst ≫ PullbackCone.fst s) ≫ 𝟙 X =
    ((pullbackSymmetry (PullbackCone.fst s) (OpenCover.map 𝒰 i)).hom ≫
        pullback.map (OpenCover.map 𝒰 i) (PullbackCone.fst s) (OpenCover.map 𝒰 i ≫ f) g (𝟙 (OpenCover.obj 𝒰 i))
          (PullbackCone.snd s) f (_ : OpenCover.map 𝒰 i ≫ f = 𝟙 (OpenCover.obj 𝒰 i) ≫ OpenCover.map 𝒰 i ≫ f)
          (_ : PullbackCone.fst s ≫ f = PullbackCone.snd s ≫ g)) ≫
      pullback.fst ≫ OpenCover.map 𝒰 i

Next tactic:
simpa using pullback.condition
/-- (Implementation)
The canonical map `(s.X ×[X] Uᵢ) ×[s.X] (s.X ×[X] Uⱼ) ⟶ (Uᵢ ×[Z] Y) ×[X] Uⱼ`

This is used in `gluedLift`. -/
def gluedLiftPullbackMap (i j : 𝒰.J) :
    pullback ((𝒰.pullbackCover s.fst).map i) ((𝒰.pullbackCover s.fst).map j) ⟶
      (gluing 𝒰 f g).V ⟨i, j⟩ := by
  change pullback pullback.fst pullback.fst ⟶ pullback _ _
  refine' (pullbackRightPullbackFstIso _ _ _).hom ≫ _
  refine' pullback.map _ _ _ _ _ (𝟙 _) (𝟙 _) _ _
  · exact (pullbackSymmetry _ _).hom ≫
      pullback.map _ _ _ _ (𝟙 _) s.snd f (Category.id_comp _).symm s.condition
  · simpa using pullback.condition
  · 

Proof state:
case refine'_3
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ OpenCover.map 𝒰 j ≫ 𝟙 X = 𝟙 (OpenCover.obj 𝒰 j) ≫ OpenCover.map 𝒰 j

Next tactic:
simp only [Category.comp_id, Category.id_comp]
@[reassoc]
theorem gluedLiftPullbackMap_fst (i j : 𝒰.J) :
    gluedLiftPullbackMap 𝒰 f g s i j ≫ pullback.fst =
      pullback.fst ≫
        (pullbackSymmetry _ _).hom ≫
          pullback.map _ _ _ _ (𝟙 _) s.snd f (Category.id_comp _).symm s.condition := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ gluedLiftPullbackMap 𝒰 f g s i j ≫ pullback.fst =
    pullback.fst ≫
      (pullbackSymmetry (PullbackCone.fst s) (OpenCover.map 𝒰 i)).hom ≫
        pullback.map (OpenCover.map 𝒰 i) (PullbackCone.fst s) (OpenCover.map 𝒰 i ≫ f) g (𝟙 (OpenCover.obj 𝒰 i))
          (PullbackCone.snd s) f (_ : OpenCover.map 𝒰 i ≫ f = 𝟙 (OpenCover.obj 𝒰 i) ≫ OpenCover.map 𝒰 i ≫ f)
          (_ : PullbackCone.fst s ≫ f = PullbackCone.snd s ≫ g)

Next tactic:
delta gluedLiftPullbackMap
@[reassoc]
theorem gluedLiftPullbackMap_fst (i j : 𝒰.J) :
    gluedLiftPullbackMap 𝒰 f g s i j ≫ pullback.fst =
      pullback.fst ≫
        (pullbackSymmetry _ _).hom ≫
          pullback.map _ _ _ _ (𝟙 _) s.snd f (Category.id_comp _).symm s.condition := by
  delta gluedLiftPullbackMap
  -- Porting note : the original set of simp lemma is not sufficient, but as this is terminal
  -- I just let `simp` do its work
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ (let_fun this :=
        (pullbackRightPullbackFstIso (PullbackCone.fst s) (OpenCover.map 𝒰 j) pullback.fst).hom ≫
          pullback.map (pullback.fst ≫ PullbackCone.fst s) (OpenCover.map 𝒰 j) (pullback.fst ≫ OpenCover.map 𝒰 i)
            (OpenCover.map 𝒰 j)
            ((pullbackSymmetry (PullbackCone.fst s) (OpenCover.map 𝒰 i)).hom ≫
              pullback.map (OpenCover.map 𝒰 i) (PullbackCone.fst s) (OpenCover.map 𝒰 i ≫ f) g (𝟙 (OpenCover.obj 𝒰 i))
                (PullbackCone.snd s) f (_ : OpenCover.map 𝒰 i ≫ f = 𝟙 (OpenCover.obj 𝒰 i) ≫ OpenCover.map 𝒰 i ≫ f)
                (_ : PullbackCone.fst s ≫ f = PullbackCone.snd s ≫ g))
            (𝟙 (OpenCover.obj 𝒰 j)) (𝟙 X)
            (_ :
              (pullback.fst ≫ PullbackCone.fst s) ≫ 𝟙 X =
                ((pullbackSymmetry (PullbackCone.fst s) (OpenCover.map 𝒰 i)).hom ≫
                    pullback.map (OpenCover.map 𝒰 i) (PullbackCone.fst s) (OpenCover.map 𝒰 i ≫ f) g
                      (𝟙 (OpenCover.obj 𝒰 i)) (PullbackCone.snd s) f
                      (_ : OpenCover.map 𝒰 i ≫ f = 𝟙 (OpenCover.obj 𝒰 i) ≫ OpenCover.map 𝒰 i ≫ f)
                      (_ : PullbackCone.fst s ≫ f = PullbackCone.snd s ≫ g)) ≫
                  pullback.fst ≫ OpenCover.map 𝒰 i)
            (_ : OpenCover.map 𝒰 j ≫ 𝟙 X = 𝟙 (OpenCover.obj 𝒰 j) ≫ OpenCover.map 𝒰 j);
      this) ≫
      pullback.fst =
    pullback.fst ≫
      (pullbackSymmetry (PullbackCone.fst s) (OpenCover.map 𝒰 i)).hom ≫
        pullback.map (OpenCover.map 𝒰 i) (PullbackCone.fst s) (OpenCover.map 𝒰 i ≫ f) g (𝟙 (OpenCover.obj 𝒰 i))
          (PullbackCone.snd s) f (_ : OpenCover.map 𝒰 i ≫ f = 𝟙 (OpenCover.obj 𝒰 i) ≫ OpenCover.map 𝒰 i ≫ f)
          (_ : PullbackCone.fst s ≫ f = PullbackCone.snd s ≫ g)

Next tactic:
simp
@[reassoc]
theorem gluedLiftPullbackMap_snd (i j : 𝒰.J) :
    gluedLiftPullbackMap 𝒰 f g s i j ≫ pullback.snd = pullback.snd ≫ pullback.snd := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ gluedLiftPullbackMap 𝒰 f g s i j ≫ pullback.snd = pullback.snd ≫ pullback.snd

Next tactic:
delta gluedLiftPullbackMap
@[reassoc]
theorem gluedLiftPullbackMap_snd (i j : 𝒰.J) :
    gluedLiftPullbackMap 𝒰 f g s i j ≫ pullback.snd = pullback.snd ≫ pullback.snd := by
  delta gluedLiftPullbackMap
  -- Porting note : the original set of simp lemma is not sufficient, but as this is terminal
  -- I just let `simp` do its work
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
i j : 𝒰.J
⊢ (let_fun this :=
        (pullbackRightPullbackFstIso (PullbackCone.fst s) (OpenCover.map 𝒰 j) pullback.fst).hom ≫
          pullback.map (pullback.fst ≫ PullbackCone.fst s) (OpenCover.map 𝒰 j) (pullback.fst ≫ OpenCover.map 𝒰 i)
            (OpenCover.map 𝒰 j)
            ((pullbackSymmetry (PullbackCone.fst s) (OpenCover.map 𝒰 i)).hom ≫
              pullback.map (OpenCover.map 𝒰 i) (PullbackCone.fst s) (OpenCover.map 𝒰 i ≫ f) g (𝟙 (OpenCover.obj 𝒰 i))
                (PullbackCone.snd s) f (_ : OpenCover.map 𝒰 i ≫ f = 𝟙 (OpenCover.obj 𝒰 i) ≫ OpenCover.map 𝒰 i ≫ f)
                (_ : PullbackCone.fst s ≫ f = PullbackCone.snd s ≫ g))
            (𝟙 (OpenCover.obj 𝒰 j)) (𝟙 X)
            (_ :
              (pullback.fst ≫ PullbackCone.fst s) ≫ 𝟙 X =
                ((pullbackSymmetry (PullbackCone.fst s) (OpenCover.map 𝒰 i)).hom ≫
                    pullback.map (OpenCover.map 𝒰 i) (PullbackCone.fst s) (OpenCover.map 𝒰 i ≫ f) g
                      (𝟙 (OpenCover.obj 𝒰 i)) (PullbackCone.snd s) f
                      (_ : OpenCover.map 𝒰 i ≫ f = 𝟙 (OpenCover.obj 𝒰 i) ≫ OpenCover.map 𝒰 i ≫ f)
                      (_ : PullbackCone.fst s ≫ f = PullbackCone.snd s ≫ g)) ≫
                  pullback.fst ≫ OpenCover.map 𝒰 i)
            (_ : OpenCover.map 𝒰 j ≫ 𝟙 X = 𝟙 (OpenCover.obj 𝒰 j) ≫ OpenCover.map 𝒰 j);
      this) ≫
      pullback.snd =
    pullback.snd ≫ pullback.snd

Next tactic:
simp
/-- The lifted map `s.X ⟶ (gluing 𝒰 f g).glued` in order to show that `(gluing 𝒰 f g).glued` is
indeed the pullback.

Given a pullback cone `s`, we have the maps `s.fst ⁻¹' Uᵢ ⟶ Uᵢ` and
`s.fst ⁻¹' Uᵢ ⟶ s.X ⟶ Y` that we may lift to a map `s.fst ⁻¹' Uᵢ ⟶ Uᵢ ×[Z] Y`.

to glue these into a map `s.X ⟶ Uᵢ ×[Z] Y`, we need to show that the maps agree on
`(s.fst ⁻¹' Uᵢ) ×[s.X] (s.fst ⁻¹' Uⱼ) ⟶ Uᵢ ×[Z] Y`. This is achieved by showing that both of these
maps factors through `gluedLiftPullbackMap`.
-/
def gluedLift : s.pt ⟶ (gluing 𝒰 f g).glued := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
⊢ s.pt ⟶ GlueData.glued (gluing 𝒰 f g)

Next tactic:
fapply (𝒰.pullbackCover s.fst).glueMorphisms
/-- The lifted map `s.X ⟶ (gluing 𝒰 f g).glued` in order to show that `(gluing 𝒰 f g).glued` is
indeed the pullback.

Given a pullback cone `s`, we have the maps `s.fst ⁻¹' Uᵢ ⟶ Uᵢ` and
`s.fst ⁻¹' Uᵢ ⟶ s.X ⟶ Y` that we may lift to a map `s.fst ⁻¹' Uᵢ ⟶ Uᵢ ×[Z] Y`.

to glue these into a map `s.X ⟶ Uᵢ ×[Z] Y`, we need to show that the maps agree on
`(s.fst ⁻¹' Uᵢ) ×[s.X] (s.fst ⁻¹' Uⱼ) ⟶ Uᵢ ×[Z] Y`. This is achieved by showing that both of these
maps factors through `gluedLiftPullbackMap`.
-/
def gluedLift : s.pt ⟶ (gluing 𝒰 f g).glued := by
  fapply (𝒰.pullbackCover s.fst).glueMorphisms
  · 

Proof state:
case f
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
⊢ (x : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J) →
    OpenCover.obj (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)) x ⟶ GlueData.glued (gluing 𝒰 f g)

Next tactic:
exact fun i => (pullbackSymmetry _ _).hom ≫
      pullback.map _ _ _ _ (𝟙 _) s.snd f (Category.id_comp _).symm s.condition ≫
        (gluing 𝒰 f g).ι i
/-- The lifted map `s.X ⟶ (gluing 𝒰 f g).glued` in order to show that `(gluing 𝒰 f g).glued` is
indeed the pullback.

Given a pullback cone `s`, we have the maps `s.fst ⁻¹' Uᵢ ⟶ Uᵢ` and
`s.fst ⁻¹' Uᵢ ⟶ s.X ⟶ Y` that we may lift to a map `s.fst ⁻¹' Uᵢ ⟶ Uᵢ ×[Z] Y`.

to glue these into a map `s.X ⟶ Uᵢ ×[Z] Y`, we need to show that the maps agree on
`(s.fst ⁻¹' Uᵢ) ×[s.X] (s.fst ⁻¹' Uⱼ) ⟶ Uᵢ ×[Z] Y`. This is achieved by showing that both of these
maps factors through `gluedLiftPullbackMap`.
-/
def gluedLift : s.pt ⟶ (gluing 𝒰 f g).glued := by
  fapply (𝒰.pullbackCover s.fst).glueMorphisms
  · exact fun i => (pullbackSymmetry _ _).hom ≫
      pullback.map _ _ _ _ (𝟙 _) s.snd f (Category.id_comp _).symm s.condition ≫
        (gluing 𝒰 f g).ι i
  

Proof state:
case hf
C : Type u
inst✝¹ : Category.{v, u} C
X Y Z : Scheme
𝒰 : OpenCover X
f : X ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (i : 𝒰.J), HasPullback (OpenCover.map 𝒰 i ≫ f) g
s : PullbackCone f g
⊢ ∀ (x y : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J),
    pullback.fst ≫
        (pullbackSymmetry (PullbackCone.fst s) (OpenCover.map 𝒰 x)).hom ≫
          pullback.map (OpenCover.map 𝒰 x) (PullbackCone.fst s) (OpenCover.map 𝒰 x ≫ f) g (𝟙 (OpenCover.obj 𝒰 x))
              (PullbackCone.snd s) f (_ : OpenCover.map 𝒰 x ≫ f = 𝟙 (OpenCover.obj 𝒰 x) ≫ OpenCover.map 𝒰 x ≫ f)
              (_ : PullbackCone.fst s ≫ f = PullbackCone.snd s ≫ g) ≫
            GlueData.ι (gluing 𝒰 f g) x =
      pullback.snd ≫
        (pullbackSymmetry (PullbackCone.fst s) (OpenCover.map 𝒰 y)).hom ≫
          pullback.map (OpenCover.map 𝒰 y) (PullbackCone.fst s) (OpenCover.map 𝒰 y ≫ f) g (𝟙 (OpenCover.obj 𝒰 y))
              (PullbackCone.snd s) f (_ : OpenCover.map 𝒰 y ≫ f = 𝟙 (OpenCover.obj 𝒰 y) ≫ OpenCover.map 𝒰 y ≫ f)
              (_ : PullbackCone.fst s ≫ f = PullbackCone.snd s ≫ g) ≫
            GlueData.ι (gluing 𝒰 f g) y

Next tactic:
intro i j