l3lab/ntp-mathlib huggingface dataset:
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
⊢ IsColimit (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h))

Next tactic:
apply Cofork.IsColimit.mk' _ _
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
⊢ (s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)) →
    { l //
      Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ l = Cofork.π s ∧
        ∀
          {m :
            ((Functor.const WalkingParallelPair).obj
                    (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
                WalkingParallelPair.one ⟶
              ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one},
          Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s →
            m = l }

Next tactic:
intro s
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
⊢ { l //
    Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ l = Cofork.π s ∧
      ∀
        {m :
          ((Functor.const WalkingParallelPair).obj
                  (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
              WalkingParallelPair.one ⟶
            ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one},
        Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s → m = l }

Next tactic:
have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      rw [← Category.assoc, ← Category.assoc, s.condition]
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
⊢ RegularEpi.left ≫ f ≫ Cofork.π s = RegularEpi.right ≫ f ≫ Cofork.π s

Next tactic:
rw [← Category.assoc, ← Category.assoc, s.condition]
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      rw [← Category.assoc, ← Category.assoc, s.condition]
    

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
l₁ : RegularEpi.left ≫ f ≫ Cofork.π s = RegularEpi.right ≫ f ≫ Cofork.π s
⊢ { l //
    Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ l = Cofork.π s ∧
      ∀
        {m :
          ((Functor.const WalkingParallelPair).obj
                  (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
              WalkingParallelPair.one ⟶
            ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one},
        Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s → m = l }

Next tactic:
obtain ⟨l, hl⟩ := Cofork.IsColimit.desc' gr.isColimit (f ≫ Cofork.π s) l₁
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      rw [← Category.assoc, ← Category.assoc, s.condition]
    obtain ⟨l, hl⟩ := Cofork.IsColimit.desc' gr.isColimit (f ≫ Cofork.π s) l₁
    

Proof state:
case mk
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
l₁ : RegularEpi.left ≫ f ≫ Cofork.π s = RegularEpi.right ≫ f ≫ Cofork.π s
l :
  (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)).pt ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hl : Cofork.π (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)) ≫ l = f ≫ Cofork.π s
⊢ { l //
    Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ l = Cofork.π s ∧
      ∀
        {m :
          ((Functor.const WalkingParallelPair).obj
                  (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
              WalkingParallelPair.one ⟶
            ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one},
        Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s → m = l }

Next tactic:
obtain ⟨p, hp₁, _⟩ := PushoutCocone.IsColimit.desc' t _ _ hl.symm
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      rw [← Category.assoc, ← Category.assoc, s.condition]
    obtain ⟨l, hl⟩ := Cofork.IsColimit.desc' gr.isColimit (f ≫ Cofork.π s) l₁
    obtain ⟨p, hp₁, _⟩ := PushoutCocone.IsColimit.desc' t _ _ hl.symm
    

Proof state:
case mk.mk.intro
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
l₁ : RegularEpi.left ≫ f ≫ Cofork.π s = RegularEpi.right ≫ f ≫ Cofork.π s
l :
  (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)).pt ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hl : Cofork.π (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)) ≫ l = f ≫ Cofork.π s
p : (PushoutCocone.mk h k comm).pt ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hp₁ : PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p = Cofork.π s
right✝ : PushoutCocone.inr (PushoutCocone.mk h k comm) ≫ p = l
⊢ { l //
    Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ l = Cofork.π s ∧
      ∀
        {m :
          ((Functor.const WalkingParallelPair).obj
                  (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
              WalkingParallelPair.one ⟶
            ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one},
        Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s → m = l }

Next tactic:
refine' ⟨p, hp₁, _⟩
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      rw [← Category.assoc, ← Category.assoc, s.condition]
    obtain ⟨l, hl⟩ := Cofork.IsColimit.desc' gr.isColimit (f ≫ Cofork.π s) l₁
    obtain ⟨p, hp₁, _⟩ := PushoutCocone.IsColimit.desc' t _ _ hl.symm
    refine' ⟨p, hp₁, _⟩
    

Proof state:
case mk.mk.intro
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
l₁ : RegularEpi.left ≫ f ≫ Cofork.π s = RegularEpi.right ≫ f ≫ Cofork.π s
l :
  (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)).pt ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hl : Cofork.π (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)) ≫ l = f ≫ Cofork.π s
p : (PushoutCocone.mk h k comm).pt ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hp₁ : PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p = Cofork.π s
right✝ : PushoutCocone.inr (PushoutCocone.mk h k comm) ≫ p = l
⊢ ∀
    {m :
      ((Functor.const WalkingParallelPair).obj
              (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
          WalkingParallelPair.one ⟶
        ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one},
    Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s → m = p

Next tactic:
intro m w
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      rw [← Category.assoc, ← Category.assoc, s.condition]
    obtain ⟨l, hl⟩ := Cofork.IsColimit.desc' gr.isColimit (f ≫ Cofork.π s) l₁
    obtain ⟨p, hp₁, _⟩ := PushoutCocone.IsColimit.desc' t _ _ hl.symm
    refine' ⟨p, hp₁, _⟩
    intro m w
    

Proof state:
case mk.mk.intro
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
l₁ : RegularEpi.left ≫ f ≫ Cofork.π s = RegularEpi.right ≫ f ≫ Cofork.π s
l :
  (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)).pt ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hl : Cofork.π (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)) ≫ l = f ≫ Cofork.π s
p : (PushoutCocone.mk h k comm).pt ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hp₁ : PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p = Cofork.π s
right✝ : PushoutCocone.inr (PushoutCocone.mk h k comm) ≫ p = l
m :
  ((Functor.const WalkingParallelPair).obj
          (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
      WalkingParallelPair.one ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
w : Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s
⊢ m = p

Next tactic:
have z := w.trans hp₁.symm
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      rw [← Category.assoc, ← Category.assoc, s.condition]
    obtain ⟨l, hl⟩ := Cofork.IsColimit.desc' gr.isColimit (f ≫ Cofork.π s) l₁
    obtain ⟨p, hp₁, _⟩ := PushoutCocone.IsColimit.desc' t _ _ hl.symm
    refine' ⟨p, hp₁, _⟩
    intro m w
    have z := w.trans hp₁.symm
    

Proof state:
case mk.mk.intro
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
l₁ : RegularEpi.left ≫ f ≫ Cofork.π s = RegularEpi.right ≫ f ≫ Cofork.π s
l :
  (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)).pt ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hl : Cofork.π (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)) ≫ l = f ≫ Cofork.π s
p : (PushoutCocone.mk h k comm).pt ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hp₁ : PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p = Cofork.π s
right✝ : PushoutCocone.inr (PushoutCocone.mk h k comm) ≫ p = l
m :
  ((Functor.const WalkingParallelPair).obj
          (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
      WalkingParallelPair.one ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
w : Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s
z :
  Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m =
    PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p
⊢ m = p

Next tactic:
apply t.hom_ext
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      rw [← Category.assoc, ← Category.assoc, s.condition]
    obtain ⟨l, hl⟩ := Cofork.IsColimit.desc' gr.isColimit (f ≫ Cofork.π s) l₁
    obtain ⟨p, hp₁, _⟩ := PushoutCocone.IsColimit.desc' t _ _ hl.symm
    refine' ⟨p, hp₁, _⟩
    intro m w
    have z := w.trans hp₁.symm
    apply t.hom_ext
    

Proof state:
case mk.mk.intro
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
l₁ : RegularEpi.left ≫ f ≫ Cofork.π s = RegularEpi.right ≫ f ≫ Cofork.π s
l :
  (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)).pt ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hl : Cofork.π (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)) ≫ l = f ≫ Cofork.π s
p : (PushoutCocone.mk h k comm).pt ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hp₁ : PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p = Cofork.π s
right✝ : PushoutCocone.inr (PushoutCocone.mk h k comm) ≫ p = l
m :
  ((Functor.const WalkingParallelPair).obj
          (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
      WalkingParallelPair.one ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
w : Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s
z :
  Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m =
    PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p
⊢ ∀ (j : WalkingSpan), (PushoutCocone.mk h k comm).ι.app j ≫ m = (PushoutCocone.mk h k comm).ι.app j ≫ p

Next tactic:
apply (PushoutCocone.mk _ _ comm).coequalizer_ext
/-- The second leg of a pushout cocone is a regular epimorphism if the right component is too.

See also `Pushout.sndOfEpi` for the basic epimorphism version, and
`regularOfIsPushoutFstOfRegular` for the flipped version.
-/
def regularOfIsPushoutSndOfRegular {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S}
    [gr : RegularEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) :
    RegularEpi h where
  W := gr.W
  left := gr.left ≫ f
  right := gr.right ≫ f
  w := by rw [Category.assoc, Category.assoc, comm]; simp only [← Category.assoc, eq_whisker gr.w]
  isColimit := by
    apply Cofork.IsColimit.mk' _ _
    intro s
    have l₁ : gr.left ≫ f ≫ s.π = gr.right ≫ f ≫ s.π := by
      rw [← Category.assoc, ← Category.assoc, s.condition]
    obtain ⟨l, hl⟩ := Cofork.IsColimit.desc' gr.isColimit (f ≫ Cofork.π s) l₁
    obtain ⟨p, hp₁, _⟩ := PushoutCocone.IsColimit.desc' t _ _ hl.symm
    refine' ⟨p, hp₁, _⟩
    intro m w
    have z := w.trans hp₁.symm
    apply t.hom_ext
    apply (PushoutCocone.mk _ _ comm).coequalizer_ext
    · 

Proof state:
case mk.mk.intro.h₀
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y P Q R S : C
f : P ⟶ Q
g : P ⟶ R
h : Q ⟶ S
k : R ⟶ S
gr : RegularEpi g
comm : f ≫ h = g ≫ k
t : IsColimit (PushoutCocone.mk h k comm)
s : Cofork (RegularEpi.left ≫ f) (RegularEpi.right ≫ f)
l₁ : RegularEpi.left ≫ f ≫ Cofork.π s = RegularEpi.right ≫ f ≫ Cofork.π s
l :
  (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)).pt ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hl : Cofork.π (Cofork.ofπ g (_ : RegularEpi.left ≫ g = RegularEpi.right ≫ g)) ≫ l = f ≫ Cofork.π s
p : (PushoutCocone.mk h k comm).pt ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
hp₁ : PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p = Cofork.π s
right✝ : PushoutCocone.inr (PushoutCocone.mk h k comm) ≫ p = l
m :
  ((Functor.const WalkingParallelPair).obj
          (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)).pt).obj
      WalkingParallelPair.one ⟶
    ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one
w : Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m = Cofork.π s
z :
  Cofork.π (Cofork.ofπ h (_ : (RegularEpi.left ≫ f) ≫ h = (RegularEpi.right ≫ f) ≫ h)) ≫ m =
    PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p
⊢ PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ m = PushoutCocone.inl (PushoutCocone.mk h k comm) ≫ p

Next tactic:
exact z