Towards a Formal Theory of Graded Monads
 11 Citations
 1.3k Downloads
Abstract
We initiate a formal theory of graded monads whose purpose is to adapt and to extend the formal theory of monads developed by Street in the early 1970’s. We establish in particular that every graded monad can be factored in two different ways as a strict action transported along a left adjoint functor. We also explain in what sense the first construction generalizes the EilenbergMoore construction while the second construction generalizes the Kleisli construction. Finally, we illustrate the EilenbergMoore construction on the graded state monad induced by any object V in a symmetric monoidal closed category \(\mathscr {C}\).
Keywords
Monoidal Category Tensorial Logic Object Versus Cartesian Closed Category Kleisli Category1 Introduction
The combination of these works raised a lot of interest in the community and established the notion of parametric monad as an important concept of the discipline. We thus feel useful and timely to join forces and to develop a formal theory of parametric monads inspired by the seminal work by Street [21] on formal monads in 2categories. However, before doing that, we will explain in Sect. 2 why we decided to revise the original terminology and to call graded monad what we used to call parametric monad. As we will see, the change of terminology is justified mathematically, and the terminology seems to be convenient in itself^{1}.
We believe that these constructions are interesting in themselves. They also contribute to the general theory of graded monads, and more generally, of parametric notions of effects and resources.
Plan of the Paper. We start by explaining in Sect. 2 why it makes sense to call graded monads what we used to call parametric monads. Then, we describe in Sect. 3 the EilenbergMoore construction (see Sect. 3.1) and the Kleisli construction (see Sect. 3.2) for graded monads. After that, in Sect. 4 we provide a 2categorical perspective on our construction, by proving that we indeed defined the EilenbergMoore and Kleisli objects in the sense of Street. We illustrate the construction by applying it in Sect. 5 to the Injgraded state monad \(\mathbf {S}\) on the category Set. In particular, we present by generators and relations the Lawvere theory characterizing the graded \(\mathbf {S}\)algebras of the graded state monad \(\mathbf {S}\) as covariant presheaves over Inj with an extra structure.
2 Parametric Monads Are Graded Monads
An \(\mathbf{N}\)grading \((A_m)_{m\in \mathbf{N}}\) on R, which is the primary data of the \(\mathbf{N}\)graded ring, depicts a monoidlike structure in \(\mathbf{Ab}\). It consists of (1) multiple carrier objects \(A_m\) given for each grade \(m\in \mathbf{N}\), (2) a unit group homomorphism \(r_0:\mathbf{Z}\rightarrow A_0\) at grade 0, which corresponds to \(1\in A_0\), and (3) a family of graderespecting multiplications \(r_{m,n}:A_m\otimes A_n\rightarrow A_{m+n}\), which are restrictions of the multiplication \((\times ):R\otimes R\rightarrow R\) by the condition (4). These morphisms satisfy the usual unit and associativity laws. We thus call such a structure an \(\mathbf{N}\)graded monoid in \(\mathbf{Ab}\) [19], and identify it with a lax monoidal functor of type \((\mathbf{N},+,0)\rightarrow (\mathbf{Ab},\otimes ,\mathbf{Z})\), because both structures carry exactly the same data. More generally, for \(\mathscr {M}\) a monoidal category, we define an \(\mathscr {M}\)graded monoid in a monoidal category \(\mathscr {C}\) to be a lax monoidal functor of type \(\mathscr {M}\rightarrow \mathscr {C}\). Of course, ordinary monoids coincide with 1graded monoids.
A \(\mathscr {M}\)graded monad on\(\mathscr {A}\) may be then defined as an \(\mathscr {M}\)graded monoid in the strict monoidal category \(([\mathscr {A},\mathscr {A}],\circ ,Id)\) of endofunctors on \(\mathscr {A}\), in the style of [19, Sect. 1.1]. An easy calculation shows that \(\mathscr {M}\)graded monads on \(\mathscr {A}\) bijectively correspond to lax \(\mathscr {M}\)actions on \(\mathscr {A}\) in the previous section, and to \(\mathscr {M}\)parametric monads on \(\mathscr {A}\) as they are called in [8, 10, 13]. Following this correspondence, in the rest of the paper we use the terminology “graded monad” instead of “parametric monad”. The main reason for this change is that it makes it easy to relate categorical concepts around graded monads and algebraic concepts around graded rings. For instance, one easily sees that the concept of graded algebra of a graded monad, introduced in the previous section, is a categorical analogue of the concept of graded module over a graded ring.
3 Adjunction Pairs Induced from Graded Monads
Throughout this section we fix a monoidal category \((\mathscr {M},\otimes ,I)\), which we will consider strict for convenience, together with an \(\mathscr {M}\)graded monad \(\mathbf {T}=(*,\mu ,\eta )\) on a given category \(\mathscr {A}\). We have explained in the introduction that every adjunction \(L\dashv R:\mathscr {B}\rightarrow \mathscr {A}\) combined with a strict \(\mathscr {M}\)action \(\circledast \) on the category \(\mathscr {B}\) induces an \(\mathscr {M}\)graded monad \(m*a=R(m\circledast La)\) on the category \(\mathscr {A}\). Especially, when \(\mathscr {M}=1\), this reduces to the wellknown fact that the adjunction \(L\dashv R\) induces a monad \(R\circ L\). Conversely, a natural question is whether one can derive any\(\mathscr {M}\)graded monad \(\mathbf {T}=(*,\mu ,\eta )\) on a category \(\mathscr {A}\) as the result of “deforming” a strict \(\mathscr {M}\)action \(\circledast \) on a category \(\mathscr {B}\) along a suitable adjunction \(L\dashv R\) with \(L:\mathscr {A}\rightarrow \mathscr {B}\). Just as in the case of monads, we provide two answers, each of them corresponding to a different construction of the category \(\mathscr {B}\) as the category \(\mathscr {A}^{\mathbf {T}}\) of EilenbergMoore algebras, or as the Kleisli category \(\mathscr {A}_{\mathbf {T}}\) associated to the graded monad \(\mathbf {T}\). The constructions require that the category \(\mathscr {M}\) is small, and we thus make this hypothesis from now on. A pair of very similar constructions have been studied by Street in a nice but not sufficiently known paper [20] where two ordinary functors \(\hat{F},\tilde{F}:\mathscr {M}\rightarrow Cat\) are associated to a given lax functor\(F:\mathscr {M}\rightarrow Cat\) starting from a category \(\mathscr {M}\). As we will see, the two constructions adapt Street’s original constructions and mildly extend it to allow \(\mathscr {M}\) to be any monoidal category (seen as a oneobject 2category).
3.1 The EilenbergMoore Construction
Given an \(\mathscr {M}\)graded monad \(\mathbf {T}=(*,\mu ,\eta )\) over a category \(\mathscr {A}\), the category \(\mathscr {A}^{\mathbf {T}}\) of its EilenbergMoore algebras is defined in the following way.
Definition 1
Definition 2
Definition 3
(EilenbergMoore construction). The category \(\mathscr {A}^{\mathbf {T}}\) has graded \(\mathbf {T}\)algebras as objects and homomorphisms between them as morphisms.
One important observation is that the category \(\mathscr {A}^{\mathbf {T}}\) admits the following strict \(\mathscr {M}\)action.
Definition 4
Theorem 5
3.2 The Kleisli Construction
Given an \(\mathscr {M}\)graded monad \(\mathbf {T}=(*,\mu ,\eta )\) over a category \(\mathscr {A}\), the Kleisli category \(\mathscr {A}_{\mathbf {T}}\) is defined in the following way.
Definition 6
Definition 7
Theorem 8
3.3 Resolutions of Graded Monads
What are special about the EilenbergMoore and Kleisli resolutions of a graded monad? To answer this question, we introduce a suitable category consisting of resolutions of a graded monad, and show that EilenbergMoore and Kleisli resolutions are terminal and initial objects in this category. This is an extension of the theory of resolutions of monads to graded monads.
Definition 9
Let \(\mathbf {T}=(*,\mu ,\eta )\) be an \(\mathscr {M}\)graded monad on \(\mathscr {A}\).

