module Cat.Monoidal.Strength where
Strong functorsπ
module _
{o β} {C : Precategory o β}
(Cα΅ : Monoidal-category C)
(F : Functor C C)
where
open Cat.Reasoning C
open Monoidal-category Cα΅
open Functor F
private module F = Cat.Functor.Reasoning F
A left strength for a functor on a monoidal category is a natural transformation
interacting nicely with the left unitor and associator.
record Left-strength : Type (o β β) where
field
: -β- Fβ (Id FΓ F) => F Fβ -β-
left-strength
module Ο = _=>_ left-strength
: β {A B} β Hom (A β Fβ B) (Fβ (A β B))
Ο = Ο.Ξ· _
Ο
field
: β {A} β Fβ (Ξ»β {A}) β Ο β‘ Ξ»β
left-strength-Ξ»β : β {A B C}
left-strength-Ξ±β β Fβ (Ξ±β A B C) β Ο β‘ Ο β (id ββ Ο) β Ξ±β A B (Fβ C)
Reversely1, a right strength is a natural transformation
interacting nicely with the right unitor and associator.
record Right-strength : Type (o β β) where
field
: -β- Fβ (F FΓ Id) => F Fβ -β-
right-strength
module Ο = _=>_ right-strength
: β {A B} β Hom (Fβ A β B) (Fβ (A β B))
Ο = Ο.Ξ· _
Ο
field
: β {A} β Fβ (Οβ {A}) β Ο β‘ Οβ
right-strength-Οβ : β {A B C}
right-strength-Ξ±β β Fβ (Ξ±β A B C) β Ο β‘ Ο β (Ο ββ id) β Ξ±β (Fβ A) B C
: β {A B C} β Ο β Ξ±β (Fβ A) B C β‘ Fβ (Ξ±β A B C) β Ο β (Ο ββ id)
right-strength-Ξ±β = sym $ swizzle
right-strength-Ξ±β (sym (right-strength-Ξ±β β assoc _ _ _))
(Ξ±β
.invr)
(F.F-map-iso Ξ±β
.invl)
A strength for is a pair of a left strength and a right strength inducing a single operation i.e.Β making the following diagram commute:
record Strength : Type (o β β) where
field
: Left-strength
strength-left : Right-strength
strength-right
open Left-strength strength-left public
open Right-strength strength-right public
field
: β {A B C}
strength-Ξ±β β Fβ (Ξ±β A B C) β Ο β (Ο ββ id) β‘ Ο β (id ββ Ο) β Ξ±β A (Fβ B) C
A functor equipped with a strength is called a strong functor.
private unquoteDecl left-eqv = declare-record-iso left-eqv (quote Left-strength)
Left-strength-path: β {a b} β a .Left-strength.left-strength β‘ b .Left-strength.left-strength
β a β‘ b
= Iso.injective left-eqv (Ξ£-prop-path (Ξ» _ β hlevel 1) p)
Left-strength-path p
private unquoteDecl right-eqv = declare-record-iso right-eqv (quote Right-strength)
Right-strength-path: β {a b} β a .Right-strength.right-strength β‘ b .Right-strength.right-strength
β a β‘ b
= Iso.injective right-eqv (Ξ£-prop-path (Ξ» _ β hlevel 1) p) Right-strength-path p
Symmetryπ
module _ (Cα΅ : Braided-monoidal Cα΅) where
open Braided Cα΅ Cα΅
open is-iso
In a symmetric monoidal category (or even just a braided monoidal category, if one is careful about directions), there is an equivalence between the notions of left and right strength: we can obtain one from the other by βconjugatingβ with the braiding, as illustrated by this diagram.
Therefore, the literature usually speaks of βstrengthβ in a symmetric
monoidal category to mean either a left or a right strength, but note
that this is not quite the same as a Strength
as defined above, which has left
and right strengths not necessarily related by the braiding. If
they are, we will say that the strength is symmetric; such a
strength contains exactly the information of a left (or right)
strength.
: Strength β Type (o β β)
is-symmetric-strength = β {A B} β Ο {A} {B} β Ξ²β β‘ Fβ Ξ²β β Ο
is-symmetric-strength s where open Strength s
The construction of the equivalence between left and right strengths
is extremely tedious, so we leave the details to the curious reader.
: Iso Left-strength Right-strength leftβright
: Iso Left-strength Right-strength leftβright
.fst l = r where
leftβright open Left-strength l
open Right-strength
: Right-strength
r .right-strength .Ξ· _ = Fβ Ξ²β β Ο β Ξ²β
r .right-strength .is-natural _ _ (f , g) =
r (Fβ Ξ²β β Ο β Ξ²β) β (Fβ f ββ g) β‘β¨ pullr (pullr (Ξ²β.is-natural _ _ _)) β©
(g ββ Fβ f) β Ξ²β β‘β¨ reflβ©ββ¨ extendl (Ο.is-natural _ _ _) β©
Fβ Ξ²β β Ο β (g ββ f) β Ο β Ξ²β β‘β¨ F.extendl (Ξ²β.is-natural _ _ _) β©
Fβ Ξ²β β Fβ (f ββ g) β Fβ Ξ²β β Ο β Ξ²β β
Fβ .right-strength-Οβ =
r .pulll Οβ-Ξ²β β©
Fβ Οβ β Fβ Ξ²β β Ο β Ξ²β β‘β¨ F
Fβ Ξ»β β Ο β Ξ²β β‘β¨ pulll left-strength-Ξ»β β©
Ξ»β β Ξ²β β‘β¨ Ξ»β-Ξ²β β©
Οβ β.right-strength-Ξ±β =
r (Ξ±β _ _ _) β Fβ Ξ²β β Ο β Ξ²β β‘β¨ reflβ©ββ¨ reflβ©ββ¨ pushl3 (sym (lswizzle (Ο.is-natural _ _ _) (F.annihilate (β.annihilate (Ξ²β
.invl))))) β©
Fβ (Ξ±β _ _ _) β Fβ Ξ²β β Fβ (Ξ²β ββ id) β Ο β (Ξ²β ββ β Fβ id β) β Ξ²β β‘β¨ ap! F-id β©
Fβ (Ξ±β _ _ _) β Fβ Ξ²β β Fβ (Ξ²β ββ id) β Ο β (Ξ²β ββ id) β Ξ²β β‘β¨ F.extendl3 (sym Ξ²β-idβΞ²β-Ξ±β) β©
Fβ (id ββ Ξ²β) β Fβ (Ξ±β _ _ _) β Ο β (Ξ²β ββ id) β Ξ²β β‘β¨ reflβ©ββ¨ reflβ©ββ¨ pulll left-strength-Ξ±β β©
Fβ Ξ²β β Fβ (id ββ Ξ²β) β (Ο β (id ββ Ο) β Ξ±β _ _ _) β (Ξ²β ββ id) β Ξ²β β‘β¨ reflβ©ββ¨ reflβ©ββ¨ pullr (pullr refl) β©
Fβ Ξ²β β Fβ (id ββ Ξ²β) β Ο β (id ββ Ο) β Ξ±β _ _ _ β (Ξ²β ββ id) β Ξ²β β‘β¨ reflβ©ββ¨ pushr (pushr (reflβ©ββ¨ sym Ξ²β-Ξ²ββid-Ξ±β)) β©
Fβ Ξ²β β Fβ (Fβ (id ββ Ξ²β) β Ο β (id ββ Ο)) β Ξ²β β (Ξ²β ββ id) β Ξ±β _ _ _ β‘Λβ¨ reflβ©ββ¨ pulll (βΆ.shufflel (Ο.is-natural _ _ _)) β©
Fβ Ξ²β β (id ββ (Fβ Ξ²β β Ο)) β Ξ²β β (Ξ²β ββ id) β Ξ±β _ _ _ β‘β¨ pushr (pushr (extendl (sym (Ξ²β.is-natural _ _ _)))) β©
Fβ Ξ²β β Ο β (Fβ Ξ²β β Ο β Ξ²β) β ((Fβ Ξ²β β Ο) ββ id) β (Ξ²β ββ id) β Ξ±β _ _ _ β‘β¨ reflβ©ββ¨ β.pulll (sym (assoc _ _ _)) β©
(Fβ Ξ²β β Ο β Ξ²β) β ((Fβ Ξ²β β Ο β Ξ²β) ββ id) β Ξ±β _ _ _ β
.snd .inv r = l where
leftβright open Right-strength r
open Left-strength
: Left-strength
l .left-strength .Ξ· _ = Fβ Ξ²β β Ο β Ξ²β
l .left-strength .is-natural _ _ (f , g) =
l (Fβ Ξ²β β Ο β Ξ²β) β (f ββ Fβ g) β‘β¨ pullr (pullr (Ξ²β.is-natural _ _ _)) β©
(Fβ g ββ f) β Ξ²β β‘β¨ reflβ©ββ¨ extendl (Ο.is-natural _ _ _) β©
Fβ Ξ²β β Ο β (g ββ f) β Ο β Ξ²β β‘β¨ F.extendl (Ξ²β.is-natural _ _ _) β©
Fβ Ξ²β β Fβ (f ββ g) β Fβ Ξ²β β Ο β Ξ²β β
Fβ .left-strength-Ξ»β =
l .pulll Ξ»β-Ξ²β β©
Fβ Ξ»β β Fβ Ξ²β β Ο β Ξ²β β‘β¨ F
Fβ Οβ β Ο β Ξ²β β‘β¨ pulll right-strength-Οβ β©
Οβ β Ξ²β β‘β¨ Οβ-Ξ²β β©
Ξ»β β.left-strength-Ξ±β =
l (Ξ±β _ _ _) β Fβ Ξ²β β Ο β Ξ²β β‘β¨ reflβ©ββ¨ reflβ©ββ¨ pushl3 (sym (lswizzle (Ο.is-natural _ _ _) (F.annihilate (βΆ.annihilate (Ξ²β
.invr))))) β©
Fβ (Ξ±β _ _ _) β Fβ Ξ²β β Fβ (id ββ Ξ²β) β Ο β (β Fβ id β ββ Ξ²β) β Ξ²β β‘β¨ ap! F-id β©
Fβ (Ξ±β _ _ _) β Fβ Ξ²β β Fβ (id ββ Ξ²β) β Ο β (id ββ Ξ²β) β Ξ²β β‘β¨ F.extendl3 ((reflβ©ββ¨ Ξ²β.is-natural _ _ _) β sym Ξ²β-Ξ²ββid-Ξ±β) β©
Fβ (Ξ²β ββ id) β Fβ (Ξ±β _ _ _) β Ο β (id ββ Ξ²β) β Ξ²β β‘β¨ reflβ©ββ¨ reflβ©ββ¨ pulll right-strength-Ξ±β β©
Fβ Ξ²β β Fβ (Ξ²β ββ id) β (Ο β (Ο ββ id) β Ξ±β _ _ _) β (id ββ Ξ²β) β Ξ²β β‘β¨ reflβ©ββ¨ reflβ©ββ¨ pullr (pullr refl) β©
Fβ Ξ²β β Fβ (Ξ²β ββ id) β Ο β (Ο ββ id) β Ξ±β _ _ _ β (id ββ Ξ²β) β Ξ²β β‘β¨ reflβ©ββ¨ pushr (pushr (reflβ©ββ¨ ((reflβ©ββ¨ sym (Ξ²β.is-natural _ _ _)) β sym Ξ²β-idβΞ²β-Ξ±β))) β©
Fβ Ξ²β β Fβ (Fβ (Ξ²β ββ id) β Ο β (Ο ββ id)) β Ξ²β β (id ββ Ξ²β) β Ξ±β _ _ _ β‘Λβ¨ reflβ©ββ¨ pulll (β.shufflel (Ο.is-natural _ _ _)) β©
Fβ Ξ²β β ((Fβ Ξ²β β Ο) ββ id) β Ξ²β β (id ββ Ξ²β) β Ξ±β _ _ _ β‘β¨ pushr (pushr (extendl (sym (Ξ²β.is-natural _ _ _)))) β©
Fβ Ξ²β β Ο β (Fβ Ξ²β β Ο β Ξ²β) β (id ββ (Fβ Ξ²β β Ο)) β (id ββ Ξ²β) β Ξ±β _ _ _ β‘β¨ reflβ©ββ¨ βΆ.pulll (sym (assoc _ _ _)) β©
(Fβ Ξ²β β Ο β Ξ²β) β (id ββ (Fβ Ξ²β β Ο β Ξ²β)) β Ξ±β _ _ _ β
.snd .rinv r = Right-strength-path $ ext Ξ» (A , B) β
leftβright (Fβ Ξ²β β Ο β Ξ²β) β Ξ²β β‘β¨ extendl (F.cancell (Ξ²β
.invl)) β©
Fβ Ξ²β β (Ξ²β
.invl) β©
Ο β Ξ²β β Ξ²β β‘β¨ elimr
Ο βwhere open Right-strength r
.snd .linv l = Left-strength-path $ ext Ξ» (A , B) β
leftβright (Fβ Ξ²β β Ο β Ξ²β) β Ξ²β β‘β¨ extendl (F.cancell (Ξ²β
.invr)) β©
Fβ Ξ²β β (Ξ²β
.invr) β©
Ο β Ξ²β β Ξ²β β‘β¨ elimr
Ο βwhere open Left-strength l
Dualityπ
As hinted to above, a right strength for on can equivalently be defined as a left strength on the reverse monoidal category It is entirely trivial to show that the two definitions are equivalent:
module _ {o β} {C : Precategory o β}
(M : Monoidal-category C) (F : Functor C C)
where
open is-iso
: Left-strength (M ^rev) F β Right-strength M F
strength^rev = IsoβEquiv is where
strength^rev : Iso _ _
is .fst l = record
is { right-strength = NT (Ξ» _ β Ο) Ξ» _ _ _ β Ο.is-natural _ _ _
; right-strength-Οβ = left-strength-Ξ»β
; right-strength-Ξ±β = left-strength-Ξ±β
} where open Left-strength l
.snd .inv r = record
is { left-strength = NT (Ξ» _ β Ο) Ξ» _ _ _ β Ο.is-natural _ _ _
; left-strength-Ξ»β = right-strength-Οβ
; left-strength-Ξ±β = right-strength-Ξ±β
} where open Right-strength r
.snd .rinv _ = Right-strength-path _ _ trivial!
is .snd .linv _ = Left-strength-path _ _ trivial! is
Sets-endofunctors are strongπ
module _ {β} (F : Functor (Sets β) (Sets β)) where
open Functor F
open Left-strength
Every endofunctor on seen as a cartesian monoidal category, can be equipped with a canonical symmetric strength: the tensor product is the actual product of sets, so, given we can simply apply the functorial action of on the function yielding a function
: Left-strength Setsβ F
Sets-strength .left-strength .Ξ· (A , B) (a , Fb) = Fβ (a ,_) Fb
Sets-strength .left-strength .is-natural (A , B) (C , D) (ac , bd) =
Sets-strength Ξ» a Fb β (sym (F-β _ _) β F-β _ _) $β Fb
ext .left-strength-Ξ»β =
Sets-strength Ξ» _ Fa β (sym (F-β _ _) β F-id) $β Fa
ext .left-strength-Ξ±β =
Sets-strength Ξ» a b Fc β (sym (F-β _ _) β F-β _ _) $β Fc ext
This is an instance of a more general fact: in a closed monoidal category (that is, one with an adjunction for example coming from a cartesian closed category), left strengths for endofunctors are equivalent to enrichments of F: that is, natural transformations
internalising the functorial action Then, what we have shown boils down to the fact that every endofunctor on is trivially
That is, on the other side of the reverse monoidal category duality.β©οΈ