module Cat.Diagram.Limit.Finite where
Finitely complete categoriesπ
A category is said to be finitely complete if it admits limits for every diagram with a finite shape.
is-finitely-complete : TypeΟ is-finitely-complete = β {o β} {D : Precategory o β} β is-finite-precategory D β (F : Functor D C) β Limit F
Similarly to the case with arbitrary limits, we can get away with only the following common shapes of limits:
- A terminal object (limit over the empty diagram)
- Binary products (limits over diagrams of the form that is, two points)
- Binary equalisers (limits over diagrams of the form
- Binary pullbacks (limits over diagrams of the form
In reality, the list above has some redundancy. Since we can build products out of pullbacks and a terminal object, and conversely we can build pullbacks out of products and equalisers, either of the following subsets suffices:
- A terminal object, binary products, binary equalisers;
- A terminal object and binary pullbacks.
For proving that a thin category is finitely complete, given that equalisers are trivial and pullbacks coincide with products, it suffices to give a terminal object and binary products.
record Finitely-complete : Type (β β β') where field terminal : Terminal C products : has-products C equalisers : has-equalisers C pullbacks : has-pullbacks C Eq : β {A B} (f g : Hom A B) β Ob Eq f g = equalisers f g .Equaliser.apex Pb : β {A B C} (f : Hom A C) (g : Hom B C) β Ob Pb f g = pullbacks f g .Pullback.apex module Products = Binary-products C products open Products using (_ββ_) public open Finitely-complete
As promised, the two definitions imply each other, assuming that is a univalent category (which is required to go from binary products to finite products).
Finitely-completeβis-finitely-complete : is-category C β Finitely-complete β is-finitely-complete Finitely-completeβis-finitely-complete cat Flim finite = limit-as-equaliser-of-product (Cartesianβfinite-products (Flim .terminal) (Flim .products) cat (finite .has-finite-Ob)) (Cartesianβfinite-products (Flim .terminal) (Flim .products) cat (finite .has-finite-Arrows)) (Flim .equalisers) is-finitely-completeβFinitely-complete : is-finitely-complete β Finitely-complete is-finitely-completeβFinitely-complete flim = Flim where Flim : Finitely-complete Flim .terminal = LimitβTerminal C (flim finite-cat _) Flim .products a b = LimitβProduct C (flim Disc-finite _) Flim .equalisers f g = LimitβEqualiser C (flim Β·βΒ·-finite _) Flim .pullbacks f g = LimitβPullback C {lzero} {lzero} (flim Β·βΒ·βΒ·-finite _)
With equalisersπ
We now prove that having products and equalisers suffices to have all pullbacks; Thus a terminal object, binary products and binary equalisers suffice for finite completeness.
The main result is as follows: Let be a (the) product of and with its projections called and Letting be a cospan, if the composites and have an equaliser then the square
is a pullback. Now, that description is almost entirely abstract-nonsensical, because (for generality) we do not use any βcanonicalβ products or equalisers If we work slightly more concretely, then this can be read as building the pullback as the largest subobject of where agree. In particular, the pullback we want is the object in the commutative diagram below.
product-equaliserβpullback : β {E P X Y Z} {p1 : Hom P X} {p2 : Hom P Y} {f : Hom X Z} {g : Hom Y Z} {e : Hom E P} β is-product C p1 p2 β is-equaliser C (f β p1) (g β p2) e β is-pullback C (p1 β e) f (p2 β e) g product-equaliserβpullback {p1 = p1} {p2} {f} {g} {e} prod eq = pb where open is-pullback module eq = is-equaliser eq module pr = is-product prod pb : is-pullback C _ _ _ _ pb .square = assoc _ _ _ β eq.equal β sym (assoc _ _ _)
To show that this object really is a pullback of and note that we can factor any pair of arrows and through the Cartesian product and use the universal property of equalisers to factor that as a unique arrow
pb .universal {pβ' = pβ'} {pβ' = pβ'} p = eq.universal {e' = pr.β¨ pβ' , pβ' β©pr.} ( (f β p1) β pr.β¨ pβ' , pβ' β©pr. β‘β¨ pullr pr.Οβββ¨β© β©β‘ f β pβ' β‘β¨ p β©β‘ g β pβ' β‘Λβ¨ pullr pr.Οβββ¨β© β©β‘Λ (g β p2) β pr.β¨ pβ' , pβ' β©pr. β ) pb .pββuniversal = pullr eq.factors β pr.Οβββ¨β© pb .pββuniversal = pullr eq.factors β pr.Οβββ¨β© pb .unique p q = eq.unique (pr.unique (assoc _ _ _ β p) (assoc _ _ _ β q))
Hence, assuming that a category has a terminal object, binary products and binary equalisers means it also admits pullbacks.
with-equalisers : Terminal C β (β A B β Product C A B) β (β {A B} (f g : Hom A B) β Equaliser C f g) β Finitely-complete with-equalisers top prod equ .terminal = top with-equalisers top prod equ .products = prod with-equalisers top prod equ .equalisers = equ with-equalisers top prod equ .pullbacks {A} {B} {X} f g = record { has-is-pb = product-equaliserβpullback Prod.has-is-product Equ.has-is-eq } where module Prod = Product (prod A B) module Equ = Equaliser (equ (f β Prod.Οβ) (g β Prod.Οβ))
With pullbacksπ
Weβll now prove the converse: That a terminal object and pullbacks implies having all products, and all equalisers. Weβll start with the products, since those are simpler. Observe that we can complete a product diagram (like the one on the left) to a pullback diagram (like the one on the right) by adding in the unique arrows into the terminal object
terminal-pullbackβproduct : β {P X Y T} {p1 : Hom P X} {p2 : Hom P Y} {f : Hom X T} {g : Hom Y T} β is-terminal C T β is-pullback C p1 f p2 g β is-product C p1 p2 terminal-pullbackβproduct {p1 = p1} {p2} {f} {g} term pb = prod where
module Pb = is-pullback pb prod : is-product C p1 p2 prod .is-product.β¨_,_β© p1' p2' = Pb.universal {pβ' = p1'} {pβ' = p2'} (is-contrβis-prop (term _) _ _) prod .is-product.Οβββ¨β© = Pb.pββuniversal prod .is-product.Οβββ¨β© = Pb.pββuniversal prod .is-product.unique p q = Pb.unique p q with-pullbacks : Terminal C β (β {A B X} (f : Hom A X) (g : Hom B X) β Pullback C f g) β Finitely-complete with-pullbacks top pb = fc where module top = Terminal top mkprod : β A B β Product C A B mkprod A B = record { has-is-product = terminal-pullbackβproduct top.hasβ€ pb' } where pb' = pb (top.hasβ€ A .centre) (top.hasβ€ B .centre) .Pullback.has-is-pb mkeq : β {A B} (f g : Hom A B) β Equaliser C f g mkeq {A = A} {B} f g = eq where
For equalisers, the situation is a bit more complicated. Recall that, by analogy with the case in Set, we can consider the equaliser to be the solution set of for some We can consider the two sides of this equation as a single map The equation is solved where this pairing map equals some We can thus build equalisers by pulling back along the diagonal map:
module Bb = Product (mkprod B B) β¨id,idβ© : Hom B Bb.apex β¨id,idβ© = Bb.β¨ id , id β©Bb. β¨f,gβ© : Hom A Bb.apex β¨f,gβ© = Bb.β¨ f , g β©Bb. module Pb = Pullback (pb β¨id,idβ© β¨f,gβ©) open is-equaliser open Equaliser
The actual equaliser map is the top, horizontal face (what the code
calls Pb.pβ
), so we must show that,
composed with this map,
and
become equal. Hereβs where we use the fact that pullback squares, well,
commute: We know that
is
and that
(since the square above is a pullback).
But both projections out of are equal, so we can apply commutativity of the square above again to conclude that
eq : Equaliser C f g eq .apex = Pb.apex eq .equ = Pb.pβ eq .has-is-eq .equal = f β Pb.pβ β‘Λβ¨ pulll Bb.Οβββ¨β© β©β‘Λ Bb.Οβ β β¨f,gβ© β Pb.pβ β‘β¨ ap (Bb.Οβ β_) (sym Pb.square) β©β‘ Bb.Οβ β β¨id,idβ© β Pb.pβ β‘β¨ pulll Bb.Οβββ¨β© β sym (pulll Bb.Οβββ¨β©) β©β‘ Bb.Οβ β β¨id,idβ© β Pb.pβ β‘β¨ ap (Bb.Οβ β_) Pb.square β©β‘ Bb.Οβ β β¨f,gβ© β Pb.pβ β‘β¨ pulll Bb.Οβββ¨β© β©β‘ g β Pb.pβ β
We must now show that if is another map which equalises and then it fits into a commutative diagram like the one below, so that we may conclude the dashed arrow exists and is unique.
A bit of boring limit-chasing lets us conclude that this diagram does commute, hence the dashed arrow does exist (uniquely!), so that the top face in our pullback diagram is indeed the equaliser of and
eq .has-is-eq .universal {e' = e'} p = Pb.universal (Bb.uniqueβ refl refl (sym p1) (sym p2)) where p1 : Bb.Οβ β β¨id,idβ© β f β e' β‘ Bb.Οβ β β¨f,gβ© β e' p1 = Bb.Οβ β β¨id,idβ© β f β e' β‘β¨ cancell Bb.Οβββ¨β© β©β‘ f β e' β‘Λβ¨ pulll Bb.Οβββ¨β© β©β‘Λ Bb.Οβ β β¨f,gβ© β e' β p2 : Bb.Οβ β β¨id,idβ© β f β e' β‘ Bb.Οβ β β¨f,gβ© β e' p2 = Bb.Οβ β β¨id,idβ© β f β e' β‘β¨ cancell Bb.Οβββ¨β© β©β‘ f β e' β‘β¨ p β©β‘ g β e' β‘Λβ¨ pulll Bb.Οβββ¨β© β©β‘Λ Bb.Οβ β β¨f,gβ© β e' β eq .has-is-eq .factors = Pb.pββuniversal eq .has-is-eq .unique {F} {e' = e'} {other = other} pββl=e' = Pb.unique path pββl=e' where path : Pb.pβ β other β‘ f β e' path = Pb.pβ β other β‘β¨ insertl Bb.Οβββ¨β© β©β‘ Bb.Οβ β β¨id,idβ© β Pb.pβ β other β‘β¨ ap (Bb.Οβ β_) (extendl Pb.square) β©β‘ Bb.Οβ β β¨f,gβ© β Pb.pβ β other β‘β¨ ap (Bb.Οβ β_) (ap (β¨f,gβ© β_) pββl=e') β©β‘ Bb.Οβ β β¨f,gβ© β e' β‘β¨ pulll Bb.Οβββ¨β© β©β‘ f β e' β
Putting it all together into a record we get our proof of finite completeness:
fc : Finitely-complete fc .terminal = top fc .products = mkprod fc .equalisers = mkeq fc .pullbacks = pb
productβterminal-pullback : β {P X Y T} {p1 : Hom P X} {p2 : Hom P Y} {f : Hom X T} {g : Hom Y T} β is-terminal C T β is-product C p1 p2 β is-pullback C p1 f p2 g productβterminal-pullback t r = pb where open is-pullback pb : is-pullback C _ _ _ _ pb .square = is-contrβis-prop (t _) _ _ pb .universal _ = r .is-product.β¨_,_β© _ _ pb .pββuniversal = r .is-product.Οβββ¨β© pb .pββuniversal = r .is-product.Οβββ¨β© pb .unique p q = r .is-product.unique p q is-completeβfinitely : β {a b} β is-complete a b C β Finitely-complete is-completeβfinitely {a} {b} compl = with-pullbacks term' pb where pb : β {x y z} (f : Hom x z) (g : Hom y z) β Pullback C f g pb f g = LimitβPullback C (compl (cospanβcospan-diagram _ _ f g)) idx : Precategory a b idx = Lift-cat a b (Disc β₯ Ξ» x β absurd x) F : Functor idx C F .Functor.Fβ () F .Functor.Fβ {()} F .Functor.F-id {()} F .Functor.F-β {()} limF : Limit F limF = compl F open Terminal open Cone-hom open Cone term' : Terminal C term' = record { top = Limit.apex limF ; hasβ€ = limiting } where limiting : β x β is-contr _ limiting x = contr (Limit.universal limF (Ξ» { () }) (Ξ» { {()} })) Ξ» h β sym (Limit.unique limF _ _ h Ξ» { () })
Lex functorsπ
A functor is said to be left exact, abbreviated lex, when it preserves finite limits. These functors arenβt called βfinite-limit-preserving functorsβ by historical accident, and for brevity. By the characterisations above, it suffices for a functor to preserve the terminal object and pullbacks.
module _ {o β o' β'} {C : Precategory o β} {D : Precategory o' β'} where private module C = Cat C private module D = Cat D
record is-lex (F : Functor C D) : Type (o β β β o' β β') where private module F = Functor F field pres-β€ : β {T} β is-terminal C T β is-terminal D (F.β T) pres-pullback : β {P X Y Z} {p1 : C.Hom P X} {p2 : C.Hom P Y} {f : C.Hom X Z} {g : C.Hom Y Z} β is-pullback C p1 f p2 g β is-pullback D (F.β p1) (F.β f) (F.β p2) (F.β g)
Since (if a terminal object exists), products can be identified with pullbacks if has a terminal object, then a lex functor also preserves products.
pres-product : β {P A B T} {p1 : C.Hom P A} {p2 : C.Hom P B} β is-terminal C T β is-product C p1 p2 β is-product D (F.β p1) (F.β p2) pres-product term pr = terminal-pullbackβproduct D (pres-β€ term) (pres-pullback {f = term _ .centre} {g = term _ .centre} (productβterminal-pullback C term pr))
Since being a monomorphism is equivalent to certain squares being pullbacks, a lex functor preserves monomorphisms.
pres-monos : β {A B} {f : C.Hom A B} β C.is-monic f β D.is-monic (F.β f) pres-monos {f = f} mono = is-pullbackβis-monic (subst (Ξ» x β is-pullback D x _ x _) F.F-id (pres-pullback (is-monicβis-pullback mono)))
module _ {o β o' β'} {C : Precategory o β} {D : Precategory o' β'} where open is-lex Fβ-is-lex : β {o'' β''} {E : Precategory o'' β''} {F : Functor D E} {G : Functor C D} β is-lex F β is-lex G β is-lex (F Fβ G) Fβ-is-lex f g .pres-β€ = f .pres-β€ β g .pres-β€ Fβ-is-lex f g .pres-pullback = f .pres-pullback β g .pres-pullback