module Cat.Diagram.Monad.Limits {o ℓ} {C : Precategory o ℓ} {M : Monad C} where
private
module EM = Cat.Reasoning (Eilenberg-Moore M)
module C = Cat.Reasoning C
module M = Monad M
open Algebra-on
open Total-hom
Limits in categories of algebras🔗
Suppose that be a category, be a monad on and be a diagram of (that is, a functor into the Eilenberg-Moore category of M). Suppose that an evil wizard has given you a limit for the diagram in which underlies but they have not (being evil and all) told you whether admits an algebra structure at all.
Perhaps we can make this situation slightly more concrete, by working in a category equivalent to an Eilenberg-Moore category: If we have two groups considered as a discrete diagram, then the limit our evil wizard would give us is the product in But we already know we can equip this product with a “pointwise” group structure! Does this result generalise?
The answer is positive, though this is one of those cases where abstract nonsense can not help us: gotta roll up our sleeves and calculate away. Suppose we have a diagram as in the setup — we’ll show that the functor both preserves and reflects limits, in that is a limiting cone if, and only if, is.
module _ {jo jℓ} {J : Precategory jo jℓ} (F : Functor J (Eilenberg-Moore M)) where
private
module J = Precategory J
module F = Functor F
module FAlg j = Algebra-on (F.₀ j .snd)
open Functor
open _=>_
That preserves limits follows immediately from the fact that it is a right adjoint: the non-trivial part is showing that it reflects them.
: preserves-limit Forget-EM F
Forget-EM-preserves-limits = right-adjoint-is-continuous Free-EM⊣Forget-EM Forget-EM-preserves-limits
We begin with the following key lemma: Write for the limit of a diagram If carries an structure and the limit projections are morphisms, then is the limit of in
make-algebra-limit: ∀ {K : Functor ⊤Cat C} {eps : K F∘ !F => Forget-EM F∘ F}
→ (lim : is-ran !F (Forget-EM F∘ F) K eps)
→ (nu : Algebra-on C M (K .F₀ tt))
→ (∀ j → is-limit.ψ lim j C.∘ nu .ν ≡ FAlg.ν j C.∘ M.M₁ (is-limit.ψ lim j))
→ make-is-limit F (K .F₀ tt , nu)
= em-lim where
make-algebra-limit lim apex-alg comm module lim = is-limit lim
open make-is-limit
module apex = Algebra-on apex-alg
open _=>_
The assumptions to this lemma are actually rather hefty: they pretty much directly say that was already the limit of However, with this more “elementary” rephrasing, we gain a bit of extra control which will be necessary for constructing limits in out of limits in later.
: make-is-limit F _
em-lim .ψ j .hom = lim.ψ j
em-lim .ψ j .preserves = comm j
em-lim .commutes f = ext (lim.commutes f)
em-lim .universal eps p .hom =
em-lim .universal (λ j → eps j .hom) (λ f i → p f i .hom)
lim.factors eps p =
em-lim (lim.factors _ _)
ext .unique eps p other q =
em-lim (lim.unique _ _ _ λ j i → q j i .hom)
ext .universal eps p .preserves = lim.unique₂ _
em-lim (λ f → C.pulll (F.F₁ f .preserves)
.pullr (sym (M.M-∘ _ _) ∙ ap M.M₁ (ap hom (p f))))
∙ C(λ j → C.pulll (lim.factors _ _)
.preserves)
∙ eps j (λ j → C.pulll (comm j)
.pullr (sym (M.M-∘ _ _) ∙ ap M.M₁ (lim.factors _ _))) ∙ C
This key lemma also doubles as a proof that the underlying object functor reflects limits: We already had an algebra structure “upstairs”!
: reflects-limit Forget-EM F
Forget-reflects-limits {K} {eps} lim = to-is-limitp
Forget-reflects-limits (make-algebra-limit lim (K .F₀ tt .snd) (λ j → eps .η j .preserves))
trivial!
Having shown that reflects the property of being a limit, we now turn to showing it reflects limits in general. Using our key lemma, it will suffice to construct an algebra structure on then show that the projection maps extend to algebra homomorphisms.
: Limit (Forget-EM F∘ F) → Limit F
Forget-lift-limit = to-limit $ to-is-limit $ make-algebra-limit
Forget-lift-limit lim-over (Limit.has-limit lim-over) apex-algebra (λ j → lim-over.factors _ _)
where
module lim-over = Limit lim-over
module lim = Ran lim-over
An algebra structure consists, centrally, of a map a map into the limit. Maps into limits are the happy case, since is essentially defined by a (natural) isomorphism between the sets and the latter limit being computed in We understand limits of sets very well: they’re (subsets of) sets of tuples!
Our algebra map is thus defined componentwise: Since we have a bunch of maps coming from the algebra structures on each we can “tuple” them into a big map Abusing notation slightly, we’re defining to be
: Algebra-on C M lim-over.apex
apex-algebra .ν =
apex-algebra .universal (λ j → FAlg.ν j C.∘ M.M₁ (lim-over.ψ j)) comm where abstract
lim-over: ∀ {x y} (f : J.Hom x y)
comm → F.₁ f .hom C.∘ FAlg.ν x C.∘ M.M₁ (lim-over.ψ x)
.ν y C.∘ M.M₁ (lim-over.ψ y)
≡ FAlg{x} {y} f =
comm .₁ f .hom C.∘ FAlg.ν x C.∘ M.M₁ (lim-over.ψ x) ≡⟨ C.extendl (F.₁ f .preserves) ⟩
F.ν y C.∘ M.M₁ (F.₁ f .hom) C.∘ M.M₁ (lim-over.ψ x) ≡˘⟨ C.refl⟩∘⟨ M.M-∘ _ _ ⟩
FAlg.ν y C.∘ M.M₁ (F.₁ f .hom C.∘ lim-over.ψ x) ≡⟨ C.refl⟩∘⟨ ap M.M₁ (lim-over.commutes f) ⟩
FAlg.ν y C.∘ M.M₁ (lim-over.ψ y) ∎ FAlg
To show that really is an algebra structure, we’ll reason componentwise, too: we must show that is the identity map: but we can compute
The other condition, compatibility with multiplication, is analogous. Formally, the computation is a bit less pretty, but it’s no more complicated.
.ν-unit = lim-over.unique₂ _ lim-over.commutes
apex-algebra (λ j → C.pulll (lim-over.factors _ _)
.pullr (sym $ M.unit.is-natural _ _ _)
·· C.cancell (FAlg.ν-unit j))
·· C(λ j → C.idr _)
.ν-mult = lim-over.unique₂ _
apex-algebra (λ f → C.pulll $ C.pulll (F.₁ f .preserves)
.pullr (sym (M.M-∘ _ _) ∙ ap M.M₁ (lim-over.commutes f)))
∙ C(λ j → C.pulll (lim-over.factors _ _)
.pullr (sym (M.M-∘ _ _) ∙ ap M.M₁ (lim-over.factors _ _) ∙ M.M-∘ _ _)
·· C.extendl (FAlg.ν-mult j)
·· C(FAlg.ν j C.∘_) (M.mult.is-natural _ _ _)
·· ap .assoc _ _ _)
·· C(λ j → C.pulll (lim-over.factors _ _))
Putting our previous results together, we conclude by observing that, if is a complete category, then so is regardless of how ill-behaved the monad might be.
Eilenberg-Moore-is-complete: ∀ {a b} → is-complete a b C → is-complete a b (Eilenberg-Moore M)
=
Eilenberg-Moore-is-complete complete F (complete _) Forget-lift-limit F