l3lab/ntp-mathlib huggingface dataset:
instance equalizer_ι_is_local_ring_hom' (F : WalkingParallelPairᵒᵖ ⥤ CommRingCat.{u}) :
    IsLocalRingHom (limit.π F (Opposite.op WalkingParallelPair.one)) := by
  

Proof state:
A B : CommRingCat
f g : A ⟶ B
F : WalkingParallelPairᵒᵖ ⥤ CommRingCat
⊢ IsLocalRingHom (limit.π F (op one))

Next tactic:
have : _ = limit.π F (walkingParallelPairOpEquiv.functor.obj _) :=
    (limit.isoLimitCone_inv_π
        ⟨_, IsLimit.whiskerEquivalence (limit.isLimit F) walkingParallelPairOpEquiv⟩
        WalkingParallelPair.zero : _)
instance equalizer_ι_is_local_ring_hom' (F : WalkingParallelPairᵒᵖ ⥤ CommRingCat.{u}) :
    IsLocalRingHom (limit.π F (Opposite.op WalkingParallelPair.one)) := by
  have : _ = limit.π F (walkingParallelPairOpEquiv.functor.obj _) :=
    (limit.isoLimitCone_inv_π
        ⟨_, IsLimit.whiskerEquivalence (limit.isLimit F) walkingParallelPairOpEquiv⟩
        WalkingParallelPair.zero : _)
  

Proof state:
A B : CommRingCat
f g : A ⟶ B
F : WalkingParallelPairᵒᵖ ⥤ CommRingCat
this :
  (limit.isoLimitCone
          { cone := Cone.whisker walkingParallelPairOpEquiv.functor (limit.cone F),
            isLimit := IsLimit.whiskerEquivalence (limit.isLimit F) walkingParallelPairOpEquiv }).inv ≫
      limit.π (walkingParallelPairOpEquiv.functor ⋙ F) zero =
    limit.π F (walkingParallelPairOpEquiv.functor.obj zero)
⊢ IsLocalRingHom (limit.π F (op one))

Next tactic:
erw [← this]
instance equalizer_ι_is_local_ring_hom' (F : WalkingParallelPairᵒᵖ ⥤ CommRingCat.{u}) :
    IsLocalRingHom (limit.π F (Opposite.op WalkingParallelPair.one)) := by
  have : _ = limit.π F (walkingParallelPairOpEquiv.functor.obj _) :=
    (limit.isoLimitCone_inv_π
        ⟨_, IsLimit.whiskerEquivalence (limit.isLimit F) walkingParallelPairOpEquiv⟩
        WalkingParallelPair.zero : _)
  erw [← this]
  

Proof state:
A B : CommRingCat
f g : A ⟶ B
F : WalkingParallelPairᵒᵖ ⥤ CommRingCat
this :
  (limit.isoLimitCone
          { cone := Cone.whisker walkingParallelPairOpEquiv.functor (limit.cone F),
            isLimit := IsLimit.whiskerEquivalence (limit.isLimit F) walkingParallelPairOpEquiv }).inv ≫
      limit.π (walkingParallelPairOpEquiv.functor ⋙ F) zero =
    limit.π F (walkingParallelPairOpEquiv.functor.obj zero)
⊢ IsLocalRingHom
    ((limit.isoLimitCone
          { cone := Cone.whisker walkingParallelPairOpEquiv.functor (limit.cone F),
            isLimit := IsLimit.whiskerEquivalence (limit.isLimit F) walkingParallelPairOpEquiv }).inv ≫
      limit.π (walkingParallelPairOpEquiv.functor ⋙ F) zero)

