Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

March 8, 2022

Compositional Thermostatics (Part 3)

Posted by John Baez

guest post by Owen Lynch

This is the third part (Part 1, Part 2) of a blog series on this paper:

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 operads 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 RR be a commutative ring, and let aa and bb be elements of RR. 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 [x,y]\mathbb{Z}[x,y] gives a way of composing a pair of elements in a commutative ring. For instance, x 2+xyy 2x^2 + x y - y^2, when applied to aa and bb, gives a 2+abb 2a^2 + a b - b^2. Note that there is nothing special here about the fact that we started with two elements of R;R; we could start with as many elements of RR as we liked, say, a 1,,a na_1,\ldots,a_n, and any element of [x 1,,x n]\mathbb{Z}[x_1,\ldots,x_n] would give a ‘way of composing’ a 1,,a na_1,\ldots,a_n.

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 nn variables’.

Let’s also discuss a less algebraic example. A point process XX on a subset of Euclidean space A nA \subseteq \mathbb{R}^n can be described as an assignment of a \mathbb{N}-valued random variable X UX_U to each measurable set UAU \subseteq A that is countably additive under disjoint union of measurable sets.

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

Now suppose that f:BAf \colon B \to A and g:CAg \colon C \to A are rigid embeddings such that f(B)g(C)=f(B) \cap g(C) = \emptyset, and that XX is a point process on BB and YY is a point process on CC. Then we can define a new point process ZZ on AA (assuming that XX and YY are independent) by letting

Z U=X f 1(U)+Y g 1(U)Z_U = X_{f^{-1}(U)}+ Y_{g^{-1}(U)}

This is the union of the point process XX running in f(B)f(B) and the point process YY running in g(C)g(C).

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 ff and gg give us a way of gluing together a point process on BB and a point process on CC to get a point process on AA. 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).


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 𝒪\mathcal{O} consists of a collection 𝒪 0\mathcal{O}_0 of types (which are abstract, just like the ‘objects’ in a category are abstract), and for every list of types X 1,,X n,Y𝒪 0X_1,\ldots,X_n,Y \in \mathcal{O}_0, a collection of operations 𝒪(X 1,,X n;Y)\mathcal{O}(X_1,\ldots,X_n;Y).

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 g𝒪(Y 1,,Y n;Z)g \in \mathcal{O}(Y_1,\ldots,Y_n;Z) and for each i=1,,ni = 1,\ldots,n, f i𝒪(X i,1,,X i,k i;Y i)f_i \in \mathcal{O}(X_{i,1},\ldots,X_{i,k_i};Y_i). Then we can make an operation

g(f 1,,f n)𝒪(X 1,1,,X 1,k 1,,X n,1,,X n,k n;Z)g(f_1,\ldots,f_n) \in \mathcal{O}(X_{1,1},\ldots,X_{1,k_1},\ldots,X_{n,1},\ldots,X_{n,k_n};Z)

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 f 1f_1, a nullary operator f 2f_2, and a binary operator f 3f_3 with a ternary operator gg to create a ternary operator g(f 1,f 2,f 3)g(f_1,f_2,f_3).

Additionally, for every type X𝒪 0X \in \mathcal{O}_0, there is an ‘identity operation’ 1 X𝒪(X;X)1_X \in \mathcal{O}(X;X) that satisfies for any g𝒪(X 1,,X n;Y)g \in \mathcal{O}(X_1,\ldots,X_n;Y)

g(1 X 1,,1 X n)=gg(1_{X_1},\ldots,1_{X_n}) = g

and for any f𝒪(X;Y)f \in \mathcal{O}(X;Y)

1 Y(f)=f1_Y(f) = f

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 f,g,hf,g,h, it states

f(g(h))=f(g)(h)f(g(h)) = f(g)(h)

The last condition for being an operad is that if

f𝒪(X 1,,X n;Y)f \in \mathcal{O}(X_1,\ldots,X_n;Y)

and σS(n)\sigma \in S(n), the symmetric group on nn elements, then we can apply σ\sigma to ff to get

σ *(f)𝒪(X σ(1),,X σ(n);Y)\sigma^\ast(f) \in \mathcal{O}(X_{\sigma(1)},\ldots,X_{\sigma(n)};Y)

We require that (στ) *(f)=τ *(σ *(f))(\sigma \tau)^\ast(f) = \tau^\ast(\sigma^\ast(f)) if σ,τS(n)\sigma,\tau \in S(n), and there are also some conditions for how σ *\sigma^\ast interacts with composition, which can be straightforwardly derived from the intuition that σ *\sigma^\ast 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 \mathcal{R} to be an operad with one type, which we will call R 0R \in \mathcal{R}_0, and let (R n;R)=[x 1,,x n]\mathcal{R}(R^n;R) = \mathbb{Z}[x_1,\ldots,x_n], where (R n;R)\mathcal{R}(R^n;R) is (R,,R;R)\mathcal{R}(R,\ldots,R;R) with RR repeated nn times.

