# Topos theory and music (1)

Although there are more things to talk about regarding neo-Riemannian theory and transformational theories of music, I’d like to talk today about something different. Some time ago, I stumbled across this paper :

• “The Topos of Triads”, T. Noll, which you can access here, and which has also been studied in the following paper :
• “Commuting groups and the topos of triads”, T. M. Fiore and T. Noll, MCM 2011 Proceedings of the Third international conference on Mathematics and computation in music, pp. 69-83

… and I couldn’t make any sense of what was the paper about ! In fact, I knew nothing about topos theory at that time, and it took me quite long before I could grasp how Noll used topos theory and its use for musical analysis.

What I intend to do here is to save you all that time, and try to expose the basics of topos theory in a very intuitive way, so that we can see what is Noll’s paper about. Of course, if you already know topos theory, you won’t have any problem understanding Noll’s theory. For those who don’t, we’ll have to introduce some mathematical concepts first. You’ll need basic category theory, up to functors (we’ll introduce natural transformations below). I have chosen to present them in a rather informal way, favoring intuition over mathematical rigor: mathematicians would probably have many remarks (which are welcome, so that I may improve these posts). If you want more maths, you should read this books :

• “Categories for the working mathematician”, S. MacLane, Springer
• “Sheaves in Geometry and Logic: A First Introduction to Topos Theory”, S. MacLane, I. Moerdijk, Springer

Finally, you may know that G. Mazzola has published a book entitled “The Topos of Music” (Birkenhauser). The book also references topos theory, but is rather complex and not essential for understanding Noll’s paper so I won’t make any reference to it here.

Presheaves

The first notion we need is that of a presheaf. Let $C$ be a small category, and $V$ another category. A $V$-valued preasheaf on $C$ is a functor $F: C^{\text{op}} \to V$ where $C^{\text{op}}$ is the opposite category of $C$. We will be particularly interested in presheaves of sets, where $V$ is $\textbf{Sets}$, the category of sets.

In fact, you already have seen such presheaves. Remember from this post that a GIS (Generalized Interval System) can be considered as functor from a group (viewed as a single-object category) to $\textbf{Sets}$. However, we will consider here all kinds of categories $C$, not only groups.

And we’ll give an example right now. Let’s imagine a world populated with dogs (D) and their masters (M). Now, our world has one specific rule: there can’t be any stray dogs, i.e. dogs without a master. In other words, there is a function which associates to each dog its master.

Thus, the category $C$ we will consider looks like this

It has one object M for the masters, one object D for the dogs, and one morphism $h_{\text{MD}}$ which represents the relation “is the master of”. Be careful, this category is not the one where actual dogs and masters live: it is only a model for the relations between masters and dogs.

If we want to have an actual realization, we need a functor $F$ from $C^{\text{op}}$ to $\textbf{Sets}$, like this

We get a set $F(D)$ with only one dog, whose master belongs to the set $F(M)$, the relation of ownership being the function between sets $F(h_{\text{MD}}): F(M) \to F(D)$. Beware that this function works in a reverse way (from dogs to masters), since a presheaf is a functor from the opposite category to $\textbf{Sets}$.

But we could have other worlds, with more dogs and masters, like this

Notice that a master may have more than one dog, but a dog can’t belong to more than one master.

Natural transformations and categories of presheaves of sets

Let’s take our two previous presheaves, like this

Intuitively, we could say that the presheaf F can inject into the presheaf G. So, we would like to have a “function between presheaves”, much like we have ordinary functions in $\textbf{Sets}$, like this

A “function between presheaves” will be called a natural transformation.

The situation is a bit more complicated for presheaves than it is for sets. In our case, we need to send dogs to dogs, and masters to masters, so instead of a single function between sets, we need for each object $X$ of the category $C$ a function $\eta_X$ between the sets $F(X)$ and $G(X)$.

But remember also that the category $C$ adds structure to the sets of $F(C)$, so the natural transformation should preserve that structure when passing from F to G. In other words, if two elements are related by a function (which is an image of a morphism in $C$), their image should be related by the corresponding function in the presheaf G, like this

In mathematical terms, a natural transformation between presheaves F and G is a collection of functions $\eta_X: F(X) \to G(X)$ for each object X of the category $C$, such that given a morphism $f : X \to Y \in C$ between objects X and Y, we have the following relation

$\eta_X \circ F(f) = G(f) \circ \eta_Y$

Natural transformations have the nice properties that you can compose them: if you have a natural transformation $\eta_1$ between presheaves F and G, and a natural transformation $\eta_2$ between presheaves G and H, you get a natural transformation $\eta_2 \circ \eta_1$ between F and H, by composing the individual functions $\eta_X$. Moreover, you can check that this composition is associative, and that you have a special natural transformation which is the identity between F and F. Thus, you can form the category of sets-valued presheaves on the category $C$, which we will write $\textbf{Sets}^{C^{\text{op}}}$, which has

• All presheaves $C^{\text{op}} \to \textbf{Sets}$ as objects
• Natural transformations between presheaves as morphisms between these objects

Such a category is called a functor category. In fact, you can form any functor category using all the functors between a small category $C$ and an arbitrary category $D$, but we will restrict ourselves to the case $D=\textbf{Sets}$ because the corresponding functor categories have additional structure, as we will see shortly.

