Abstract
When modelling side-effects using a monad, we need to equip the monad with effectful operations. This can be done by noting that each algebra of the monad carries interpretations of the desired operations. We consider the analogous situation for graded monads, which are a generalization of monads that enable us to track quantitative information about side-effects. Grading makes a significant difference: while many graded monads of interest can be equipped with similar operations, the algebras often cannot. We explain where these operations come from for graded monads. To do this, we introduce the notion of flexibly graded monad, for which the situation is similar to the situation for ordinary monads. We then show that each flexibly graded monad induces a canonical graded monad in such a way that operations for the flexibly graded monad carry over to the graded monad. In doing this, we reformulate grading in terms of locally graded categories, showing in particular that graded monads are a particular kind of relative monad. We propose that locally graded categories are a useful setting for work on grading in general.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Altenkirch, T., Chapman, J., Uustalu, T.: Monads need not be endofunctors. Log. Methods Comput. Sci 11(1), 3:1–3:40 (2015). https://doi.org/10.2168/lmcs-11(1:3)2015
Dorsch, U., Milius, S., Schröder, L.: Graded monads and graded logics for the linear time - branching time spectrum. In: Fokkink, W., van Glabbeek, R. (eds.) Proc. of 30th Int. Conf. on Concurrency Theory, CONCUR 2019, Leibniz Int. Proc. in Informatics, vol. 140, pp. 36:1–36:16. Dagstuhl Publishing, SaarbrĂ¼cken/Wadern (2019). https://doi.org/10.4230/lipics.concur.2019.36
Fritz, T., Perrone, P.: A probability monad as the colimit of spaces of finite samples. Theor. Appl. Categ. 34(7), 170–220 (2019). http://www.tac.mta.ca/tac/volumes/34/7/34-07abs.html
Fujii, S., Katsumata, S., Melliès, P.-A.: Towards a formal theory of graded monads. In: Jacobs, B., Löding, C. (eds.) FoSSaCS 2016. LNCS, vol. 9634, pp. 513–530. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49630-5_30
Gaboardi, M., Katsumata, S., Orchard, D., Sato, T.: Graded hoare logic and its categorical semantics. In: ESOP 2021. LNCS, vol. 12648, pp. 234–263. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-72019-3_9
Garner, R.: An embedding theorem for tangent categories. Adv. Math. 323, 668–687 (2018). https://doi.org/10.1016/j.aim.2017.10.039
Goncharov, S.: Trace semantics via generic observations. In: Heckel, R., Milius, S. (eds.) CALCO 2013. LNCS, vol. 8089, pp. 158–174. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-40206-7_13
Gordon, R., Power, A.: Algebraic structure for bicategory enriched categories. J. Pure Appl. Algebra 130(2), 119–132 (1998). https://doi.org/10.1016/s0022-4049(97)00094-7
Katsumata, S.: Parametric effect monads and semantics of effect systems. In: Proceedings of 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2014, pp. 633–645. ACM Press, New York (2014). https://doi.org/10.1145/2535838.2535846
Katsumata, S., McDermott, D., Uustalu, T., Wu, N.: Flexible presentations of graded monads. Proc. ACM Program. Lang. 6(ICFP), 123:1–123:29 (2022). https://doi.org/10.1145/3547654
Kelly, G.M.: Basic Concepts of Enriched Category Theory, London Math. Soc. Lecture Note Series, vol. 64. Cambridge University Press, Cambridge (1982), reprinted as: Reprints Theor. Appl. Categ. 10 (2005). http://www.tac.mta.ca/tac/reprints/articles/10/tr10abs.html
Kura, S.: Graded algebraic theories. In: FoSSaCS 2020. LNCS, vol. 12077, pp. 401–421. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-45231-5_21
Levy, P.B.: Locally graded categories. Slides (2019). https://www.cs.bham.ac.uk/~pbl/papers/locgrade.pdf
Lobbia, G.: Distributive laws for relative monads. arXiv preprint arXiv:2007.12982 [math.CT] (2020). https://arxiv.org/abs/2007.12982
Marmolejo, F., Wood, R.J.: Monads as extension systems: No iteration is necessary. Theor. Appl. Categ. 24(4), 84–113 (2010). http://www.tac.mta.ca/tac/volumes/24/4/24-04abs.html
Melliès, P.A.: Parametric monads and enriched adjunctions. Manuscript (2012). https://www.irif.fr/~mellies/tensorial-logic/8-parametric-monads-and-enriched-adjunctions.pdf
Milius, S., Pattinson, D., Schröder, L.: Generic trace semantics and graded monads. In: Moss, L.S., SobociÅ„ski, P. (eds.) Proceedings of 6th Conference on Algebra and Coalgebra in Computer Science, CALCO 2015, Leibniz Int. Proceedings in Informatics, vol. 35, pp. 253–269. Dagstuhl Publishing, SaarbrĂ¼cken/Wadern (2015). https://doi.org/10.4230/lipics.calco.2015.253
Moggi, E.: Computational lambda-calculus and monads. In: Proceedings of 4th Annual Symposium on Logic in Computer Science, LICS 1989, pp. 14–23. IEEE Press, Los Alamitos, CA (1989). https://doi.org/10.1109/lics.1989.39155
Moggi, E.: Notions of computation and monads. Inf. Comput. 93(1), 55–92 (1991). https://doi.org/10.1016/0890-5401(91)90052-4
Mycroft, A., Orchard, D., Petricek, T.: Effect systems revisited—control-flow algebra and semantics. In: Probst, C.W., Hankin, C., Hansen, R.R. (eds.) Semantics, Logics, and Calculi. LNCS, vol. 9560, pp. 1–32. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-27810-0_1
Plotkin, G., Power, J.: Algebraic operations and generic effects. Appl. Categ. Struct. 11, 69–94 (2003). https://doi.org/10.1023/a:1023064908962
Smirnov, A.: Graded monads and rings of polynomials. J. Math. Sci. 151(3), 3032–3051 (2008). https://doi.org/10.1007/s10958-008-9013-7
Staton, S.: An algebraic presentation of predicate logic. In: Pfenning, F. (ed.) FoSSaCS 2013. LNCS, vol. 7794, pp. 401–417. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-37075-5_26
Street, R.: Two constructions on lax functors. Cah. Topol. Géom. Diff. Catég. 13(3), 217–264 (1972). http://www.numdam.org/item/CTGDC_1972__13_3_217_0
Ulmer, F.: Properties of dense and relative adjoint functors. J. Algebra 8(1), 77–95 (1968). https://doi.org/10.1016/0021-8693(68)90036-7
Wood, R.J.: Indicial Methods for Relative Categories. Ph.D. thesis, Dalhousie University (1976). http://hdl.handle.net/10222/55465
Acknowledgements
We thank Nathanael Arkor, Shin-ya Katsumata and Nicolas Wu for helpful discussions. Both authors were supported by the Icelandic Research Fund grants no. 196323-053 and 228684-051.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
McDermott, D., Uustalu, T. (2022). Flexibly Graded Monads and Graded Algebras. In: Komendantskaya, E. (eds) Mathematics of Program Construction. MPC 2022. Lecture Notes in Computer Science, vol 13544. Springer, Cham. https://doi.org/10.1007/978-3-031-16912-0_4
Download citation
DOI: https://doi.org/10.1007/978-3-031-16912-0_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-16911-3
Online ISBN: 978-3-031-16912-0
eBook Packages: Computer ScienceComputer Science (R0)