A resolution of \(\mathbf {T}\) is a tuple of a 0cell \((\mathscr {B},\circledast )\) in \(\mathscr {M}\hbox {} Cat\) and an adjunction \(l\dashv r:\mathscr {B}\rightarrow \mathscr {A}\) in Cat such that \(\mathbf {T}\) coincides with the graded monad \(r(\circledast (l))\) derived from the adjunction \(l\dashv r\) and the strict \(\mathscr {M}\)action \(\circledast \).

Given two resolutions \(((\mathscr {B},\circledast ),l\dashv r)\) and \(((\mathscr {B}',\circledast '),l'\dashv r')\) of \(\mathbf {T}\), a morphism from the former to the latter is a 1cell \(h:(\mathscr {B},\circledast )\rightarrow (\mathscr {B}',\circledast ')\) in \(\mathscr {M}\hbox {} Cat\) such that \(h\circ l=l'\) and \(r=r'\circ h\) (here \(U^\mathscr {M}\) is implicitly applied to h).

We define the category \(Res(\mathbf {T})\) of resolutions of \(\mathbf {T}\) by the above data.
4 Towards a Formal Theory of Graded Monads
We explain how Street’s formal theory of monads can be adapted in order to characterize the two constructions of \(\mathscr {A}^{\mathbf {T}}\) and of \(\mathscr {A}_{\mathbf {T}}\) described in Sect. 3 as universal constructions. In his seminal paper [21], Street developed a general theory of monads relative to an arbitrary 2category K, so that the usual theory of monads is regained by instantiating K by Cat, the 2category of categories, functors, and natural transformations.
Definition 10
A monad \(\mathbf {T}\) in K is given by a 0cell k, a 1cell \(T:k\rightarrow k\), and 2cells \(\mu :T\circ T\Rightarrow T\) of K and \(\eta :\mathrm {id}_{k}\Rightarrow T\), satisfying the usual axioms \(\mu \circ \eta T=\mathrm {id}_{T}=\mu \circ T\eta \) and \(\mu \circ T\mu =\mu \circ \mu T\).
Among his various abstract developments of the theory, the notions of EilenbergMoore object and Kleisli object for a monad in a 2category will be the most important ones to our current work. We adopt the following definition, which appears for instance in [20]:
Definition 11
Definition 12
Now a remarkable point is that from this simple and abstract definition, one can reconstruct a fair amount of the wellknown properties of EilenbergMoore or Kleisli categories, including the existence of adjunctions which generate the monads, and the existence and uniqueness of comparison 1cells. The interested reader should consult [21] for an ingenious 2categorical manipulation achieving this reconstruction. In what follows, however, we choose to describe the adjunctions explicitly, for the sake of concreteness. As we did in Sect. 3, we suppose here that the category \(\mathscr {M}\) is small, a necessary condition in order to perform the constructions of the EilenbergMoore and Kleisli objects.
4.1 A 2Category for EilenbergMoore Objects
We introduce the 2category \(E^{++}\) where the category \(\mathscr {A}^{\mathbf {T}}\) of graded algebras (Definition 1) arises as an EilenbergMoore object in it. This 2category is obtained by a suitable lax comma construction for the 3category \(2\hbox {} Cat\) of 2categories, 2functors, 2natural transformations and modifications. We denote the terminal 2category by 1.
Definition 13
We define the 2category \(E^{++}\) by the following data.

