*guest post by Owen Lynch*

This is the third part (Part 1, Part 2) of a blog series on a paper that we wrote recently:

• John Baez, Owen Lynch and Joe Moeller, Compositional thermostatics.

In the previous two posts we talked about what a thermostatic system was, and how we think about composing them. In this post, we are going to back up from thermostatic systems a little bit, and talk about *operads*: a general framework for composing things! But we will not yet discuss how thermostatic systems use this framework—we’ll do that in the next post.

The basic idea behind this framework is the following. Suppose that we have a bunch of widgets, and we want to compose these widgets. If we are lucky, given two widgets there is a natural way of composing them. This is the case if the widgets are elements of a monoid; we simply use the monoid operation. This is also the case if the widgets are morphisms in a category; if the domain and codomain of two widgets match up, then they can be composed. More generally, n-morphisms in a higher category also have natural ways of composition.

However, there is not always a canonical way of composing widgets. For instance, let be a commutative ring, and let and be elements of Then there are many ways to compose them: we could add them, subtract them, multiply them, etc. In fact any element of the free commutative ring gives a way of composing a pair of elements in a commutative ring. For instance, when applied to and gives Note that there is nothing special here about the fact that we started with two elements of we could start with as many elements of as we liked, say, and any element of would give a ‘way of composing’

The reader familiar with universal algebra should recognize that this situation is very general: we could do the exact same thing with vector spaces, modules, groups, algebras, or any more exotic structures that support a notion of ‘free algebra on variables’.

Let’s also discuss a less algebraic example. A point process on a subset of Euclidean space can be described as an assignment of a -valued random variable to each measurable set that is countably additive under disjoint union of measurable sets.

The interpretation is that a point process gives a random collection of points in and counts how many points fall in Moreover, this collection of points cannot have a limit point; there cannot be infinitely many points in any compact subset of

Now suppose that and are rigid embeddings such that and that is a point process on and is a point process on Then we can define a new point process on (assuming that and are independent) by letting

This is the union of the point process running in and the point process running in

The precise details here are not so important: what I want to display is the intuition that we are geometrically composing things that ‘live on’ a space. The embeddings and give us a way of gluing together a point process on and a point process on to get a point process on We could have picked something else that lives on a space, like a scalar/vector field, but I chose point processes because they are easy to visualize and composing them is fairly simple (when composing vector fields one has to be careful that they ‘match’ at the edges).

### Operads

In all of the examples in the previous section, we have *things that we want to compose*, and *ways of composing them*. This situation is formalized by *operads* and *operad algebras* (which we will define very shortly). However, the confusing part is that the operad part corresponds to'”ways of composing them’, and the operad algebra part corresponds to ‘things we want to compose’. Thus, the mathematics is somewhat ‘flipped’ from the way of thinking that comes naturally; we first think about the ways of composing things, and then we think about what things we want to compose, rather than first thinking about the things we want to compose and only later thinking about the ways of composing them!

Unfortunately, this is the logical way of presenting operads and operad algebras; we must define what an operad is before we can talk about their algebras, even if what we really care about is the algebras. Thus, without further ado, let us define what an operad is.

An **operad** consists of a collection of **types** (which are abstract, just like the ‘objects’ in a category are abstract), and for every list of types a collection of **operations**

These operations are the ‘ways of composing things’, but they themselves can be composed by ‘feeding into’ each other, in the following way.

Suppose that and for each Then we can make an operation

We visualize operads by letting an operation be a circle that can take several inputs and produces a single output. Then composition of operations is given by attaching the output of circles to the input of other circles. Pictured below is the composition of a unary operator a nullary operator and a binary operator with a ternary operator to create a ternary operator

Additionally, for every type there is an ‘identity operation’ that satisfies for any

and for any

There is also an associativity law for composition that is a massive pain to write out explicitly, but is more or less exactly as one would expect. For unary operators it states

The last condition for being an operad is that if and the symmetric group on elements, then we can apply to to get

We require that if and there are also some conditions for how interacts with composition, which can be straightforwardly derived from the intuition that permutes the arguments of an operation.

Note that our definition of an operad is what might typically be known as a ‘symmetric, colored operad’, but as we will always be using symmetric, colored operads, we choose to simply drop the modifiers.

That was a long definition, so it is time for an example. This example corresponds to the first situation in the first section, where we wanted to compose ring elements.

Define to be an operad with one type, which we will call and let where is with repeated times.

Composition is simply polynomial substitution. That is, if

and

then

is the composite of For instance, composing

and

results in

The reader is invited to supply details for identities and the symmetry operators.

For the other example, define an operad by letting be the set of compact subsets of (we could consider something more exciting, but this works fine and is easy to visualize). An operation consists of disjoint embeddings where

We can visualize such an operation as simply a shape with holes in it.

Composition of such operations is just given by nesting the holes.

The outcome of the above composition is given by simply taking away the intermediate shapes (i.e. the big circle and the triangle).

Another source of examples for operads comes from the following construction. Suppose that is a symmetric monoidal category. Define by letting

where is the collection of objects in and

To compose operations and (assuming that the types are such that these are composable), we simply take Moreover, the identity operation is simply the identity morphism, and the action of is given by the symmetric monoidal structure.

In fact, the second example that we talked about is an example of this construction! If we let be the category where the objects are compact subsets of with embeddings as the morphisms, and let the symmetric monoidal product be disjoint union, then it is not too hard to show that the operad we end up with is the same as the one we described above.

Perhaps the most important example of this construction is when it is applied to because this is important in the next section! This operad has as types, sets, and an operation

is simply a function

### Operad algebras