Just like bijections, injections and surjections in sets, we can have “bijective natural transformations” (morphisms which have an inverse), “injective natural transformations” (monomorphisms, i.e. left-cancellative morphisms) and “surjective natural transformations” (epimorphisms, i.e. right-cancellative morphisms)

Topos

So, what is a topos ? There are a number of definitions (including the difference between elementary topos and Grothendieck topos, which I won’t talk about here): the following one will be useful when looking at the particular example of $\textbf{Sets}$.

A topos is a category which has

The archetypal example of a topos is the category $\textbf{Sets}$. In this category, the limit is given by the cartesian product, the colimit by the disjoint union and the exponential object $Y^X$ of two sets $X$ and $Y$ is the set of all functions from $X$ to $Y$. But what is a subobject classifier, and what is it in $\textbf{Sets}$ ?

We need to define first what a subobject is. In the small example below

the three-elements blue set is a subobject of the larger four-elements gray set. Note that there is a an injective function $i$ of the three-elements set into the four-elements set :

Of course, we could have another injective function $j$ from the three-elements set to the larger one, with the same image. But then, there would be a bijection $\phi$ such that $j = i \circ \phi$. So a subobject is in fact an equivalence class of injections, where the equivalence relation between two injections $i$ and $j$ is given by the existence of a bijection $\phi$ such that $j = i \circ \phi$.

Now for the subobject classifier. In $\textbf{Sets}$, given a set $X$ and a subobject $Y$ of that set, there exists a characteristic function which sends the elements of $Y$ to 1, and the elements of $X-Y$ to 0. The two-elements set $\Omega = \{1,0\}$ is called the subobject classifier of $\textbf{Sets}$. To be more formal, we need:

• The terminal element $\textbf{1}$ of $\textbf{Sets}$, which is the single element set.
• The subobject classifier $\Omega = \{1,0\}$
• The function $\text{True}: \textbf{1} \to \Omega$, whose image is the element $\{1\} \in \Omega$.

The subobject $Y$ should be mapped to $\{1\} \in \Omega$, so we will send $Y$ to $\textbf{1}$ via the unique morphism $\text{!}: Y \to \textbf{1}$, which we will compose with $\text{True}$, like this

The characteristic function $\chi$ is then the unique function $\chi: X \to \Omega$ such that the we obtain the following pullback diagram

and we see that it sends elements of the subobject to 1 and the rest to 0.

The discussion was all about $\textbf{Sets}$, but the definition of the subobject classifier is more general. An object $\Omega$ is a subobject classifier for a category $C$ if

• there exists a morphism $\text{True}: \textbf{1} \to \Omega$ (where $\textbf{1}$ is the terminal object of $C$) such that
• for each monomorphism $i: Y \to X$, there exists a unique morphism $\chi_i: X \to \Omega$ such that the commutative diagramis  a pullback diagram.

And now for the really cool thing about categories of presheaves:

Given a small category $C$, the functor category $\textbf{Sets}^{C^{\text{op}}}$ is a topos.

The subobject classifier in such a category is the presheaf which sends each object to the set of sieves on that object. A sieve on an object $X \in C$ is a set of morphisms whose codomain is $X$ which is invariant when composing on the left.

Let’s try to find the subobject classifier of our category of dogs and masters. Remember, this is the category

What are the sieves on $M$ ? Well, there is always $\emptyset_M$, of course. And then, there is $\{\text{id}_M\}$ and that’s it. So $\Omega(M)$ is a two element set, which we will notate as $\Omega = \{1,0\}$, 1 corresponding to the sieve $\{\text{id}_M\}$ and 0 to the sieve $\emptyset_M$.

And what about the sieves on $D$ ? Again, we have $\emptyset_D$. Then we have $\{h_{MD}\}$, since it is invariant if we compose it on the left with $\text{id}_D$. And then we have $\{h_{MD},\text{id}_D\}$. So $\Omega(D)$ is a three element set, which we will notate as $\{0,1/2,1\}$ corresponding to the sieves I’ve just presented.

Therefore, the subobject classifier $\Omega$ is the following presheaf

(Remember that in the functor category we’re working with, the objects are presheaves, therefore the subobject classifier is a presheaf as well.)

How does it classify things ? Let’s consider the following world $X$, with five dogs and two masters

and let’s consider the subobject $Y$ which consists of dog A and master M1, or in other words the following equivalence class of monomorphisms

(I’m dropping the drawing of the category, but you have to remember it’s there since we are working with presheaves and not just sets).

Now the question is: does the master M2 belong to $Y$ ? The answer is no. Does the dog D belong to $Y$ ? The answer is again no. Does the dog B belong to $Y$ ? It’s not quite simple ! Of course, it does not belong directly to $Y$, but his master does. So we have an intermediate truth value for dog B, rather than just a binary answer. I’m sure you understand now the significance of 1/2 in $\Omega(D)$. The whole picture for the pullback diagram will look like this

Each element of the sets in $X$ is assigned a truth value in $\Omega$ depending on its relationship with the subobject $Y$.

Topos theory really generalize all the nice properties you have in $\textbf{Sets}$. In a sense, it generalizes set theory to sets modelled on a category $C$ which provides additional structure. In the next post, we’ll introduce more properties of toposes, and we’ll turn to Noll’s paper to see their application in music.

## One comment

1. Congratulations on making these concepts so very clear. I actually witnessed the conferences introducing the papers you mention and would have benefited from your ‘dogs and masters’ analogies.