The comonad from an adjunction🔗
module
.Functor.Adjoint.Comonad
Cat{o₁ h₁ o₂ h₂ : _}
{C : Precategory o₁ h₁}
{D : Precategory o₂ h₂}
{L : Functor C D} {R : Functor D C}
(L⊣R : L ⊣ R)
where
private
module C = Precategory C
module D = Precategory D
module L = Functor L
module R = Functor R
module adj = _⊣_ L⊣R
Every adjunction gives rise to a comonad, where the underlying functor is This is dual to the construction of the monad from an adjunction.
: Comonad-on (L F∘ R) Adjunction→Comonad
The counit of the comonad is just the adjunction counit, and the comultiplication comes from the unit.
.counit = adj.counit
Adjunction→Comonad .comult = NT (λ x → L.₁ (adj.η (R.₀ x))) λ x y f →
Adjunction→Comonad .₁ (adj.η (R.₀ y)) D.∘ L.₁ (R.₁ f) ≡˘⟨ L.F-∘ _ _ ⟩
L.₁ (adj.η (R.₀ y) C.∘ R.₁ f) ≡⟨ ap L.₁ (adj.unit.is-natural _ _ _) ⟩
L.₁ (R.₁ (L.₁ (R.₁ f)) C.∘ adj.η (R.₀ x)) ≡⟨ L.F-∘ _ _ ⟩
L.₁ (R.₁ (L.₁ (R.₁ f))) D.∘ L.₁ (adj.η (R.₀ x)) ∎ L
The comonad laws follow from the zig-zag identities. In fact, the
right identity law is exactly the zig
identity.
.δ-unitr {x} = adj.zig Adjunction→Comonad
The others are slightly more involved.
.δ-unitl {x} = path where abstract
Adjunction→Comonad : L.₁ (R.₁ (adj.ε x)) D.∘ L.₁ (adj.η (R.F₀ x)) ≡ D.id
path =
path .₁ (R.₁ (adj.ε _)) D.∘ L.₁ (adj.η _) ≡⟨ sym (L.F-∘ _ _) ⟩
L.₁ (R.₁ (adj.ε _) C.∘ adj.η _) ≡⟨ ap L.₁ adj.zag ⟩
L.₁ C.id ≡⟨ L.F-id ⟩
L.id ∎
D
.δ-assoc {x} = path where abstract
Adjunction→Comonad : L.₁ (R.₁ (L.₁ (adj.η (R.F₀ x)))) D.∘ L.₁ (adj.η _)
path .₁ (adj.η (R .F₀ (L.F₀ (R.F₀ x)))) D.∘ L.₁ (adj.η _)
≡ L=
path .₁ (R.₁ (L.₁ (adj.η _))) D.∘ L.₁ (adj.η _) ≡⟨ sym (L.F-∘ _ _) ⟩
L.₁ (R.₁ (L.₁ (adj.η _)) C.∘ adj.η _) ≡˘⟨ ap L.₁ (adj.unit.is-natural _ _ _) ⟩
L.₁ (adj.η _ C.∘ adj.η _) ≡⟨ L.F-∘ _ _ ⟩
L.₁ (adj.η _) D.∘ L.₁ (adj.η _) ∎ L