module Cat.Diagram.Coequaliser wheremodule _ {o β} (C : Precategory o β) where
  open Cat.Reasoning C
  private variable
    A B : Ob
    f g h : Hom A BCoequalisersπ
The coequaliser of two maps (if it exists), represents the largest quotient object of that identifies and
  record is-coequaliser {E} (f g : Hom A B) (coeq : Hom B E) : Type (o β β) where
    field
      coequal    : coeq β f β‘ coeq β g
      universal  : β {F} {e' : Hom B F} (p : e' β f β‘ e' β g) β Hom E F
      factors    : β {F} {e' : Hom B F} {p : e' β f β‘ e' β g}
                 β universal p β coeq β‘ e'
      unique     : β {F} {e' : Hom B F} {p : e' β f β‘ e' β g} {colim : Hom E F}
                 β colim β coeq β‘ e'
                 β colim β‘ universal p
    uniqueβ
      : β {F} {e' : Hom B F}  {o1 o2 : Hom E F}
      β (e' β f β‘ e' β g)
      β o1 β coeq β‘ e'
      β o2 β coeq β‘ e'
      β o1 β‘ o2
    uniqueβ p q r = unique {p = p} q β sym (unique r)
    id-coequalise : id β‘ universal coequal
    id-coequalise = unique (idl _)There is also a convenient bundling of an coequalising arrow together with its codomain:
  record Coequaliser (f g : Hom A B) : Type (o β β) where
    field
      {coapex}  : Ob
      coeq      : Hom B coapex
      has-is-coeq : is-coequaliser f g coeq
    open is-coequaliser has-is-coeq publicCoequalisers are epicπ
Dually to the situation with equalisers, coequaliser arrows are always epic.
module _ {o β} {C : Precategory o β} where
  open Cat.Reasoning C
  private variable
    A B : Ob
    f g h : Hom A B  is-coequaliserβis-epic
    : β {E} (coequ : Hom A E)
    β is-coequaliser C f g coequ
    β is-epic coequ
  is-coequaliserβis-epic {f = f} {g = g} equ equalises h i p =
    h                            β‘β¨ unique p β©
    universal (extendr coequal) β‘Λβ¨ unique refl β©
    i                            β
    where open is-coequaliser equalises
  coequaliser-unique
    : β {E E'} {c1 : Hom A E} {c2 : Hom A E'}
    β is-coequaliser C f g c1
    β is-coequaliser C f g c2
    β E β
 E'
  coequaliser-unique {c1 = c1} {c2} co1 co2 = make-iso
    (co1 .universal {e' = c2} (co2 .coequal))
    (co2 .universal {e' = c1} (co1 .coequal))
    (uniqueβ co2 (co2 .coequal) (pullr (co2 .factors) β co1 .factors) (idl _))
    (uniqueβ co1 (co1 .coequal) (pullr (co1 .factors) β co2 .factors) (idl _))
    where open is-coequaliserCategories with all coequalisersπ
We also define a helper module for working with categories that have coequalisers of all parallel pairs of morphisms.
has-coequalisers : β {o β} β Precategory o β β Type _
has-coequalisers C = β {a b} (f g : Hom a b) β Coequaliser C f g
  where open Precategory C
module Coequalisers
  {o β}
  (C : Precategory o β)
  (all-coequalisers : has-coequalisers C)
  where
  open Cat.Reasoning C
  module coequaliser {a b} (f g : Hom a b) = Coequaliser (all-coequalisers f g)
  Coequ : β {a b} (f g : Hom a b) β Ob
  Coequ = coequaliser.coapex