Infinite Ascent.

by CJ Quineson

Non-compositionality of square dance calls

of course there’s math in square dancing

What is square dancing?

Square dancing is a social dance that involves a square of eight dancers, starting like this:

starting formation

This is a view from above. Each square is a dancer, and the dots are their noses. Outside of the square, another person, the caller, says a series of calls. A call is a word or phrase, like Hinge, Pass the Ocean, or Chain Reaction, that instructs certain dancers to move to certain spots on the floor.

I learned to square dance from Tech Squares, MIT’s square dance club. Here’s a video of some Tech Squares people square dancing, which will do more justice to describing square dancing than anything I could write here. I am, in particular, a fan of challenge square dancing, which stresses the puzzly part of square dancing, and I’d like to talk about some puzzly parts in this post.

Calls and concepts

Let’s go through some calls that I’ll use as examples later.

Pass Thru. This call tells two dancers, who are facing each other, to walk to the spot of the person they’re facing.

A rule called the right-shoulder rule states that if two dancers would stand in the same spot, they instead pass right shoulders. Thus, Pass Thru looks like this:

before
after 1/2
Pass Thru

Trade. This call tells two dancers, who are standing next to each other, to walk in a half-circle to occupy the other dancer’s spot. Depending on where it starts, Trade can look like this:

before
after 1/2
Trade

Or like this, where we apply the right-shoulder rule:

before
after 1/2
Trade

These two examples differ in their starting formation. The formation describes which spots people are on the floor, and which directions they face in.

Hinge. 12\frac{1}{2} Trade.

before
Hinge

Note how we used 12\frac{1}{2}. This is our first example of a concept. A concept is a function that takes a call and returns a call. We’ll see more concepts later.

Pass the Ocean. This is a three part call.

  1. Pass Thru.
  2. Turn 14\frac{1}{4} in.
  3. 12\frac{1}{2} Pass Thru.
start
Pass Thru
1/4 In
1/2 Pass Thru

Lockit. This call instructs four dancers, typically in a line. The centers Hinge, while the others move forward in a 9090^{\circ} arc to end next to them.

before
Lockit

Here’s something to note. From the below formation, 12\frac{1}{2} Pass Thru; Lockit puts people in the same spots as Pass the Ocean.

start
1/2 Pass Thru
Lockit

This dances better than following the steps of Pass the Ocean mechanically. In practice, when asked to Pass the Ocean, dancers will blend the steps together, moving in a way closer to 12\frac{1}{2} Pass Thru; Lockit.

What is compositionality?

There’s this Jules Hedges post on compositionality that I’ll use as the basis for a description. A system that’s compositional has several properties:

  • Composition. Parts can be combined to create larger parts.
  • Structure. Large parts can be split into smaller parts that determine its meaning.
  • Interfaces. We can use a part if we know what it does, even if we don’t understand how it works.

Example: programming languages

As an example of a compositional system, consider a programming language.

Composition. Variables like x, operations like +, and constants like 2, can be combined to form expressions, like x + 2. Expressions can be combined to form other expressions, or to form statements like y = x + 2. And statements can be combined to form functions:

def f(x):
    y = x + 2
    return y + 2
def f(x):
    y = x + 2
    return y + 2

In other words, we can say that expressions compose to form expressions or statements, and that statements can compose to form functions.

Structure. We can understand how a function works by looking at the statements it’s made of. To understand f(x), we can first understand y = x + 2, and then return y + 2.

We can split further, too. The meaning of y = x + 2 is built from the meanings of y and = and x + 2. The meaning of (left) = (right) is:

change the value of (left) to (right),

so the meaning of y = x + 2 is

change the value of y to x + 2.

We call the smaller parts constituents, and the way they combine their structure. Structure tells us how x = y and y = x are different even though they’re made of the same constituents.

Interfaces. From the outside, f is a function that takes x and returns x + 4, and if we understand that we can use f. We don’t need to know how f works on the inside; it doesn’t matter that it adds 2 and then adds 2 again.

