Last time, we introduced a more general definition of monads, in the setting of (strict) 2-categories. Unfortunately this strictness is often a bit too rigid to incorporate natural mathematical objects, and this is certainly true for monad theory. This time, we will push our definition of monads beyond this strict setting, into the wider world of bicategories.

## Generalising to Bicategories

A bicategory consists of:

- A collection of
**0-cells** - Between every pair of 0-cells , a category . The objects of these categories are termed
**1-cells**, and the morphisms**2-cells**. Composition of 2-cells is called**vertical composition**. - For every triple of 0-cells, a bifunctor , referred to as
**horizontal composition**. For every 0-cell , there are identity 1-cells in .

Horizontal composition is associative and unital *up to isomorphism*. That is, there are natural isomorphisms:

- A
**left unitor**. - A
**right unitor**. - An
**associator**, between the two different orders in which we can apply horizontal composition twice.

As you might expect, this structure is subject to some coherence equations, entirely analogous to those for a monoidal category.

**Example**: A (strict) 2-category is a bicategory in which the unitors and associators are identities, so horizontal composition is unital and associative on the nose.

**Example**: A monoidal category is “the same thing” as a bicategory with one 0-cell. This is often phrased as “A monoidal category is a one object bicategory”.

Considering one direction in more detail, in a bicategory with one 1-cell consists of a single category . We also have:

- A horizontal composition bifunctor . We consider this to be the tensor product of our monoidal category.
- The identity 1-cell will serve as the monoidal unit.

The coherence axioms for a bicategory is this simple case are exactly those of a monoidal category. Going in the other direction is similar.

We also introduce a couple of more complex bicategories that will be important in subsequent examples.

**Example**: A span of type in a category is a pair of -morphisms of the form:

.

If has pullbacks, we can form the composite of a span with a span as:

where are the two projection maps given by forming the pullback of along .

Given two spans and a morphism of spans between them is a -morphism such that:

In fact, for a category with pullbacks, there is a bicategory with:

- 0-cells the objects of .
- consists of all spans of type , and span morphisms between them.
- The universal property of pullbacks means composition of spans extends to a bifunctor, which we take to be our horizontal composition.

We are skimming over a size issue here. Readers with the necessary background may want to consider how such questions might creep in to the definition above.

**Example**: Let be a monoidal category with coproducts. For sets , we can consider -valued matrices of type to be functions:

Given a pair of matrices and , we can form their composite as follows:

Given a pair of matrices , a morphism of matrices is a family of morphisms:

This data can be combined into a bicategory with:

- 0-cells sets.
- The category consists of matrices of type and morphisms between then.
- Horizontal composition is given by composition of matrices, as described above.

The two previous examples are typical for bicategories, in that horizontal composition involves either limits or colimits. In such cases, if we form iterated horizontal composites in different orders, the universal properties involved will ensure they agree *up to isomorphism*. Insisting that composites formed in different orders agree on the nose would lead to unrealistic requirements on our choice of (co)limits, so the bicategorical rather than strict 2-categorical setting is more natural.

Now we’ve seen a few different bicategories, it’s time to get back to our main motivation, monads. A **monad in a bicategory** consists of:

- A 0-cell .
- A 1-cell .
- A
**unit**2-cell . - A
**multiplication**2-cell .

As before, our notation is suggestive of that for “ordinary” monads on categories. Notice the data above is no different to that which we encountered in the strict 2-categorical setting. Things get more interesting when we consider the coherence equations that need to hold, as now we must account for the fact that horizontal composition is not unital or associative on the nose, but only up to isomorphism. The required equations are:

- .
- .
- .

Firstly, we see that this really does generalise our previous definition.

**Example**: As we would expect, a monad in a 2-category is a special case of a monad in a bicategory. The unitors and associators are identities, and the equations above collapse to those of the 2-categorical case.

We also find a fun simple source of monads that would not have made sense before:

**Example**: We can view any monoidal category as a one object bicategory. A monoid in is the same thing as a monad in this one object bicategory. For example, every group or monoid can be seen as a monad. There is a certain symmetry here:

- In a bicategory ,
**every monad on is a monoid in the monoidal category**. **A monoid in a monoidal category is a monad in the corresponding one object bicategory**.

We now move on to some more interesting examples, which really highlight the benefits afforded by the more liberal bicategorical definition.

**Example**: A (small) category consists of a set of objects and a set of morphisms . There are two functions giving the source and target of a given morphism, forming a span:

The identities induce a morphism from the identity span to this span. If we form the pullback of along , the object consists of all composable pairs of morphisms, and there is a span morphism from the resulting span to the one defined above, given by the function maps composable pairs to their composite.

Given a category with pullbacks, we can define an internal category in to consists of the analogous structure. A (small) category is then an internal category in .

The key observation for our purposes is that **an internal category in is the same thing as a monad in **. The monad unit and multiplication correspond to the identities and composition respectively. The rest is “just” an exercise in unravelling definitions.

**Example**: For a monoidal category with coproducts, a -enriched category consists of:

- A set of objects .
- For each pair of objects a hom-object in . We can view this as a -valued matrix .
- Morphisms picking out the identities. These form a morphism of matrices from the identity matrix to .
- Composition morphisms , which via the universal property of coproducts induce a morphism . Together, these form a morphism of matrices of type .

A more careful unpacking of the definitions following these intuitions shows that **a -category is the same thing as a monad in **.

As a special case of this construction, the Booleans can be considered as a thin two object monoidal category . The category is equivalent to the bicategory of relations we encountered last time. The Boolean enriched categories are then exactly preorders.

## Conclusion

By considering a further generalisation of the notion of monad to the weak setting of bicategories, many new interesting examples become possible. The examples of internal and enriched categories are well-known, and provide the intuitions for other, more elaborate constructions.

A categorically minded reader should be asking themselves the following question. We have identified internal and enriched categories as monads in certain bicategories, what about the morphisms between them? Do internal and enriched functors correspond to an obvious notion of morphism between these monads? The answer to this question is a bit more subtle than one might hope. We may return to this point in a later post.

More background on bicategories, and the monads corresponding to internal and enriched categories can be found in Lack’s “A 2-Categories Companion”, which is highly recommended reading.

## 3 thoughts on “Bicategories, monoids, internal and enriched categories”