module Cat.Diagram.Coequaliser {o β„“} (C : Precategory o β„“) where

CoequalisersπŸ”—

The coequaliser of two maps f,g:A→Bf, g : A \to B (if it exists), represents the largest quotient object of BB that identifies ff and gg.

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 public

Coequalisers are epicπŸ”—

Dually to the situation with equalisers, coequaliser arrows are always epic.

is-coequaliser→is-epic
  : βˆ€ {E} (coequ : Hom A E)
  β†’ is-coequaliser 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 f g c1
  β†’ is-coequaliser 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-coequaliser

Categories with all coequalisersπŸ”—

We also define a helper module for working with categories that have coequalisers of all parallel pairs of morphisms.

has-coequalisers : Type _
has-coequalisers = βˆ€ {a b} (f g : Hom a b) β†’ Coequaliser f g

module Coequalisers (all-coequalisers : has-coequalisers) where
  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