## April 2, 2018

### Dynamical Systems and Their Steady States

#### Posted by John Baez guest post by Maru Sarazola

Now that we know how to use decorated cospans to represent open networks, the Applied Category Theory Seminar has turned its attention to open reaction networks (aka Petri nets) and the dynamical systems associated to them.

In A Compositional Framework for Reaction Networks (summarized in this very blog by John Baez not too long ago), authors John Baez and Blake Pollard put Fong’s results to good use and define cospan categories $\mathbf{RxNet}$ and $\mathbf{Dynam}$ of (open) reaction networks and (open) dynamical systems. Once this is done, the main goal of the paper is to show that the mapping that associates to an open reaction network its corresponding dynamical system is compositional, as is the mapping that takes an open dynamical system to the relation that holds between its constituents in steady state. In other words, they show that the study of the whole can be done through the study of the parts.

I would like to place the focus on dynamical systems and the study of their steady states, taking a closer look at this correspondence called “black-boxing”, and comparing it to previous related work done by David Spivak.

## Baez–Pollard’s approach

### The category $\mathbf{Dynam}$ of open dynamical systems

Let’s start by introducing the main players. A dynamical system is usually defined as a manifold $M$ whose points are “states”, together with a smooth vector field on $M$ saying how these states evolve in time. Since the motivation in this paper comes from chemistry, our manifolds will be euclidean spaces $\mathbb{R}^S$, where $S$ should be thought of as the finite set of species involved, and a vector $c\in\mathbb{R}^S$ gives the concentration of each species. Then, the dynamical system is a differential equation

$\frac{d c(t)}{d t}=v(c(t))$

where $c:\mathbb{R}\to\mathbb{R}^S$ gives the concentrations as a function of time, and $v$ is a vector field on $\mathbb{R}^S$.

Now imagine our motivating chemical system is open; that is, we are allowed to inject molecules of some chosen species, and remove some others. An open dynamical system is a cospan of finite sets together with a vector field $v$ on $\mathbb{R}^S$. Here the legs of the cospan mark the species that we’re allowed to inject and remove, labeled $i$ ($o$) for input (output).

So, how can we build a category from this? Loosely citing a result of Fong, if the decorations of the cospan (in this case, the vector fields) can be given through a functor $F:(\mathbf{FinSet},+)\to(\mathbf{Set},\times )$ that is lax monoidal, then we can form a category whose objects are finite sets, and whose morphisms are (iso classes of) decorated cospans.

Indeed, this can be done in a very natural way, and therefore gives rise to the category $\mathbf{Dynam}$, whose morphisms are open dynamical systems.

### The black-boxing functor $\blacksquare :\mathbf{Dynam}\to\mathbf{Rel}$

Given a dynamical system, one of the first things we might like to do is to study its fixed points; in our case, study the concentration vectors that remain constant in time. When working with an open dynamical system, it’s clear that the amounts that we choose to inject and remove will alter the change in concentration of our species, and hence it makes sense to consider the following.

For an open dynamical system $(X\xrightarrow{i} S \xleftarrow{o} Y, v)$, together with a constant inflow $I\in\mathbb{R}^X$ and constant outflow $O\in\mathbb{R}^Y$, a steady state (with inflows $I$ and outflows $O$) is a constant vector of concentrations $c\in\mathbb{R}^S$ such that

$v(c)+i_{\ast} (I)-o_{\ast} (O)=0$

Here $i_{\ast} (I)$ is the vector in $\mathbb{R}^S$ given by $i_{\ast} (I)(s)=\sum_{x\in X: i(x)=s} I(x)$; that is, the inflow concentration of all species as marked by the input leg of the cospan. As the authors concisely put it, “in a steady state, the inflows and outflows conspire to exactly compensate for the reaction velocities”.

Note that the inflow and outflow functions $I$ and $O$ won’t affect any species not marked by the legs of the cospan, and so any steady state $c$ must be such that $v(c)=0$ when restricted to these inner species that we can’t reach.

What we want to do next is build a functor that, given an open dynamical system, records all possible combinations of input concentrations, output concentrations, inflows and outflows that hold in steady state. This process will be called black-boxing, since it discards information that can’t be seen at the inputs and outputs.

The black-boxing functor $\blacksquare:\mathbf{Dynam}\to \mathbf{Rel}$ takes a finite set $X$ to the vector space $\mathbb{R}^X\oplus\mathbb{R}^X$, and a morphism, that is, an open dynamical system $f=(X\xrightarrow{i} S \xleftarrow{o} Y, v)$, to the subset

$\blacksquare(f)\subseteq\mathbb{R}^X\oplus\mathbb{R}^X\oplus\mathbb{R}^Y\oplus\mathbb{R}^Y$

$\blacksquare(f)=\{(i^{\ast} (c),I,o^{\ast} (c),O): c   \text{ is a steady state with inflows }   I   \text{ and outflows }   O\}$

where $i^{\ast} (c)$ is the vector in $\mathbb{R}^X$ defined by $i^{\ast} (c) (x)=c(i(x))$; that is, the concentration of the input species.

