## Internalizations commute

Okay, back in the saddle. We know about monoid objects and group objects, and also the slight variant of abelian group objects. These are functors (preserving some sort of product structure) from the toy categories , , and to our target category , respectively. We could also write out all the properties of (unital) rings in terms of a category — the “theory of rings” — and then use this to define “ring objects

We know, though, that a ring is a monoid object in the category of abelian groups. And the category of abelian groups is the category of abelian group objects in . That is, . And then we get monoid objects (rings) by considering .

But what is a functor from one category into the category of functors from a second category into a third? What is ? This is just a functor from the *product category* to ! Thus . This should look familiar — it says that (to whatever extent it’s well-defined) the category of categories is a closed category!

Now we also know that the product of two categories is “weakly symmetric” — is equivalent to . And thus the categories of functors from either one of these to a third category are equivalent — . Putting this together with the “currying” above we find that .

So let’s bring this back to internalizations. We find that and are equivalent. A monoid object in is equivalent to an abelian group object in .

And we saw evidence of this before. We’ve taken abelian groups and built free monoid objects on them, and we’ve taken monoids and built free abelian group objects on them. And the rings we get from each case are isomorphic to each other.

This whole setup generalizes. For any two algebraic structures we can describe by “theory of” categories, we can add both structures to an object of a category in either order. the processes of “internalizing” the two structures into the category commute with each other.

Now, for an exercise you can work out the naïve approach mentioned above. Write down the definition of from first principles, just like we did for monoids and groups and such. Then show that the resulting category is equivalent to .

## Group objects

Just like we have monoid objects, we can construct a category called , which encodes the notion of a “group object”.

Groups are a lot like monoids, but we’ll need to be able to do a few more things to describe groups than we needed for monoids. So let’s start with all the same setup as for monoid objects, but let’s make the monoidal structure in our toy category be an actual cartesian structure. That is, we start with an object and we build up all the “powers”, but now we insist that they be built from categorical products rather than just some arbitrary monoidal structure. Then is the categorical product of copies of . Not only does this work like a monoidal structure, but it come equipped with a bunch of extra arrows. For example, there are arrows to “project out” a copy of from a product, and every object has a unique arrow from to the terminal object — the product of zero copies of .

More importantly it has an arrow called the “diagonal” that is defined as the unique arrow satisfying . That is, it makes an “identical copy” of . For instance, in the context of sets this is the function defined by .

Now we do everything like we did for monoid objects. There’s a morphism , and one , and these satisfy the identity and associativity relations. Now we also throw in an arrow satisfying . That is, we can start with an “element” of and split it into two copies. Then we can either copy with and leave the other alone. Then we can multiply together the copies. Either choice of which one to hit with will give us the exact same result as if we’d just “forgotten” the original element of by passing to the terminal object, and then created a copy of the identity element with .

Wow, that looks complicated. Well, let’s take a functor from this category to that preserves products. Then what does the equation say in terms of elements of sets? We read off . That is, the product of and on either side is just the single element in the image of the arrow described by — the identity element of the monoid. But this is the condition that be the inverse of . So we’re just saying that (when we read the condition in sets) every element of our monoid has an inverse, which makes it into a group! Now a group object in any other category is a product-preserving functor from to .

We can do even better. Since the monoidal structure in is cartesian, it comes with a symmetry. The twist is defined as the unique arrow satisfying and . In sets, this means . Now we can add the relation to our category. In sets this reads that , which says that the multiplication is commutative. The resulting category is — the “theory of abelian groups” — and an “abelian group object” in a category is a product-preserving functor in .

## Free Algebras

Let’s work an explicit example from start to finish to illustrate these free monoid objects a little further. Consider the category of modules over the commutative ring , with tensor product over as its monoidal structure. We know that monoid objects here are -algebras with units.

