Strong monads, the topic of this post, are a somewhat technical looking topic at first glance, requiring more definitions and machinery than we have seen up until now. Unfortunately, they are key to some more interesting topics, both mathematically and in terms of computer science application. As usual when dealing with new abstract ideas, it is useful to focus on intuitions and examples to get a feeling for the formal definitions. This post is longer than might be ideal, but there are plenty of examples.
For those interested in the technical details I skip, some recommended reading:
- Monoidal categories: “Categories for the Working Mathematician” by Mac Lane has a very readable account of monoidal categories, despite its reputation for requiring a lot of mathematical background.
- Enriched categories: Both volume 2 of Borceux’s “Handbook of Categorical Algebra”, and Riehl’s “Categorical Homotopy Theory” have brief introductions to monoidal categories, to set up a concise introduction to enriched category theory. The standard reference for enriched category theory is Kelly’s “Basic Concepts of Enriched Category Theory”, which also contains the necessary background on monoidal categories. This book can be difficult in places, but the material we require is covered at a reasonable pace.
A monoidal category is a category with a monoidal product bifunctor, typically denoted , and a unit object, . Intuitively, this is a generalization of the notion of monoid from sets to categories. There are isomorphisms
natural in , and referred to as the left and right unitor respectively. These encode that acts as a unit for the multiplication, up to isomorphism. There are also associator isomorphisms:
natural in , encoding associativity up to isomorphism. The unitors and associator are required to satisfy some compatibility equations (referred to as coherence conditions). We won’t need the details, but they can be found in any standard category theory reference.
A symmetric monoidal category is a monoidal category with a further symmetry isomorphisms encoding commutativity up to isomorphism:
natural in . Again, the symmetry is required to satisfy some coherence conditions (equations) with respect to the other structure. Finally, a (symmetric) monoidal closed category is a (symmetric) monoidal category such that for each object , there is an adjunction:
Example: Any category with products is a symmetric monoidal category, with
The left and right unitors, associator and symmetry are the “obvious” canonical maps induced by the universal property of products. If is Cartesian closed, then it is symmetric monoidal closed, with given by the exponential .
In particular, the category is symmetric monoidal closed with monoidal product given by Cartesian products, and given by the function space functor . This is the motivating example for much of what follows, and of practical interest in algebraic examples we shall see later. When working with , if not otherwise stated the monoidal structure is taken to be the Cartesian product structure.
For a monoidal category , and endofunctor , a strength (sometimes referred to as a tensorial strength) for is a natural transformation
which satisfies two coherence conditions with respect to the monoidal structure. A strong functor is a functor with a chosen strength. A strong monad is monad with a strong underlying endofunctor, satisfying additional coherence conditions with respect to the monad unit and multiplication. Again, the actual coherence conditions can be found in standard sources, we shall focus on examples and intuitions.
Example: The list and powerset monads are both strong in a unique way, with strengths:
We shall shortly see that form (and uniqueness) of the strengths for the monads in the previous example are in no way special.
So a crude first sketch of a strength is that it is a well-behaved way of commuting an endofunctor and a monoidal product. You may notice that there are other ways you might imagine commuting an endofunctor with a monoidal product. We shall return to that thought in later posts.
To get a more principled mathematical perspective on strength, unfortunately we need to introduce further abstract machinery.
Enriched category theory is a large and potentially complex topic. Fortunately we will only need a few of the basic definitions, and no deep theory. The idea of an enriched category is that often for a category , the homsets carry additional mathematical structure, and this structure interacts well with composition. For example:
Example: The homsets in the category of preorders and monotone maps actually carry a natural pointwise order:
This structure satisfies:
when the composites are well-defined. So the homsets are actually -objects, and the composition maps are -morphisms
A close relative of the previous example is the following:
Example: The homsets of the category of all (small) categories are themselves categories, with morphisms the natural transformations. Furthermore, the composition maps are bifunctors
An important trivial example is the following:
Example: The homsets of the category are -objects, and the composition maps are -morphisms
Finally, a slightly different example, which motivates the level of generalization of the formal definition.
Example: The homsets of the category of Abelian groups can be given the structure of Abelian groups pointwise. With this structure, the composition maps satisfy:
and the dual conditions for precomposition. This is not the same as saying the composition maps are morphisms:
This temporarily breaks the pattern with the previous examples. However, there is a monoidal structure on such that the composition maps are -morphisms
In fact this monoidal structure arises via some rather beautiful monad theory, which we will hopefully get to in later posts.
The final example motivates defining enriched categories so that the hom objects can live in monoidal categories.
For a monoidal category , a -enriched category has:
- A collection of objects
- For each pair of objects , a hom object in .
- For each object , a morphism . Intuitively, these encode the the identities in the category.
- For each triple of objects , a morphism . These encode composition of morphisms with the enriched category.
This data must satisfy some axioms, ensuring that composition is associative and has units the identities. In fact, some mathematical structures that are far away from our motivating examples are also enriched categories. The original surprising example was that a mild generalization of metric spaces can be seen as enriched categories, as shown by Lawvere.
Example: For any monoidal closed category , we can regard as a -category, with hom objects
The identity and composition maps are derived in a reasonably routine way, and can be found in standard sources. This is usually described as being canonically enriched over itself.
To connect the worlds of ordinary and enriched categories, note that any -category , has an underlying ordinary category , with the same objects, and homsets:
Composition and identities in are defined in a natural way. Strictly speaking, to give an enrichment for an ordinary category is to give a -category , and a specified isomorphism . Generally, this isomorphism is ignored when there is a natural choice.
Once we’ve defined a new class of objects, we should consider the morphisms between them. A -functor consists of:
- A mapping from -objects to -objects.
- For each pair of -objects, a -morphism . Intuitively, these describe the action on morphisms of the functor.
The morphism are required to satisfy axioms generalizing the usual idea that identities and composition are preserved.
Example: For the constructions we have seen previous:
- A -enriched functor is a functor which is monotone, in that .
- A -enriched functor is a (strict) 2-functor.
- A -functor is an ordinary functor.
- A -functor is a functor such that and .
Again, it is helpful to connect back to the world of ordinary category theory. A -functor induces an ordinary functor that agrees with on objects. Morphisms in are -morphisms . Then is given by:
A -functor is said to an enrichment of ordinary functor if .
Finally, a -natural transformation is a family of -morphisms satisfying an axiom generalizing the usual notion of naturality to the enriched setting.
Strength and Enrichment
Finally, we are in a position to relate strength and enrichment. If is a monoidal closed category, and an ordinary endofunctor, giving a strength for is “the same thing as” giving a structure for as a -functor.
Lets unpack this a bit. As described above, we view as being canonically enriched over itself. Giving an enriched structure, sometimes referred to as a functorial strength, for is to give a natural family of morphisms:
compatible with the identity and composition maps. That these maps are natural in the sense of ordinary category is equivalent to being an enrichment of the ordinary functor is an important point that is often skimmed over.
To build such a family given a strength
we form the composite:
where is the counit of the adjunction, which can be seen as an evaluation morphism for function spaces. Taking the transpose of this morphism gives a map:
It takes some checking, but these form the components of an enrichment for as required. In the other direction, given an enrichment, we can form the composite:
where is the unit of the adjunction. Taking the transpose of this morphism gives a map:
Again, after a bit of checking, it can be seen that this results in a strength for . The passages in the two directions are mutually inverse, so for monoidal closed category to give a strength for is equivalent to giving an enrichment for . This dealt with the endofunctor component, but we are really interested in monads. Here, to give a strength for a monad on monoidal closed is equivalent to giving an enrichment for .
Example: As a special case of this result, as every monad is (trivially) enriched over in a unique way. Therefore, given the observations above, every monad has a unique strength. This has a concrete description as:
This formula can seem slightly magical if given without context, but it is arrived at by unravelling the strength derived from the unique enrichment. Here we use notion to define a simple function. The strengths given for the list and powerset monads in the earlier example arise via this construction.
As usual, it is useful to think about algebra examples. For a monad given by some equational presentation , the unique strength is given on representatives by:
where is the set of variables appearing in the representative term . As usual, square brackets are somewhat overloaded, denoting both equivalence classes and the substitution operation. In words – we replace each variable appearing in the representative term with the variable .