The authors prove that black-boxing is indeed a functor, which implies that if we want to study the steady states of a complex open dynamical system, we can break it up into smaller, simpler pieces and study their steady states. In other words, studying the steady states of a big system, which is given by the composition of smaller systems (as morphisms in the category $\mathbf{Dynam}$) amounts to studying the steady states of each of the smaller systems, and composing them (as morphisms in $\mathbf{Rel}$).

## Spivak’s approach

### The category $\mathcal{W}$ of wiring diagrams

Instead of dealing with dynamical systems from the start, Spivak takes a step back and develops a syntax for boxes, which are things that admit inputs and outputs.

Let’s define the category $\mathcal{W}_\mathcal{C}$ of $\mathcal{C}$-boxes and wiring diagrams, for a category $\mathcal{C}$ with finite products. Its objects are pairs

$X=(X^\text{in},X^\text{out})$

where each of these coordinates is a finite product of objects of $\mathcal{C}$. For example, we interpret the pair $(A_1\times A_2, B_1\times B_2\times B_3)$ as a box with input ports $(a_1 ,a_2)\in A_1\times A_2$ and output ports $(b_1 ,b_2 ,b_3 )\in B_1\times B_2\times B_3$. Its morphisms are wiring diagrams $\varphi:X\to Y$, that is, pairs of maps $(\varphi^\text{in},\varphi^\text{out})$ which we interpret as a rewiring of the box $X$ inside of the box $Y$. The function $\varphi^\text{in}$ indicates whether an input port of $X$ should be attached to an input of $Y$ or to an output of $X$ itself; the function $\varphi^\text{out}$ indicates how the outputs of $X$ feed the outputs of $Y$. Examples of wirings are Composition is given by a nesting of wirings.

Given boxes $X$ and $Y$, we define their parallel composition by

$X\boxtimes Y=(X^\text{in}\times Y^\text{in},X^\text{out}\times Y^\text{out})$

This gives a monoidal structure to the category $\mathcal{W}_\mathcal{C}$. Parallel composition is true to its name, as illustrated by The huge advantage of this approach is that one can now fill the boxes with suitable “inhabitants”, and model many different situations that look like wirings at their core. These inhabitants will be given through functors $\mathcal{W}_\mathcal{C}\to\mathbf{Set}$, taking a box to the set of its desired interpretations, and giving a meaning to the wiring of boxes.

### The functor $ODS:\mathcal{W}_{\mathbf{Euc}}\to\mathbf{Set}$ of open dynamical systems

The first of our inhabitants will be, as you probably guessed by now, open dynamical systems. Here $\mathcal{C}=\mathbf{Euc}$ is the category of Euclidean spaces $\mathbb{R}^n$ and smooth maps.

From the perspective of Spivak’s paper, an $(\mathbb{R}^X,\mathbb{R}^Y)$-open dynamical system is a 3-tuple $(\mathbb{R}^S,f^\text{dyn},f^\text{rdt})$ where

• $\mathbb{R}^S$ is the state space

• $f^\text{dyn}:\mathbb{R}^X\times\mathbb{R}^S\to\mathbb{R}^S$ is a vector field parametrized by the inputs $\mathbb{R}^X$, giving the differential equation of the system

• $f^\text{rdt}:\mathbb{R}^S\to\mathbb{R}^Y$ is the readout function at the outputs $\mathbb{R}^Y$.

One should notice the similarity with our previously defined dynamical systems, although it’s clear that the two definitions are not equivalent.

The functor $ODS:\mathcal{W}_{\mathbf{Euc}}\to\mathbf{Set}$ exhibiting dynamical systems as inhabitants of input-output boxes, takes a box $X=(X^\text{in},X^\text{out})$ to the set of all $(\mathbb{R}^{X^\text{in}},\mathbb{R}^{X^\text{out}})$-dynamical systems

$ODS(X)=\{(\mathbb{R}^S,f^\text{dyn}:\mathbb{R}^{X^\text{in}}\times\mathbb{R}^S\to\mathbb{R}^S,f^\text{rdt}:\mathbb{R}^S\to\mathbb{R}^{X^\text{out}})\}$

You can surely figure out how $ODS$ acts on wirings by drawing a picture and doing a bit of careful bookkeeping.

Note that there’s a natural notion of parallel composition of two dynamical systems, which amounts to carrying out the processes indicated by the two dynamical systems in parallel. Spivak shows that $ODS$ is a functor, and, furthermore, that

$ODS(X\boxtimes Y)\simeq ODS(X)\boxtimes ODS(Y)$

### The functor $Mat:\mathcal{W}_{\mathcal{C}}\to\mathbf{Set}$ of $\mathbf{Set}$-matrices

Our second inhabitants will be given by matrices of sets. For objects $X,Y$, an $(X,Y)$-matrix of sets is a function $M$ that assigns to each pair $(x,y)$ a set $M_{x,y}$. In other words, it is a matrix indexed by $X\times Y$ that, instead of coefficients, has sets in each position.

