module Cat.Diagram.Comonad where
Comonadsπ
A comonad on a category is dual to a monad on instead of a unit and multiplication we have a counit and comultiplication More generally, we can define what it means to equip a fixed functor with the structure of a comonad; even more generally, we can specify what it means for a triple to be a comonad. Unsurprisingly, these are dual to the equations of a monad.
record is-comonad {W : Functor C C} (counit : W => Id) (comult : W => W Fβ W) : Type (o β β) where
no-eta-equality open Functor W renaming (Fβ to Wβ ; Fβ to Wβ ; F-id to W-id ; F-β to W-β) public module counit = _=>_ counit renaming (Ξ· to Ξ΅) module comult = _=>_ comult renaming (Ξ· to Ξ΄) open counit using (Ξ΅) public open comult using (Ξ΄) public
field Ξ΄-unitl : β {x} β Wβ (Ξ΅ x) β Ξ΄ x β‘ id Ξ΄-unitr : β {x} β Ξ΅ (Wβ x) β Ξ΄ x β‘ id Ξ΄-assoc : β {x} β Wβ (Ξ΄ x) β Ξ΄ x β‘ Ξ΄ (Wβ x) β Ξ΄ x
record Comonad-on (W : Functor C C) : Type (o β β) where field counit : W => Id comult : W => (W Fβ W) has-is-comonad : is-comonad counit comult
open is-comonad has-is-comonad public unquoteDecl H-Level-is-comonad = declare-record-hlevel 1 H-Level-is-comonad (quote is-comonad)
module _ {o h : _} {C : Precategory o h} {F G : Functor C C} {M : Comonad-on F} {N : Comonad-on G} where private module C = Cat.Reasoning C module M = Comonad-on M module N = Comonad-on N unquoteDecl eqv = declare-record-iso eqv (quote Comonad-on) Comonad-on-path : (p0 : F β‘ G) β (β x β PathP (Ξ» i β C.Hom (p0 i Β· x) x) (M.Ξ΅ x) (N.Ξ΅ x)) β (β x β PathP (Ξ» i β C.Hom (p0 i Β· x) (p0 i Β· (p0 i Β· x))) (M.Ξ΄ x) (N.Ξ΄ x)) β PathP (Ξ» i β Comonad-on (p0 i)) M N Comonad-on-path M=N pcounit pcomult = injectiveP (Ξ» _ β eqv) $ Nat-pathp M=N refl pcounit ,β Nat-pathp M=N (apβ _Fβ_ M=N M=N) pcomult ,β prop!