Next tactic:
infer_instance
/-- In the category of `CommRingCat`, the pullback of `f : A ⟶ C` and `g : B ⟶ C` is the `eqLocus`
of the two maps `A × B ⟶ C`. This is the constructed pullback cone.
-/
def pullbackCone {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) : PullbackCone f g :=
  PullbackCone.mk
    (CommRingCat.ofHom <|
      (RingHom.fst A B).comp
        (RingHom.eqLocus (f.comp (RingHom.fst A B)) (g.comp (RingHom.snd A B))).subtype)
    (CommRingCat.ofHom <|
      (RingHom.snd A B).comp
        (RingHom.eqLocus (f.comp (RingHom.fst A B)) (g.comp (RingHom.snd A B))).subtype)
    (by
      

Proof state:
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
⊢ ofHom
        (RingHom.comp (RingHom.fst ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) ≫
      f =
    ofHom
        (RingHom.comp (RingHom.snd ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) ≫
      g

Next tactic:
ext ⟨x, e⟩
/-- In the category of `CommRingCat`, the pullback of `f : A ⟶ C` and `g : B ⟶ C` is the `eqLocus`
of the two maps `A × B ⟶ C`. This is the constructed pullback cone.
-/
def pullbackCone {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) : PullbackCone f g :=
  PullbackCone.mk
    (CommRingCat.ofHom <|
      (RingHom.fst A B).comp
        (RingHom.eqLocus (f.comp (RingHom.fst A B)) (g.comp (RingHom.snd A B))).subtype)
    (CommRingCat.ofHom <|
      (RingHom.snd A B).comp
        (RingHom.eqLocus (f.comp (RingHom.fst A B)) (g.comp (RingHom.snd A B))).subtype)
    (by
      ext ⟨x, e⟩
      

Proof state:
case w.mk
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
x : ↑A × ↑B
e : x ∈ RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))
⊢ (ofHom
          (RingHom.comp (RingHom.fst ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) ≫
        f)
      { val := x, property := e } =
    (ofHom
          (RingHom.comp (RingHom.snd ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) ≫
        g)
      { val := x, property := e }

Next tactic:
simpa [CommRingCat.ofHom] using e
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  

Proof state:
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
⊢ IsLimit (pullbackCone f g)

Next tactic:
fapply PullbackCone.IsLimit.mk
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · 

Proof state:
case lift
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
⊢ (s : PullbackCone f g) →
    s.pt ⟶ of ↥(RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))

Next tactic:
intro s
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    

Proof state:
case lift
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
⊢ s.pt ⟶ of ↥(RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))

Next tactic:
apply (s.fst.prod s.snd).codRestrict
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    

Proof state:
case lift.h
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
⊢ ∀ (x : ↑s.pt),
    (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s)) x ∈
      RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))

Next tactic:
intro x
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    

Proof state:
case lift.h
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
x : ↑s.pt
⊢ (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s)) x ∈
    RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))

Next tactic:
exact congr_arg (fun f : s.pt →+* C => f x) s.condition
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · 