The functor $Mat:\mathcal{W}_{\mathcal{C}}\to\mathbf{Set}$ exhibiting $\mathbf{Set}$-matrices as inhabitants of input-output boxes, takes a box $X=(X^\text{in},X^\text{out})$ to the set of all $(X^\text{in},X^\text{out})$-matrices of sets

$Mat(X)=\{\{M_{i,j}\}_{X^\text{in}\times X^\text{out}} : M_{i,j}   \text{ is a set}\}$

Once again, it’s not too hard to figure out how $Mat$ should act on wirings.

Like before, there’s a notion of parallel composition of two matrices of sets, and the author shows that $Mat$ is a functor such that

$Mat(X\boxtimes Y)\simeq Mat(X)\boxtimes Mat(Y)$

### The steady-state natural transformation $Stst:ODS\to Mat$

Finally, we explain how to use all this to study steady states of dynamical systems.

Given an $(\mathbb{R}^X,\mathbb{R}^Y)$-dynamical system $f=(\mathbb{R}^S,f^\text{dyn},f^\text{rdt})$ and an element $(I,O)\in\mathbb{R}^X\times\mathbb{R}^Y$, an $(I,O)$-steady state is a state $c\in\mathbb{R}^S$ such that

$f^\text{dyn}(I,c)=0     \text{ and }     f^\text{rdt}(c)=O$

Since dynamical systems are encoded by the functor $ODS$, it makes sense to study steady states through a natural transformation out of $ODS$. We define $Stst:ODS\to Mat$ as the transformation that assigns to each box $X$, the function

$Stst_X:ODS(X)\longrightarrow Mat(X)$

taking a dynamical system $(\mathbb{R}^S,f^\text{dyn},f^\text{rdt})$ to its matrix of steady states

$M_{I,O}=\{c\in\mathbb{R}^S : f^\text{dyn}(I,c)=0,   f^\text{rdt}(c)=O\}$

where $(I,O)\in \mathbb{R}^{X^\text{in}}\times \mathbb{R}^{X^\text{out}}$. The author proceeds to show that $Stst$ is a monoidal natural transformation.

Is it possible to use this machinery to draw the same conclusion as before, that is, that the steady states of a composition of systems comes from the composition of the steady states of the parts?

Indeed, it is! Given two boxes $X_1$ and $X_2$, we recover the usual notion of (serial) composition by first setting them in parallel $X_1 \boxtimes X_2$, and wiring this by $\varphi:X_1 \boxtimes X_2\to Y$ as follows: The fact that $Stst$ is a monoidal natural transformation, combined with the facts that the functors $ODS$ and $Mat$ respect parallel composition, allows us to write the following diagram, where both squares are commutative Then, chasing the diagram along the top and left sides gives the steady states of the serial composition of the dynamical systems $X_1$ and $X_2$, while chasing it along the right and bottom sides gives the composition of the steady states of $X_1$ and of $X_2$, and the two must agree.

## The two approaches, side by side

So how are these two perspectives related? Looking at the definitions we can immediately see that Spivak’s approach has a broader scope than Baez and Pollard’s, so it’s apparent that his results won’t be implied by theirs.

For the converse direction, recall that in the first paper, a dynamical system is given by a decorated cospan $f=(X\xrightarrow{i} S \xleftarrow{o} Y, v)$, and a steady state with inflows $I$ and outflows $O$ is a constant vector of concentrations $c\in\mathbb{R}^S$ such that

$v(c)+i_{\ast} (I)-o_{\ast} (O)=0$

Thus, studying the steady states for this cospan system corresponds to studying the box system $f=(\mathbb{R}^S, f^\text{dyn}:\mathbb{R}^X\times\mathbb{R}^S\to\mathbb{R}^S, f^\text{rdt}:\mathbb{R}^S\to\mathbb{R}^Y)$

with dynamics given by $f^\text{dyn}(I,c)=v(c)+i_{\ast} (I)-o_{\ast} (f^\text{rdt}(c))$, since its $(I,O)$-steady states are vectors $c\in\mathbb{R}^S$ such that

$f^\text{dyn}(I,c)=0     \text{ and }     f^\text{rdt}(c)=O$

Thus, the study of the steady states of a given cospan dynamical system can be done just as well by looking at it as a box dynamical system and running it through Spivak’s machinery. However, setting two such box systems in serial composition will not yield the box system representing the composition of the cospan systems as one would (naively?) hope, so it doesn’t seem that Spivak’s compositional results will imply those of Baez and Pollard.

This is a bit disconcerting, but instead of it being discouraging, I believe it should be seen as an invitation to delve into the semantics of open dynamical systems and find the right perspective, which manages to subsume both of the approaches presented here.

Posted at April 2, 2018 8:49 PM UTC

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/3030

## 1 Comment & 0 Trackbacks

### Re: Dynamical Systems and Their Steady States

Can Spivak’s formalism of open dynamical systems express the same sequential composition of dynamical systems as the Baez-Pollard Dynam?

Also this all smells very double categorical to me. I know Decorated Cospans come with a natural double category structure, maybe Spivak’s functors can be viewed that way too.

Posted by: Max S. New on April 6, 2018 9:47 PM | Permalink | Reply to this

Post a New Comment