Public:Comonads
UNDER CONSTRUCTION
Contents
Different representations
Recall that a comonad on a category \(\mathcal{A}\) is a triple \((C,\epsilon,\delta)\) such that
- \(C\colon \mathcal{A} \to \mathcal{A}\) is a functor,
- \(\epsilon\colon C \to \mathrm{Id}_\mathcal{A}\) is a natural transformation,
- \(\delta\colon C \to C^2\) is a natural transformation, and
- the following diagrams commute
\[ \begin{array}{rcl} C & \overset{\delta}\rightarrow & C^2 \\ {}_\delta\downarrow & & \downarrow {}_{\delta_C} \\ C^2 & \overset{C\delta}\rightarrow & C^3 \end{array} \qquad \qquad \begin{array}{rrl} C & \overset{\delta}\rightarrow & C^2 \\ & {}_{\id}\searrow & \downarrow {}_{\epsilon_C} \\ & & C \end{array} \qquad \qquad \begin{array}{rrl} C & \overset{\delta}\rightarrow & C^2 \\ & {}_{\mathrm{id}}\searrow & \downarrow {}_{C\epsilon} \\ & & C \end{array} \]
Equivalently, it can be represented as a Kleisli-Manes triple \((C, \epsilon, \overline{(-)})\) such that
- \(C\) is a mapping \(\mathrm{obj}(\mathcal{A}) \to \mathrm{obj}(\mathcal{A})\)
- \(\epsilon\) is a collection of morphisms \(\epsilon_A\colon C(A) \to A\), for every object \(A\in \mathcal A\)
- for every morphism \(f\colon C(A)\to B\) in \(\mathcal A\) we have a morphism \(\overline f\colon C(A)\to C(B)\) such that
- (C1) \(\ \overline{\epsilon_A} = \id_{C(A)}\) for all objects \(A\in \mathcal{A}\)
- (C2) \(\ \overline f \fcmp \epsilon_B = f\) for all morphisms \(f\colon C(A) \to B\)
- (C3) \(\ \overline{\overline f \fcmp g} = \overline f \fcmp \overline g\) for all morphisms \(f\colon C(A) \to B\) and \(g\colon C(B) \to E\)
Here \(f \fcmp g\) is the diagramatic composition of arrows, equivalent to the more standard \(g \circ f\).
To transfer from the standard representation to the Kleisli-Manes we assign:
- \((C,\epsilon,\delta) \mapsto (C, \epsilon, \overline{(-)}) \) where \(\overline f = \delta_A \fcmp C(f)\) for every \(f\colon C(A) \to B\)
And conversely:
- \((C, \epsilon, \overline{(-)}) \mapsto (C,\epsilon,\delta)\) where, for a morphism \(f\colon A \to B\), the morphism \(C(f)\colon C(A) \to C(B)\) is \(\overline{\epsilon_A \fcmp f}\) and \(\delta_A\) is equal to \(\overline{\id_{C(A)}}\).
In fact, this is a bijective correspondence, cf. Proposition 1.6 in [Moggi91 [1]]
Relative comonads
TODO
Comonad morphism
Given comonads \(C\) and \(D\) on categories \(\mathcal A\) and \(\mathcal B\), respectively, a comonad morphism \((F,\lambda)\colon D \to C\) is given by a functor \(F\colon \mathcal B\to \mathcal A\) and a natural transformation \(\lambda\colon CF \to FD\) such that
\[ \begin{array}{rcl} CF & \stackrel{\lambda}{\to} & FD \\ & {}_{\epsilon^C_F}\searrow & \downarrow_{F\epsilon^D} \\ & & F \end{array} \qquad \qquad \begin{array}{rcl} CF & --- & -\stackrel{\lambda}{--} & \to & FD \\ {}_{\delta^C_F}\downarrow & & & & \downarrow {}_{F\delta^D} \\ C^2F & \stackrel{C(\lambda)}{\to} & CFD & \stackrel{\lambda_D}{\to} & FD^2 \end{array} \]
In particular, if the two comonads \(C,D\) are on the same category \(\mathcal A\) a comonad morphism \(\lambda\colon C\to D\) is required to make the two following diagrams commute \[ \begin{array}{rcl} C & \stackrel{\lambda}{\to} & D \\ & {}_{\epsilon^C}\searrow & \downarrow_{\epsilon^D} \\ & & \Id \end{array} \qquad \qquad \begin{array}{rcl} C & --- & -\stackrel{\lambda}{--} & \to & D \\ {}_{\delta^C}\downarrow & & & & \downarrow {}_{\delta^D} \\ C^2 & \stackrel{C(\lambda)}{\to} & C\circ D & \stackrel{\lambda_D}{\to} & D^2 \end{array} \]
Given two morphisms \((F,\lambda),(F',\lambda')\colon D\to C\) of comonads. A morphism of comonad morphisms \(\gamma\colon (F,\lambda) \Rightarrow (F',\lambda')\) is given by a natural transformation \(\gamma\colon F\to F'\) such that
\[
\begin{array}{rcl}
CF & \stackrel{C\gamma}{\to} & CF'\\
{}_{\lambda}\downarrow & & {}_{\lambda'}\downarrow \\
FD & \stackrel{\gamma_D}{\to} & F'D
\end{array}
\]
Let's assume we have a functor \(F\colon \mathcal B\to \mathcal A\) and comonads \(C\) and \(D\) on \(\mathcal A\) and \(\mathcal B\), respectively. Then,
- comonad morphisms \((F,\lambda)\colon D\to C\) are in a bijective correspondence with functors \(\widehat F\colon EM(D) \to EM(C)\) such that \[ \array{ EM(D) & \stackrel{\widehat{F}}{\to} & EM(C) \\ \downarrow & & \downarrow \\ \mathcal B & \stackrel{F}{\to} & \mathcal A } \]
- If \(EM(D)\) has equalisers of reflexive pairs and \(F\) has a right adjoint, then any lifting \(\widehat F\) has a right adjoint.
- If \(T\) has a left adjoint and \(\lambda\colon D\to C\) is invertible, then the lifting \(\widehat T\) associated with \(\lambda\) has a left adjoint.
For details see Wisbauer's "Algebras versus Coalgebras" listed below.
Distributive laws
These are special kinds of comonad morphisms. Let \(C,D\) be two comonads on the same category \(\mathcal A\) and let \(\lambda\colon CD \to DC\) be a natural transformation which corresponds to a lifting \(\widehat D\) such that \[ \array{ EM(C) & \stackrel{\widehat{D}}{\to} & EM(C) \\ \downarrow & & \downarrow \\ \mathcal A & \stackrel{D}{\to} & \mathcal A } \] Then, \(\lambda\) is said to be a comonad distributive law if and only if \(\widehat{D}\) is a comonad on \(EM(C)\).
Comonad distributive laws \(\lambda\colon CD \to DC\) are in bijection with
- liftings \(\widehat C\colon EM(D) \to EM(D)\)
Distributive laws with monads
References
- Robert Wisbauer. Algebras versus coalgebras, Applied Categorical Structures 16.1 (2008): 255-295.
- Gabriella Böhm, Tomasz Brzeziński, Robert Wisbauer. Monads and comonads on module categories. Journal of Algebra 322.5 (2009): 1719-1747.
- Danel Ahman, Tarmo Uustalu. Decomposing Comonad Morphisms, in the 8th Conference on Algebra and Coalgebra in Computer Science (CALCO 2019). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2019.
- Michael Barr. Composite cotriples and derived functors. Seminar on Triples and Categorical Homology Theory. Springer, Berlin, Heidelberg, 1969.
TODO add more
Mentioned above:
- ↑ E. Moggi. “Notions of Computations and Monads”. In: Information and Computation 93.1 (1991), pp. 55–92.