Interaction Laws of Monads and Comonads

We introduce and study functor-functor and monad-comonad interaction laws as mathematical objects to describe interaction of effectful computations with behaviors of effect-performing machines. Monad-comonad interaction laws are monoid objects of the monoidal category of functor-functor interaction laws. We show that, for suitable generalizations of the concepts of dual and Sweedler dual, the greatest functor resp. monad interacting with a given functor or comonad is its dual while the greatest comonad interacting with a given monad is its Sweedler dual. We relate monad-comonad interaction laws to stateful runners. We show that functor-functor interaction laws are Chu spaces over the category of endofunctors taken with the Day convolution monoidal structure. Hasegawa's glueing endows the category of these Chu spaces with a monoidal structure whose monoid objects are monad-comonad interaction laws.

[1]  Frank J. Oles,et al.  A category-theoretic approach to the semantics of programming languages , 1982 .

[2]  de Paiva,et al.  The Dialectica categories , 1991 .

[3]  Bernardo Toninho,et al.  Dependent session types via intuitionistic linear type theory , 2011, PPDP.

[4]  M. Barr THE CHU CONSTRUCTION: HISTORY OF AN IDEA , 2006 .

[5]  Ross Street,et al.  Generalizations of the Sweedler Dual , 2015, Appl. Categorical Struct..

[6]  Eugenio Moggi,et al.  Computational lambda-calculus and monads , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[7]  Gordon D. Plotkin,et al.  Handling Algebraic Effects , 2013, Log. Methods Comput. Sci..

[8]  Du Sko Pavlovi,et al.  Chu I: Cofree Equivalences, Dualities and -autonomous Categories , 1993 .

[9]  Gordon D. Plotkin,et al.  Semantics for Algebraic Operations , 2001, MFPS.

[10]  Andrej Bauer,et al.  Programming with algebraic effects and handlers , 2012, J. Log. Algebraic Methods Program..

[11]  Andrej Bauer What is algebraic about algebraic effects and handlers? , 2018, ArXiv.

[12]  H. Porst Hopf monoids in varieties , 2018 .

[13]  Dirk Pattinson,et al.  Comodels and Effects in Mathematical Operational Semantics , 2013, FoSSaCS.

[14]  Martin Hyland,et al.  Glueing and orthogonality for models of linear logic , 2003, Theor. Comput. Sci..

[15]  S. Lack,et al.  Introduction to extensive and distributive categories , 1993 .

[16]  S. Lane Categories for the Working Mathematician , 1971 .

[17]  Tarmo Uustalu,et al.  Update Monads: Cointerpreting Directed Containers , 2013, TYPES.

[18]  Andrej Bauer,et al.  Runners in Action , 2020, ESOP.

[19]  John Power,et al.  The Category Theoretic Understanding of Universal Algebra: Lawvere Theories and Monads , 2007, Computation, Meaning, and Logic.

[20]  Peter Hancock,et al.  Programming interfaces and basic topology , 2009, Ann. Pure Appl. Log..

[21]  Gordon D. Plotkin,et al.  Algebraic Operations and Generic Effects , 2003, Appl. Categorical Struct..

[22]  Philip Wadler Propositions as sessions , 2014, J. Funct. Program..

[23]  Radha Jagadeesan,et al.  Games and Full Completeness for Multiplicative Linear Logic , 1994, J. Symb. Log..

[24]  Glynn Winskel,et al.  A Higher-Order Calculus for Categories , 2001, TPHOLs.

[25]  Gordon D. Plotkin,et al.  Tensors of Comodels and Models for Operational Semantics , 2008, MFPS.

[26]  Exequiel Rivas,et al.  Notions of computation as monoids* , 2014, Journal of Functional Programming.

[27]  Fosco Loregian,et al.  This is the (co)end, my only (co)friend , 2015 .

[28]  B. Day On closed categories of functors , 1970 .

[29]  M. Hyland,et al.  Hopf measuring comonoids and enrichment , 2015, 1509.07632.

[30]  Tarmo Uustalu,et al.  Coalgebraic Update Lenses , 2014, MFPS.

[31]  Eugenio Moggi,et al.  Monad transformers as monoid transformers , 2010, Theor. Comput. Sci..

[32]  Tarmo Uustalu,et al.  Coproducts of Ideal Monads , 2004, RAIRO Theor. Informatics Appl..

[33]  Ambrus Kaposi,et al.  Free Applicative Functors , 2014, MSFP.

[34]  Marcelo Aguiar,et al.  Monoidal Functors, Species, and Hopf Algebras , 2010 .

[35]  Dusko Pavlovic,et al.  Chu I: cofree equivalences, dualities and *-autonomous categories , 1997, Mathematical Structures in Computer Science.

[36]  Rasmus Ejlers Møgelberg,et al.  Linear usage of state , 2014, Log. Methods Comput. Sci..

[37]  Tarmo Uustalu,et al.  Stateful Runners of Effectful Computations , 2015, MFPS.

[38]  Gordon D. Plotkin,et al.  Notions of Computation Determine Monads , 2002, FoSSaCS.

[39]  Frank Pfenning,et al.  Session Types as Intuitionistic Linear Propositions , 2010, CONCUR.

[40]  Masahito Hasegawa Logical Predicates for Intuitionistic Linear Type Theories , 1999, TLCA.

[41]  Dirk Pattinson,et al.  Sound and Complete Equational Reasoning over Comodels , 2015, MFPS.

[42]  Gordon D. Plotkin,et al.  Combining effects: Sum and tensor , 2006, Theor. Comput. Sci..

[43]  Tarmo Uustalu Generalizing Substitution , 2002, RAIRO Theor. Informatics Appl..

[44]  John Power,et al.  From Comodels to Coalgebras: State and Arrays , 2004, CMCS.