module Cat.Regular where

Regular categories🔗

A regular category is a category with pullback-stable image factorisations. To define regular categories, we use the theory of orthogonal morphisms, specifically strong epimorphisms: A regular category is one where every morphism factors as a strong epimorphism followed by a monomorphism, and strong epimorphisms are stable under pullback.

At face value, it’s a bit weird to take the definition of regular categories to talk about strong, rather than regular, epimorphisms. But it turns out that strong epimorphisms correspond pretty directly to the idea of an image factorisation, or at least much more directly than regular epimorphisms do. As we shall see, in a regular category, every strong epimorphism is regular.

  record is-regular : Type (o ⊔ ℓ) where
      factor : ∀ {a b} (f : C.Hom a b) → Factorisation 𝒞 StrongEpi Mono f
      stable : is-pullback-stable 𝒞 (is-strong-epi 𝒞)
      has-is-lex : Finitely-complete 𝒞

    module factor {a b} (f : C.Hom a b) = Factorisation (factor f)
    module lex = Finitely-complete has-is-lex

We also introduce some more palatable names for the components of the provided factorisations: Letting be a map and its image factorisation, we refer to as to as a↠im[_], and as im[_]â†Șb. These latter two names have a placeholder for the morphism we are factoring.

    im[_] : ∀ {a b} (f : C.Hom a b) → C.Ob
    im[ f ] = factor f .Factorisation.mediating

    im[_]â†Șb : ∀ {a b} (f : C.Hom a b) → im[ f ] C.â†Ș b
    im[ f ]â†Șb = record { monic = out! (factor f .Factorisation.forget∈M) }

    a↠im[_] : ∀ {a b} (f : C.Hom a b) → C.Hom a im[ f ]
    a↠im[ f ] = factor f .Factorisation.mediate


Regular categories are interesting in the study of categorical logic since they have exactly the structure required for their subobject fibrations to interpret existential quantifiers, and for these to commute with substitution which, in this case, is interpreted as pullback.

We’ve already seen that, in a category with pullbacks, arbitrary morphisms induce an adjunction between the right adjoint models the substitution (base change) along and the left adjoint models the dependent sum over Between subobject categories, though, pullbacks are not enough structure: this can be seen type-theoretically by noting that, even if is a family of propositions, the sum will generally not be.

Instead, the existential quantifier must be truncated to work correctly, and it is this truncation that the pullback-stable image factorisations in a regular category exist to model. In a category with pullbacks and images, we have adjunctions now between However, the existence of images is not enough to guarantee they behave type-theoretically. In a regular category, since images are stable under pullback, the equation

holds as long as and fit into a pullback square, expressing that existential quantification commutes with substitution.

Another reason to be interested in regular categories is their well-behaved calculus of relations: any category with pullbacks has an associated bicategory of spans, but images are precisely what’s missing to interpret composition of relations. Indeed, the existential quantifier in a regular category allows us to interpret the formula for relational composition,

internally to an arbitrary category. Regularity comes in when we want to show that composition of relations is associative: indeed, associativity in the formula above, modulo associativity of the conjunction is exactly a question of commutativity between and substitution. It follows, but we do not establish here, that a category is regular exactly when its composition of relations is associative.

As a universe for interpreting logic, regular categories allow us to talk about formulae (in arbitrary contexts) consisting of conjunction, equality, truth, and existential quantification, and all of these connectives commute with substitution. This subset of logic is, unsurprisingly, called regular logic. For working with regular categories, one notes that is regular, and that regularity is preserved by slicing.

Strong epis are regular🔗

This section formalises the proof of A1.3.4 from (Johnstone 2002), which says that every strong epimorphism1 in a regular category is regular. Actually, we’ll show that every strong epimorphism in a regular category is effective: it’s the coequaliser of its kernel pair.

  -- Johnstone, A.1.3.4
  module _ (r : is-regular) {A B} (f : C.Hom A B) (is-s : is-strong-epi 𝒞 f) where
      module r = is-regular r
      module kp = Pullback (r.lex.pullbacks f f)
        renaming (apex to R ; p₁ to a ; p₂ to b)

For a strong epimorphism start by pulling back along itself to form the kernel pair We want to show that coequalises and which means that any morphism satisfying should have a unique factorisation through So, quantify over such morphisms and let’s get started.

    private module Make {C} {c : C.Hom A C} (w : c C.∘ a ≡ c C.∘ b) where

We start by calculating the image factorisation of

      dgh : Factorisation 𝒞 StrongEpi Mono ⟹ f , c ⟩
      dgh = r.factor ⟹ f , c ⟩
      module dgh = Factorisation dgh
        renaming (mediating to D ; forget to gh ; mediate to d)
      open dgh using (D ; d ; gh)

      g : C.Hom D B
      g = π₁ C.∘ gh

      h : C.Hom D C
      h = π₂ C.∘ gh

Following Johnstone, we show that is an isomorphism, so that is the factorisation we’re looking for.2 Since is an extremal epimorphism, any monomorphism through which it factors must be an iso. And since we have

