l3lab/ntp-mathlib huggingface dataset:
@[simp, reassoc]
theorem pullbackP1Iso_hom_snd (i : 𝒰.J) :
    (pullbackP1Iso 𝒰 f g i).hom ≫ pullback.snd = pullback.fst ≫ p2 𝒰 f g := by
  delta pullbackP1Iso; 

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
⊢ (Iso.mk
          (pullback.lift pullback.snd (pullback.fst ≫ p2 𝒰 f g)
            (_ : pullback.snd ≫ OpenCover.map 𝒰 i ≫ f = (pullback.fst ≫ p2 𝒰 f g) ≫ g))
          (pullback.lift (GlueData.ι (gluing 𝒰 f g) i) pullback.fst
            (_ : GlueData.ι (gluing 𝒰 f g) i ≫ p1 𝒰 f g = pullback.fst ≫ OpenCover.map 𝒰 i))).hom ≫
      pullback.snd =
    pullback.fst ≫ p2 𝒰 f g

Next tactic:
simp only [pullback.lift_snd]
@[simp, reassoc]
theorem pullbackP1Iso_inv_fst (i : 𝒰.J) :
    (pullbackP1Iso 𝒰 f g i).inv ≫ pullback.fst = (gluing 𝒰 f g).ι i := 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
⊢ (pullbackP1Iso 𝒰 f g i).inv ≫ pullback.fst = GlueData.ι (gluing 𝒰 f g) i

Next tactic:
delta pullbackP1Iso
@[simp, reassoc]
theorem pullbackP1Iso_inv_fst (i : 𝒰.J) :
    (pullbackP1Iso 𝒰 f g i).inv ≫ pullback.fst = (gluing 𝒰 f g).ι i := by
  delta pullbackP1Iso; 

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
⊢ (Iso.mk
          (pullback.lift pullback.snd (pullback.fst ≫ p2 𝒰 f g)
            (_ : pullback.snd ≫ OpenCover.map 𝒰 i ≫ f = (pullback.fst ≫ p2 𝒰 f g) ≫ g))
          (pullback.lift (GlueData.ι (gluing 𝒰 f g) i) pullback.fst
            (_ : GlueData.ι (gluing 𝒰 f g) i ≫ p1 𝒰 f g = pullback.fst ≫ OpenCover.map 𝒰 i))).inv ≫
      pullback.fst =
    GlueData.ι (gluing 𝒰 f g) i

Next tactic:
simp only [pullback.lift_fst]
@[simp, reassoc]
theorem pullbackP1Iso_inv_snd (i : 𝒰.J) :
    (pullbackP1Iso 𝒰 f g i).inv ≫ pullback.snd = pullback.fst := 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
⊢ (pullbackP1Iso 𝒰 f g i).inv ≫ pullback.snd = pullback.fst

Next tactic:
delta pullbackP1Iso
@[simp, reassoc]
theorem pullbackP1Iso_inv_snd (i : 𝒰.J) :
    (pullbackP1Iso 𝒰 f g i).inv ≫ pullback.snd = pullback.fst := by
  delta pullbackP1Iso; 

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
⊢ (Iso.mk
          (pullback.lift pullback.snd (pullback.fst ≫ p2 𝒰 f g)
            (_ : pullback.snd ≫ OpenCover.map 𝒰 i ≫ f = (pullback.fst ≫ p2 𝒰 f g) ≫ g))
          (pullback.lift (GlueData.ι (gluing 𝒰 f g) i) pullback.fst
            (_ : GlueData.ι (gluing 𝒰 f g) i ≫ p1 𝒰 f g = pullback.fst ≫ OpenCover.map 𝒰 i))).inv ≫
      pullback.snd =
    pullback.fst

Next tactic:
simp only [pullback.lift_snd]
@[simp, reassoc]
theorem pullbackP1Iso_hom_ι (i : 𝒰.J) :
    (pullbackP1Iso 𝒰 f g i).hom ≫ (gluing 𝒰 f g).ι i = pullback.fst := 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