Before we can invoke our theorem to cook up free -algebras, we need to verify the hypotheses. First of all, is symmetric. Well, remember that the tensor product is defined so that -bilinear functions from to are in bijection with -linear functions from to . So we’ll define the function . Now there is a unique function which sends to . Naturality and symmetry are straightforward from here.

Now we need to know that is closed. Again, this goes back to the definition of tensor products. The set consists of -linear functions from to , which correspond to -bilinear functions from to . Now we can use th same argument we did for sets to see such a function as a -linear function from to the -module . Remember here that every modyle over is both a left and a right module because is commutative. That is, we have a bijection . Naturality is easy to check, so we conclude that is indeed closed.

Finally, we need to see that has countable coproducts. But the direct sum of modules gives us our coproducts (but not products, since our index set is infinite). Then since is closed the tensor product preserves all of these coproducts.

At last, the machinery of our free monoid object theorem creaks to life and says that the free -algebra on a -module is . And we see that this is exactly how we constructed the free ring on an abelian group! In fact, that’s a special case of this construction because abelian groups are -modules and rings are -algebras.

## Free Monoid Objects

When we have an algebraic concept described as a set with extra structure, the morphisms between such structured sets are usually structure-preserving functions between the underlying sets. This gives us a “forgetful” functor which returns the underlying sets and functions. Then as we saw, we often have a left adjoint to this forgetful functor giving the “free” structure generated by a set.

But now that we’re talking about monoid objects we’re trying not to think about sets. A monoid object in is a monoidal functor from to , and a “homomorphism” of such monoid objects is a monoidal natural transformation. But the object part of such a functor is specified by one object of — the image of — which we can reasonably call the “underlying object” of the monoid object. Similarly, a natural transformation will be specified by a morphism between the underlying objects (subject to naturality conditions, of course). That is, we have a “forgetful functor” from monoid objects in to itself. And a reasonable notion of a “free” monoid object will be a left adjoint to this functor.

Now, if the monoidal category has coproducts indexed by the natural numbers, and if the functors and preserve these coproducts for all objects , then the forgetful functor above will have a left adjoint. To say that the monoidal structure preserves these coproducts is to say that the following “distributive laws” hold:

For any object we can define the “free monoid object on ” to be , equipped with certain multiplication and unit morphisms. For the unit, we will use the inclusion morphism that comes for free with the coproduct. The multiplication will take a bit more work.

Given any natural numbers and , the object is canonically isomorphic to , which then includes into using the coproduct morphisms. But this object also includes into , which is isomorphic to . Thus by the universal property of coproducts there is a unique morphism . This is our multiplication.

Proving that these two morphisms satisfy the associativity and identity relations is straightforward, though somewhat tedious. Thus we have a monoid object in . The inclusion defines a universal arrow from to the forgetful functor, and so we have an adjunction.

So what does this look like in ? The free monoid object on a set will consist of the coproduct (disjoint union) of the sets of ordered -tuples of elements of . The unit will be the unique -tuple , and I’ll leave it to you to verify that the multiplication defined above becomes concatenation in this context. And thus we recover the usual notion of a free monoid.

One thing I slightly glossed over is showing that satisfies the hypotheses of our construction. It works here for the same reason it will work in many other contexts: is a closed category. Given any closed category with countable coproducts, the functor has a right adjoint by definition. And thus it preserves all colimits which might exist. In particular, it preserves the countable coproducts, which is what the construction requires. The other functor preserves these coproducts as well because the category is symmetric — tensoring by on the left and tensoring by on the right are naturally isomorphic. Thus we have free monoid objects in any closed category with countable coproducts.

## Closed Categories

A closed category is a symmetric monoidal category where each functor has a specified right adjoint called an “exponential”: . By what we said yesterday, this means that there is a unique way to sew all these adjoints parametrized by together into a functor.

The canonical example of such a category is the category of sets with the cartesian product as its monoidal structure. For each set we need an adjunction . That is, functions taking a pair of elements — one from and one from — to an element of should be in bijection with functions from to . And indeed we have such an adjunction: is the set of all functions from to .