We call what f does its interface, and how f works its implementation. The interface is what we know from the outside, and the implementation is how it works in the inside.

One property of interfaces is that, if we replace things with the same interface, then it doesn’t matter if they have different implementations. Let’s define a new function, double:

def double(x):
    return f(x + f(x)) - 8
def double(x):
    return f(x + f(x)) - 8

We want double to be a function that doubles its input. We know this because we know that f takes x to x + 4, so this becomes

f(x+f(x))8=((x+f(x))+4)8=((x+x+4)+4)8=2x.\begin{align*} f(x + f(x)) - 8 &= ((x + f(x)) + 4) - 8 \\ &= ((x + x + 4) + 4) - 8 \\ &= 2x. \end{align*}

This is an example of reasoning by interface. We don’t need to know that f computes y = x + 2 and then returns y + 2; all we need to know is its interface, which is what it does.

Suppose we replace f with

def f(x):
    y = x + 3
    return y + 1
def f(x):
    y = x + 3
    return y + 1

Do we need to change double? No, because the interface of f is the same. It doesn’t matter, from the outside, if f changes its implementation, as long as the interface is the same.

Example: road signs

Another example of a compositional system are road signs, an example I’m stealing from the SEP entry on compositionality.

Composition. Composing the signs for gas, food, etc., gives us a larger rest stop sign. We have one sign, not six different signs.

Structure. The meaning of the first sign below is built from its constituents:

The red circle and slash means “no”, and the arrow means “left turn”. Together, the sign means “no left turn”. The structure is such that the red circle and slash is placed above the arrow. (If it were below the arrow, the meaning wouldn’t be defined.)

Interfaces. This is a sketchier example, but bear with me. Let’s say you need a sign for information amenity, and you have two options:

The difference is their color: the first sign is blue, and the second sign is yellow. Now, you may not exactly know what blue or yellow on a road sign means. But signs for amenities have the same interface: they’re all blue. You’d pick the blue sign, because you understand the interface of “amenities are blue”, even if you don’t know the exact shade of blue or the exact meaning of an amenity.

A scale of compositionality

Compositionality is not all-or-nothing. A system can be more or less compositional than another. Here’s some systems sorted from most to least compositional, by my judgment.

IKEA furniture. Furniture in general is compositional, sure. One look at IKEA storage solution systems, though, convinces me that IKEA’s design stresses compositionality: “…combine different colors and sizes, or change the placement of the cabinets as you see fit.” Mixing and matching parts is possible because there are consistent interfaces.

Architecture. From Systems Generating Systems, which uses the phrase generating system. “A building system is a generating system in this sense. It provides a kit of parts — columns, beams, panels, windows, doors — which must be put together according to certain rules.” These rules correspond to the structure property.

Below this line, examples fail to have interfaces.


Natural languages. It’s debatable how compositional English is. You can understand Superman can fly by understanding the words Superman, can, fly, plus knowing how English sentence structure works. But words don’t have well-defined interfaces. For example, even if Superman and Clark Kent were the same person, the sentence Clark Kent can fly has a different meaning.

Fighting game combos. Part of the complexity of fighting games (think Street Fighter or Smash Bros.) comes from combos, formed from sequences of attacks. The SmashWiki defines true combos as a sequence that “keeps the opponent in hitstun, and is thus guaranteed to connect.” As different attacks have different hitstun properties, there are rules that govern what can be chained to make a true combo. This gives the system the structure property.

Below this line, examples fail to have structure. I wouldn’t call these systems compositional; a better word would be modular.


Protein structure. You can decompose quaternary structure into tertiary, then into secondary, primary, down to amino acids. This is composition, sure. But predicting secondary structure, given the primary structure, is a major open problem, so protein structure fails to have the structure property. I think biology, as a whole, fails to be compositional in a lot of ways.

Economics. Microeconomics and macroeconomics are two different fields of study for a reason. Even if you understand how an individual spends money, you can’t compose a million such individuals to understand how a country spends money. Inflation doesn’t have a structure made of constituents that you can understand individually.

