Blog on Applied Mathematics

# Creative Mathematics: An Application of Category Theory

By Maria Mannone

PANGOLIN (Ground Pangolin, manis temminckii)

A pangolin curled up in the defensive position:

When the pangolin is frightened, it curls up, becoming a sort of armored ball that the predatory animals are not able to open, but easy to be caught by poachers.

The pangolin is characterized by a strong scale armor that makes it look almost like a small dinosaur. The pangolin is too little to run and too big to hide, thus nature gave it the armor. The particular armor of the pangolin can guide us to the discovery of some basic concepts of category theory.

Let us consider one scale.
Then, two scales.

The repetition of two scales is defined by a transformation that we call g:

The scales are our “objects,” and the arrows g are our “morphisms.” If we compose several g-arrows, we again obtain scales, as the following image shows.

If we don’t make any repetition, thus, if we move from a scale and we apply the arrow “1” that gives us again the same scale, we just defined what mathematicians call an “identity.” Thus, already the very first observation allows us to define the category “scale,” with its objects, arrows, identity-arrows, and arrow composition.

The whole image of the pangolin in its closed-defensive position is much more complicated. We can try to add new “transformations” to build such a whole image.

After the “horizontal” composition, we add a vertical composition, given by the “vertical” repetition of scales, through the arrow h.

In this way, by combining g and h, we can build several rows of scales, the ones partially superposed to the others. However, by looking at the real image of the pangolin’s armor, we can see that the rows are offset as if we introduced a little shift in the even rows. Let us indicate such a transformation with Sh (where Sh stands for shift and not for ‘s composed with h’):

We obtain all the scales by repeating N-times the action of g and h. To obtain a whole image that is more realistic, we can modify the “general shape” of the image via the arrow I:

Finally, we “close” the obtained figure, to imitate the image of the defensive-position curled-up pangolin’s back. Here, we use letter L which stands for Loop.

Remaining within the category “scales,” we reconstructed a complex image through a sequence of progressive transformations.

If we keep working with a category-typical operation, we can take such a collection of objects (points) and morphisms (arrows), and we can apply this to something else. It is like… to have some bridges, from an initial to a final point (to be opportunely shifted into a new initial and new final point), and we can transform each bridge into another bridge: we would create a “bridge of bridges”! The concept of “transformation between transformations” is, in fact, the “primum movens” that gave birth to Category Theory in the Forties of last Century.

Now, let us try to apply all of that to music. We can move from the category “images” to the category “musical fragments.”

There is an endless number of ways (mappings) to transfer a visual shape into a musical structure (in general, a set of non-sound data into a sound data). We are in the field of “sonification.”

In our analysis, we can choose a melody that imitates the upper contour of the scale, with a raising and lowering movement. Is that a case that, in English, the term “scale” applies both to music as well as to a part of the armor?

Now, let us apply to music, one by one, each transformation we could apply to images. Our priority is to opportunely translate each arrow from the visual field into the sound domain.

The horizontal repetition g could be ‘translated’ in a time repetition (g’) of a musical fragment; the vertical repetition h becomes a simultaneous repetition of the same melodic fragment at different pitches (h’); the spatial shift of even rows becomes a time shift of even melodies.

There are several ways to musically render the transformations I and L. A possible choice consists in the assignation of an intensity change in correspondence of the change of shape (I’), and a cycle of repetition of fragments and melodies with L’. We get a series of musical fragments (objects) connected by transformations (the arrows g’, h’, Sh’, I’, L’). The composition of two or more arrows still gives musical fragments, and an arrow that does not change anything and returns a musical fragment that is identical to the initial one is the identity. In this way, we build up the category of musical fragments.

We obtain the same result if we separately sonify each image, and also if we sonify the initial one and we successively apply the musical transformations. For such an invariance of results, we obtained diagrams that are called “commutative.”

The transformation that brings each image into a musical fragment (red arrows), and each visual transformation into a musical transformation (green arrows), is the “sonification functor.” In category theory, a functor is a mathematical entity that transfers objects and morphisms of a category into objects and morphisms of another category. It is a sort of… hyper-bridge between bridges and islands!

Let us call S1 the functor we just defined: we have g’ = S1(g), h’ = S1(h), …, and so on.

Let us now suppose to have another sonification functor, S2. Category theory also allows here to define what changes between the melodic fragments we produced with S1 and the melodic fragments we produced with S2, if we restrict the analysis to the symbolic point of view. These transformations are called “natural”: they are transformations α defined from S1 to S2. All said above can be summarized in the following image.

Via the tools given by category theory is then possible to create music, and also to analyze written music—by “decomposing” the structures as we did for the pangolin’s armor—as well as to analyze basic and advanced elements of musical practice. An example for all: a crescendo at the piano, from ‘piano’ to ‘forte’ can be described through an arrow; a slower crescendo and a faster one can be represented as two arrows between the same points, connected by a temporal transformation (an arrow between arrows.)

Summarizing, the particular example we considered can also be interpreted as a structure to compose, program, and also as a scheme to improvise music. The following link leads us to an improvisation whose unique “score” is constituted not by notes to play, but by transformations to apply.

(Idea, study, schemes, and drawings by Maria Mannone)

Selected References. A very clear textbook to start the study of category theory is “Conceptual Mathematics” by Lawvere and Schanuel. For a deeper reading, we suggest the classic textbook “Categories for the Working Mathematician” by Sounders Mac Lane, and, for an interdisciplinary view on the topic, the reader can examine “Categories for the Sciences” by David Spivak. The recent literature on mathematics and music about the applications of category theory to music includes the works by Guerino Mazzola, Franck Jedrzejewski, and Alexandre Popoff. The Italian book “Le Figure della Musica” by the composer Salvatore Sciarrino, even if not explicitly talking about category theory, highlights the importance of concepts of elementary mathematics to compare structures and transformations between music and visual arts. The works by Lawrence Zbikowski concerning the relationships between music and movement from a cognitive point of view can find in category theory a formal explanation, that graphically describes the “transformations of transformations.” The philosopher Charles Alunni uses diagrammatic thinking in his works, and the physicist John Baez, an expert of the topic, administrates an interdisciplinary blog, considered as one of the most important references for category theory. My studies are about applications of category theory to the orchestra, structures in composition, and relationships between music and images.

### 1 Comment

1. Ruhan
September 15, 2018

Very well explained. Thank you.