Let’s say this a bit more concretely. If we consider the set of natural numbers we have the function , which takes two numbers and gives back a third: if we stick in and we get back . But what if we just stick in the first number of the pair? Then what we get back is a function that will take the second number and give us the sum: if we just feed in we get back the function . That is, we can see addition either as a function taking a pair of numbers to a number, or we can see it as a function , taking a number to a function from numbers to numbers.

More generally, if we can define , which is defined by . That is, takes an element of and gives back a function from to . We call this process of turning functions of many variables into functions of a single variable at a time “currying”, after Haskell Curry. It turns out to be phenomenally useful for discussing theories of computation, and forms part of the basis of functional programming.

Closed categories are an attempt to mirror this currying procedure in other categories. In general, if the monoidal structure in question is the categorical product (which is always symmetric) then we say the category is “cartesian closed”. Most such categories still look a lot like this example in sets, with morphisms given by functions preserving structure and the exponential given by an appropriate analogue of the functor.

Here’s an example, though, of a cartesian closed category that looks rather different. It requires the notion of a “predicate calculus”, but not very much of it. Basically, if you have a rough idea of what such a thing is you’ll be fine.

Okay, there’s a category whose objects are well-formed formulas in the calculus, and whose arrows are proofs. The product in this category is , read “and”. If we know then we can derive and we can derive , so there are two arrows. On the other hand, if implies both and , then implies . This is just a rough sketch that is the categorical product, but it’s good enough for now.

Anyhow, the exponential is , read “implies”. This is subtler than it seems. In the last paragraph I was saying things like “ implies “, but this is *not* what I mean here. The formula is the statement *within the calculus* that there exists a proof starting from and ending with . Writing out “implies” as I’m discussing the structure is a high-level view from outside the system. Writing in the structure itself is a low-level view, “internal” to the category. “ implies ” is a statement *about* the category, while “” is a statement *within* the category.

Now if implies we have (by definition) a proof starting from and ending with . Then we can use this proof to devise a proof starting from and ending with . That is, implies if and only if implies . This shows that is right adjoint to , as we claimed.

## Adjoints with parameters

Now that we know how to transform adjoints, we can talk about whole families of adjoints parametrized by some other category. That is, for each object of the parametrizing category we’ll have an adjunction , and for each morphism of we’ll have a transformation of the adjunctions.

Let’s actually approach this from a slightly different angle. Say we have a functor , and that for each the functor has a right adjoint . Then I claim that there is a unique way to make into a functor from to so that the bijection is natural in all three variables. Note that must be contravariant in here to make the composite functors have the same variance in .

If we hold fixed, the bijection is already natural in and . Let’s hold and fixed and see how to make it natural in . The components are already given in the setup, so we can’t change them. What we need are functions and for each arrow .

For naturality to hold, we need . But from what we saw last time this just means that the pair of natural transformations forms a conjugate pair from to . And this lets us define uniquely in terms of , the counit of , and the unit of by using the first of the four listed equalities.

From here, it’s straightforward to show that this definition of how acts on morphisms of makes it functorial in both variables, proving the claim. We can also flip back to the original viewpoint to define an adjunction between categories and parametrized by the category as a functor from to the category of adjunctions between those two categories.

## Transformations of Adjoints

And now we go back to adjoints. Like every other structure out there, we want to come up with some analogue of a homomorphism between two adjunctions. Let’s consider the adjunctions and , and try to find a good notion of a transformation from the first to the second.

We’ll proceed by considering an adjunction to consist of the pair of categories with the functors giving extra structure. Down in the land of groups and rings and such, we’d consider sets with extra structure and functions that preserved that structure. So here, naturally, we want to consider functors which preserve this extra structure. That is, a map of adjunctions consists of a pair of functors and . These must preserve the structure in that and .

But hold up a second, we’ve forgotten something else that goes into an adjunction: the isomorphism . Here’s a diagram showing how the map of adjunctions should play nicely with them:

