module Cat.Diagram.Coend.Formula {o ā o' ā'} {C : Precategory o ā} {D : Precategory o' ā'} where
Computing coendsš
Using the twisted arrow category as a mediating notion, we show how to compute coends as ordinary colimits. The calculation is actually a bit more straightforward than it might seem at first. The first thing we note is that any functor generates a functor from the twisted arrow category of
This is the fundamental part of our theorem: The twisted arrow category, in a sense, āclassifies cowedgesā, in that cocones under (the composite above) are the same thing as cowedges from The proof is entirely shuffling some data around, but the commutativity/extranaturality conditions need to be massaged a bit. Check it out, itās not too long:
module _ (F : Functor (C ^op Ćį¶ C) D) where private module C = Cat C module D = Cat D module F = F-r F open _=>_ open Twist open Bifunctor coconeācowedge : ā {x} ā twistįµįµ F => Const x ā Cowedge F coconeācowedge eta .nadir = _ coconeācowedge eta .Ļ c = eta .Ī· ((c , c) , C.id) coconeācowedge eta .extranatural f = eta .is-natural _ _ (twist _ _ (C.eliml (C.idl _))) ā (sym $ eta .is-natural _ _ (twist _ _ (C.cancelr (C.idl _)))) cowedgeācocone : (W : Cowedge F) ā twistįµįµ F => Const (W .nadir) cowedgeācocone W .Ī· ((c , c') , f) = W .Ļ c D.ā second F f cowedgeācocone W .is-natural ((a , b) , f) ((x , y) , g) h = (W .Ļ x D.ā F.Fā (C.id , g)) D.ā F.Fā (_ , _) ā”āØ W .extranatural g D.ā©āāØrefl ā©ā” (W .Ļ y D.ā F.Fā (g , C.id)) D.ā F.Fā (h .before , h .after) ā”āØ D.pullr (F.weave (C.introl refl ,ā refl)) ā©ā” W .Ļ y D.ā ((F.Fā (h .before C.ā g , C.id)) D.ā F.Fā (C.id , h .after)) ā”āØ D.extendl (sym (W .extranatural _)) ā©ā” (W .Ļ a D.ā (F.Fā (C.id , h .before C.ā g) D.ā F.Fā (C.id , h .after))) ā”āØ D.reflā©āāØ sym (Bifunctor.secondāsecond F) ā ap (Bifunctor.second F) (h .commutes) ā©ā” W .Ļ a D.ā F.Fā (C.id , f) ā”āØ sym (D.idl _) ā©ā” D.id D.ā W .Ļ a D.ā F.Fā (C.id , f) ā
We can now extend that correspondence to calculating coends as certain colimits: has a coend for if it has a colimit for
colimitācoend : Colimit (twistįµįµ F) ā Coend F colimitācoend colim = coend where open Coend module W = Colimit colim coend : Coend F coend .cowedge = coconeācowedge W.cocone coend .factor W' = W.universal (cowedgeācocone W' .Ī·) (Ī» f ā cowedgeācocone W' .is-natural _ _ f ā D.idl _) coend .commutes {W = W'} = W.factors _ _ ā D.elimr (Bifunctor.second-id F) coend .unique {W = W'} comm = W.unique _ _ _ $ Ī» j ā sym $ W' .extranatural _ Ā·Ā· D.pushl (sym comm) Ā·Ā· (D.reflā©āāØ (W.commutes (twist _ _ (C.cancelr (C.idl _))))) cocompleteācoend : is-cocomplete (o ā ā) ā D ā Coend F cocompleteācoend colim = colimitācoend (colim _) module cocompleteāā« (cocomp : is-cocomplete (o ā ā) ā D) where open Coend (cocompleteācoend cocomp) public