Composition is simply polynomial substitution. That is, if

q(y 1,,y n)[y 1,,y n](R n;R)q(y_1,\ldots,y_n) \in \mathbb{Z}[y_1,\ldots,y_n] \cong \mathcal{R}(R^n;R)


p i(x i,1,,x i,k i)[x i,1,,x i,k i](R k i;R)p_i(x_{i,1},\ldots,x_{i,k_i}) \in \mathbb{Z}[x_{i,1},\ldots,x_{i,k_i}] \cong \mathcal{R}(R^{k_i};R)


q(p 1(x 1,1,,x 1,k 1),,p n(x n,1,,x n,k n))(R i=1 nk i;R)q(p_1(x_{1,1},\ldots,x_{1,k_1}),\ldots,p_n(x_{n,1},\ldots,x_{n,k_n})) \in \mathcal{R}(R^{\sum_{i=1}^n k_i};R)

is the composite of p 1,,p n,qp_1,\ldots,p_n,q. For instance, composing

x 2[x](R;R)x^2 \in \mathbb{Z}[x] \cong \mathcal{R}(R;R)


y+z[y,z](R,R;R)y+z \in \mathbb{Z}[y,z] \cong \mathcal{R}(R,R;R)

results in

(y+z) 2[y,z](R,R;R)(y+z)^2 \in \mathbb{Z}[y,z] \cong \mathcal{R}(R,R;R)

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

For the other example, define an operad 𝒫\mathcal{P} by letting 𝒫 0\mathcal{P}_0 be the set of compact subsets of 2\mathbb{R}^2 (we could consider something more exciting, but this works fine and is easy to visualize). An operation f𝒫(X 1,,X n;Y)f \in \mathcal{P}(X_1,\ldots,X_n;Y) consists of disjoint embeddings f 1,,f nf_1,\ldots,f_n, where f i:X iYf_i \colon X_i \to Y.

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 (C,,1)(C,\otimes,1) is a symmetric monoidal category. Define Op(C,,1)=Op(C)\mathrm{Op}(C,\otimes,1) = \mathrm{Op}(C) by letting

Op(C) 0=C 0\mathrm{Op}(C)_0 = C_0

where C 0C_0 is the collection of objects in CC, and

Op(C)(X 1,,X n;Y)=Hom C(X 1X n,Y)\mathrm{Op}(C)(X_1,\ldots,X_n;Y) = \mathrm{Hom}_C(X_1 \otimes \cdots \otimes X_n, Y)

To compose operations f 1,,f nf_1,\ldots,f_n and gg (assuming that the types are such that these are composable), we simply take g(f 1f n)g \circ (f_1 \otimes \ldots \otimes f_n). Moreover, the identity operation is simply the identity morphism, and the action of σS(n)\sigma \in S(n) 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 CC be the category where the objects are compact subsets of 2\mathbb{R}^2, 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 (Set,×,1)(\mathsf{Set}, \times, 1), because this is important in the next section! This operad has as types, sets, and an operation

fOp(Set)(X 1,,X n;Y)f \in \mathrm{Op}(\mathsf{Set})(X_1,\ldots,X_n;Y)

is simply a function

f:X 1××X nYf \colon X_1 \times \cdots \times X_n \to Y

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 Set\mathsf{Set}, and as we will see, an operad algebra can also be described as an ‘operad morphism’ from the operad to Op(Set)\mathrm{Op}(\mathsf{Set}), 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 Op(Set)\mathrm{Op}(\mathsf{Set}).

An operad morphism FF from an operad 𝒪\mathcal{O} to an operad 𝒫\mathcal{P} is exactly what one would expect: it consists of

  • For every X 1,,X n,Y𝒪 0X_1,\ldots,X_n,Y \in \mathcal{O}_0, a map

F:𝒪(X 1,,X n;Y)𝒫(F(X 1),,F(X n);F(Y))F \colon \mathcal{O}(X_1,\ldots,X_n;Y) \to \mathcal{P}(F(X_1),\ldots,F(X_n);F(Y))

such that FF commutes with all of the things an operad does, i.e. composition, identities, and the action of σS(n)\sigma \in S(n).

Thus an operad morphism FF from 𝒪\mathcal{O} to Op(Set)\mathrm{Op}(\mathsf{Set}), also known as an operad algebra, consists of

  • A set F(X)F(X) for every X𝒪 0X \in \mathcal{O}_0

  • A function F(f):F(X 1)××F(X n)F(Y)F(f) \colon F(X_1) \times \cdots \times F(X_n) \to F(Y) for every operation f𝒪(X 1,,X n;Y)f \in \mathcal{O}(X_1,\ldots,X_n;Y)

such that the assignment of sets and functions preserves identities, composition, and the action of σS(n)\sigma \in S(n).

Without further ado, let’s look at the examples. From any ring AA we can produce an algebra F AF_A of \mathcal{R}. We let F A(R)=AF_A(R) = A (considered as a set), and for