⊢ (pullbackP1Iso 𝒰 f g i).hom ≫ GlueData.ι (gluing 𝒰 f g) i = pullback.fst

Next tactic:
rw [← pullbackP1Iso_inv_fst, Iso.hom_inv_id_assoc]
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f 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
s : PullbackCone f g
⊢ IsLimit (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g))

Next tactic:
apply PullbackCone.isLimitAux'
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  

Proof state:
case create
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 : PullbackCone f g) →
    { l //
      l ≫ PullbackCone.fst (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
          PullbackCone.fst s ∧
        l ≫ PullbackCone.snd (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
            PullbackCone.snd s ∧
          ∀ {m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt},
            m ≫ PullbackCone.fst (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
                PullbackCone.fst s →
              m ≫ PullbackCone.snd (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
                  PullbackCone.snd s →
                m = l }

Next tactic:
intro s
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  

Proof state:
case create
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✝ s : PullbackCone f g
⊢ { l //
    l ≫ PullbackCone.fst (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
        PullbackCone.fst s ∧
      l ≫ PullbackCone.snd (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
          PullbackCone.snd s ∧
        ∀ {m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt},
          m ≫ PullbackCone.fst (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
              PullbackCone.fst s →
            m ≫ PullbackCone.snd (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
                PullbackCone.snd s →
              m = l }

Next tactic:
refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  

Proof state:
case create
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✝ s : PullbackCone f g
⊢ ∀ {m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt},
    m ≫ PullbackCone.fst (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
        PullbackCone.fst s →
      m ≫ PullbackCone.snd (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) =
          PullbackCone.snd s →
        m = gluedLift 𝒰 f g s

Next tactic:
intro m h₁ h₂
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  

Proof state:
case create
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✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ PullbackCone.fst (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) = PullbackCone.fst s
h₂ : m ≫ PullbackCone.snd (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) = PullbackCone.snd s
⊢ m = gluedLift 𝒰 f g s

Next tactic:
change m ≫ p1 𝒰 f g = _ at h₁
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  

Proof state:
case create
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✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₂ : m ≫ PullbackCone.snd (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)) = PullbackCone.snd s
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
⊢ m = gluedLift 𝒰 f g s

Next tactic:
change m ≫ p2 𝒰 f g = _ at h₂
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  

Proof state:
case create
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✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
⊢ m = gluedLift 𝒰 f g s

Next tactic:
apply (𝒰.pullbackCover s.fst).hom_ext
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  apply (𝒰.pullbackCover s.fst).hom_ext
  

Proof state:
case create.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
s✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
⊢ ∀ (x : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J),
    OpenCover.map (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)) x ≫ m =
      OpenCover.map (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)) x ≫ gluedLift 𝒰 f g s

Next tactic:
intro i
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  apply (𝒰.pullbackCover s.fst).hom_ext
  intro i
  

Proof state:
case create.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
s✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
i : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J
⊢ OpenCover.map (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)) i ≫ m =
    OpenCover.map (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)) i ≫ gluedLift 𝒰 f g s

Next tactic:
rw [OpenCover.pullbackCover_map]
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  apply (𝒰.pullbackCover s.fst).hom_ext
  intro i
  rw [OpenCover.pullbackCover_map]
  

Proof state:
case create.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
s✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
i : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J
⊢ pullback.fst ≫ m = pullback.fst ≫ gluedLift 𝒰 f g s

Next tactic:
have := pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  apply (𝒰.pullbackCover s.fst).hom_ext
  intro i
  rw [OpenCover.pullbackCover_map]
  have := pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl
  

Proof state:
case create.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
s✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
i : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J
this : pullback m pullback.fst ≅ pullback (PullbackCone.fst s) (OpenCover.map 𝒰 i)
⊢ pullback.fst ≫ m = pullback.fst ≫ gluedLift 𝒰 f g s

Next tactic:
erw [(𝒰.pullbackCover s.fst).ι_glueMorphisms]
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  apply (𝒰.pullbackCover s.fst).hom_ext
  intro i
  rw [OpenCover.pullbackCover_map]
  have := pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl
  erw [(𝒰.pullbackCover s.fst).ι_glueMorphisms]
  

Proof state:
case create.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
s✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
i : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J
this : pullback m pullback.fst ≅ pullback (PullbackCone.fst s) (OpenCover.map 𝒰 i)
⊢ pullback.fst ≫ m =
    (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) ≫
        GlueData.ι (gluing 𝒰 f g) i

Next tactic:
rw [←
    cancel_epi
      (pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl).hom,
    Iso.trans_hom, Category.assoc, pullback.congrHom_hom, pullback.lift_fst_assoc,
    Category.comp_id, pullbackRightPullbackFstIso_hom_fst_assoc, pullback.condition]
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  apply (𝒰.pullbackCover s.fst).hom_ext
  intro i
  rw [OpenCover.pullbackCover_map]
  have := pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl
  erw [(𝒰.pullbackCover s.fst).ι_glueMorphisms]
  rw [←
    cancel_epi
      (pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl).hom,
    Iso.trans_hom, Category.assoc, pullback.congrHom_hom, pullback.lift_fst_assoc,
    Category.comp_id, pullbackRightPullbackFstIso_hom_fst_assoc, pullback.condition]
  

Proof state:
case create.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
s✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
i : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J
this : pullback m pullback.fst ≅ pullback (PullbackCone.fst s) (OpenCover.map 𝒰 i)
⊢ pullback.snd ≫ pullback.fst =
    ((pullbackRightPullbackFstIso (p1 𝒰 f g) (OpenCover.map 𝒰 i) m).hom ≫
        pullback.map (m ≫ p1 𝒰 f g) (OpenCover.map 𝒰 i) (PullbackCone.fst s) (OpenCover.map 𝒰 i) (𝟙 s.pt)
          (𝟙 (OpenCover.obj 𝒰 i)) (𝟙 X) (_ : (m ≫ p1 𝒰 f g) ≫ 𝟙 X = 𝟙 s.pt ≫ PullbackCone.fst s)
          (_ : OpenCover.map 𝒰 i ≫ 𝟙 X = 𝟙 (OpenCover.obj 𝒰 i) ≫ OpenCover.map 𝒰 i)) ≫
      (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) ≫
          GlueData.ι (gluing 𝒰 f g) i

Next tactic:
trans pullback.snd ≫ (pullbackP1Iso 𝒰 f g _).hom ≫ (gluing 𝒰 f g).ι _
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  apply (𝒰.pullbackCover s.fst).hom_ext
  intro i
  rw [OpenCover.pullbackCover_map]
  have := pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl
  erw [(𝒰.pullbackCover s.fst).ι_glueMorphisms]
  rw [←
    cancel_epi
      (pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl).hom,
    Iso.trans_hom, Category.assoc, pullback.congrHom_hom, pullback.lift_fst_assoc,
    Category.comp_id, pullbackRightPullbackFstIso_hom_fst_assoc, pullback.condition]
  trans pullback.snd ≫ (pullbackP1Iso 𝒰 f g _).hom ≫ (gluing 𝒰 f g).ι _
  · 

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✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
i : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J
this : pullback m pullback.fst ≅ pullback (PullbackCone.fst s) (OpenCover.map 𝒰 i)
⊢ pullback.snd ≫ pullback.fst = pullback.snd ≫ (pullbackP1Iso 𝒰 f g i).hom ≫ GlueData.ι (gluing 𝒰 f g) i

Next tactic:
congr 1
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  apply (𝒰.pullbackCover s.fst).hom_ext
  intro i
  rw [OpenCover.pullbackCover_map]
  have := pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl
  erw [(𝒰.pullbackCover s.fst).ι_glueMorphisms]
  rw [←
    cancel_epi
      (pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl).hom,
    Iso.trans_hom, Category.assoc, pullback.congrHom_hom, pullback.lift_fst_assoc,
    Category.comp_id, pullbackRightPullbackFstIso_hom_fst_assoc, pullback.condition]
  trans pullback.snd ≫ (pullbackP1Iso 𝒰 f g _).hom ≫ (gluing 𝒰 f g).ι _
  · congr 1; 

Proof state:
case 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
s✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
i : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J
this : pullback m pullback.fst ≅ pullback (PullbackCone.fst s) (OpenCover.map 𝒰 i)
⊢ pullback.fst = (pullbackP1Iso 𝒰 f g i).hom ≫ GlueData.ι (gluing 𝒰 f g) i

Next tactic:
rw [← pullbackP1Iso_hom_ι]
/-- The glued scheme (`(gluing 𝒰 f g).glued`) is indeed the pullback of `f` and `g`. -/
def gluedIsLimit : IsLimit (PullbackCone.mk _ _ (p_comm 𝒰 f g)) := by
  apply PullbackCone.isLimitAux'
  intro s
  refine' ⟨gluedLift 𝒰 f g s, gluedLift_p1 𝒰 f g s, gluedLift_p2 𝒰 f g s, _⟩
  intro m h₁ h₂
  change m ≫ p1 𝒰 f g = _ at h₁
  change m ≫ p2 𝒰 f g = _ at h₂
  apply (𝒰.pullbackCover s.fst).hom_ext
  intro i
  rw [OpenCover.pullbackCover_map]
  have := pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl
  erw [(𝒰.pullbackCover s.fst).ι_glueMorphisms]
  rw [←
    cancel_epi
      (pullbackRightPullbackFstIso (p1 𝒰 f g) (𝒰.map i) m ≪≫ pullback.congrHom h₁ rfl).hom,
    Iso.trans_hom, Category.assoc, pullback.congrHom_hom, pullback.lift_fst_assoc,
    Category.comp_id, pullbackRightPullbackFstIso_hom_fst_assoc, pullback.condition]
  trans pullback.snd ≫ (pullbackP1Iso 𝒰 f g _).hom ≫ (gluing 𝒰 f g).ι _
  · congr 1; rw [← pullbackP1Iso_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✝ s : PullbackCone f g
m : s.pt ⟶ (PullbackCone.mk (p1 𝒰 f g) (p2 𝒰 f g) (_ : p1 𝒰 f g ≫ f = p2 𝒰 f g ≫ g)).pt
h₁ : m ≫ p1 𝒰 f g = PullbackCone.fst s
h₂ : m ≫ p2 𝒰 f g = PullbackCone.snd s
i : (OpenCover.pullbackCover 𝒰 (PullbackCone.fst s)).J
this : pullback m pullback.fst ≅ pullback (PullbackCone.fst s) (OpenCover.map 𝒰 i)
⊢ pullback.snd ≫ (pullbackP1Iso 𝒰 f g i).hom ≫ GlueData.ι (gluing 𝒰 f g) i =
    ((pullbackRightPullbackFstIso (p1 𝒰 f g) (OpenCover.map 𝒰 i) m).hom ≫
        pullback.map (m ≫ p1 𝒰 f g) (OpenCover.map 𝒰 i) (PullbackCone.fst s) (OpenCover.map 𝒰 i) (𝟙 s.pt)
          (𝟙 (OpenCover.obj 𝒰 i)) (𝟙 X) (_ : (m ≫ p1 𝒰 f g) ≫ 𝟙 X = 𝟙 s.pt ≫ PullbackCone.fst s)
          (_ : OpenCover.map 𝒰 i ≫ 𝟙 X = 𝟙 (OpenCover.obj 𝒰 i) ≫ OpenCover.map 𝒰 i)) ≫
      (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) ≫
          GlueData.ι (gluing 𝒰 f g) i

Next tactic:
simp_rw [← Category.assoc]