Equivalently we can specify an adjunction by its unit and counit. In this case the compatibility in question is a pair of equations of natural transformations: and .

What if we’re looking at two different adjunctions between the same pair of categories? Well then we may as well try to use the appropriate identity functors for and . But then it’s sort of silly to insist that on the nose, and similarly for . Instead, as we do so often, let’s weaken this equality to just a natural transformation.

We’ll say that a pair of natural transformations and are “conjugate” if . This is equivalent, in terms of the unit and counit, to any one of the following four equalities:

Now it’s easily verified that given a pair of categories we can build a category whose objects are adjunctions and whose morphisms are conjugate pairs of natural transformations, which we write out in full as . We compose conjugate pairs in this category in the obvious way, which we write .

On the other hand, if we have a pair and another , then we can form the composite , which we’ll write as . Notice the similarity of this situation with the two different compositions of natural transformations between functors.

## The Simplicial Category

There’s another approach to the theory of monoids which finds more direct application in topology and homology theory (which, yes, I’ll get to eventually) — the “simplicial category” . Really it’s an isomorphic category to , but some people think better in these other terms. I personally like the direct focus on the algebra, coupled with the diagrammatics so reminiscent of knot theory, but for thoroughness’ sake I’ll describe the other approach.

Note that the objects of correspond exactly with the natural numbers. Each object is the monoidal product of some number of copies of the generating object . We’re going to focus here on the model of given by the ordinal numbers. That is, the object corresponds to the ordinal number , which is a set of elements with its unique (up to isomorphism) total order. In fact, we’ve been implicitly thinking about an order all along. When we draw our diagrams, the objects consist of a set of marked points along the upper or lower edge of the diagram, which we can read *in order* from left to right.

Let’s pick a specific representation of each ordinal to be concrete about this. The ordinal will be represented by the set of natural numbers from to with the usual order relation. The monoidal structure will just be addition — .

The morphisms between ordinals are functions which preserve the order. A function between ordinals satisfies this property if whenever in then in . Note that we can send two different elements of to the same element of , just as long as we don’t pull them *past* each other.

So what sorts of functions do we have to play with? Well, we have a bunch of functions from to that skip some element of the image. For instance, we could send to by sending to , skipping , sending to , and sending to . We’ll say for the function that skips in its image. The above function is then . For a fixed , the index can run from to .

We also have a bunch of functions from to that repeat one element of the image. For example, we could send to by sending to , and both to , and to . We’ll say for the function that repeats in its image. The above function is then . Again, for a fixed , the index can run from to .

Notice in particular that “skipping” and “repeating” are purely local properties of the function. For instance, is the unique function from (the empty set) to , which clearly skips . Then can be written as , since it leaves the numbers from to alone, sticks in a new , and then just nudges over everything from (the old) to . Similarly, is the unique function from to that sends both elements in its domain to . Then all the other can be written as .

Now every order-preserving function is determined by the set of elements of the range that are actually in the image of the function along with the set of elements of its domain where it does not increase. That is, if we know where it skips and where it repeats, we know the whole function. This tells us that we can write any function as a composition of and functions. These basic functions satisfy a few identities:

- If then .
- If then .
- If then .
- If or then .
- If then .

We could check all these by hand, and if you like that sort of thing you’re welcome to it. Instead, I’ll just assume we’ve checked the second one for and the fourth one for .

What’s so special about those conditions? Well, notice that takes two copies of to one copy, and that the second relation becomes the associativity condition for this morphism. Then also takes zero copies to one copy, and the fourth relation becomes the left and right identity conditions. That is, with these two morphisms is a monoid object in this category! Now we can verify all the other relations by using our diagrams rather than a lot of messy calculations!

We can also go back the other way, breaking any of our diagrams into basic pieces and translating each piece into one of the or functions. The category of ordinal numbers not only contains a monoid object, it is actually *isomorphic* to the “theory of monoids” functor — it contains the “universal” monoid object.

