module Cat.Instances.Algebras.Kan where
Right Kan extensions in categories of algebras🔗
module _
{o ℓ o' o'' ℓ' ℓ''}
{C : Precategory o ℓ} {F : Functor C C} (M : Monad-on F)
{J : Precategory o' ℓ'} {D : Precategory o'' ℓ''} (p : Functor J D)
where
private
module EM = Cat.Reasoning (Eilenberg-Moore M)
module C = Cat.Reasoning C
module M = Monad-on M
module p = Functor p
The construction of limits in categories of algebras from limits in the base category generalises to arbitrary right Kan extensions. We start by showing that the forgetful functor lifts right Kan extensions.
The setup is as follows: given a right Kan extension of along we want to construct a right Kan extension of along
Forget-EM-lift-ran: ∀ {G : Functor J (Eilenberg-Moore M)}
→ Ran p (Forget-EM F∘ G)
→ Ran p G
{G} ran-over = to-ran has-ran^M
Forget-EM-lift-ran where
open Ran ran-over
module G = Functor G
module MR = Cat.Functor.Reasoning F
The first step is to construct the functor Since this Kan extension is supposed to be preserved by we know that should lift along hence, thanks to the universal property of is entirely specified by the data of a monad action of on
The natural transformation is defined using the universal property of it suffices to give a map which we construct as in the following diagram:
: Action-on M Ext
Ext-action .α = σ $
Ext-action (Forget-EM-action M .α ◂ G) ∘nt
nat-unassoc-from (F ▸ eps) nat-assoc-from
Checking the algebra laws involves the uniqueness part of the universal property and some tedious computations.
.α-unit = σ-uniq₂ eps eq (ext λ _ → sym (C.idr _))
Ext-action where
: eps ≡ eps ∘nt (Ext-action .α ∘nt nat-idl-from (M.unit ◂ Ext) ◂ p)
eq = ext λ j → sym $
eq .η j C.∘ Ext-action .α .η (p.₀ j) C.∘ M.η (Ext.₀ (p.₀ j)) ≡⟨ C.extendl (σ-comm ηₚ j) ⟩
eps .₀ j .snd .ν C.∘ M.M₁ (eps .η j) C.∘ M.η (Ext.₀ (p.₀ j)) ≡˘⟨ C.refl⟩∘⟨ M.unit .is-natural _ _ _ ⟩
G.₀ j .snd .ν C.∘ M.η (G.₀ j .fst) C.∘ eps .η j ≡⟨ C.cancell (G.₀ j .snd .ν-unit) ⟩
G.η j ∎
eps
.α-mult = σ-uniq₂ _ eq refl
Ext-action where
: _ ≡ eps ∘nt ((Ext-action .α ∘nt nat-unassoc-from (M.mult ◂ Ext)) ◂ p)
eq = ext λ j →
eq .η j C.∘ Ext-action .α .η (p.₀ j) C.∘ M.M₁ (Ext-action .α .η (p.₀ j)) ≡⟨ C.extendl (σ-comm ηₚ j) ⟩
eps .₀ j .snd .ν C.∘ M.M₁ (eps .η j) C.∘ M.M₁ (Ext-action .α .η (p.₀ j)) ≡⟨ C.refl⟩∘⟨ MR.weave (σ-comm ηₚ j) ⟩
G.₀ j .snd .ν C.∘ M.M₁ (G.₀ j .snd .ν) C.∘ M.M₁ (M.M₁ (eps .η j)) ≡˘⟨ C.extendl (G.₀ j .snd .ν-mult) ⟩
G.₀ j .snd .ν C.∘ M.μ (G.₀ j .fst) C.∘ M.M₁ (M.M₁ (eps .η j)) ≡⟨ C.refl⟩∘⟨ M.mult .is-natural _ _ _ ⟩
G.₀ j .snd .ν C.∘ M.M₁ (eps .η j) C.∘ M.μ (Ext.₀ (p.₀ j)) ≡˘⟨ C.extendl (σ-comm ηₚ j) ⟩
G.η j C.∘ Ext-action .α .η (p.₀ j) C.∘ M.μ (Ext.₀ (p.₀ j)) ∎
eps
: Functor D (Eilenberg-Moore M)
Ext^M = EM-universal M Ext-action Ext^M
The universal natural transformation extends to a natural transformation
: Ext^M F∘ p => G
eps^M .η j .fst = eps .η j
eps^M .η j .snd = σ-comm ηₚ j
eps^M .is-natural _ _ _ = ext (eps .is-natural _ _ _) eps^M
It remains to check universality, which is another short computation.
: is-ran p G Ext^M eps^M
has-ran^M .is-ran.σ {M = X} c =
has-ran^M (σ-uniq₂ _ refl eq)
EM-2-cell' M σ^M where
module X = Functor X
: Forget-EM F∘ X => Ext
σ^M = σ (nat-assoc-from (Forget-EM ▸ c))
σ^M
: _ ≡ eps ∘nt ((Ext-action .α ∘nt (F ▸ σ^M)) ◂ p)
eq = ext λ j →
eq .η j C.∘ σ^M .η (p.₀ j) C.∘ X.₀ (p.₀ j) .snd .ν ≡⟨ C.pulll (σ-comm ηₚ j) ⟩
eps .η j .fst C.∘ X.₀ (p.₀ j) .snd .ν ≡⟨ c .η j .snd ⟩
c .₀ j .snd .ν C.∘ M.M₁ (c .η j .fst) ≡˘⟨ C.refl⟩∘⟨ MR.collapse (σ-comm ηₚ j) ⟩
G.₀ j .snd .ν C.∘ M.M₁ (eps .η j) C.∘ M.M₁ (σ^M .η (p.₀ j)) ≡˘⟨ C.extendl (σ-comm ηₚ j) ⟩
G.η j C.∘ Ext-action .α .η (p.₀ j) C.∘ M.M₁ (σ^M .η (p.₀ j)) ∎
eps
.is-ran.σ-comm {β = c} = ext (unext σ-comm)
has-ran^M .is-ran.σ-uniq {X} {σ' = σ'} eq =
has-ran^M (σ-uniq {σ' = U∘σ'} (reext! eq))
reext! where
: Forget-EM F∘ X => Ext
U∘σ' = cohere! (Forget-EM ▸ σ') U∘σ'
Since is a right adjoint, this Kan extension is automatically preserved; and since is conservative, we can conclude that it creates right Kan extensions.
Forget-EM-preserves-ran: ∀ {G : Functor J (Eilenberg-Moore M)}
→ preserves-ran p G Forget-EM
= right-adjoint→preserves-ran Free-EM⊣Forget-EM
Forget-EM-preserves-ran
: lifts-ran-along p (Forget-EM {M = M})
Forget-EM-lifts-ran .lifted = Forget-EM-lift-ran ran
Forget-EM-lifts-ran ran .preserved = Forget-EM-preserves-ran
Forget-EM-lifts-ran ran (Ran.has-ran (Forget-EM-lift-ran ran))
: creates-ran-along p (Forget-EM {M = M})
Forget-EM-creates-ran = conservative+lifts→creates-ran
Forget-EM-creates-ran Forget-EM-is-conservative Forget-EM-lifts-ran