it will suffice to show that is a monomorphism. So assume you’re given with Let’s show that Start by pulling back along obtaining

      g-monic : g
      g-monic {e} k l w' = out! dgh.forget∈M _ _ rem₈ where
        d×d = ×-functor .F₁ (d , d)
        module pb = Pullback (r.lex.pullbacks ⟹ k , l ⟩ d×d)
          renaming (p₁ to p ; apex to P ; p₂ to mn ; square to sq'-)
        open pb using (p ; P ; mn ; sq'-)
        m = π₁ C.∘ mn
        n = π₂ C.∘ mn
        sq' : ⟹ k C.∘ p , l C.∘ p ⟩ ≡ ⟹ d C.∘ m , d C.∘ n ⟩
        sq' = sym (⟚⟩∘ _) ∙ sq'- ∙ ⟚⟩-unique _ (C.pulll π₁∘⟚⟩ ∙ C.pullr refl)
                                               (C.pulll π₂∘⟚⟩ ∙ C.pullr refl)

We define a map into the kernel pair of factoring through Using this morphism we may conclude that (rem₁).

        q : C.Hom P R
        q = kp.universal $
          f ∘ m         ≡⟹ C.pushl (extend-π₁ dgh.factors ∙ C.pulll refl) âŸ©â‰Ą
          g ∘ d ∘ m     ≡˘⟹ refl⟩∘⟚ by-π₁ sq' âŸ©â‰ĄË˜
          g ∘ k ∘ p     ≡⟹ C.extendl w' âŸ©â‰Ą
          g ∘ l ∘ p     ≡⟹ refl⟩∘⟚ by-π₂ sq' âŸ©â‰Ą
          g ∘ d ∘ n     ≡˘⟹ C.pushl (extend-π₁ dgh.factors ∙ C.pulll refl) âŸ©â‰ĄË˜
          f ∘ n         ∎

        rem₁ = h ∘ k ∘ p     ≡⟹ refl⟩∘⟚ by-π₁ sq' âŸ©â‰Ą
               h ∘ d ∘ m     ≡⟹ pulll (pullr (sym dgh.factors) ∙ π₂∘⟚⟩) âŸ©â‰Ą
               c ∘ m         ≡˘⟹ refl⟩∘⟚ kp.p₁∘universal âŸ©â‰ĄË˜
               c ∘ a ∘ q     ≡⟹ extendl w âŸ©â‰Ą
               c ∘ b ∘ q     ≡⟹ refl⟩∘⟚ kp.p₂∘universal âŸ©â‰Ą
               c ∘ n         ≡˘⟹ pulll (pullr (sym dgh.factors) ∙ π₂∘⟚⟩) âŸ©â‰ĄË˜
               h ∘ d ∘ n     ≡˘⟹ refl⟩∘⟚ by-π₂ sq' âŸ©â‰ĄË˜
               h ∘ l ∘ p     ∎

We want to show that for which it will suffice for to be an epimorphism. Since we’re working in a regular category, we can show that is a strong epimorphism by showing that is a composite of strong epis. But is the composite and both of those maps are pullbacks of which is a strong epimorphism since it arises from an image factorisation.

This <details> tag contains the proof that and are pullbacks of You may choose to unfold or skip it.
        open is-pullback

        rem₂ : is-strong-epi 𝒞 (×-functor .F₁ (d , id))
        rem₂ = r.stable d π₁ {p2 = π₁} (out! dgh.mediate∈E) λ where
          .square → π₁∘⟚⟩
          .universal {p₁' = p₁'} {p₂'} p → ⟹ p₂' , π₂ ∘ p₁' ⟩
          .p₁∘universal {p₁' = p₁'} {p₂'} {p = p} → ⟚⟩∘ _
            ·· ap₂ ⟹_,_⟩ (pullr π₁∘⟚⟩ ∙ sym p) (pullr π₂∘⟚⟩ ∙ idl _)
            ·· sym (⟚⟩-unique _ refl refl)
          .p₂∘universal → π₁∘⟚⟩
          .unique {p = p} {lim'} q r → ⟚⟩-unique _ r $ sym $
            ap (π₂ ∘_) (sym q) ∙ pulll π₂∘⟚⟩ ∙ ap (_∘ lim') (idl _)

        rem₃ : is-strong-epi 𝒞 (×-functor .F₁ (id , d))
        rem₃ = r.stable d π₂ {p2 = π₂} (out! dgh.mediate∈E) λ where
          .square → π₂∘⟚⟩
          .universal {p₁' = p₁'} {p₂'} p → ⟹ π₁ ∘ p₁' , p₂' ⟩
          .p₁∘universal {p = p} → ⟚⟩∘ _
            ·· ap₂ ⟹_,_⟩ (pullr π₁∘⟚⟩ ∙ idl _) (pullr π₂∘⟚⟩)
            ·· sym (⟚⟩-unique _ refl p)
          .p₂∘universal → π₂∘⟚⟩
          .unique {p = p} {lim'} q r → ⟚⟩-unique _
            (sym (ap (π₁ ∘_) (sym q) ∙ pulll π₁∘⟚⟩ ∙ ap (_∘ lim') (idl _)))

        rem₄ = sym (×-functor .F-∘ _ _)
             ∙ ap (×-functor .F₁) (Σ-pathp (idl _) (idr _))

So is a strong epimorphism by the above remarks, and is a pullback of so it is also strong epic (rem₆); We obtain (rem₇). By pushing some symbols, this gives (rem₈), but is a monomorphism by construction, so — so is also monic.

        rem₅ : is-strong-epi 𝒞 d×d
        rem₅ = subst (is-strong-epi 𝒞) rem₄ (strong-epi-compose 𝒞 _ _ rem₂ rem₃)

        rem₆ : is-strong-epi 𝒞 p
        rem₆ = r.stable _ _ rem₅ pb.has-is-pb

        rem₇ : h ∘ k ≡ h ∘ l
        rem₇ = rem₆ .fst _ _ $
          (h ∘ k) ∘ p   ≡⟹ sym (assoc _ _ _) ∙ rem₁ âŸ©â‰Ą
          h ∘ l ∘ p     ≡⟹ pulll refl âŸ©â‰Ą
          (h ∘ l) ∘ p   ∎

        rem₈ : gh C.∘ k ≡ gh C.∘ l
        rem₈ =
          gh ∘ k              ≡⟹ ⟚⟩-unique _ refl refl ⟩∘⟚refl âŸ©â‰Ą
          ⟹ g , h ⟩ ∘ k       ≡⟹ ⟚⟩∘ _ âŸ©â‰Ą
          ⟹ g ∘ k , h ∘ k ⟩   ≡⟹ ap₂ ⟹_,_⟩ w' rem₇ âŸ©â‰Ą
          ⟹ g ∘ l , h ∘ l ⟩   ≡˘⟹ ⟚⟩∘ _ âŸ©â‰ĄË˜
          ⟹ g , h ⟩ ∘ l       ≡˘⟹ ⟚⟩-unique _ refl refl ⟩∘⟚refl âŸ©â‰ĄË˜
          gh ∘ l              ∎

Having shown that is monic, and knowing that — a strong (thus extremal) epimorphism — factors through it, we conclude that is an isomorphism. It remains to compute that which we do below.

      compute =
        (h ∘ g.from) ∘ f                           ≡⟹ pullr refl ∙ pullr refl âŸ©â‰Ą
        π₂ ∘ ∘ g.from ∘ f                   ≡⟹ refl ⟩∘⟚ ⟚⟩-unique _ refl refl ⟩∘⟚ refl âŸ©â‰Ą
        π₂ ∘ ⟹ g , h ⟩ ∘ g.from ∘ f                ≡⟹ refl⟩∘⟚ ⟚⟩∘ _ âŸ©â‰Ą
        π₂ ∘ ⟹ g ∘ g.from ∘ f , h ∘ g.from ∘ f ⟩   ≡⟹ π₂∘⟚⟩ âŸ©â‰Ą
        h ∘ g.from ∘ f                             ≡⟹ refl⟩∘⟚ g-ortho.p .centre .snd .fst âŸ©â‰Ą
        h ∘ dgh.d                                  ≡⟹ pullr (sym dgh.factors) âŸ©â‰Ą
        π₂ ∘ ⟹ f , c ⟩                             ≡⟹ π₂∘⟚⟩ âŸ©â‰Ą
        c                                          ∎

This proves that an arbitrary strong epi, coequalises its kernel pair. It’s an effective epimorphism! So it’s definitely the case that it coequalises some pair of maps.

    open is-regular-epi renaming (r to Kp)
    open is-coequaliser
    is-strong-epi→is-regular-epi : is-regular-epi 𝒞 f
    is-strong-epi→is-regular-epi = go where
      go : is-regular-epi 𝒞 f
      go .Kp = kp.R
      go .arr₁ = kp.a
      go .arr₂ = kp.b
      go .has-is-coeq .coequal = kp.square
      go .has-is-coeq .universal w = Make.h w ∘ Make.g.from w
      go .has-is-coeq .factors {e' = e'} {p = w} = Make.compute w
      go .has-is-coeq .unique {e' = e'} {p = p} {colim} q = is-s .fst _ _ $
        colim ∘ f                      ≡⟹ q âŸ©â‰Ą
        e'                             ≡˘⟹ Make.compute p âŸ©â‰ĄË˜
        (Make.h p ∘ Make.g.from p) ∘ f ∎

  1. Note: Johnstone prefers to work with “covers” instead, which in our lingo are extremal epimorphisms. In a finitely complete category, strong and extremal epimorphisms coincide↩

  2. Johnstone says it’s clearly unique, but the tiny calculation is included at the end of the proof since it wasn’t clear to me↩


  • Johnstone, Peter T. 2002. Sketches of an Elephant: a Topos Theory Compendium. Oxford Logic Guides. New York, NY: Oxford Univ. Press.