Ways calls are(n’t) compositional

Tandem

If square dance calls were purely compositional, then we only need to care about the result of each call, and not how you got there. In other words, calls would have interfaces, and the interface of a call is what formation in starts in, and what formation it ends in.

For example, recall that Pass the Ocean ends in the same spots as 12\frac{1}{2} Pass Thru; Lockit. If calls had perfect interfaces, you could get away with never knowing the parts of Pass the Ocean, and instead always dance 12\frac{1}{2} Pass Thru; Lockit. You could even go further, and only memorize the formations.

before
Pass the Ocean

This interface is useful for composing calls. If you think of calling one call after another as their composition, then the formations tell you which calls you’re allowed to call.

Recall that there are concepts, functions that take a call and return another call. For example, we’ve seen 12\frac{1}{2}, which takes a call, and returns the call where you only do the first half. This concept takes Trade, and returns Hinge.

Another concept is Tandem, which takes an nn-person call, and returns a 2n2n-person call, where each person is replaced with two people, one in front of the other. Here’s what Tandem Pass the Ocean does:

before
Tandem Pass the Ocean

So far so good! We can forget the exact definition of Pass the Ocean, and still be able to dance Tandem Pass the Ocean. That’s a win for interfaces.

Reverse Order

However, there’s a whole class of concepts that need you to know the parts of each call: fractions. In the same way that you can dance 12\frac{1}{2} Trade, you can dance 13\frac{1}{3} and 23\frac{2}{3} Pass the Ocean.

start
1/3 Pass the Ocean
2/3 Pass the Ocean
Pass the Ocean

At minimum, this forces you to know what each part of a call does; you can’t forget the parts of a call. But let’s say you’re stubborn about interfaces, and instead memorize how each part of the call starts and ends.

Even if you did, you wouldn’t be able to dance Reverse Order. This concept takes a call, and returns a call with the parts reversed. If you tried to dance Reverse Order Pass the Ocean, you’d get this far:

before
last 1/3 Pass the Ocean

before you’d be stuck, because you can’t directly apply the middle 1/3 of Pass the Ocean. You’d have to know the definition of that part, turn 14\frac{1}{4} In. Putting it together, Reverse Order Pass the Ocean is:

start
1/2 Pass Thru
1/4 In
Pass Thru

In general, concepts obstruct calls from having nice interfaces, making it important to know a call’s definition.

Roll

Let’s say you thought about this, then decided that you don’t like concepts. Lucky for you, square dancing has levels, like Mainstream, Plus, Advanced 1 (or A1), A2, Challenge 1 (or C1), C2, C3A, C3B, and C4. Each level introduces more calls and concepts over the previous level. A Mainstream dancer would needs to know around 90 calls; a C4 dancer would know, in total, around 700 calls and concepts. People dance different levels for different reasons; I usually dance in levels between Plus and C2.

Concepts aren’t introduced until A1, so maybe you could delay learning definitions until then? Well, in Plus, there’s the call Roll. Per the Tech Squares definition, Roll means:

Dancers who turned as part of their last movement in the [previous] call continue turning 9090^{\circ} in place. Dancers whose last movement did not involve turning do not turn.

For example, consider the sequence Lockit; Roll. After doing Lockit, dancers keep turning to Roll. In the diagram, dancer 1 was going clockwise, and so continues turning clockwise; similarly dancer 2 turns counterclockwise.

start
Lockit
Roll

Consider the sequence Pass the Ocean; Roll. Remember how I said that dancers often blend the parts of Pass the Ocean together, moving in a way closer to 12\frac{1}{2} Pass Thru; Lockit? Because of that, you might think that Pass the Ocean; Roll would dance like this:

start
partway
Pass the Ocean
Roll?

However, Roll explicitly refers to the last movement in the previous call. The last movement everyone makes in Pass the Ocean is 12\frac{1}{2} Pass Thru, which doesn’t involve turning. No one does the Roll after Pass the Ocean.

start
Pass the Ocean
Roll

