module Cat.Instances.Coalgebras.Limits
{o ℓ} (C : Precategory o ℓ) {F : Functor C C} (W : Comonad-on F)
where
open Cat.Reasoning C
open Total-hom
open _=>_
open Coalgebra-on
open Comonad-on W using (module comult ; module counit ; W-∘ ; W-id ; W₀ ; W₁)
private module W = Func F
Arbitrary limits of coalgebras🔗
This module concerns itself with the more general construction of limits in a category of coalgebras, as mentioned in the (more focused) construction of finite limits of coalgebras. Namely, if is a comonad on which, as a functor, preserves limits, then the forgetful functor preserves and reflects those same limits.
module
_ {oi ℓi} {I : Precategory oi ℓi}
(pres : ∀ (G : Functor I C) {X η} (l : is-ran !F G X η) → preserves-ran F l)
where
We start by showing reflection: Let be a diagram of be a coalgebra, and be a natural transformation If is the limit of in then is the limit of in
is-limit-coalgebra: ∀ (F : Functor I (Coalgebras W)) {K phi}
→ (l : is-ran !F (πᶠ _ F∘ F) (πᶠ _ F∘ K) (nat-assoc-from (πᶠ _ ▸ phi)))
→ reflects-ran (πᶠ (Coalgebras-over W)) l
{K} {phi} l = to-is-limitp mk fixup where is-limit-coalgebra F
It will suffice to show the following: if is a natural family of coalgebra homomorphisms, then one may construct a map satisfying For if we are given such a map, we can show that is a coalgebra homomorphism Since is a limit, we may argue for preservation componentwise against the projections and we have
so that as required. Showing that is indeed the unique map factoring through is done through exactly the same style of argument.
module K = Functor K
module F = Functor F
module l = is-limit l
module l' = is-limit (pres _ l)
open make-is-limit
module
_ {x : Coalgebras.Ob W}
(eta : (j : Precategory.Ob I) → Coalgebras.Hom W x (F.₀ j))
(nat : ∀ {x y} (f : Precategory.Hom I x y) → Coalgebras._∘_ W (F.₁ f) (eta x) ≡ eta y)
where
That’s very well and good, but does such exist? Well, yes: much like in the finite case, we note that is also natural in so that the limit factorisation
exists. By composing with we obtain a map and with a short calculation we establish that this map satisfies the commutativity condition we remarked was sufficient above; we’re done!
opaque: Hom (x .fst) (K.₀ tt .fst)
ν = counit.ε _ ∘ l'.universal (λ j → F.₀ j .snd .ρ ∘ eta j .hom) λ {x} {y} f →
ν (F.₁ f .hom) ∘ F.₀ x .snd .ρ ∘ eta x .hom ≡⟨ pulll (F.₁ f .preserves) ⟩
W₁ (F.₀ y .snd .ρ ∘ F.₁ f .hom) ∘ eta x .hom ≡⟨ pullr (ap hom (nat _)) ⟩
.₀ y .snd .ρ ∘ eta y .hom ∎
F
: ∀ {j} → phi .η j .hom ∘ ν ≡ eta j .hom
ν-β {j} =
ν-β .η j .hom ∘ ν ≡⟨ pulll (sym (counit.is-natural _ _ _)) ⟩
phi (counit.ε _ ∘ l'.ψ j) ∘ l'.universal _ _ ≡⟨ pullr (l'.factors _ _) ⟩
.ε _ ∘ F.₀ j .snd .ρ ∘ eta j .hom ≡⟨ cancell (F.₀ _ .snd .ρ-counit) ⟩
counit.hom ∎ eta j
: make-is-limit F (K.₀ tt)
mk .ψ j .hom = l.ψ j
mk .ψ j .preserves = phi .η j .preserves
mk .commutes f = ext (l.commutes f)
mk .universal eta nat .hom = ν eta nat
mk .universal eta nat .preserves = l'.unique₂ _
mk (λ f → pulll (F.₁ f .preserves) ∙ pullr (ap hom (nat _)))
(λ j → W.pulll (ν-β eta nat) ∙ eta j .preserves)
(λ j → pulll (phi .η j .preserves) ∙ pullr (ν-β eta nat))
.factors eta nat = ext (ν-β eta nat)
mk .unique eta nat other comm = ext (l.unique₂ _
mk (λ f → ap hom (nat f)) (λ j → ap hom (comm j)) (λ j → ν-β eta nat))
abstract
: ∀ {j} → mk .ψ j ≡ phi .η j
fixup = ext refl fixup
Coalgebra-on-limit: (F : Functor I (Coalgebras W))
→ (L : Limit (πᶠ (Coalgebras-over W) F∘ F))
→ Coalgebra-on W (Limit.apex L)
= coalg module Coalgebra-on-limit where Coalgebra-on-limit F L
It remains to show that, if and are as before, then the coalgebra structures on assemble into a coalgebra structure on Fundamentally, this amounts to construct a map
private
module L = Limit L
module L' = is-limit (pres (πᶠ _ F∘ F) L.has-limit)
module L'' = is-limit (pres _ (pres (πᶠ _ F∘ F) L.has-limit))
module F = Functor F
open counit using (ε)
Since preserves we may treat maps as “tuplings” of morphisms and test equality componentwise. Tupling the maps where the map is the projection from the limit, we obtain a morphism uniquely characterised by having for every
opaque: Hom L.apex (W₀ L.apex)
ν = L'.universal (λ j → F.₀ j .snd .ρ ∘ L.ψ j) λ {x} {y} h →
ν (F.₁ h .hom) ∘ F.₀ x .snd .ρ ∘ L.ψ x ≡⟨ pulll (F.₁ h .preserves) ⟩
W₁ (F.₀ y .snd .ρ ∘ F.₁ h .hom) ∘ L.ψ x ≡⟨ pullr (sym (L.eps .is-natural _ _ _) ∙ elimr L.Ext.F-id) ⟩
.₀ y .snd .ρ ∘ L.ψ y ∎
F
: ∀ {j} → W₁ (L.ψ j) ∘ ν ≡ F.₀ j .snd .ρ ∘ L.ψ j
ν-β = L'.factors _ _ ν-β
Since we may again reason componentwise to establish compatibility of with and these will follow from the naturality of each of structural transformations, and from compatibility of each of the coalgebra maps. We comment on compatibility with the counit, and omit the rest of the proof for space.
: Coalgebra-on W (Limit.apex L)
coalg .ρ = ν
coalg .ρ-counit = L.unique₂ _
coalg (λ f → sym (L.eps .is-natural _ _ f) ∙ elimr L.Ext.F-id)
To show that it will suffice to show that But we have
(λ j → L.ψ j ∘ ε _ ∘ ν ≡⟨ pulll (sym (counit.is-natural _ _ _)) ⟩
(ε _ ∘ W₁ (L.ψ j)) ∘ ν ≡⟨ pullr ν-β ⟩
_ ∘ F.₀ j .snd .ρ ∘ L.ψ j ≡⟨ cancell (F.₀ j .snd .ρ-counit) ⟩
ε .ψ j ∎)
L(λ j → idr (L.ψ j))
.ρ-comult = L''.unique₂ _
coalg (λ f → W.extendl (F.₁ f .preserves) ∙ ap₂ _∘_ refl
( pulll (F.₁ f .preserves)
(sym (L.eps .is-natural _ _ f) ∙ elimr L.Ext.F-id)))
∙ pullr (λ j → W.extendl ν-β ∙ ap₂ _∘_ refl ν-β)
(λ j → pulll (sym (comult.is-natural _ _ _))
∙∙ pullr ν-β(sym (F.₀ j .snd .ρ-comult)))
∙∙ extendl
open Ran
open is-ran
Coalgebra-limit: (F : Functor I (Coalgebras W))
→ Limit (πᶠ (Coalgebras-over W) F∘ F)
→ Limit F
.Ext = Const (_ , Coalgebra-on-limit F lim) Coalgebra-limit F lim
It remains to show that the projection maps are coalgebra homomorphisms for the “lifted” structure defined above. But this condition is precisely i.e., the defining property of
.eps .η x .hom = lim .eps .η x
Coalgebra-limit F lim .eps .η x .preserves = Coalgebra-on-limit.ν-β F lim
Coalgebra-limit F lim .eps .is-natural x y f = ext $
Coalgebra-limit F lim _∘_ refl (sym (lim .Ext .Functor.F-id)) ∙ lim .eps .is-natural x y f ap₂
.has-ran = is-limit-coalgebra F $ natural-isos→is-ran
Coalgebra-limit F lim
idni idni rem₁(Nat-path λ x → idl _ ∙ elimr (elimr refl ∙ lim .Ext .Functor.F-id))
(lim .has-ran)
where
open make-natural-iso
: lim .Ext ≅ⁿ πᶠ (Coalgebras-over W) F∘ Const (_ , Coalgebra-on-limit F lim)
rem₁ = to-natural-iso λ where
rem₁ .eta x → id
.inv x → id
.eta∘inv x → idl id
.inv∘eta x → idl id
.natural x y f → eliml refl ∙ intror (lim .Ext .Functor.F-id)