Proof state:
case fac_left
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
⊢ ∀ (s : PullbackCone f g),
    RingHom.codRestrict (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s))
          (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
          (_ : ∀ (x : ↑s.pt), (PullbackCone.fst s ≫ f) x = (PullbackCone.snd s ≫ g) x) ≫
        ofHom
          (RingHom.comp (RingHom.fst ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
      PullbackCone.fst s

Next tactic:
intro s
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    

Proof state:
case fac_left
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
⊢ RingHom.codRestrict (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s))
        (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
        (_ : ∀ (x : ↑s.pt), (PullbackCone.fst s ≫ f) x = (PullbackCone.snd s ≫ g) x) ≫
      ofHom
        (RingHom.comp (RingHom.fst ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.fst s

Next tactic:
ext x
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    

Proof state:
case fac_left.w
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
x : (forget CommRingCat).obj s.pt
⊢ (RingHom.codRestrict (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s))
          (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
          (_ : ∀ (x : ↑s.pt), (PullbackCone.fst s ≫ f) x = (PullbackCone.snd s ≫ g) x) ≫
        ofHom
          (RingHom.comp (RingHom.fst ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))))
      x =
    (PullbackCone.fst s) x

Next tactic:
rfl
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · 

Proof state:
case fac_right
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
⊢ ∀ (s : PullbackCone f g),
    RingHom.codRestrict (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s))
          (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
          (_ : ∀ (x : ↑s.pt), (PullbackCone.fst s ≫ f) x = (PullbackCone.snd s ≫ g) x) ≫
        ofHom
          (RingHom.comp (RingHom.snd ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
      PullbackCone.snd s

Next tactic:
intro s
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · intro s
    

Proof state:
case fac_right
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
⊢ RingHom.codRestrict (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s))
        (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
        (_ : ∀ (x : ↑s.pt), (PullbackCone.fst s ≫ f) x = (PullbackCone.snd s ≫ g) x) ≫
      ofHom
        (RingHom.comp (RingHom.snd ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.snd s

Next tactic:
ext x
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · intro s
    ext x
    

Proof state:
case fac_right.w
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
x : (forget CommRingCat).obj s.pt
⊢ (RingHom.codRestrict (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s))
          (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
          (_ : ∀ (x : ↑s.pt), (PullbackCone.fst s ≫ f) x = (PullbackCone.snd s ≫ g) x) ≫
        ofHom
          (RingHom.comp (RingHom.snd ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))))
      x =
    (PullbackCone.snd s) x

Next tactic:
rfl
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · intro s
    ext x
    rfl
  · 

Proof state:
case uniq
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
⊢ ∀ (s : PullbackCone f g)
    (m : s.pt ⟶ of ↥(RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))),
    m ≫
          ofHom
            (RingHom.comp (RingHom.fst ↑A ↑B)
              (Subring.subtype
                (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
        PullbackCone.fst s →
      m ≫
            ofHom
              (RingHom.comp (RingHom.snd ↑A ↑B)
                (Subring.subtype
                  (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
          PullbackCone.snd s →
        m =
          RingHom.codRestrict (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s))
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
            (_ : ∀ (x : ↑s.pt), (PullbackCone.fst s ≫ f) x = (PullbackCone.snd s ≫ g) x)

Next tactic:
intro s m e₁ e₂
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · intro s
    ext x
    rfl
  · intro s m e₁ e₂
    

Proof state:
case uniq
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
m : s.pt ⟶ of ↥(RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
e₁ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.fst ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.fst s
e₂ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.snd ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.snd s
⊢ m =
    RingHom.codRestrict (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s))
      (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
      (_ : ∀ (x : ↑s.pt), (PullbackCone.fst s ≫ f) x = (PullbackCone.snd s ≫ g) x)

Next tactic:
refine RingHom.ext fun (x : s.pt) => Subtype.ext ?_
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · intro s
    ext x
    rfl
  · intro s m e₁ e₂
    refine RingHom.ext fun (x : s.pt) => Subtype.ext ?_
    

Proof state:
case uniq
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
m : s.pt ⟶ of ↥(RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
e₁ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.fst ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.fst s
e₂ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.snd ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.snd s
x : ↑s.pt
⊢ ↑(m x) =
    ↑((RingHom.codRestrict (RingHom.prod (PullbackCone.fst s) (PullbackCone.snd s))
          (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
          (_ : ∀ (x : ↑s.pt), (PullbackCone.fst s ≫ f) x = (PullbackCone.snd s ≫ g) x))
        x)

Next tactic:
change (m x).1 = (_, _)
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · intro s
    ext x
    rfl
  · intro s m e₁ e₂
    refine RingHom.ext fun (x : s.pt) => Subtype.ext ?_
    change (m x).1 = (_, _)
    

Proof state:
case uniq
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
m : s.pt ⟶ of ↥(RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
e₁ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.fst ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.fst s
e₂ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.snd ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.snd s
x : ↑s.pt
⊢ ↑(m x) = ((PullbackCone.fst s) x, (PullbackCone.snd s) x)

Next tactic:
have eq1 := (congr_arg (fun f : s.pt →+* A => f x) e₁ : _)
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · intro s
    ext x
    rfl
  · intro s m e₁ e₂
    refine RingHom.ext fun (x : s.pt) => Subtype.ext ?_
    change (m x).1 = (_, _)
    have eq1 := (congr_arg (fun f : s.pt →+* A => f x) e₁ : _)
    

Proof state:
case uniq
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
m : s.pt ⟶ of ↥(RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
e₁ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.fst ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.fst s
e₂ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.snd ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.snd s
x : ↑s.pt
eq1 :
  (m ≫
        ofHom
          (RingHom.comp (RingHom.fst ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))))
      x =
    (PullbackCone.fst s) x
⊢ ↑(m x) = ((PullbackCone.fst s) x, (PullbackCone.snd s) x)

Next tactic:
have eq2 := (congr_arg (fun f : s.pt →+* B => f x) e₂ : _)
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · intro s
    ext x
    rfl
  · intro s m e₁ e₂
    refine RingHom.ext fun (x : s.pt) => Subtype.ext ?_
    change (m x).1 = (_, _)
    have eq1 := (congr_arg (fun f : s.pt →+* A => f x) e₁ : _)
    have eq2 := (congr_arg (fun f : s.pt →+* B => f x) e₂ : _)
    

Proof state:
case uniq
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
m : s.pt ⟶ of ↥(RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
e₁ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.fst ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.fst s
e₂ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.snd ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.snd s
x : ↑s.pt
eq1 :
  (m ≫
        ofHom
          (RingHom.comp (RingHom.fst ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))))
      x =
    (PullbackCone.fst s) x
eq2 :
  (m ≫
        ofHom
          (RingHom.comp (RingHom.snd ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))))
      x =
    (PullbackCone.snd s) x
⊢ ↑(m x) = ((PullbackCone.fst s) x, (PullbackCone.snd s) x)

Next tactic:
rw [← eq1, ← eq2]
/-- The constructed pullback cone is indeed the limit. -/
def pullbackConeIsLimit {A B C : CommRingCat.{u}} (f : A ⟶ C) (g : B ⟶ C) :
    IsLimit (pullbackCone f g) := by
  fapply PullbackCone.IsLimit.mk
  · intro s
    apply (s.fst.prod s.snd).codRestrict
    intro x
    exact congr_arg (fun f : s.pt →+* C => f x) s.condition
  · intro s
    ext x
    rfl
  · intro s
    ext x
    rfl
  · intro s m e₁ e₂
    refine RingHom.ext fun (x : s.pt) => Subtype.ext ?_
    change (m x).1 = (_, _)
    have eq1 := (congr_arg (fun f : s.pt →+* A => f x) e₁ : _)
    have eq2 := (congr_arg (fun f : s.pt →+* B => f x) e₂ : _)
    rw [← eq1, ← eq2]
    

Proof state:
case uniq
A B C : CommRingCat
f : A ⟶ C
g : B ⟶ C
s : PullbackCone f g
m : s.pt ⟶ of ↥(RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B)))
e₁ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.fst ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.fst s
e₂ :
  m ≫
      ofHom
        (RingHom.comp (RingHom.snd ↑A ↑B)
          (Subring.subtype
            (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))) =
    PullbackCone.snd s
x : ↑s.pt
eq1 :
  (m ≫
        ofHom
          (RingHom.comp (RingHom.fst ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))))
      x =
    (PullbackCone.fst s) x
eq2 :
  (m ≫
        ofHom
          (RingHom.comp (RingHom.snd ↑A ↑B)
            (Subring.subtype
              (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))))
      x =
    (PullbackCone.snd s) x
⊢ ↑(m x) =
    ((m ≫
          ofHom
            (RingHom.comp (RingHom.fst ↑A ↑B)
              (Subring.subtype
                (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))))
        x,
      (m ≫
          ofHom
            (RingHom.comp (RingHom.snd ↑A ↑B)
              (Subring.subtype
                (RingHom.eqLocus (RingHom.comp f (RingHom.fst ↑A ↑B)) (RingHom.comp g (RingHom.snd ↑A ↑B))))))
        x)

Next tactic:
rfl