A 0cell of \(E^{++}\) is a 2functor \(a: 1\rightarrow A\) where A is a 2category; equivalently, it is a pair (A, a) where a is a 0cell of A.
 A 1cell of \(E^{++}\) from (A, a) to \((A^\prime ,a^\prime )\) is a diagram in \(2\hbox {} Cat\) filled with a 2natural transformation f; equivalently, it is a pair (F, f) where \(f: Fa\rightarrow a^\prime \) is a 1cell of \(A^\prime \).
 A 2cell of \(E^{++}\) from (F, f) to \((F^\prime ,f^\prime )\) is a pair \((\varTheta ,\alpha )\) where \(\varTheta :F\rightarrow F'\) is a 2natural transformation and \(\alpha \) is a modification of the following type: Equivalently, \(\alpha \) is a 2cell of \(A^\prime \) of the following type:
The first projection of the data defines a 2functor \(p^{++}:E^{++}\rightarrow 2\hbox {} Cat_2\), where \(2\hbox {} Cat_2\) is the 2category of 2categories, 2functors, and 2natural transformations. We take a fibrational viewpoint [1, 7] and say a notion X is aboveI if \(p^{++}(X)=I\). A first key observation is the following:
Proposition 14
Let \((\mathscr {M},\otimes ,I)\) be a strict monoidal category and \(\mathscr {A}\) a category. Then, an \(\mathscr {M}\)graded monad on \(\mathscr {A}\) is the same thing as a monad in \(E^{++}\) on \((Cat,\mathscr {A})\), above the 2monad \(\mathscr {M}\times ()\) on Cat.
Thanks to this proposition, it makes sense to speculate on the EilenbergMoore objects (in the sense of Street) of graded monads in this 2category \(E^{++}\). Indeed, \(E^{++}\) turns out to admit EilenbergMoore objects of graded monads, and moreover the EilenbergMoore adjunction for an \(\mathscr {M}\)graded monad lies above that for the 2monad \(\mathscr {M}\times ()\).
Proposition 15
Proof
In general, for an adjunction \(L\dashv R\) in \(2\hbox {} Cat_2\) and a morphism \((R,r):(D,d)\rightarrow (C,c)\) in \(E^{++}\), a left adjoint to (R, r) above L in \(E^{++}\) bijectively corresponds to a left adjoint to \(r:c\rightarrow Rd\) in C. By letting (R, r) be \((U^\mathscr {M},u^{\mathbf {T}})\), where \(u^{\mathbf {T}}\) is a right adjoint, we obtain the above left adjoint, lying above \(F^\mathscr {M}\).
A long, but straightforward calculation establishes the announced result:
Theorem 16
Corollary 17
Let \(\mathbf {T}\) be a graded monad. Then \(((\mathscr {A}^{\mathbf {T}},\circledast ),f^{\mathbf {T}}\dashv u^{\mathbf {T}})\) is terminal in the category \(Res(\mathbf {T})\) of resolutions of \(\mathbf {T}\).
Proof
The idea is similar to that of Proposition 15.
4.2 A 2Category for Kleisli Objects
We next introduce the 2category \(E^{}\) where the category \(\mathscr {A}_\mathbf {T}\) (Definition 6) arises as a Kleisli object in it. It turns out to be a certain dual of the 2category \(E^{++}\):
Definition 18
Define the 2category \(E^{}\) as follows.

A 0cell of \(E^{}\) is a 2functor \(a: 1\rightarrow A\) where A is a 2category; equivalently, it is a pair (A, a) where a is a 0cell of A.
 A 1cell of \(E^{}\) from (A, a) to \((A^\prime ,a^\prime )\) is a diagram in \(2\hbox {} Cat\) filled with a 2natural transformation f; equivalently, it is a pair (F, f) where \(f: a\rightarrow Fa^\prime \) is a 1cell of A.
 A 2cell of \(E^{}\) from (F, f) to \((F^\prime ,f^\prime )\) is a pair \((\varTheta ,\alpha )\) where \(\varTheta :F'\rightarrow F\) is a 2natural transformation and \(\alpha \) is a modification of the following type: Equivalently, \(\alpha \) is a 2cell of A of the following type:
Again the first projection of the data defines a 2functor \(p^{}:E^{}\rightarrow 2\hbox {} Cat_2^{op(1,2)}\), where \(2\hbox {} Cat_2^{op(1,2)}\) is the 2category obtained by reversing both 1cells and 2cells of \(2\hbox {} Cat_2\).
Proposition 19
Let \((\mathscr {M},\otimes ,I)\) be a strict monoidal category and \(\mathscr {A}\) a category. Then, an \(\mathscr {M}\)graded monad on \(\mathscr {A}\) is the same thing as a monad in \(E^{}\) on \((Cat,\mathscr {A})\), above the 2comonad \([\mathscr {M},]\) on Cat.
Proposition 20
Proof
We give a proof similar to Proposition 15. This time we use the following fact: for an adjunction \(L\dashv R\) in \(2\hbox {} Cat_2\) and a 1cell \((L,l):(C,c)\rightarrow (D,d)\) in \(E^{}\), a right adjoint to (L, l) above R in \(E^{}\) bijectively corresponds to a right adjoint to \(l:c\rightarrow Ld\) in C.
Theorem 21
Corollary 22
Let \(\mathbf {T}\) be an \(\mathscr {M}\)graded monad. Then \(((\mathscr {A}_{\mathbf {T}},\circledast ),v_{\mathbf {T}}\dashv g_{\mathbf {T}})\) is initial in the category \(Res(\mathbf {T})\) of resolutions of \(\mathbf {T}\).
5 Illustration: The Graded State Monad

the family \(h_{m,n}: m*A_n\rightarrow A_{m\otimes n}\) is natural in m and n,

h satisfies the Eq. (5) of a graded \(\mathbf {S}\)algebra.
The equations are given in the Appendix. The resulting algebraic presentation of graded \(\mathbf {S}\)algebras by operations and equations enables one to establish that
Theorem 23
The canonical forgetful functor \(U:Set^\mathbf {S}\rightarrow [Inj,Set]\) given by \((A,h)\mapsto A\) is monadic.
One main reason for studying the Injgraded monad \(\mathbf {S}\) is that it induces in this way a monad on [Inj, Set] with arities \(\varTheta :\varSigma Inj^{\,op}\rightarrow [Inj,Set]\) whose Lawvere theory Open image in new window with arities \(\varTheta \) is a subtheory of the Lawvere theory Open image in new window (with same arities) of the local state monad L presented by generators and relations in [14].
Interestingly, the resulting algebraic theory Open image in new window captures only a restricted part of the original algebraic theory Open image in new window since the multiplication \(\mu _{m,n,A}\) does not enable the graded algebra \((A_m)_{m\in Inj}\) to pass states from one layer of application \((m*)\) of the graded state monad to the next layer \((n*)\). This limitation should not be seen as a defect but rather as a feature of the graded state monad \(\mathbf {S}\) since it enables us to delineate a natural fragment of the local state monad L.
Footnotes
 1.
It should be noted that the notion of \(\mathscr {M}\)graded monad is the same thing as a lax 2functor \(\varSigma \mathscr {M}\rightarrow \mathbf {Cat}\) from the bicategory \(\varSigma \mathscr {M}\) with one object \(*\) obtained by “suspending” the monoidal category \(\mathscr {M}\), to the 2category \(\mathbf {Cat}\). For that reason, we consider that the notion of lax action and of graded monad (in its full generality) deserves to be traced back to the seminal work by Bénabou on bicategories [2].
Notes
Acknowledgments
The authors are grateful to the anonymous reviewer for suggesting an alternative and more elegant construction of the graded state monad. The authors are also grateful to Marco Gaboardi and to Dominic Orchard for a number of useful discussions about this work. The authors were supported by the JSPSINRIA Bilateral Joint Research Project CRECOGI, the second author was supported by GrantinAid No.15K00014 while the third author was partly supported by the ANR Project Recre.
References
 1.Baković, I.: Fibrations of bicategories. Available on the ArXiVGoogle Scholar
 2.Bénabou, J.: Introduction to bicategories. In: Reports of the Midwest Category Seminar. Lecture Notes in Mathematics, vol. 47, pp. 1–77. Springer, Heidelberg (1967)Google Scholar
 3.Berger, C., Melliès, P.A., Weber, M.: Monads with arities and their associated theories. J. Pure Appl. Algebra 216, 2029–2048 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
 4.Dal Lago, U.: A short introduction to implicit computational complexity. In: Bezhanishvili, N., Goranko, V. (eds.) ESSLLI 2010 and ESSLLI 2011. LNCS, vol. 7388, pp. 89–109. Springer, Heidelberg (2012)CrossRefGoogle Scholar
 5.Dal Lago, U., Gaboardi, M.: Linear dependent types and relative completeness. Log. Meth. Comput. Sci. 8(4), 12 (2012)MathSciNetzbMATHGoogle Scholar
 6.Grellois, C., Melliès, P.A.: Relational semantics of linear logic, higherorder model checking. In: Proceedings of CSL 2015, pp. 260–276 (2015)Google Scholar
 7.Hermida, C.: Descent on 2fibrations and strongly 2regular 2categories. Appl. Categorical Struct. 12(5–6), 427–459 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
 8.Katsumata, S.y.: Parametric effect monads and semantics of effect systems. In: Proceedings of POPL 2014, pp. 633–645. ACM (2014)Google Scholar
 9.Melliès, P.A.: Towards an algebra of duality. Talk given during the workshop Linear Logic, Ludics, Implicit Complexity, Operator Algebras, dedicated to JeanYves Girard on the occasion of his 60th birthday, May 2007Google Scholar
 10.Melliès, P.A.: Game semantics in string diagrams. In: Proceedings of Logic In Computer Science, LICS, Dubrovnik (2012)Google Scholar
 11.Melliès, P.A.: Segal condition meets computational effects. LICS (2010)Google Scholar
 12.Melliès, P.A.: Sharing and duplication in tensorial logic. Invited talk at the 4th International workshop on Developments in Implicit Computational complexity (DICE), Rome, March 2013Google Scholar
 13.Melliès, P.A.: Parametric monads and enriched adjunctions. Syntax and Semantics of Low Level Languages, LOLA, Dubrovnik. Manuscript available on the author’s webpage (2012)Google Scholar
 14.Melliès, P.A.: Local states in string diagrams. In: Dowek, G. (ed.) RTATLCA 2014. LNCS, vol. 8560, pp. 334–348. Springer, Heidelberg (2014)Google Scholar
 15.Melliés, P.A.: The parametric continuation monad. Festschrift in honor of Corrado Böhm for his 90th birthday. Mathematical Structures in Computer Science (2016)Google Scholar
 16.Milius, S., Pattinson, D., Schröder, L.: Generic trace semantics and graded monads. Calco (2015)Google Scholar
 17.Petricek, T., Orchard, D., Mycroft, A.: Coeffects: unified static analysis of contextdependence. In: Fomin, F.V., Freivalds, R., Kwiatkowska, M., Peleg, D. (eds.) ICALP 2013, Part II. LNCS, vol. 7966, pp. 385–397. Springer, Heidelberg (2013)Google Scholar
 18.Plotkin, G., Power, J.: Computational effects determine monads. In: Proceedings of FoSSaCS, Grenoble (2002)Google Scholar
 19.Smirnov, A.: Graded monads and rings of polynomials. J. Math. Sci. 151(3), 3032–3051 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
 20.Street, R.: Two constructions on lax functors. Cahiers de topologie et géométrie différentielle 13, 217–264 (1972)MathSciNetzbMATHGoogle Scholar
 21.Street, R.: The formal theory of monads. J. Pure Appl. Algebra 2(2), 149–168 (1972)MathSciNetCrossRefzbMATHGoogle Scholar