In practice, it’s unlikely to hear Pass the Ocean; Roll, as it’s bad taste to call Roll when no one can do it. Even so, Roll prevents calls from having interfaces, as dancers need to know what the last movement is for each call. (Dylan points out that you can make the interfaces larger. Yes, you can include the “roll direction” as part of a call’s interface. You’d also have to include other things to account for calls like Sweep a Quarter or With the Flow. And maybe more?)

Bring in the categories

A decent number of my friends who dance C3B and C4 talk about square dancing from a category theory perspective. Maybe it’s something about the bubble of friends I have and how much they like talking about math. But maybe there’s a deeper reason. Maybe, for some reason, it’s natural to model square dancing using categories.

I’ve tried several times, though, and I can’t find a satisfying category to study square dancing in. Here’s things I’ve considered and why I don’t like them. (Warning: category theory incoming. Feel free to skip the next two sections if you get lost.)

Category of formations

Recall that a formation describes where people are on the floor and which way they’re facing. Consider the category where the objects are formations, and the morphisms are calls.

What do concepts look like in this category? As concepts are functions from calls to calls, we could hope that they’d be functors. I think some concepts are functors, like Tandem. (tckmn points out it’s a “partial functor”, since you can’t apply it to every call.) For example, Pass the Ocean is:

  1. Pass Thru.
  2. 14\frac{1}{4} In.
  3. 12\frac{1}{2} Pass Thru.

If Tandem was a functor, we’d hope for Tandem Pass the Ocean to be:

  1. Tandem Pass Thru.
  2. Tandem 14\frac{1}{4} In.
  3. Tandem 12\frac{1}{2} Pass Thru.

And indeed, it is:

before
Tandem Pass Thru
Tandem 1/4 In
Tandem 1/2 Pass Thru

This relates to our discussion earlier, about how we can forget the definition of Pass the Ocean, and still be able to dance it Tandem. But we also mentioned that you can’t do this with concepts like fractions, or Reverse Order. This also relates to how these concepts aren’t functors in this category. In fact, most concepts aren’t functorial.

Maybe there’s a weaker notion of “functor” that describes these concepts, but I’m not aware of one. (Something about adjoints, maybe?) This also doesn’t account for metaconcepts, functions that take a concept and return another concept, like Initially or Echo.

Category of calls

Another formulation would be the category where the objects are calls, and the morphisms are concepts. This accounts for concepts, if you have separate instances of a concept for each call. With some stretching, there’s a way to account for some metaconcepts as functors.

I think this fails to model the compositionality that square dance calls do have, though, which is that you can chain calls one after another, if the first ends in a formation that you can call the second in.

In search of structure

So, I can’t think of a good way to model square dance calls with categories. Reasons this could be true:

  1. I don’t know enough about categories to model this in the right way.
  2. Something fundamental about square dancing makes it impossible to do good category theory in.
  3. Applied category theory, as a field, hasn’t developed the tools for modeling square dancing yet.

Reason 1 sure is possible, as I don’t know much about category theory in general. (I was a math major, sure, but my day job involves little math.) If you see something, let me know!

Reason 2 might be because of what I’ve been talking about in this post: there’s a lack of compositionality that makes it hard to get the kinds of structure needed to make interesting categories. Referring to the Hedges post again, emergent effects happen because there’s no compositionality, and it’s this emergence that makes square dancing interesting. But maybe there’s another way to capture the structure that does exist?

Reason 3 could be possible. While writing this post, I came across the paper Obstructions to Compositionality. It discusses the example of open graphs, and how they’re not quite compositional with respect to reachability. I haven’t read the paper, but it seems like they develop formal machinery to describe it anyway. Notably, the paper was only posted on the arXiv a few months ago, with a revision uploaded two days ago(!) mentioning an upcoming “extended technical paper.”

I started this post because there wasn’t any good public writing about square dancing and category theory, so I hoped to at least put down some naive thoughts. Maybe this’ll motivate me to study more math—if I learn anything, I’ll try to write about it!

Comments

Loading...