So why bother with this new formulation at all? Well, for one thing it’s always nice to see the same structure instantiated in many different ways. Now we have it built from the ground up as , we have it implemented as a subcategory of , we have it as the category of ordinal numbers, and thus we also have it as a full subcategory of — the category of all small categories (why?).

There’s another reason, though, which won’t really concern us for a while yet. The morphisms and turn out to be very well-known to topologists as “face” and “degeneracy” maps when working with shapes they call “simplicial complexes”. Not only is this a wonderful oxymoron, it’s the source of the term “simplicial category”. If you know something about topology or homology, you can probably see how these different views start to tie together. If not, don’t worry — I’ll get back to this stuff.

## The General Associative Law

For any monoid object we have an associative law for the multiplication: . This basically says that the two different ways of multiplying together three inputs to give one output are the same. Let’s call the result . In fact, we might go so far as to say , , and even .

This generalizes a lot. We want to say that there’s a unique way (called ) to multiply together inputs. The usual way is to pick some canonical form and show that everything can be reduced to that form. This ends up being a lot like the Coherence Theorem. In fact, if we take a monoid object in the category of small categories, this *is* the Coherence Theorem for a *strict* monoidal category.

But there’s an easier way than walking through that big proof again, and it uses our diagrammatic approach! The first thing we need to realize is that if we can show this rule holds in , then it will hold for all monoid objects. That’s why the “theory of monoids” category is so nice — it exactly encodes the structure of a monoid. Anything that is true for all monoids can be proved by just looking at this category and proving it there!

So how do we show that the general associative law holds in ? Now we need to notice that the functor that makes into a monoid object is faithful. That is, if two Temperley-Lieb diagrams in the image are the same, then they must come from the same morphism in . But if two diagrams are equivalent they differ by either sliding loops arcs around in the plane — which uses the monoidal structure to pull cups or caps past each other — or by using the zig-zag identities — which encode the left and right identity laws. Thus any equalities that hold in the image of the functor must come from equalities already present in !

Now any way of multiplying together inputs to give one output is a morphism in , which will be sent to a diagram in . It’s not too hard to see that there’s really only one of these diagrams that could be in the image of the functor (up to equivalence of diagrams). So all such multiplications are sent to the same diagram. By the faithfulness above, this means that they were all the same morphism in to begin with, and we’re done.

By the way, you should try playing around with the oriented Temperley-Lieb diagrams to verify the claim I made of uniqueness. Try to work out exactly what diagrams are in , and then which ones can possibly be in the image of the functor. Playing with the diagrams like this should give you a much better intuition for how they work. If nothing else, drawing a bunch of pictures is a lot more fun than algebra homework from back in school.

## More monoid diagrams

Let’s pick up with the diagrams for monoid objects from yesterday. In fact, let’s draw the multiplication and unit diagrams again, but this time let’s make the lines really thick.

Now we’re looking at something more like a region of the plane than a curve. We really don’t need all that inside part, so let’s rub it out and just leave the outline. Of course, whenever we go from a blob to its outline we like to remember where the blob was. We do this by marking a direction on the outline so if we walk in that direction the blob would be on our left. Those of you who have taken multivariable calculus probably have a vague recollection of this sort of thing. Don’t worry, though — we’re not doing calculus here.

Okay, now the outline diagrams look like this:

That’s odd. These diagrams look an awful lot like Temperley-Lieb diagrams. And in fact they are! In fact, we get a functor from to that sends to . That is, a downward-oriented strand next to an upward-oriented strand makes a monoid object on !

But to be sure of this, we need to check that the associativity and identity relations hold. Here’s associativity:

Well that’s pretty straightforward. It’s just sliding the arcs around in the plane. How about the identity relations?

The right identity relation holds because of one of the “zig-zag” relations for duals, and the left identity relation holds because of the other!

Now you should be able to find a comonoid object in in a very similar way.