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
    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