p(x 1,,x n)[x 1,,x n]=(X 1,,X n;Y)p(x_1,\ldots,x_n) \in \mathbb{Z}[x_1,\ldots,x_n] = \mathcal{R}(X_1,\ldots,X_n;Y)

we let

F(p)(a 1,,a n)=p(a 1,,a n)F(p)(a_1,\ldots,a_n) = p(a_1,\ldots,a_n)

We can also make an operad algebra of point processes, PP\mathrm{PP}, for 𝒫\mathcal{P}. For A𝒫 0A \in \mathcal{P}_0, we let PP(A)\mathrm{PP}(A) be the set of point processes on AA. If f:A 1A nBf \colon A_1 \sqcup \cdots \sqcup A_n \to B is an embedding, then we let PP(f)\mathrm{PP}(f) be the map that sends point processes X 1,,X nX_1,\ldots,X_n on A 1,,A nA_1,\ldots,A_n respectively to the point process YY defined by

Y U=X f 1(U)A 1++X f 1(U)A nY_U = X_{f^{-1}(U) \cap A_1} + \cdots + X_{f^{-1}(U) \cap A_n}

Finally, if (C,,1)(C,\otimes,1) is a symmetric monoidal category, there is a way to make an operad algebra of Op(C)\mathrm{Op}(C) from a special type of functor F:CSetF \colon C \to \mathsf{Set}. 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 FF equipped with a natural transformation τ A,B:F(A)×F(B)F(AB)\tau_{A,B} \colon F(A) \times F(B) \to F(A \otimes B) that is well-behaved with respect to the associator, identity, and symmetric structure of (C,,1)(C, \otimes, 1). We call τ\tau 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 fOp(C)(X,Y;Z)f \in \mathrm{Op}(C)(X,Y;Z) (which is a morphism f:XYZf \colon X \otimes Y \to Z), we can construct a function F(X)×F(Y)F(Z)F(X) \times F(Y) \to F(Z) by composing

τ X,Y:F(X)×F(Y)F(XY)\tau_{X,Y} \colon F(X) \times F(Y) \to F(X \otimes Y)


F(f):F(XY)F(Z)F(f) \colon F(X \otimes Y) \to F(Z)

This basic idea can be extended using associativity to produce a function X 1××X nYX_1 \times \cdots \times X_n \to Y from an operation f:X 1X nYf \colon X_1 \otimes \cdots \otimes X_n \to Y.

As an example of this construction, consider point processes again. We can make a lax symmetric monoidal functor PP\mathrm{PP} by sending a set AA to PP(A)\mathrm{PP}(A), the set of point processes on AA, and an embedding f:ABf \colon A \to B to the map F(f)F(f) that sends a point process XX to a point process YY defined by

Y U=X f 1(U)Y_U = X_{f^{-1}(U)}

The laxator τ A,B:F(A)×F(B)F(AB)\tau_{A,B} \colon F(A) \times F(B) \to F(A \sqcup B) sends a point process XX on AA and a point process YY on BB to a point process ZZ on a ABA \sqcup B defined by

Z U=X UA+Y UBZ_{U} = X_{U \cap A} + Y_{U \cap B}

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


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 arise 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.

Posted at March 8, 2022 9:32 PM UTC

TrackBack URL for this Entry:

2 Comments & 1 Trackback

Re: Compositional Thermostatics (Part 3)

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 \mathcal{R}.

Posted by: John Baez on March 8, 2022 9:49 PM | Permalink | Reply to this

Re: Compositional Thermostatics (Part 3)

Let’s see. For any monad TT on SetSet, there’s an operad P T=(T(n)) n0P_T = (T(n))_{n \geq 0}, where by T(n)T(n) I mean T({1,,n})T(\{1, \ldots, n\}). Its composition and identity are given in a canonical way. Any TT-algebra is certainly a P TP_T-algebra, but there are usually many more P TP_T-algebras.

If you view TT as a theory, then a P TP_T-algebra is a set equipped with all the operations of a TT-algebra, but subject to only those equations in the theory that are strongly regular: the same variables appear on each side of the equality, in the same order and without repetition. Or if we’re doing symmetric operads, drop the “without repetition” clause.

We’ve often discussed TT-algebras versus P TP_T-algebras in the case where TT is the monad for convex algebras. There, T(n)T(n) is the (n1)(n - 1)-dimensional simplex.

In Owen’s case, TT is the free commutative ring monad and T(n)=[x 1,,x n]T(n)=\mathbb{Z}[x_1, \ldots, x_n]. My P TP_T is Owen’s \mathcal{R}. But I can’t think of anything special to say about P TP_T-algebras for this particular TT.

Posted by: Tom Leinster on March 9, 2022 9:20 AM | Permalink | Reply to this
Read the post Compositional Thermostatics (Part 4)
Weblog: The n-Category Café
Excerpt: The last of four posts explaining a compositional approach to thermodynamics using operads and convex spaces.
Tracked: June 18, 2022 11:40 PM

Post a New Comment