Polarities (Part 1)

Azimuth 2024-11-03

This is a progress report on some joint work with Xiaoyan Li, Nathaniel Osgood and Evan Patterson. Together with collaborators we have been developing software for ‘system dynamics’ modelling, and applying it to epidemiology—though it has many other uses. We’ve written two papers about it, and given plenty of talks:

Software for compositional modeling.

But the software keeps growing—so it’s time to write another paper or two! First we’re writing one aimed at applied category theorists, where we explain the math in detail, and don’t pull any punches. One small part of this paper involves the concept of ‘polarities’. Let me explain those now.

Causal loop diagrams

In the tradition of system dynamics we model systems at various levels of detail using at least three kinds of diagrams. The most detail is provided by stock and flow diagrams: from such a diagram we can recover a system of first-order ordinary differential equations describing how quantities called ‘stocks’ change due to ‘flows’ between these stocks. A ‘system structure diagram’ is like a stock and flow diagram without the functions describing how flows are functions of stocks. The least detail is provided by a causal loop diagram, and this is what I want to talk about now.

Here is a causal loop diagram drawn by Six Sigma, a consulting company that aims to help you find problems in your organization and fix them:

Mathematically a causal loop diagram is a graph whose edges are labeled by signs, + and -. A positive edge

x \xrightarrow{+} y

means that increasing x tends to increase y, while decreasing x tends to decrease y. A negative edge

x \xrightarrow{-} y

means that increasing x tends to decrease y, while decreasing x tends to increase y.

As the name suggests, the main use of causal loop diagrams is to detect feedback loops. Suppose we go around a loop of edges, multiplying the signs as we go, following the usual rules:

+ \times + = + + \times - = - - \times + = - - \times - = +

If the result is a + sign, then we call this loop a positive feedback loop. If the result is a – sign, we call this loop a negative feedback loop.

For example, here is a positive feedback loop:

Increasing the number of employees available to work increases productivity, which decreases the number of managers doing employees’ duties, which increases the quality of supervision, which decreases the employees who are late, which increases the number of employees available to work!

Can you spot a negative feedback loop in this diagram?

Polarities

So far all this is very simple—and indeed that’s part of the point: causal loop diagrams are so easy to understand that you can walk into a business, talk to them about their problems, and start drawing diagrams that shed light on the feedback loops that they’re encountering.

But causal loop diagrams get a bit more interesting when we replace signs by more general ‘polarities’. Mathematically, polarities can be elements of any monoid: a set with an associative multiplication and a unit element. The monoid of signs, \{+,-\}, is better known to mathematicians as the abelian group \mathbb{Z}/2. But there’s no need for polarities to form a group, and there’s no need for the multiplication to be commutative. In principle any monoid will work, though some simple ones seem to be the most useful.

For example we can take our set of polarities to be

\mathbb{S} = \{+, 0, -\}

where 0 means ‘indeterminate’. Now this edge:

x \xrightarrow{0} y

means that increasing the quantity x could either increase or decrease quantity y, and similarly decreasing x could have either effect. We can multiply these polarities as we did before, with the additional rule that 0 times anything equals 0.

Mathematicians will instantly recognize that this multiplication rule makes the set \mathbb{S} = \{+,0,-\} into a monoid. It happens to be isomorphic to the multiplicative monoid of the ring \mathbb{Z}/3 = \{1,0,-1\} The multiplicative group of \mathbb{Z}/3, meaning the group of elements that have multiplicative inverses, is the smaller monoid \{+,-\} we saw earlier.

There are other interesting monoids we can use as polarities. But instead of listing a bunch, let me explain a simple thing what we do wit causal loop diagrams. It’s something we’ve already been talking about.

From causal loop diagrams to categories

Let’s be a bit more formal. A graph with edges E and vertices V is a pair of functions

s,t\colon E \to V

We say s(e) is the source of the edge e, and t(e) is its target.

Given any set M, we can label the edges of G by elements of M. To do this we just pick a function

\ell \colon E \to M

But when the set M is a monoid, we can do more! In this case let’s call the whole setup

s,t\colon E \to V , \qquad \ell \colon E \to M

a causal loop diagram over M. I don’t really like this term—it will be confusing to mathematicians—but it’s appropriate for work in the field of system dynamics, so let’s use it just for now.

What can we do with a causal loop diagram over M? We can form the free category F(G) on our graph, and get a way to label morphisms in this category by elements of M.

A morphism f in the category F(G) is just an edge path in G, i.e. a list of edges e_1, \dots, e_n where the target of each edge is the source of the next. So, it makes sense to label f by the element

L(f) = \ell(e_1) \cdots \ell(e_n) \in M

defined using multiplication in the monoid M.

For example, suppose M is the two-element monoid \{+,   if latex f$ is the red loop here, saying starting and ending at ‘amount of overtime utilized’, it will get labeled by -.

This means it’s a negative feedback loop.

But what’s really going on here? We have a map L that sends morphisms in F(G) to elements of M, but it’s better than just an arbitrary map of sets, because it obeys

L(f \circ g) = L(f) L(g)

So, this map is really a functor from F(G) to some category! Which category? It’s called the delooping B M of the monoid M. It has just one object \star, and a morphism m \colon \star \to \star for each element m \in M. Composition of morphisms in this category is just multiplication in M.

Note, we don’t need to say what our functor

L \colon F(G) \to B M

does to objects, since B M has just one object \star. All that matters is what L does to morphisms, and we’ve specified that.

This viewpoint is quite nice. For example, the ‘free’ functor

F \colon \mathsf{Grph} \to \mathsf{Cat}

has a right adjoint

U \colon \mathsf{Cat} \to \mathsf{Grph}

sending any category to its underlying graph. Using the properties of adjoints, our functor

L \colon F(G) \to B M

gives a map of graphs

G \to U(B M)

Here U(B M) is the graph with one vertex $\star$ and one edge for each element of M. A map of graphs G \to U(B M) simply labels every edge of G with an element of M. So, it’s only a slight abuse of language to call this map of graphs

\ell \colon G \to U(B M)

It’s just our original labeling \ell dressed up in fancy categorical clothes. And while we’re dressing up and formalizing things, we can summarize our observation as an official Lemma:

Lemma. Given a monoid M and a graph G, labelings of the edges of G by elements of M correspond bijectively to functors

L \colon F(G) \to B M

since F \colon \mathsf{Grph} \to \mathsf{Cat} is left adjoint to U \colon \mathsf{Cat} \to \mathsf{Grph}.

There’s a lot more to say, but I’ll stop here for now and continue later. I’ve decided people just don’t read long blog articles.