5 - Monads, Comonads and Distributive Laws
Published online by Cambridge University Press: 22 December 2016
Summary
Monads and comonads – the duals of monads – form one of the basic notions in category theory, like adjunction. A monad is a special kind of endofunctor with some additional structure (unit and multiplication), a bit like for a monoid. Various computationally relevant functors are actually monads: lift, list, powerset, multiset, distribution. Associated with a (co)monad two categories are of interest.
• The Kleisli category captures the computations associated with a (co)monad. Coalgebras can be described within such Kleisli categories, namely as endomaps, and the Kleisli structure can be used for sequential composition of coalgebras. A prominent application involves final coalgebra inside such Kleisli categories. It gives a systematic description of so-called trace semantics; see Section 5.3.
• The Eilenberg–Moore category contains (co)algebras for a (co)monad as objects. They are the mathematical structures associated with the (co)monad. Where (co)algebras of a functor describe only operations, (co)algebras of a (co)monad additionally capture constraints, in the form of equations or other assertions. Many standard mathematical structures, such as monoids, vector spaces and complete lattices, are algebras of a monad. A systematic, uniform description of such structures is convenient, since it gives many results at once, such as the existence of limit and colimits.
Most of the material in this chapter is standard (basic) category theory. It is presented here with a special focus on the context of coalgebras as dynamical state-based systems. Section 5.1 introduces the basic definitions, together with the main examples. Kleisli categories will be discussed in Section 5.2, with an emphasis on the lifting of functors to such categories. These liftings play an important role in Section 5.3, on trace semantics. Section 5.4 describes Eilenberg–Moore categories, together with their basic properties. Section 5.5 concludes this chapter with bialgebras, combining both algebras (structure) and coalgebras (behaviour), for the operational semantics of programming languages.
The topic of algebras and coalgebras in combination with assertions is postponed until Chapter 6. Assertions require the notion of invariant, in the coalgebraic case. Once this concept is in place, (co)algebraic specifications can be introduced, as descriptions of (co)algebras satisfying certain logical properties.
- Type
- Chapter
- Information
- Introduction to CoalgebraTowards Mathematics of States and Observation, pp. 246 - 333Publisher: Cambridge University PressPrint publication year: 2016