Although ‘operad algebra’ is the name that has stuck in the literature, I think a better term would be ‘operad action’, because the analogy to keep in mind is that of a group action. A group action allows a group to ‘act on’ elements of a set; an operad algebra similarly allows an operad to ‘act on’ elements of a set.

Moreover, a group action can be described as a functor from the 1-element category representing that group to and as we will see, an operad algebra can also be described as an ‘operad morphism’ from the operad to the operad just described in the last section.

In fact, this is how we will define an operad algebra; first we will define what an operad morphism is, and then we will define an operad algebra as an operad morphism to

An operad morphism from an operad to an operad is exactly what one would expect: it consists of

• For every a mapsuch that commutes with all of the things an operad does, i.e. composition, identities, and the action of

Thus an operad morphism from to also known as an operad algebra, consists of

• A set for every• A function for every operation

such that the assignment of sets and functions preserves identities, composition, and the action of

Without further ado, let’s look at the examples. From any ring we can produce an algebra of We let (considered as a set), and for

we let

We can also make an operad algebra of point processes, for For we let be the set of point processes on If is an embedding, then we let be the map that sends point processes on respectively to the point process defined by

Finally, if is a symmetric monoidal category, there is a way to make an operad algebra of from a special type of functor This is convenient, because it is often easier to prove that the functor satisfies the necessary properties than it is to prove that the algebra is in fact well-formed.

The special kind of functor we need is a *lax symmetric monoidal* functor. This is a functor equipped with a natural transformation that is well-behaved with respect to the associator, identity, and symmetric structure of We call the **laxator**, and formally speaking, a **lax symmetric monoidal functor** consists of a functor along with a laxator.
I won’t go into detail about the whole construction that makes an operad algebra out of a lax symmetric monoidal functor, but the basic idea is that given an operation (which is a morphism ), we can construct a function by composing

with

This basic idea can be extended using associativity to produce a function from an operation

As an example of this construction, consider point processes again. We can make a lax symmetric monoidal functor by sending a set to the set of point processes on and an embedding to the map that sends a point process to a point process defined by

The laxator sends a point process on and a point process on to a point process on a defined by

The reader should inspect this definition and think about why it is equivalent to the earlier definition for the operad algebra of point processes.

### Summary

This was a long post, so I’m going to try and go over the main points so that you can organize what you just learned in some sort of coherent fashion.

First I talked about how there frequently arises situations in which there isn’t a canonical way of ‘composing’ two things. The two examples that I gave were elements of a ring, and structures on spaces, specifically point processes.

I then talked about the formal way that we think about these situations. Namely, we organize the ‘ways of composing things’ into an operad, and then we organize the ‘things that we want to compose’ into an operad algebra. Along the way, I discussed a convenient way of making an operad out of a symmetric monoidal category, and an operad algebra out of a lax symmetric monoidal functor.

This construction will be important in the next post, when we make an operad of ‘ways of composing thermostatic systems’ and an operad algebra of thermostatic systems to go along with it.

See all four parts of this series: • Part 1: thermostatic systems and convex sets. • Part 2: composing thermostatic systems. • Part 3: operads and their algebras. • Part 4: the operad for composing thermostatic systems.

Since there’s no operad (or more precisely, no Set-operad, the only kind discussed here) whose algebras are exactly commutative rings, the reader is invited to figure out what are the algebras of Owen’s operad called

I give up. I've looked at this back and forth, and as long as Owen means what I mean by ‘polynomial’ (an element of the free commutative ring on the set of variables), then it seems to me that the algebras are commutative rings. Although I should look at what the algebra homomorphisms are (which was not defined here); maybe the true answer is Morita equivalence classes of rings or something like that.

There can’t possibly be an operad whose algebras in Set are commutative rings, since operads can only describe sets equipped with operations obeying equations with no deletion or duplication of variables. This is why there’s an operad for monoids (that is, an operad whose algebras in Set are monoids) but no operad for groups: the axiom

duplicates a variable at left and deletes it at right! There’s also no operad for rings, or commutative rings, due to the axiom

There’s an adjunction between Lawvere theories and operads, so you can take the Lawvere theory for groups or rings or commutative rings and then take its underlying operad—but the resulting operad has something

elseas its algebras in Set.I believe this is what Owen is implicitly doing here: taking the Lawvere theory for commutative rings, whose n-ary operations are integer-coefficient polynomials in n variables, and then taking the underlying operad.

I’m not sure exactly what the algebras of this operad are like: one possibility is that they’re things like rings but not obeying the axioms where variables are duplicated or deleted, like

and

I thought of that, but then Owen also said that he's using a fancy version of operads, so I decided to focus on the details. And in the details, the set of -ary operations is the set of polynomials in variables, and is equal to in the set of polynomials in (say) variables.

Maybe the problem is with the composition of operators. If I compose the -variable polynomial with the -variable polynomial (which is the identity) and the -variable polynomial , then I get the -variable polynomial . But if I compose the -variable polynomial with the -variable polynomial twice, then I get the -variable polynomial . And I could apply a symmetry to this to turn it into , but nothing will turn it into , which is an operation with a different arity. So in an algebra of the operad, applying to the algebra elements , , and , will typically give a different result from applying to the elements , , , and , even though we'd be tempted to write both of them as .

So it's not that we don't have ; we should be so lucky! No, instead, we have two different interpretations of , one of which equals , and one of which doesn't. Or rather, we have infinitely many interpretations of , one of which equals one of the infinitely many interpretations of , and another of which doesn't equal any of them. In fact, every expression has infinitely many distinct interpretations, even integer constants!

So the algebras are actually extremely complicated.