Algebras of Open Dynamical Systems on the Operad of Wiring Diagrams
2015 Spivak, Vagner, Lerman 26 pp.

Algebras of Open Dynamical Systems on the Operad of Wiring Diagrams

1. ALGEBRAS OF OPEN DYNAMICAL SYSTEMS ON THE OPERAD OF WIRING DIAGRAMS

DMITRY VAGNER, DAVID I. SPIVAK, AND EUGENE LERMAN

ABSTRACT. In this paper, we use the language of operads to study open dynamical systems. More specifically, we study the algebraic nature of assembling complex dynamical systems from an interconnection of simpler ones. The syntactic architecture of such interconnections is encoded using the visual language of wiring diagrams. We define the symmetric monoidal category \mathbf{W}, from which we may construct an operad \mathbf{OW}, whose objects are black boxes with input and output ports, and whose morphisms are wiring diagrams, thus prescribing the algebraic rules for interconnection. We then define two \mathbf{W}-algebras \mathcal{G} and \mathcal{L}, which associate semantic content to the structures in \mathbf{W}. Respectively, they correspond to general and to linear systems of differential equations, in which an internal state is controlled by inputs and produces outputs. As an example, we use these algebras to formalize the classical problem of systems of tanks interconnected by pipes, and hence make explicit the algebraic relationships among systems at different levels of granularity.

1.1. 1. INTRODUCTION

It is widely believed that complex systems of interest in the sciences and engineering are both modular and hierarchical. Network theory uses the tools and visual language of graph theory to model such systems, and has proven to be both effective and flexible in describing their modular character. However, the field has put less of an emphasis on finding powerful and versatile language for describing the hierarchical aspects of complex systems. There is growing confidence that category theory can provide the necessary conceptual setting for this project. This is seen, for example, in Mikhail Gromov’s well-known claim, “the mathematical language developed by the end of the 20th century by far exceeds in its expressive power anything, even imaginable, say, before 1960. Any meaningful idea coming from science can be fully developed in this language.” [Gro13]

Joyal and Street’s work on string diagrams [JS91] for monoidal categories and (with Verity) on traced monoidal categories [JSV96] has been used for decades to visualize compositions and feedback in networked systems, for example in the theory of flow charts [AMMO10]. Precursors, such as Penrose diagrams and flow diagrams, have been used in physics and the theory of computation, respectively, since the 1970’s [Sco71, BS11].

Over the past several years, the second author and collaborators have been developing a novel approach to modular hierarchical systems based on the language of operads and symmetric monoidal categories [Spi13, SR13]. The main contribution to the theory of string diagrams of the present research program is


Spivak was supported by ONR grant N000141310260 and AFOSR grant FA9550-14-1-0031.

the inclusion of an outer box, which allows for holarchic [Koe67] combinations of these diagrams. That is, the parts can be assembled into a whole, which can itself be a part. The composition of such assemblies can now be viewed as morphism composition in an operad. In fact, there is a strong connection between traced monoidal categories and algebras on these operads, such as our operad \mathcal{OW} of wiring diagrams, though it will not be explained here (see [SSR15] for details).

More broadly, category theory can organize graphical languages found in a variety of applied contexts. For example, it is demonstrated in [BS11] and [Coe13] that the theory of monoidal categories unifies the diagrams coming from diverse fields such as physics, topology, logic, computation, and linguistics. More recently, as in [BB12], there has been growing interest in viewing more traditionally applied fields, such as ecology, biology, chemistry, electrical engineering, and control theory through such a lens. Specifically, category theory has been used to draw connections among visual languages such as planar knot diagrams, Feynman diagrams, circuit diagrams, signal flow graphs, Petri nets, entity relationship diagrams, social networks, and flow charts. This research is building toward what John Baez has called “a foundation of applied mathematics” [Bae13].

The goal of the present paper is to show that open continuous time dynamical systems form an algebra over a certain (colored) operad, which we call the operad of wiring diagrams. It is a variant of the operad that appeared in [SR13]. That is, wiring diagrams provide a straightforward, diagrammatic language to understand how dynamical systems that describe processes can be built up from the systems that describe its sub-processes.

More precisely, we will define a symmetric monoidal category \mathbf{W} of black boxes and wiring diagrams. Its underlying operad \mathcal{OW} is a graphical language for building larger black boxes out of an interconnected set of smaller ones. We then define two \mathbf{W}-algebras, \mathcal{G} and \mathcal{L}, which encode open dynamical systems, i.e., differential equations of the form

(1) \quad \begin{cases} \dot{Q} = f^{\text{in}}(Q, \text{input}) \\ \text{output} = f^{\text{out}}(Q) \end{cases}

where Q represents an internal state vector, \dot{Q} = \frac{dQ}{dt} represents its time derivative, and input and output represent inputs to and outputs from the system. In \mathcal{G}, the functions f^{\text{in}} and f^{\text{out}} are smooth, whereas in the subalgebra \mathcal{L} \subseteq \mathcal{G}, they are moreover linear. The fact that \mathcal{G} and \mathcal{L} are \mathbf{W}-algebras captures the fact that these systems are closed under wiring diagram interconnection.

Our notion of interconnection is a generalization of that in Deville and Lerman [DL10], [DL15], [DL14]. Their version of interconnection produces a closed system from open ones, and can be understood in the present context as a morphism whose codomain is the closed box (see Definition 3.8). Graph fibrations between wiring diagrams form an important part of their formalism, though we do not discuss that aspect here.

This paper is the third in a series, following [SR13] and [Spi13], on using wiring diagrams to model interactions. The algebra we present here, that of open systems, is distinct from the algebras of relations and of propagators studied in earlier works. Beyond the dichotomy of discrete vs. continuous, these algebras are markedly different in structure. For one thing, the internal wires in [SR13] themselves carry state, whereas here, a wire should be thought of as instantaneously transmitting its contents from an output site to an input site. Another difference between our algebra and those of previous works is that the algebras here involve open systems in which, as in (1), the instantaneous change of state is a function of the current state and the input, whereas the output depends only on the current state (see Definition 4.2). The differences between these algebras is also reflected in a mild difference between the operad we use here and the one used in previous work.

1.1. Motivating example. The motivating example for the algebras in this paper comes from classical differential equations pedagogy; namely, systems of tanks containing salt water concentrations, with pipes carrying fluid among them. The systems of ODEs produced by such applications constitute a subset of those our language can address; they are linear systems with a certain form (see Example 5.7). To ground the discussion, we consider a specific example.

Example 1.1. Figure 1 below reimagines a problem from Boyce and DiPrima's canonical text [BD65, Figure 7.1.6] as a dynamical system over a wiring diagram.

Figure 1: A dynamical system diagram showing two tanks, X1 and X2, within a larger system Y. Tank X1 has an input from the outside world (Y^in_a) at 1 gal/min with 3 oz/gal salt concentration, and an input from the outside world (Y^in_b) at 1.5 gal/min with 1 oz/gal salt concentration. Tank X1 outputs to Tank X2 at 3 gal/min. Tank X2 outputs to the outside world (Y^out_a) at 2.5 gal/min. The diagram also shows a feedback loop from Tank X2 back to Tank X1 at 1.5 gal/min. The tanks are labeled with their respective salt concentrations and flow rates.

The diagram illustrates a dynamical system within a container labeled Y. Inside, there are two rectangular boxes representing tanks, X_1 and X_2.
- Inputs to X_1: From the left, two arrows enter X_1. The top arrow is labeled Y_a^{\text{in}} and has the text "1 gal/min" and "3 oz/gal" next to it. The bottom arrow is labeled Y_b^{\text{in}} and has "1.5 gal/min" and "1 oz/gal" next to it. These arrows are also labeled X_{1a}^{\text{in}} and X_{1b}^{\text{in}} respectively.
- Flow from X_1 to X_2: An arrow labeled X_{2a}^{\text{in}} and X_{1a}^{\text{out}} connects the right side of X_1 to the left side of X_2. It is labeled "3 gal/min".
- Flow from X_2 to X_1: An arrow labeled X_{1b}^{\text{in}} and X_{2b}^{\text{out}} connects the right side of X_2 back to the left side of X_1. It is labeled "1.5 gal/min".
- Output from X_2: An arrow labeled Y_a^{\text{out}} and X_{2b}^{\text{out}} exits the right side of X_2. It is labeled "2.5 gal/min".
- Internal Labels: Inside X_1, the text "Q_1(t) oz salt" and "30 gal water" is present. Inside X_2, the text "Q_2(t) oz salt" and "20 gal water" is present.

Figure 1: A dynamical system diagram showing two tanks, X1 and X2, within a larger system Y. Tank X1 has an input from the outside world (Y^in_a) at 1 gal/min with 3 oz/gal salt concentration, and an input from the outside world (Y^in_b) at 1.5 gal/min with 1 oz/gal salt concentration. Tank X1 outputs to Tank X2 at 3 gal/min. Tank X2 outputs to the outside world (Y^out_a) at 2.5 gal/min. The diagram also shows a feedback loop from Tank X2 back to Tank X1 at 1.5 gal/min. The tanks are labeled with their respective salt concentrations and flow rates.

FIGURE 1. A dynamical system from Boyce and DiPrima interpreted over a wiring diagram \Phi : X_1, X_2 \rightarrow Y in \mathcal{OW}.

In this diagram, X_1 and X_2 are boxes that represent tanks consisting of salt water solution. The functions Q_1(t) and Q_2(t) represent the amount of salt (in ounces) found in 30 and 20 gallons of water, respectively. These tanks are interconnected with each other by pipes embedded within a total system Y. The prescription for how wires are attached among the boxes is formally encoded in the wiring diagram \Phi : X_1, X_2 \rightarrow Y, as we will discuss in Definition 3.1.

Both tanks are being fed salt water concentrations at constant rates from the outside world. Specifically, X_1 is fed a 1 ounce salt per gallon water solution at 1.5 gallons per minute and X_2 is fed a 3 ounce salt per gallon water solution at 1 gallon per minute. The tanks also both feed each other their solutions, with X_1 feeding X_2 at 3 gallons per minute and X_2 feeding X_1 at 1.5 gallons per minute. Finally, X_2 feeds the outside world its solution at 2.5 gallons per minute.

The dynamics of the salt water concentrations both within and leaving each tank X_i is encoded in a linear open system f_i, consisting of a differential equation for Q_i and a readout map for each X_i output (see Definition 2.9). Our algebra \mathcal{L} allows one to assign a linear open system f_i to each tank X_i, and by functoriality the morphism \Phi: X_1, X_2 \rightarrow Y produces a linear open system for the larger box Y. We will explore this construction in detail, in particular providing explicit formulas for it in the linear case, as well as for more general systems of ODEs.

1.2. 2. PRELIMINARY NOTIONS

Throughout this paper we use the language of monoidal categories and functors. Depending on the audience, appropriate background on basic category theory can be found in MacLane [ML98], Awodey [Awo10], or Spivak [Spi14]. Leinster [Lei04] is a good source for more specific information on monoidal categories and operads. We refer the reader to [KFA69] for an introduction to dynamical systems.

Notation. We denote the category of sets and functions by Set and the full subcategory spanned by finite sets as FinSet. We generally do not concern ourselves with cardinality issues. We follow Leinster [Lei04] and use \times for binary product and \Pi for arbitrary product, and dually + for binary coproduct and \coprod for arbitrary coproduct in any category. By operad we always mean symmetric colored operad or, equivalently, symmetric multicategory.

2.1. Monoidal categories and operads. In Section 3, we will construct the symmetric monoidal category (\mathbf{W}, \oplus, 0) of boxes and wiring diagrams, which we often simply denote as W. We will sometimes consider the underlying operad \mathcal{OW}, obtained by applying the fully faithful functor

\mathcal{O}: \mathbf{SMC} \rightarrow \mathbf{Opd}

to W. A brief description of this functor \mathcal{O} is given below in Definition 2.1.

Definition 2.1. Let SMC denote the category of symmetric monoidal categories and lax monoidal functors; and Opd be the category of operads and operad functors. Given a symmetric monoidal category (\mathcal{C}, \otimes, I_{\mathcal{C}}) \in \mathbf{Ob} \mathbf{SMC}, we define the operad \mathcal{OC} as follows:

\mathbf{Ob} \mathcal{OC} := \mathbf{Ob} \mathcal{C}, \quad \mathbf{Hom}_{\mathcal{OC}}(X_1, \dots, X_n; Y) := \mathbf{Hom}_{\mathcal{C}}(X_1 \otimes \dots \otimes X_n, Y)

for any n \in \mathbb{N} and objects X_1, \dots, X_n, Y \in \mathbf{Ob} \mathcal{C}.

Now suppose F: (\mathcal{C}, \otimes, I_{\mathcal{C}}) \rightarrow (\mathcal{D}, \odot, I_{\mathcal{D}}) is a lax monoidal functor in SMC. By definition such a functor is equipped with a morphism

\mu: FX_1 \odot \dots \odot FX_n \rightarrow F(X_1 \otimes \dots \otimes X_n),

natural in the X_i, called the coherence map. With this map in hand, we define the operad functor \mathcal{OF}: \mathcal{OC} \rightarrow \mathcal{OD} by stating how it acts on objects X and morphisms \Phi: X_1, \dots, X_n \rightarrow Y in \mathcal{OC}:

\mathcal{OF}(X) := F(X), \quad \mathcal{OF}(\Phi: X_1, \dots, X_n \rightarrow Y) := F(\Phi) \circ \mu: FX_1 \odot \dots \odot FX_n \rightarrow FY.

Example 2.2. Consider the symmetric monoidal category (\mathbf{Set}, \times, \star), where \times is the cartesian product of sets and \star a one element set. Define Sets := \mathcal{OSet} as in Definition 2.1. Explicitly, Sets is the operad in which an object is a set and a morphism f: X_1, \dots, X_n \rightarrow Y is a function f: X_1 \times \dots \times X_n \rightarrow Y.

Definition 2.3. Let \mathcal{C} be a symmetric monoidal category and let \mathbf{Set} = (\mathbf{Set}, \times, \star) be as in Example 2.2. A \mathcal{C}-algebra is a lax monoidal functor \mathcal{C} \rightarrow \mathbf{Set}. Similarly, if \mathcal{D} is an operad, a \mathcal{D}-algebra is defined as an operad functor \mathcal{D} \rightarrow \mathbf{Sets}.

To avoid subscripts, we will generally use the formalism of SMCs in this paper. Definitions 2.1 and 2.3 can be applied throughout to recast everything we do in terms of operads. The primary reason operads may be preferable in applications is that they suggest more compelling pictures. Hence throughout this paper, depictions of wiring diagrams will often be operadic, i.e., have many input boxes wired together into one output box.

2.2. Typed sets. Each box in a wiring diagram will consist of finite sets of ports, each labelled by a type. To capture this idea precisely, we define the notion of typed finite sets. By a finite product category, we mean a category that is closed under taking finite products.

Definition 2.4. Let \mathcal{C} be a small finite product category. The category of \mathcal{C}-typed finite sets, denoted \mathbf{TFS}_{\mathcal{C}}, is defined as follows. An object in \mathbf{TFS}_{\mathcal{C}} is a map from a finite set to the objects of \mathcal{C}:

\mathbf{Ob} \mathbf{TFS}_{\mathcal{C}} := \{(A, \tau) \mid A \in \mathbf{Ob} \mathbf{FinSet}, \tau: A \rightarrow \mathbf{Ob} \mathcal{C}\}.

Intuitively, one can think of a typed finite set as a finite unordered list of \mathcal{C}-objects. For any element a \in A, we call the object \tau(a) its type. If the typing function \tau is clear from context, we may denote (A, \tau) simply by A.

A morphism q: (A, \tau) \rightarrow (A', \tau') in \mathbf{TFS}_{\mathcal{C}} consists of a function q: A \rightarrow A' that makes the following diagram of finite sets commute:

\begin{array}{ccc} A & \xrightarrow{q} & A' \\ \tau \searrow & & \swarrow \tau' \\ & \mathbf{Ob} \mathcal{C} & \end{array}

Note that \mathbf{TFS}_{\mathcal{C}} is a cocartesian monoidal category.

We refer to the morphisms of \mathbf{TFS}_{\mathcal{C}} as \mathcal{C}-typed functions. If a \mathcal{C}-typed function q is bijective, we call it a \mathcal{C}-typed bijection.

In other words, \mathbf{TFS}_{\mathcal{C}} is the comma category for the diagram

\mathbf{FinSet} \xrightarrow{i} \mathbf{Set} \xleftarrow{\mathbf{Ob} \mathcal{C}} \{*\}

where i is the inclusion.

Definition 2.5. Let \mathcal{C} be a finite product category, and let (A, \tau) \in \mathbf{Ob} \mathbf{TFS}_{\mathcal{C}} be a \mathcal{C}-typed finite set. Its dependent product \overline{(A, \tau)} \in \mathbf{Ob} \mathcal{C} is defined as

\overline{(A, \tau)} := \prod_{a \in A} \tau(a).

Coordinate projections and diagonals are generalized as follows. Given a typed function q: (A, \tau) \rightarrow (A', \tau') in \mathbf{TFS}_{\mathcal{C}} we define

\overline{q}: \overline{(A', \tau')} \rightarrow \overline{(A, \tau)}

to be the unique morphism for which the following diagram commutes for all a \in A:

\begin{array}{ccc} \prod_{a' \in A'} \tau'(a') & \xrightarrow{\bar{q}} & \prod_{a \in A} \tau(a) \\ \pi_{q(a)} \downarrow & & \downarrow \pi_a \\ \tau'(q(a)) & \xlongequal{\quad} & \tau(a) \end{array}

By the universal property for products, this defines a functor,

\bar{\cdot}: \mathbf{TFS}_{\mathcal{C}}^{\text{op}} \rightarrow \mathcal{C}.

Lemma 2.6. The dependent product functor \mathbf{TFS}_{\mathcal{C}}^{\text{op}} \rightarrow \mathcal{C} is strong monoidal. In particular, for any finite set I whose elements index typed finite sets (A_i, \tau_i), there is a canonical isomorphism in \mathcal{C},

\overline{\prod_{i \in I} (A_i, \tau_i)} \cong \prod_{i \in I} \overline{(A_i, \tau_i)}.

Remark 2.7. The category of second-countable smooth manifolds and smooth maps is essentially small (by the embedding theorem) so we choose a small representative and denote it Man. Note that Man is a finite product category. Manifolds will be our default typing, in the sense that we generally take \mathcal{C} := \mathbf{Man} in Definition 2.4 and denote

(2) \quad \mathbf{TFS} := \mathbf{TFS}_{\mathbf{Man}}.

We thus refer to the objects, morphisms, and isomorphisms in TFS simply as typed finite sets, typed functions, and typed bijections, respectively.

Remark 2.8. The ports of each box in a wiring diagram will be labeled by manifolds because they are the natural setting for geometrically interpreting differential equations (see [Spi65]). For simplicity, one may wish to restrict attention to the full subcategory Euc of Euclidean spaces \mathbb{R}^n for n \in \mathbb{N}, because they are the usual domains for ODEs found in the literature; or to the (non-full) subcategory Lin of Euclidean spaces and linear maps between them, because they characterize linear systems of ODEs. We will return to TFSLin in Section 5.

2.3. Open systems. As a final preliminary, we define our notion of open dynamical system. Recall that every manifold M has a tangent bundle manifold, denoted TM, and a smooth projection map p: TM \rightarrow M. For any point m \in M, the preimage T_m M := p^{-1}(m) has the structure of a vector space, called the tangent space of M at m. If M \cong \mathbb{R}^n is a Euclidean space then also T_m M \cong \mathbb{R}^n for every point m \in M. A vector field on M is a smooth map g: M \rightarrow TM such that p \circ g = \text{id}_M. See [Spi65] or [War83] for more background.

For the purposes of this paper we make the following definition of open systems; this may not be completely standard.

Definition 2.9. Let M, U^{\text{in}}, U^{\text{out}} \in \text{Ob } \mathbf{Man} be smooth manifolds and TM be the tangent bundle of M. Let f = (f^{\text{in}}, f^{\text{out}}) denote a pair of smooth maps

\begin{cases} f^{\text{in}}: M \times U^{\text{in}} \rightarrow TM \\ f^{\text{out}}: M \rightarrow U^{\text{out}} \end{cases}

where, for all (m, u) \in M \times U^{\text{in}} we have f^{\text{in}}(m, u) \in T_m M; that is, the following diagram commutes:

\begin{array}{ccc} M \times U^{\text{in}} & \xrightarrow{f^{\text{in}}} & TM \\ & \searrow \pi_M \quad \swarrow p & \\ & M & \end{array}

We sometimes use f to denote the whole tuple,

f = (M, U^{\text{in}}, U^{\text{out}}, f),

which we refer to as an open dynamical system (or open system for short). We call M the state space, U^{\text{in}} the input space, U^{\text{out}} the output space, f^{\text{in}} the differential equation, and f^{\text{out}} the readout map of the open system.

Note that the pair f = (f^{\text{in}}, f^{\text{out}}) is determined by a single smooth map

f: M \times U^{\text{in}} \rightarrow TM \times U^{\text{out}},

which, by a minor abuse of notation, we also denote by f.

In the special case that M, U^{\text{in}}, U^{\text{out}} \in \text{Ob } \mathbf{Lin} are Euclidean spaces and f is a linear map (or equivalently f^{\text{in}} and f^{\text{out}} are linear), we call f a linear open system.

Remark 2.10. Let M be a smooth manifold, and let U^{\text{in}} = U^{\text{out}} = \mathbb{R}^0 be trivial. Then an open system in the sense of Definition 2.9 is a smooth map f: M \rightarrow TM over M, in other words, a vector field on M. From the geometric point of view, vector fields are autonomous (i.e., closed!) dynamical systems; see [Tes12].

Remark 2.11. For an arbitrary manifold U^{\text{in}}, a map M \times U^{\text{in}} \rightarrow TM can be considered as a function U^{\text{in}} \rightarrow \mathbf{VF}(M), where \mathbf{VF}(M) is the set of vector fields on M. Hence, U^{\text{in}} controls the behavior of the system in the usual sense.

Remark 2.12. Given an open system f we can form a new open system by feeding the readout of f into the inputs of f. For example suppose the open system is of the form

\begin{cases} M \times A \times B \xrightarrow{F} TM \\ g = (g_A, g_B): M \rightarrow C \times B, \end{cases}

where A, B, C and M are manifolds. Define F': M \times A \rightarrow TM by

F'(m, a) := F(m, a, g_B(m)) \quad \text{for all } (m, a) \in M \times A.

Then

\begin{cases} M \times A \xrightarrow{F'} TM \\ g_A: M \rightarrow C \end{cases}

is a new open system obtained by plugging a readout of f into the space of inputs B. Compare with Figure 3.

This looks a little boring. It becomes more interesting when we start with several open systems, take their product and then plug (some of the) outputs into inputs. For example suppose we start with two open systems

\begin{cases} M_1 \times A \times B \xrightarrow{F_1} TM_1 \\ g_1: M_1 \rightarrow C \end{cases}

and

\begin{cases} M_2 \times C \xrightarrow{F_2} TM_2 \\ g_2 = (g_B, g_D): M_2 \rightarrow B \times D \end{cases}.

Here, again, all capital letters denote manifolds. Take their product; we get

\begin{cases} M_1 \times A \times B \times M_2 \times C \xrightarrow{(F_1, F_2)} TM_1 \times TM_2 \\ (g_1, g_2): M_1 \times M_2 \rightarrow C \times B \times D \end{cases}

Now plug in the functions g_B and g_1 into inputs. We get a new system

\begin{cases} M_1 \times M_2 \times A \xrightarrow{F'} TM_1 \times TM_2 \\ g': M_1 \times M_2 \rightarrow D \end{cases}

where

F'(m_1, m_2, a) := (F_1(m_1, a, g_B(m_2)), F_2(m_2, g_1(m_1))).

Compare with Figure 7. Making these kinds of operations on open systems precise for an arbitrary number of interacting systems is the point of our paper.

By defining the appropriate morphisms, we can consider open dynamical systems as being objects in a category. We are not aware of this notion being defined previously in the literature, but it is convenient for our purposes.

Definition 2.13. Suppose that M_i, U_i^{\text{in}}, U_i^{\text{out}} \in \text{Ob } \mathbf{Man} and (M_i, U_i^{\text{in}}, U_i^{\text{out}}, f_i) is an open system for i \in \{1, 2\}. A morphism of open systems

\zeta: (M_1, U_1^{\text{in}}, U_1^{\text{out}}, f_1) \rightarrow (M_2, U_2^{\text{in}}, U_2^{\text{out}}, f_2)

is a triple (\zeta_M, \zeta_{U^{\text{in}}}, \zeta_{U^{\text{out}}}) of smooth maps \zeta_M: M_1 \rightarrow M_2, \zeta_{U^{\text{in}}}: U_1^{\text{in}} \rightarrow U_2^{\text{in}}, and \zeta_{U^{\text{out}}}: U_1^{\text{out}} \rightarrow U_2^{\text{out}}, such that the following diagram commutes:

\begin{array}{ccc} M_1 \times U_1^{\text{in}} & \xrightarrow{f_1} & TM_1 \times U_1^{\text{out}} \\ \zeta_M \times \zeta_{U^{\text{in}}} \downarrow & & \downarrow T\zeta_M \times \zeta_{U^{\text{out}}} \\ M_2 \times U_2^{\text{in}} & \xrightarrow{f_2} & TM_2 \times U_2^{\text{out}} \end{array}

This defines the category ODS of open dynamical systems. We define the subcategory ODSLin \subseteq ODS by restricting our objects to linear open systems, as in Definition 2.9, and imposing that the three maps in \zeta are linear.

As in Remark 2.12, we will often want to combine two or more interconnected open systems into one larger one. As we shall see in Section 4, this will involve taking a product of the smaller open systems. Before we define this formally, we first remind the reader that the tangent space functor T is strong monoidal, i.e., it canonically preserves products,

T(M_1 \times M_2) \cong TM_1 \times TM_2.

Lemma 2.14. The category ODS of open systems has all finite products. That is, if I is a finite set and f_i = (M_i, U_i^{\text{in}}, U_i^{\text{out}}, f_i) \in \text{Ob } \mathbf{ODS} is an open system for each i \in I, then their product is

\prod_{i \in I} f_i = \left( \prod_{i \in I} M_i, \prod_{i \in I} U_i^{\text{in}}, \prod_{i \in I} U_i^{\text{out}}, \prod_{i \in I} f_i \right)

with the obvious projection maps.

1.3. 3. THE OPERAD OF WIRING DIAGRAMS

In this section, we define the symmetric monoidal category (\mathbf{W}, \oplus, 0) of wiring diagrams. We then use Definition 2.1 to define the wiring diagram operad \mathcal{OW}, which situates our pictorial setting. We begin by formally defining the underlying category \mathbf{W} and continue with some concrete examples to explicate this definition.

Definition 3.1. The category \mathbf{W} has objects boxes and morphisms wiring diagrams. A box X is an ordered pair of \mathbf{Man}-typed finite sets (Definition 2.4),

X = (X^{\text{in}}, X^{\text{out}}) \in \text{Ob } \mathbf{TFS} \times \text{Ob } \mathbf{TFS}.

Let X^{\text{in}} = (A, \tau) and X^{\text{out}} = (A', \tau'). Then we refer to elements a \in A and a' \in A' as input ports and output ports, respectively. We call \tau(a) \in \text{Ob } \mathbf{Man} the type of port a, and similarly for \tau'(a').

A wiring diagram \Phi: X \rightarrow Y in \mathbf{W} is a triple (X, Y, \varphi), where \varphi is a typed bijection (see Definition 2.4)

(3) \quad \varphi: X^{\text{in}} + Y^{\text{out}} \xrightarrow{\cong} X^{\text{out}} + Y^{\text{in}},

satisfying the following condition:

no passing wires: \varphi(Y^{\text{out}}) \cap Y^{\text{in}} = \emptyset, or equivalently \varphi(Y^{\text{out}}) \subseteq X^{\text{out}}.

This condition allows us to decompose \varphi into a pair \varphi = (\varphi^{\text{in}}, \varphi^{\text{out}}):

(4) \quad \begin{cases} \varphi^{\text{in}}: X^{\text{in}} \rightarrow X^{\text{out}} + Y^{\text{in}} \\ \varphi^{\text{out}}: Y^{\text{out}} \rightarrow X^{\text{out}} \end{cases}

We often identify the wiring diagram \Phi = (X, Y, \varphi) with the typed bijection \varphi, or equivalently its corresponding pair (\varphi^{\text{in}}, \varphi^{\text{out}}).

By a wire in \Phi, we mean a pair (a, b), where a \in X^{\text{in}} + Y^{\text{out}}, b \in X^{\text{out}} + Y^{\text{in}}, and \varphi(a) = b. In other words a wire in \Phi is a pair of ports connected by \phi.

The identity wiring diagram \iota: X \rightarrow X is given by the identity morphism X^{\text{in}} + X^{\text{out}} \rightarrow X^{\text{in}} + X^{\text{out}} in \mathbf{TFS}.

Now suppose \Phi = (X, Y, \varphi) and \Psi = (Y, Z, \psi) are wiring diagrams. We define their composition as \Psi \circ \Phi = (X, Z, \omega), where \omega = (\omega^{\text{in}}, \omega^{\text{out}}) is given by the pair of dashed arrows making the following diagrams commute.

(5) \quad \begin{array}{ccc} X^{\text{in}} & \xrightarrow{\omega^{\text{in}}} & X^{\text{out}} + Z^{\text{in}} \\ \downarrow \varphi^{\text{in}} & & \uparrow \nabla + \mathbb{I}_{Z^{\text{in}}} \\ & X^{\text{out}} + X^{\text{out}} + Z^{\text{in}} & \\ & \uparrow \mathbb{I}_{X^{\text{out}}} + \varphi^{\text{out}} + \mathbb{I}_{Z^{\text{in}}} & \\ X^{\text{out}} + Y^{\text{in}} & \xrightarrow{\mathbb{I}_{X^{\text{out}}} + \psi^{\text{in}}} & X^{\text{out}} + Y^{\text{out}} + Z^{\text{in}} \end{array} \quad \begin{array}{ccc} Z^{\text{out}} & \xrightarrow{\omega^{\text{out}}} & X^{\text{out}} \\ \searrow \psi^{\text{out}} & & \nearrow \varphi^{\text{out}} \\ & Y^{\text{out}} & \end{array}

Here \nabla: X^{\text{out}} + X^{\text{out}} \rightarrow X^{\text{out}} is the codiagonal map in \mathbf{TFS}.

Remark 3.2. For any finite product category \mathcal{C}, we may define the category \mathbf{W}_{\mathcal{C}} by replacing \mathbf{Man} with \mathcal{C}, and \mathbf{TFS} with \mathbf{TFS}_{\mathcal{C}}, in Definition 3.1. In particular, as in Remark 2.8, we have the symmetric monoidal category \mathbf{W}_{\text{Lin}} of linearly typed wiring diagrams.

What we are calling a box is nothing more than an interface; at this stage it has no semantics, e.g., in terms of differential equations. Each box can be given a pictorial representation, as in Example 3.3 below.

Example 3.3. As a convention, we depict a box X = (\{a, b\}, \{c\}) with input ports connecting on the left and output ports connecting on the right, as in Figure 2 below. When types are displayed, we label ports on the exterior of their box and their types adjacently on the interior of the box with a ‘:’ symbol in between to designate typing. Reading types off of this figure, we see that the type of input port a is the manifold \mathbb{R}, that of input port b is the circle S^1, and that of output port c is the torus T^2.

Diagram of a box X with two input ports on the left and one output port on the right. The left input ports are labeled 'a : R' and 'b : S^1' with arrows pointing into the box. The right output port is labeled 'T^2 : c' with an arrow pointing out of the box. The box is labeled 'X' in the center.
Diagram of a box X with two input ports on the left and one output port on the right. The left input ports are labeled 'a : R' and 'b : S^1' with arrows pointing into the box. The right output port is labeled 'T^2 : c' with an arrow pointing out of the box. The box is labeled 'X' in the center.

FIGURE 2. A box with two input ports, of types \mathbb{R} and S^1, and one output port with type T^2.

A morphism in \mathbf{W} is a wiring diagram \Phi = (X, Y, \varphi), the idea being that a smaller box X (the domain) is nested inside of a larger box Y (the codomain). The ports of X and Y are then interconnected by wires, as specified by the typed bijection \varphi. We will now see an example of a wiring diagram, accompanied by a picture.

Example 3.4. Reading off the wiring diagram \Phi = (X, Y, \varphi) drawn below in Figure 3, we have the following data for boxes:

\begin{array}{ll} X^{\text{in}} = \{a, b\} & X^{\text{out}} = \{c, d\} \\ Y^{\text{in}} = \{m\} & Y^{\text{out}} = \{n\} \end{array}

Table 1 makes \varphi explicit via a list of its wires, i.e., pairs (\gamma, \varphi(\gamma)).

\begin{array}{c|c|c|c} \gamma \in X^{\text{in}} + Y^{\text{out}} & a & b & n \\ \hline \varphi(\gamma) \in X^{\text{out}} + Y^{\text{in}} & m & d & c \end{array}

TABLE 1

Remark 3.5. The condition that \varphi be typed, as in Definition 2.4, ensures that if two ports are connected by a wire then the associated types are the same. In particular, in Example 3.4 above, (a, b, n) must be the same type tuple as (m, d, c).

Now that we have made wiring diagrams concrete and visual, we can do the same for their composition.

Example 3.6. In Figure 4, we visualize the composition of two wiring diagrams \Phi = (X, Y, \varphi) and \Psi = (Y, Z, \psi) to form \Psi \circ \Phi = (X, Z, \omega). Composition is depicted by drawing the wiring diagram for \Psi and then, inside of the Y box, drawing in the wiring diagram for \Phi. Finally, to depict the composition \Psi \circ \Phi as one single wiring diagram, one simply “erases” the Y box, leaving the X and Z boxes interconnected among themselves. Figure 4 represents such a procedure by depicting the Y box with a dashed arrow.

Figure 3: A Wiring Diagram \Phi = (X, Y, \varphi). The diagram shows a large rectangle labeled Y containing a smaller rectangle labeled X. On the left side of Y, there is an input wire labeled m entering from the left. This wire splits into two paths: one goes straight into the top-left port of X labeled a, and the other goes down and then right into the bottom-left port of X labeled b. On the right side of Y, there is an output wire labeled n exiting to the right. This wire is formed by two paths: one comes from the top-right port of X labeled c, and the other comes from the bottom-right port of X labeled d. A curved wire also connects the bottom-left port of X (b) to the bottom-right port of X (d).
Figure 3: A Wiring Diagram \Phi = (X, Y, \varphi). The diagram shows a large rectangle labeled Y containing a smaller rectangle labeled X. On the left side of Y, there is an input wire labeled m entering from the left. This wire splits into two paths: one goes straight into the top-left port of X labeled a, and the other goes down and then right into the bottom-left port of X labeled b. On the right side of Y, there is an output wire labeled n exiting to the right. This wire is formed by two paths: one comes from the top-right port of X labeled c, and the other comes from the bottom-right port of X labeled d. A curved wire also connects the bottom-left port of X (b) to the bottom-right port of X (d).
FIGURE 3. A Wiring Diagram \Phi = (X, Y, \varphi).

It’s important to note that the wires also connect, e.g. if a wire in \Psi connects a Z port to some Y port, and that Y port attaches via a \Phi wire to some X port, then these wires “link together” to a total wire in \Psi \circ \Phi, connecting a Z port with an X port. Table 2 below traces the wires of \Psi \circ \Phi through the \omega^{\text{in}} and \omega^{\text{out}} composition diagrams in (5) on its left and right side, respectively. The left portion of the table starts with \gamma \in X^{\text{in}} and ends at \omega^{\text{in}}(\gamma) \in X^{\text{out}} + Z^{\text{in}}, with intermediary steps of the composition denoted with superscripts \gamma^n. The right portion of the table starts with \gamma \in Z^{\text{out}} then goes through the intermediary of \gamma' \in Y^{\text{out}} and finally reaches \omega^{\text{out}}(\gamma) \in Z^{\text{out}}. We skip lines on the right portion to match the spacing on the left.

\gamma \in X^{\text{in}}abcv\gamma \in Z^{\text{out}}
\gamma^1 \in X^{\text{out}} + Y^{\text{in}}dkl
\gamma^2 \in X^{\text{out}} + Y^{\text{out}} + Z^{\text{in}}dunm\gamma' \in Y^{\text{out}}
\gamma^3 \in X^{\text{out}} + X^{\text{out}} + Z^{\text{in}}duf
\omega^{\text{in}}(\gamma) \in X^{\text{out}} + Z^{\text{in}}dufe\omega^{\text{out}}(\gamma) \in X^{\text{out}}

TABLE 2

Remark 3.7. The condition that \varphi be both injective and surjective prohibits exposed ports and split ports, respectively, as depicted in Figure 5a. The no passing wires condition on \varphi(Y^{\text{out}}) prohibits wires that go straight across the Y box, as seen in the intermediate box of Figure 5b.

Now that we have formally defined and concretely explicated the category \mathbf{W}, we will make it into a monoidal category by defining its tensor product.

Definition 3.8. Let X_1, X_2, Y_1, Y_2 \in \text{Ob } \mathbf{W} be boxes and \Phi_1: X_1 \rightarrow Y_2 and \Phi_2: X_2 \rightarrow Y_2 be wiring diagrams. The monoidal product \oplus is given by

X_1 \oplus X_2 := (X_1^{\text{in}} + X_2^{\text{in}}, X_1^{\text{out}} + X_2^{\text{out}}), \quad \Phi_1 \oplus \Phi_2 := \Phi_1 + \Phi_2.

The closed box 0 = \{\emptyset, \emptyset\} is the monoidal unit.

Figure 4: A wiring diagram composition. A large box labeled Z contains a dashed box labeled Y. Inside Y is a box labeled X. Wires enter Z from the left at point u, split into two paths: one passing through point k to enter X at point a, and another passing through point l to enter X at point c. Wires exit X at points d and f, pass through points m1 and n1 respectively, and exit Z at point v on the right. A curved wire connects the bottom of X back to the bottom of Z.
Figure 4: A wiring diagram composition. A large box labeled Z contains a dashed box labeled Y. Inside Y is a box labeled X. Wires enter Z from the left at point u, split into two paths: one passing through point k to enter X at point a, and another passing through point l to enter X at point c. Wires exit X at points d and f, pass through points m1 and n1 respectively, and exit Z at point v on the right. A curved wire connects the bottom of X back to the bottom of Z.

FIGURE 4. A wiring diagram composition \Psi \circ \Phi = (X, Z, \omega) of \Phi = (X, Y, \varphi) and \Psi = (Y, Z, \psi), with dashed medium box Y.

Figure 5: (a) A faux-wiring diagram violating the bijectivity condition. A box labeled Y contains a box labeled X. Two input wires enter Y from the left, and two output wires exit Y to the right. The wires do not match the ports of X. (b) A composition of diagrams where a loop emerges. A box labeled Z contains a dashed box labeled Y, which contains a box labeled X. A wire enters Z, passes through Y, and loops back to enter X, illustrating a prohibited passing wire.
Figure 5: (a) A faux-wiring diagram violating the bijectivity condition. A box labeled Y contains a box labeled X. Two input wires enter Y from the left, and two output wires exit Y to the right. The wires do not match the ports of X. (b) A composition of diagrams where a loop emerges. A box labeled Z contains a dashed box labeled Y, which contains a box labeled X. A wire enters Z, passes through Y, and loops back to enter X, illustrating a prohibited passing wire.

FIGURE 5. (a) A faux-wiring diagram violating the bijectivity condition in Definition 3.1.

(b) A composition of diagrams in which a loop emerges because the inner diagram has a (prohibited) passing wire.

Remark 3.9. Once we add semantics in Section 4, closed boxes will correspond to autonomous systems, which do not interact with any outside environment (see Remark 2.10).

We now make this monoidal product explicit with an example.

Example 3.10. Consider boxes X = (\{x_1, x_2\}, \{x_3, x_4\}) and Y = (\{y_1\}, \{y_2, y_3\}) depicted below.

Diagram showing two boxes. Box X has two input ports on the left labeled x1 and x2, and two output ports on the right labeled x3 and x4. Box Y has one input port on the left labeled y1, and two output ports on the right labeled y2 and y3.
Diagram showing two boxes. Box X has two input ports on the left labeled x1 and x2, and two output ports on the right labeled x3 and x4. Box Y has one input port on the left labeled y1, and two output ports on the right labeled y2 and y3.

We depict their tensor X \oplus Y = (\{x_1, x_2, y_1\}, \{x_3, x_4, y_2, y_3\}) by stacking boxes.

A wiring diagram representing the direct sum X ⊕ Y. It is a rectangle with three input ports on the left labeled x1, x2, and y1, and three output ports on the right labeled x3, x4, and y3. The top half of the rectangle is labeled X ⊕ Y.
A wiring diagram representing the direct sum X ⊕ Y. It is a rectangle with three input ports on the left labeled x1, x2, and y1, and three output ports on the right labeled x3, x4, and y3. The top half of the rectangle is labeled X ⊕ Y.

Similarly, consider the following wiring diagrams (with ports left unlabelled).

Two wiring diagrams side-by-side. The left diagram, labeled Φ1: X1 → Y1, shows a box with a smaller box X1 inside. X1 has two inputs and two outputs. The outer box Y1 has two inputs and two outputs. The right diagram, labeled Φ2: X2 → Y2, shows a box with a smaller box X2 inside. X2 has two inputs and two outputs. The outer box Y2 has two inputs and two outputs.
Two wiring diagrams side-by-side. The left diagram, labeled Φ1: X1 → Y1, shows a box with a smaller box X1 inside. X1 has two inputs and two outputs. The outer box Y1 has two inputs and two outputs. The right diagram, labeled Φ2: X2 → Y2, shows a box with a smaller box X2 inside. X2 has two inputs and two outputs. The outer box Y2 has two inputs and two outputs.

We can depict their composition via stacking.

A stacked wiring diagram representing the composition Φ1 ∘ Φ2: X1 ⊕ X2 → Y1 ⊕ Y2. It consists of two boxes stacked vertically. The top box is labeled Y1 ⊕ Y2 and contains a smaller box labeled X1 ⊕ X2. The bottom box is labeled X1 ⊕ X2 and contains a smaller box labeled Y1 ⊕ Y2. The overall diagram has four inputs on the left and four outputs on the right.
A stacked wiring diagram representing the composition Φ1 ∘ Φ2: X1 ⊕ X2 → Y1 ⊕ Y2. It consists of two boxes stacked vertically. The top box is labeled Y1 ⊕ Y2 and contains a smaller box labeled X1 ⊕ X2. The bottom box is labeled X1 ⊕ X2 and contains a smaller box labeled Y1 ⊕ Y2. The overall diagram has four inputs on the left and four outputs on the right.

We now prove that the above data characterizing (\mathbf{W}, \oplus, 0) indeed constitutes a symmetric monoidal category, at which point we can, as advertised, invoke Definition 2.1 to define the operad \mathcal{OW}.

Proposition 3.11. The category \mathbf{W} in Definition 3.1 and the monoidal product \oplus with unit 0 in Definition 3.8 form a symmetric monoidal category (\mathbf{W}, \oplus, 0).

Proof. We begin by establishing that \mathbf{W} is indeed a category. We first show that our class of wiring diagrams is closed under composition. Let \Phi = (X, Y, \varphi), \Psi = (Y, Z, \psi), and \Psi \circ \Phi = (X, Z, \omega).

To show that \omega is a typed bijection, we replace the pair of maps (\varphi^{\text{in}}, \varphi^{\text{out}}) with a pair of bijections (\widetilde{\varphi}^{\text{in}}, \widetilde{\varphi}^{\text{out}}) as follows. Let X_{\varphi}^{\text{exp}} \subseteq X^{\text{out}} (for exports) denote the image of \varphi^{\text{out}}, and X_{\varphi}^{\text{loc}} (for local ports) be its complement. Then we can identify \varphi with the following pair of typed bijections

\begin{cases} \widetilde{\varphi}^{\text{in}} : X^{\text{in}} \xrightarrow{\cong} X_{\varphi}^{\text{loc}} + Y^{\text{in}} \\ \widetilde{\varphi}^{\text{out}} : Y^{\text{out}} \xrightarrow{\cong} X_{\varphi}^{\text{exp}} \end{cases}

Similarly, identify \psi with (\widetilde{\psi}^{\text{in}}, \widetilde{\psi}^{\text{out}}). We can then rewrite the diagram defining \omega in (5) as one single commutative diagram of typed finite sets.

\begin{array}{ccc} X^{\text{in}} + Z^{\text{out}} & \xrightarrow{\quad \omega \quad} & X^{\text{out}} + Z^{\text{in}} \\ \downarrow \widetilde{\varphi}^{\text{in}} + \widetilde{\psi}^{\text{out}} & & \uparrow \cong \\ X_{\varphi}^{\text{loc}} + Y^{\text{in}} + Y_{\psi}^{\text{exp}} & & X_{\varphi}^{\text{loc}} + X_{\varphi}^{\text{exp}} + Z^{\text{in}} \\ \downarrow \mathbb{1}_{X_{\varphi}^{\text{loc}}} + \widetilde{\psi}^{\text{in}} + \mathbb{1}_{Y_{\psi}^{\text{exp}}} & & \uparrow \mathbb{1}_{X_{\varphi}^{\text{loc}}} + \widetilde{\varphi}^{\text{out}} + \mathbb{1}_{Z^{\text{in}}} \\ X_{\varphi}^{\text{loc}} + Y_{\psi}^{\text{loc}} + Z^{\text{in}} + Y_{\psi}^{\text{exp}} & \xrightarrow{\quad \cong \quad} & X_{\varphi}^{\text{loc}} + Y^{\text{out}} + Z^{\text{in}} \end{array}

As a composition of typed bijections, \omega is also a typed bijection.

The following computation proves that \omega has no passing wires:

\omega(Z^{\text{out}}) = \varphi(\psi(Z^{\text{out}})) \subseteq \varphi(Y^{\text{out}}) \subseteq X^{\text{out}}.

Therefore \mathbf{W} is closed under wiring diagram composition. To show that \mathbf{W} is a category, it remains to prove that composition of wiring diagrams satisfies the unit and associativity axioms. The former is straightforward and will be omitted. We now establish the latter.

Consider the wiring diagrams \Theta = (V, X, \theta), \Phi = (X, Y, \varphi), \Psi = (Y, Z, \psi); and let (\Psi \circ \Phi) \circ \Theta = (V, Z, \kappa) and \Psi \circ (\Phi \circ \Theta) = (V, Z, \lambda). We readily see that \kappa^{\text{out}} = \lambda^{\text{out}} by the associativity of composition in TFS. Proving that \kappa^{\text{in}} = \lambda^{\text{in}} is equivalent to establishing the commutativity of the following diagram:

(6)

\begin{array}{ccccc} & & V^{\text{out}} + Z^{\text{in}} & & \\ & & \uparrow \nabla + \mathbb{1} & & \\ & & V^{\text{out}} + V^{\text{out}} + Z^{\text{in}} & & \\ & & \uparrow \mathbb{1} + \theta^{\text{out}} + \mathbb{1} & & \\ V^{\text{out}} + Y^{\text{out}} + Z^{\text{in}} & \xrightarrow{\mathbb{1} + \varphi^{\text{out}} + \mathbb{1}} & V^{\text{out}} + X^{\text{out}} + Z^{\text{in}} & \xleftarrow{\mathbb{1} + \nabla + \mathbb{1}} & V^{\text{out}} + X^{\text{out}} + X^{\text{out}} + Z^{\text{in}} \\ \uparrow \mathbb{1} + \psi^{\text{in}} & & & & \uparrow \mathbb{1} + \mathbb{1} + \varphi^{\text{out}} + \mathbb{1} \\ V^{\text{out}} + Y^{\text{in}} & & & & \\ \uparrow \nabla + \mathbb{1} & & & & \\ V^{\text{out}} + V^{\text{out}} + Y^{\text{in}} & \xleftarrow{\mathbb{1} + \theta^{\text{out}} + \mathbb{1}} & V^{\text{out}} + X^{\text{out}} + Y^{\text{in}} & \xrightarrow{\mathbb{1} + \mathbb{1} + \psi^{\text{in}}} & V^{\text{out}} + X^{\text{out}} + Y^{\text{out}} + Z^{\text{in}} \\ & & \uparrow \mathbb{1} + \varphi^{\text{in}} & & \\ & & V^{\text{out}} + X^{\text{in}} & & \\ & & \uparrow \theta^{\text{in}} & & \\ & & V^{\text{in}} & & \end{array}

This diagram commutes in any category with coproducts, as follows from the associativity and naturality of the codiagonal map. We present a formal argument of this fact below in the language of string diagrams (See [JS91]). As in [Sel11], we let squares with blackened corners denote generic morphisms. We let triangles denote codiagonal maps. See Figure 6 below.

Figure 6: String diagram proof of commutativity of (6). The diagram consists of four horizontal rows of string diagrams, each representing a different way to compose morphisms. The top row shows a sequence of morphisms: X^out, theta^out, Y^out, phi^out, X^out, theta^out, V^out, and Z^in. The second row shows a different arrangement: X^out, theta^out, Y^out, phi^out, X^out, theta^out, V^out, and Z^in. The third row shows a third arrangement: X^out, theta^out, Y^out, phi^out, X^out, theta^out, V^out, and Z^in. The bottom row shows a fourth arrangement: X^out, theta^out, Y^out, phi^out, X^out, theta^out, V^out, and Z^in. The diagrams are connected by arrows, indicating the flow of the proof.
Figure 6: String diagram proof of commutativity of (6). The diagram consists of four horizontal rows of string diagrams, each representing a different way to compose morphisms. The top row shows a sequence of morphisms: X^out, theta^out, Y^out, phi^out, X^out, theta^out, V^out, and Z^in. The second row shows a different arrangement: X^out, theta^out, Y^out, phi^out, X^out, theta^out, V^out, and Z^in. The third row shows a third arrangement: X^out, theta^out, Y^out, phi^out, X^out, theta^out, V^out, and Z^in. The bottom row shows a fourth arrangement: X^out, theta^out, Y^out, phi^out, X^out, theta^out, V^out, and Z^in. The diagrams are connected by arrows, indicating the flow of the proof.

FIGURE 6. String diagram proof of commutativity of (6)

The first step of the proof follows from the topological nature of string diagrams, which mirror the axioms of monoidal categories. The second step invokes the associativity of codiagonal maps. The third and final step follows from the naturality of codiagonal maps, i.e., the commutativity of the following diagram.

\begin{array}{ccc} V^{\text{out}} + V^{\text{out}} & \xrightarrow{\nabla} & V^{\text{out}} \\ \theta^{\text{out}} + \theta^{\text{out}} \downarrow & & \downarrow \theta^{\text{out}} \\ X^{\text{out}} + X^{\text{out}} & \xrightarrow{\nabla} & X^{\text{out}} \end{array}

Now that we have shown that \mathbf{W} is a category, we show that (\oplus, 0) is a monoidal structure on \mathbf{W}. Let X, X', X'' \in \text{Ob } \mathbf{W} be boxes. We readily observe the following canonical isomorphisms.

\begin{aligned} X \oplus 0 &= X = 0 \oplus X && (\text{unity}) \\ (X \oplus X') \oplus X'' &= X \oplus (X' \oplus X'') && (\text{associativity}) \\ X \oplus X' &= X' \oplus X && (\text{commutativity}) \end{aligned}

Hence the monoidal product \oplus is well behaved on objects. It is similarly easy, and hence will be omitted, to show that \oplus is functorial. This completes the proof that (\mathbf{W}, \oplus, 0) is a symmetric monoidal category. \square

Having established that (\mathbf{W}, \oplus, 0) is an SMC, we can now speak about the operad \mathcal{OW} of wiring diagrams. In particular, we can draw operadic pictures, such as the one in our motivating example in Figure 1, to which we now return.

Example 3.12. Figure 7 depicts an \mathcal{OW} wiring diagram \Phi: X_1, X_2 \rightarrow Y, which we may formally denote by the tuple \Phi = (X_1, X_2; Y; \varphi). Reading directly from Figure 7, we have the boxes:

\begin{aligned} X_1 &= (\{X_{1a}^{\text{in}}, X_{1b}^{\text{in}}\}, \{X_{1a}^{\text{out}}\}) \\ X_2 &= (\{X_{2a}^{\text{in}}, X_{2b}^{\text{in}}\}, \{X_{2a}^{\text{out}}, X_{2b}^{\text{out}}\}) \\ Y &= (\{Y_a^{\text{in}}, Y_b^{\text{in}}\}, \{Y_a^{\text{out}}\}) \end{aligned}

The wiring diagram \Phi is visualized by nesting the domain boxes X_1, X_2 within the codomain box Y, and drawing the wires prescribed by \varphi, as recorded below in Table 3.

\frac{w \in X^{\text{in}} + Y^{\text{out}}}{\varphi(w) \in X^{\text{out}} + Y^{\text{in}}} \left\| \begin{array}{c|c|c|c|c} X_{1a}^{\text{in}} & X_{1b}^{\text{in}} & X_{2a}^{\text{in}} & X_{2b}^{\text{in}} & Y_a^{\text{out}} \\ \hline Y_b^{\text{in}} & X_{2b}^{\text{out}} & Y_a^{\text{in}} & X_{1a}^{\text{out}} & X_{2a}^{\text{out}} \end{array} \right\|

TABLE 3

Figure 7: A wiring diagram Φ: X1, X2 → Y in OW. The diagram shows a large box Y containing two smaller boxes X1 and X2. X1 has two input wires (X1a^in, X1b^in) and one output wire (X1a^out). X2 has two input wires (X2a^in, X2b^in) and two output wires (X2a^out, X2b^out). Y has two input wires (Ya^in, Yb^in) and one output wire (Ya^out). Wires connect Ya^in to X1a^in, Yb^in to X1b^in, X1a^out to X2a^in, X1a^out to X2b^in, X2a^out to Ya^out, and X2b^out to X2a^in.
Figure 7: A wiring diagram Φ: X1, X2 → Y in OW. The diagram shows a large box Y containing two smaller boxes X1 and X2. X1 has two input wires (X1a^in, X1b^in) and one output wire (X1a^out). X2 has two input wires (X2a^in, X2b^in) and two output wires (X2a^out, X2b^out). Y has two input wires (Ya^in, Yb^in) and one output wire (Ya^out). Wires connect Ya^in to X1a^in, Yb^in to X1b^in, X1a^out to X2a^in, X1a^out to X2b^in, X2a^out to Ya^out, and X2b^out to X2a^in.
FIGURE 7. A wiring diagram \Phi: X_1, X_2 \rightarrow Y in \mathcal{OW}.

To reconceptualize \Phi: X_1, X_2 \rightarrow Y as a wiring diagram in \mathbf{W}, we simply consider the tensor \Phi: X_1 \oplus X_2 \rightarrow Y, as given in Figure 8 below. This demonstrates the fact that operadic pictures are easier to read and hence are more illuminating.

Figure 8: A wiring diagram in W. A large rectangle labeled Y contains a smaller rectangle labeled X1 ⊕ X2. On the left side of Y, there are two input wires labeled Yin_a and Yin_b. On the right side of Y, there are two output wires labeled Yout_a and Yout_b. Inside the X1 ⊕ X2 box, there are four intermediate wires: Xin_1a, Xin_1b, Xin_2a, and Xin_2b. Wires connect Yin_a to Xin_1a and Xin_1b, and Yin_b to Xin_2a and Xin_2b. From Xin_1a and Xin_1b, two curved wires loop around the right side of the X1 ⊕ X2 box to connect to Yout_a. From Xin_2a and Xin_2b, two curved wires loop around the right side of the X1 ⊕ X2 box to connect to Yout_b.
Figure 8: A wiring diagram in W. A large rectangle labeled Y contains a smaller rectangle labeled X1 ⊕ X2. On the left side of Y, there are two input wires labeled Yin_a and Yin_b. On the right side of Y, there are two output wires labeled Yout_a and Yout_b. Inside the X1 ⊕ X2 box, there are four intermediate wires: Xin_1a, Xin_1b, Xin_2a, and Xin_2b. Wires connect Yin_a to Xin_1a and Xin_1b, and Yin_b to Xin_2a and Xin_2b. From Xin_1a and Xin_1b, two curved wires loop around the right side of the X1 ⊕ X2 box to connect to Yout_a. From Xin_2a and Xin_2b, two curved wires loop around the right side of the X1 ⊕ X2 box to connect to Yout_b.

FIGURE 8. A wiring diagram \Phi: X_1 \oplus X_2 \rightarrow Y in \mathbf{W} corresponding to the \mathbf{CW} wiring diagram \Phi: X_1, X_2 \rightarrow Y of Figure 7.

The following remark explains that our pictures of wiring diagrams are not completely ad hoc—they are depictions of 1-dimensional oriented manifolds with boundary. The boxes in our diagrams simply tie together the positively and negatively oriented components of an individual oriented 0-manifold.

Remark 3.13. For any set S, let 1\text{-Cob}/S denote the symmetric monoidal category of oriented 0-manifolds over S and the 1-dimensional cobordisms between them. We call its objects oriented S-typed 0-manifolds. Recall that \mathbf{W} = \mathbf{W}_{\mathbf{Man}} is our category of Man-typed wiring diagrams; let \mathbf{M} := \text{Ob } \mathbf{Man} denote the set of manifolds (see Remark 2.7). There is a faithful, essentially surjective, strong monoidal functor

\mathbf{W} \rightarrow 1\text{-Cob}/\mathbf{M},

sending a box (X^{\text{in}}, X^{\text{out}}) to the oriented \mathbf{M}-typed 0-manifold X^{\text{in}} + X^{\text{out}} where X^{\text{in}} is oriented positively and X^{\text{out}} negatively. Under this functor, a wiring diagram \Phi = (X, Y, \varphi) is sent to a 1-dimensional cobordism that has no closed loops. A connected component of such a cobordism can be identified with either its left or right endpoint, which correspond to the domain or codomain of the bijection \varphi: X^{\text{in}} + Y^{\text{out}} \xrightarrow{\cong} X^{\text{out}} + Y^{\text{in}}. See [SSR15].

In fact, with the no passing wires condition on morphisms (cobordisms) X \rightarrow Y (see Definition 3.1), the subcategory \mathbf{W} \subseteq 1\text{-Cob}/\mathbf{M} is the left class of an orthogonal factorization system. See [Aba15].

Let \Phi = (X, Y, \varphi) be a wiring diagram. Applying the dependent product functor (see Definition 2.5) to \varphi, we obtain a diffeomorphism of manifolds

(7) \quad \overline{\varphi}: \overline{X^{\text{out}}} \times \overline{Y^{\text{in}}} \rightarrow \overline{X^{\text{in}}} \times \overline{Y^{\text{out}}}.

Equivalently, if \varphi is represented by the pair (\varphi^{\text{in}}, \varphi^{\text{out}}), as in Definition 3.1, we can express \overline{\varphi} in terms of its pair of component maps:

\begin{cases} \overline{\varphi^{\text{in}}}: \overline{X^{\text{out}}} \times \overline{Y^{\text{in}}} \rightarrow \overline{X^{\text{in}}} \\ \overline{\varphi^{\text{out}}}: \overline{X^{\text{out}}} \rightarrow \overline{Y^{\text{out}}} \end{cases}

It will also be useful to apply the dependent product functor to the commutative diagrams in (5), which define wiring diagram composition. Note that, by the contravariance of the dependent product, the codiagonal \nabla: X^{\text{out}} + X^{\text{out}} \rightarrow X^{\text{out}} gets sent to the diagonal map \Delta: \overline{X^{\text{out}}} \rightarrow \overline{X^{\text{out}}} \times \overline{X^{\text{out}}}. Thus we have the following commutative diagrams:

(8) \quad \begin{array}{ccc} \overline{X^{\text{out}}} \times \overline{Z^{\text{in}}} & \xrightarrow{\overline{\omega^{\text{in}}}} & \overline{X^{\text{in}}} \\ \Delta \times \mathbb{I} \downarrow & & \uparrow \varphi^{\text{in}} \\ \overline{X^{\text{out}}} \times \overline{X^{\text{out}}} \times \overline{Z^{\text{in}}} & & \\ \mathbb{I} \times \overline{\varphi^{\text{out}}} \times \mathbb{I} \downarrow & & \\ \overline{X^{\text{out}}} \times \overline{Y^{\text{out}}} \times \overline{Z^{\text{in}}} & \xrightarrow{\mathbb{I} \times \overline{\psi^{\text{in}}}} & \overline{X^{\text{out}}} \times \overline{Y^{\text{in}}} \end{array} \quad \begin{array}{ccc} \overline{X^{\text{out}}} & \xrightarrow{\overline{\omega^{\text{out}}}} & \overline{Z^{\text{out}}} \\ \searrow \varphi^{\text{out}} & & \nearrow \psi^{\text{out}} \\ & Y^{\text{out}} & \end{array}

1.4. 4. THE ALGEBRA OF OPEN SYSTEMS

In this section we define an algebra \mathcal{G}: (\mathbf{W}, \oplus, 0) \rightarrow (\mathbf{Set}, \times, \star) (see Definition 2.3) of general open dynamical systems. A \mathbf{W}-algebra can be thought of as a choice of semantics for the syntax of \mathbf{W}, i.e., a set of possible meanings for boxes and wiring diagrams. As in Definition 2.1, we may use this to construct the corresponding operad algebra \mathcal{OG}: \mathcal{OW} \rightarrow \mathbf{Sets}. Before we define \mathcal{G}, we revisit Example 1.1 for inspiration.

Example 4.1. As the textbook exercise [BD65, Problem 7.21] prompts, let's begin by writing down the system of equations that governs the amount of salt Q_i within the tanks X_i. This can be done by using dimensional analysis for each port of X_i to find the rate of salt being carried in ounces per minute, and then equating the rate \dot{Q}_i to the sum across these rates for X_i^{\text{in}} ports minus X_i^{\text{out}} ports.

\begin{aligned} \dot{Q}_1 \frac{\text{oz}}{\text{min}} &= - \left( \frac{Q_1 \text{oz}}{30 \text{gal}} \cdot \frac{3 \text{gal}}{\text{min}} \right) + \left( \frac{Q_2 \text{oz}}{20 \text{gal}} \cdot \frac{1.5 \text{gal}}{\text{min}} \right) + \left( \frac{1 \text{oz}}{\text{gal}} \cdot \frac{1.5 \text{gal}}{\text{min}} \right) \\ \dot{Q}_2 \frac{\text{oz}}{\text{min}} &= - \left( \frac{Q_2 \text{oz}}{20 \text{gal}} \cdot \frac{(1.5 + 2.5) \text{gal}}{\text{min}} \right) + \left( \frac{Q_1 \text{oz}}{30 \text{gal}} \cdot \frac{3 \text{gal}}{\text{min}} \right) + \left( \frac{3 \text{oz}}{\text{gal}} \cdot \frac{1 \text{gal}}{\text{min}} \right) \end{aligned}

Dropping the physical units, we are left with the following system of ODEs:

(9) \quad \begin{cases} \dot{Q}_1 = -.1Q_1 + .075Q_2 + 1.5 \\ \dot{Q}_2 = .1Q_1 - .2Q_2 + 3 \end{cases}

The derivations for the equations in (9) involved a hidden step in which the connection pattern in Figure 1, or equivalently Figure 7, was used. Our wiring diagram approach explains this step and makes it explicit. Each box in a wiring diagram should only “know” about its own inputs and outputs, and not how they are connected to others. That is, we can only define a system on X_i by expressing Q_i just in terms of Q_i and X_i^{\text{in}}—this is precisely the data of an open system (see Definition 2.9). We now define our algebra \mathcal{G}, which assigns a set of open systems to a box. Given a wiring diagram and an open system on its domain box, it also gives a functorial procedure for assigning an open system to the codomain box. We will then use this new machinery to further revisit Example 4.1 in Example 5.7.

Definition 4.2. We define \mathcal{G} : (\mathbf{W}, \oplus, 0) \rightarrow (\mathbf{Set}, \times, \star) as follows. Let X \in \mathbf{Ob} \mathbf{W}. The set of open systems on X, denoted \mathcal{G}(X), is defined as

\mathcal{G}(X) = \{(S, f) \mid S \in \mathbf{Ob} \mathbf{TFS}, (\overline{S}, \overline{X}^{\text{in}}, \overline{X}^{\text{out}}, f) \in \mathbf{Ob} \mathbf{ODS}\}.

We call S the set of state variables and its dependent product \overline{S} the state space.

Let \Phi = (X, Y, \varphi) be a wiring diagram. Then \mathcal{G}(\Phi) : \mathcal{G}(X) \rightarrow \mathcal{G}(Y) is given by (S, f) \mapsto (\mathcal{G}(\Phi)S, \mathcal{G}(\Phi)f), where \mathcal{G}(\Phi)S = S and g = \mathcal{G}(\Phi)f : \overline{S} \times \overline{Y}^{\text{in}} \rightarrow \overline{T\overline{S}} \times \overline{Y}^{\text{out}} is defined by the dashed arrows (g^{\text{in}}, g^{\text{out}}) (see Definition 2.9) that make the diagrams below commute:

(10) \quad \begin{array}{ccc} \overline{S} \times \overline{Y}^{\text{in}} & \xrightarrow{\quad g^{\text{in}} \quad} & \overline{T\overline{S}} \\ \Delta \times \mathbb{I}_{Y^{\text{in}}} \downarrow & & \uparrow f^{\text{in}} \\ \overline{S} \times \overline{S} \times \overline{Y}^{\text{in}} & & \\ \mathbb{I}_{\overline{S}} \times f^{\text{out}} \times \mathbb{I}_{Y^{\text{in}}} \downarrow & & \\ \overline{S} \times \overline{X}^{\text{out}} \times \overline{Y}^{\text{in}} & \xrightarrow{\quad \mathbb{I}_{\overline{S}} \times \varphi^{\text{in}} \quad} & \overline{S} \times \overline{X}^{\text{in}} \end{array} \quad \begin{array}{ccc} \overline{S} & \xrightarrow{\quad g^{\text{out}} \quad} & \overline{Y}^{\text{out}} \\ f^{\text{out}} \swarrow & & \nwarrow \varphi^{\text{out}} \\ & \overline{X}^{\text{out}} & \end{array}

One may note strong resemblance between the diagrams in (10) and those in (5).

We give \mathcal{G} a lax monoidal structure: for any pair X, X' \in \mathbf{W} we have a coherence map \mu_{X, X'} : \mathcal{G}(X) \times \mathcal{G}(X') \rightarrow \mathcal{G}(X \oplus X') given by

((S, f), (S', f')) \mapsto (S + S', f \times f'),

where f \times f' is as in Lemma 2.14.

Remark 4.3. Recall from Remark 2.7 that \mathbf{Man} is small, so the collection \mathcal{G}(X) of open systems on X is indeed a set.

Remark 4.4. One may also encode an initial condition in \mathcal{G} by using \mathbf{Man}_* instead of \mathbf{Man} in Remark 2.7 as the default choice of finite product category, where \mathbf{Man}_* is the category of pointed smooth manifolds and base point preserving smooth maps. The base point represents the initialization of the state variables.

We now establish that \mathcal{G} is indeed an algebra.

Proposition 4.5. The pair (\mathcal{G}, \mu) of Definition 4.2 is a lax monoidal functor, i.e., \mathcal{G} is a \mathbf{W}-algebra.

Proof. Let \Phi = (X, Y, \varphi) and \Psi = (Y, Z, \psi) be wiring diagrams in \mathbf{W}. To show that \mathcal{G} is a functor, we must have that \mathcal{G}(\Psi \circ \Phi) = \mathcal{G}(\Psi) \circ \mathcal{G}(\Phi). Immediately we have \mathcal{G}(\Psi \circ \Phi)S = S = \mathcal{G}(\Psi)(\mathcal{G}(\Phi)S).

Now let h := \mathcal{G}(\Psi \circ \Phi)f and k := \mathcal{G}(\Psi)(\mathcal{G}(\Phi)f). It suffices to show h = k, or equivalently (h^{\text{in}}, h^{\text{out}}) = (k^{\text{in}}, k^{\text{out}}). One readily sees that h^{\text{out}} = k^{\text{out}}. We use (8) and (10) to produce the following diagram; showing it commutes is equivalent to proving that h^{\text{in}} = k^{\text{in}}.

\begin{array}{c} (11) \quad \begin{array}{c} \overline{S} \times \overline{Z^{\text{in}}} \\ \downarrow \Delta \times \mathbf{1} \\ \overline{S} \times \overline{S} \times \overline{Z^{\text{in}}} \\ \downarrow \mathbf{1} \times f^{\text{out}} \times \mathbf{1} \\ \overline{S} \times \overline{Y^{\text{out}}} \times \overline{Z^{\text{in}}} \xleftarrow{\mathbf{1} \times \overline{\varphi^{\text{out}}} \times \mathbf{1}} \overline{S} \times \overline{X^{\text{out}}} \times \overline{Z^{\text{in}}} \xrightarrow{\mathbf{1} \times \Delta \times \mathbf{1}} \overline{S} \times \overline{X^{\text{out}}} \times \overline{X^{\text{out}}} \times \overline{Z^{\text{in}}} \\ \downarrow \mathbf{1} \times \overline{\psi^{\text{in}}} \quad \downarrow \mathbf{1} \times \mathbf{1} \times \overline{\varphi^{\text{out}}} \times \mathbf{1} \\ \overline{S} \times \overline{Y^{\text{in}}} \quad \overline{S} \times \overline{X^{\text{out}}} \times \overline{Y^{\text{in}}} \xleftarrow{\mathbf{1} \times \overline{\varphi^{\text{in}}}} \overline{S} \times \overline{X^{\text{out}}} \times \overline{Y^{\text{out}}} \times \overline{Z^{\text{in}}} \\ \downarrow \Delta \times \mathbf{1} \quad \downarrow \mathbf{1} \times f^{\text{out}} \times \mathbf{1} \quad \downarrow \mathbf{1} \times \overline{\varphi^{\text{in}}} \\ \overline{S} \times \overline{S} \times \overline{Y^{\text{in}}} \xrightarrow{\mathbf{1} \times f^{\text{out}} \times \mathbf{1}} \overline{S} \times \overline{X^{\text{out}}} \times \overline{Y^{\text{in}}} \xrightarrow{\mathbf{1} \times \overline{\varphi^{\text{in}}}} \overline{S} \times \overline{X^{\text{in}}} \\ \downarrow f^{\text{in}} \\ T\overline{S} \end{array} \end{array}

The commutativity of this diagram, which is dual to the one for associativity in (6), holds in an arbitrary category with products. Although the middle square fails to commute by itself, the composite of the first two maps equalizes it; that is, the two composite morphisms \overline{S} \times \overline{Z^{\text{in}}} \rightarrow \overline{S} \times \overline{X^{\text{out}}} \times \overline{Y^{\text{in}}} agree.

Since we proved the analogous result via string diagrams in the proof of Proposition 3.11, we show it concretely using elements this time. Let (s, z) \in \overline{S} \times \overline{Z^{\text{in}}} be an arbitrary element. Composing six morphisms \overline{S} \times \overline{Z^{\text{in}}} \rightarrow \overline{S} \times \overline{X^{\text{out}}} \times \overline{Y^{\text{in}}} through the left of the diagram gives the same answer as composing through the right; namely,

(s, f^{\text{out}}(s), \psi^{\text{in}}(\varphi^{\text{out}} \circ f^{\text{out}}(s), z)) \in \overline{S} \times \overline{X^{\text{out}}} \times \overline{Y^{\text{in}}}.

Since the diagram commutes, we have shown that \mathcal{G} is a functor. To prove that the pair (\mathcal{G}, \mu) constitutes a lax monoidal functor \mathbf{W} \rightarrow \mathbf{Set}, i.e., a \mathbf{W}-algebra, we must establish coherence. Since \mu simply consists of a coproduct and a product, this is straightforward and will be omitted. \square

As established in Definition 2.1, the coherence map \mu allows us to define the operad algebra \mathcal{OG} from \mathcal{G}. This finally provides the formal setting to consider open dynamical systems over operadic wiring diagrams, such as our motivating one in Figure 1. We note that, in contrast to the trivial equality \mathcal{G}(\Phi)S = S found in Definition 4.2, in the operadic setting we have

\mathcal{OG}(\Phi)(S_1, \dots, S_n) = \prod_{i=1}^n S_i.

This simply means that the set of state variables of the larger box Y is the disjoint union of the state variables of its constituent boxes X_i. Now that we have the tools to revisit Example 4.1, we do so in the following section, but first we will define the subalgebra \mathcal{L} to which it belongs—that of linear open systems.

1.5. 5. THE SUBALGEBRA OF LINEAR OPEN SYSTEMS

In this section, we define the algebra \mathcal{L}: \mathbf{W}_{\mathbf{Lin}} \rightarrow \mathbf{Set}, which encodes linear open systems. Here \mathbf{W}_{\mathbf{Lin}} is the category of \mathbf{Lin}-typed wiring diagrams, as in Remark 3.2. Of course, one can use Definition 2.1 to construct an operad algebra \mathcal{OL}: \mathcal{OW}_{\mathbf{Lin}} \rightarrow \mathbf{Sets}.

Before we give a formal definition for \mathcal{L}, we first provide an alternative description for linear open systems and wiring diagrams in \mathbf{W}_{\mathbf{Lin}}. The category \mathbf{Lin} enjoys special properties—in particular it is an additive category, as seen by the fact that there is an equivalence of categories \mathbf{Lin} \cong \mathbf{Vect}_{\mathbb{R}}. Specifically, finite products and finite coproducts are isomorphic. Hence a morphism f: A_1 \times A_2 \rightarrow B_1 \times B_2 in \mathbf{Lin} canonically decomposes into a matrix equation

\begin{bmatrix} a_1 \\ a_2 \end{bmatrix} \mapsto \begin{bmatrix} b_1 \\ b_2 \end{bmatrix} = \begin{bmatrix} f^{1,1} & f^{1,2} \\ f^{2,1} & f^{2,2} \end{bmatrix} \begin{bmatrix} a_1 \\ a_2 \end{bmatrix}

This matrix is naturally equivalent to the whole map f by universal properties. We use these to rewrite our relevant \mathbf{Lin} maps in Definitions 5.1 and 5.2 below.

Definition 5.1. Suppose that (M, U^{\text{in}}, U^{\text{out}}, f) is a linear open system and hence f: M \times U^{\text{in}} \rightarrow TM \times U^{\text{out}}. Then f decomposes into the four linear maps:

\begin{array}{ll} f^{M,M}: M \rightarrow TM & f^{M,U}: U^{\text{in}} \rightarrow TM \\ f^{U,M}: M \rightarrow U^{\text{out}} & f^{U,U}: U^{\text{in}} \rightarrow U^{\text{out}} \end{array}

By Definition 2.9, we know f^{U,U} = 0. If we let (m, u^{\text{in}}, u^{\text{out}}) \in M \times U^{\text{in}} \times U^{\text{out}}, these equations can be organized into a single matrix equation

(12) \quad \begin{bmatrix} m \\ u^{\text{out}} \end{bmatrix} = \begin{bmatrix} f^{M,M} & f^{M,U} \\ f^{U,M} & 0 \end{bmatrix} \begin{bmatrix} m \\ u^{\text{in}} \end{bmatrix}

We will exploit this form in Definition 5.4 to define how \mathcal{L} acts on wiring diagrams in terms of one single matrix equation, in place of the seemingly complicated commutative diagrams in (10). To do so, we also recast wiring diagrams in matrix format in Definition 5.2 below.

Definition 5.2. Suppose \Phi = (X, Y, \varphi) is a wiring diagram in \mathbf{W}_{\mathbf{Lin}}. Recalling (7), we apply the dependent product functor to \varphi:

\overline{\varphi}: \overline{X^{\text{out}}} \times \overline{Y^{\text{in}}} \rightarrow \overline{X^{\text{in}}} \times \overline{Y^{\text{out}}}

Since this is a morphism in \mathbf{Lin}, it can be decomposed into four linear maps

\begin{array}{ll} \overline{\varphi}^{X,X}: \overline{X^{\text{out}}} \rightarrow \overline{X^{\text{in}}} & \overline{\varphi}^{X,Y}: \overline{X^{\text{out}}} \rightarrow \overline{Y^{\text{out}}} \\ \overline{\varphi}^{Y,X}: \overline{Y^{\text{in}}} \rightarrow \overline{X^{\text{out}}} & \overline{\varphi}^{Y,Y}: \overline{Y^{\text{in}}} \rightarrow \overline{Y^{\text{out}}} \end{array}

By virtue of the no passing wires condition in Definition 3.1, we must have \overline{\varphi}^{Y,Y} = 0. We can then, as in (12), organize this information in one single matrix:

\overline{\varphi} = \begin{bmatrix} \overline{\varphi^{X,X}} & \overline{\varphi^{X,Y}} \\ \overline{\varphi^{Y,X}} & 0 \end{bmatrix}

Remark 5.3. The bijectivity condition in Definition 3.1 implies that \overline{\varphi} is a permutation matrix.

We now employ these matrix characterizations to define the algebra \mathcal{L} of linear open systems.

Definition 5.4. We define the algebra \mathcal{L} : (\mathbf{W}_{\text{Lin}}, \oplus, 0) \rightarrow (\mathbf{Set}, \times, \star) as follows. Let X \in \text{Ob } \mathbf{W}_{\text{Lin}}. Then the set of linear open systems \mathcal{L}(X) on X is defined as

\mathcal{L}(X) := \{(S, f) \mid S \in \text{Ob } \mathbf{TFS}_{\text{Lin}}, (\overline{S}, \overline{X}^{\text{in}}, \overline{X}^{\text{out}}, f) \in \text{Ob } \mathbf{ODS}_{\text{Lin}}\}.

Let \Phi = (X, Y, \varphi) be a wiring diagram. Then, as in Definition 4.2, we define \mathcal{L}(\Phi)(S, f) := (S, g). We use the format of Definitions 5.1 and 5.2 to define g:

\begin{aligned} (13) \quad g &= \begin{bmatrix} g^{S,S} & g^{S,X} \\ g^{X,S} & g^{X,X} \end{bmatrix} = \begin{bmatrix} f^{S,X} & 0 \\ 0 & I \end{bmatrix} \overline{\varphi} \begin{bmatrix} f^{X,S} & 0 \\ 0 & I \end{bmatrix} + \begin{bmatrix} f^{S,S} & 0 \\ 0 & 0 \end{bmatrix} \\ &= \begin{bmatrix} f^{S,X} & 0 \\ 0 & I \end{bmatrix} \begin{bmatrix} \overline{\varphi}^{X,X} & \overline{\varphi}^{X,Y} \\ \overline{\varphi}^{Y,X} & \overline{\varphi}^{Y,Y} \end{bmatrix} \begin{bmatrix} f^{X,S} & 0 \\ 0 & I \end{bmatrix} + \begin{bmatrix} f^{S,S} & 0 \\ 0 & 0 \end{bmatrix} \\ &= \begin{bmatrix} f^{S,X} \overline{\varphi}^{X,X} f^{X,S} + f^{S,S} & f^{S,X} \overline{\varphi}^{X,Y} \\ \overline{\varphi}^{Y,X} f^{X,S} & 0 \end{bmatrix} \end{aligned}

This is really just a linear version of the commutative diagrams in (10). For example, the equation g^{S,S} = f^{S,X} \overline{\varphi}^{X,X} f^{X,S} + f^{S,S} can be read off the diagram for g^{\text{in}} in (10), using the additivity of \mathbf{Lin}.

Finally, The coherence map \mu_{\text{Lin}_{X,X'}} : \mathcal{L}(X) \times \mathcal{L}(X') \rightarrow \mathcal{L}(X \oplus X') is given, as in Definition 4.2, by ((S, f), (S', f')) \mapsto (S + S', f \times f').

We now establish that this constitutes an algebra.

Proposition 5.5. The pair (\mathcal{L}, \mu_{\text{Lin}}) of Definition 5.4 is a lax monoidal functor, i.e. a \mathbf{W}_{\text{Lin}}-algebra.

Proof. Since coherence is identical to that in Proposition 4.5, it will suffice to show functoriality. Let \Phi = (X, Y, \varphi) and \Psi = (Y, Z, \psi) be wiring diagrams with composition \Psi \circ \Phi = (X, Z, \omega). We now rewrite \omega using a matrix equation in terms of \overline{\varphi} and \overline{\psi} by recasting (5) in matrix form below.

\begin{aligned} (14) \quad \omega &= \begin{bmatrix} \overline{\omega^{X,X}} & \overline{\omega^{X,Z}} \\ \overline{\omega^{Z,X}} & \overline{\omega^{Z,Z}} \end{bmatrix} = \begin{bmatrix} \overline{\varphi}^{X,Y} & 0 \\ 0 & I \end{bmatrix} \overline{\psi} \begin{bmatrix} \overline{\varphi}^{Y,X} & 0 \\ 0 & I \end{bmatrix} + \begin{bmatrix} \overline{\varphi}^{X,X} & 0 \\ 0 & 0 \end{bmatrix} \\ &= \begin{bmatrix} \overline{\varphi}^{X,Y} \overline{\psi}^{Y,Y} \overline{\varphi}^{Y,X} + \overline{\varphi}^{X,X} & \overline{\varphi}^{X,Y} \overline{\psi}^{Y,Z} \\ \overline{\psi}^{Z,Y} \overline{\varphi}^{Y,X} & 0 \end{bmatrix} \end{aligned}

We now prove that \mathcal{L}(\Psi \circ \Phi) = \mathcal{L}(\Psi) \circ \mathcal{L}(\Phi). We immediately have \mathcal{L}(\Psi \circ \Phi)S = S = \mathcal{L}(\Psi)(\mathcal{L}(\Phi)S). Let h := \mathcal{L}(\Psi \circ \Phi)f and k := \mathcal{L}(\Psi)(\mathcal{L}(\Phi)f). We must show h = k. Let g = \mathcal{L}(\Psi)f and \Psi \circ \Phi = (X, Z, \omega). It is then straightforward matrix arithmetic to see that

(15)

\begin{aligned} k = \mathcal{L}(\Psi)g &= \begin{bmatrix} g^{S,Y} & 0 \\ 0 & I \end{bmatrix} \overline{\psi} \begin{bmatrix} g^{Y,S} & 0 \\ 0 & I \end{bmatrix} + \begin{bmatrix} g^{S,S} & 0 \\ 0 & 0 \end{bmatrix} \\ &= \begin{bmatrix} f^{S,X} (\overline{\varphi}^{X,Y} \overline{\psi}^{Y,X} + \overline{\varphi}^{X,X}) f^{X,S} + f^{S,S} & f^{S,X} \overline{\varphi}^{X,Y} \overline{\psi}^{Y,Z} \\ \overline{\psi}^{Z,Y} \overline{\varphi}^{Y,X} f^{X,S} & 0 \end{bmatrix} \\ &= \begin{bmatrix} f^{S,X} & 0 \\ 0 & I \end{bmatrix} \overline{\omega} \begin{bmatrix} f^{X,S} & 0 \\ 0 & I \end{bmatrix} + \begin{bmatrix} f^{S,S} & 0 \\ 0 & 0 \end{bmatrix} = \mathcal{L}(\Psi \circ \Phi)f = h \end{aligned}

Therefore, the pair (\mathcal{L}, \mu_{\text{Lin}}) constitutes a lax monoidal functor \mathbf{W}_{\text{Lin}} \rightarrow \mathbf{Set}, i.e., a \mathbf{W}_{\text{Lin}}-algebra. \square

Remark 5.6. Although we've been referring to \mathcal{L} as a subalgebra of \mathcal{G}, this is technically not the case since they have different source categories. The following diagram illustrates precisely the relationship between the \mathbf{W}_{\text{Lin}}-algebra \mathcal{L}, defined above, and the \mathbf{W}-algebra \mathcal{G}, defined in Section 4.

(16) \quad \begin{array}{ccc} \mathbf{W}_{\text{Lin}} & \xrightarrow{\mathbf{W}_i} & \mathbf{W} \\ & \searrow \mathcal{L} \quad \xRightarrow{\epsilon} \quad \swarrow \mathcal{G} & \\ & \mathbf{Set} & \end{array}

Here, the natural inclusion \mathbf{W}_i: \mathbf{W}_{\text{Lin}} \hookrightarrow \mathbf{W} corresponds to i: \mathbf{Lin} \hookrightarrow \mathbf{Man}, and we have a natural transformation \epsilon: \mathcal{L} \rightarrow \mathcal{G} \circ i. Hence for each X \in \text{Ob } \mathbf{W}_{\text{Lin}}, we have a function \epsilon_X: \mathcal{L}(X) \rightarrow \mathcal{G}(i(X)) = \mathcal{G}(X) that sends the linear open system (S, f) \in \mathcal{L}(X) to the open system (\mathbf{TFS}_i(S), i(f)) = (S, f) \in \mathcal{G}(X).

As promised, we now reformulate Example 1.1 in terms of our language.

Example 5.7. For the reader's convenience, we reproduce Figure 1 and Table 3.

Figure 9: A dynamical system diagram showing two boxes, X1 and X2, within a larger box Y. X1 has inputs X1a (3 oz/gal salt) and X1b (30 gal water) and outputs Q1(t) oz salt and 3 gal/min water. X2 has inputs X2a (3 gal/min water) and X2b (20 gal water) and outputs Q2(t) oz salt and 2.5 gal/min water. External inputs to Y are Ya^in (1 gal/min, 3 oz/gal) and Yb^in (1.5 gal/min, 1 oz/gal). External outputs from Y are Ya^out (2.5 gal/min) and a bottom output (1.5 gal/min).

The diagram illustrates a dynamical system within a container Y. It consists of two sub-systems, X_1 and X_2, represented as boxes.
- X_1 receives two inputs: X_{1a}^{\text{in}} (3 oz/gal salt) and X_{1b}^{\text{in}} (30 gal water). It produces two outputs: Q_1(t) oz salt and 3 gal/min water.
- X_2 receives two inputs: X_{2a}^{\text{in}} (3 gal/min water) and X_{2b}^{\text{in}} (20 gal water). It produces two outputs: Q_2(t) oz salt and 2.5 gal/min water.
- The entire system is part of a larger environment Y. Y has two external inputs: Y_a^{\text{in}} (1 gal/min, 3 oz/gal) and Y_b^{\text{in}} (1.5 gal/min, 1 oz/gal).
- Y also has two external outputs: Y_a^{\text{out}} (2.5 gal/min) and a bottom output of 1.5 gal/min.
- Arrows indicate the flow of materials between these components.

Figure 9: A dynamical system diagram showing two boxes, X1 and X2, within a larger box Y. X1 has inputs X1a (3 oz/gal salt) and X1b (30 gal water) and outputs Q1(t) oz salt and 3 gal/min water. X2 has inputs X2a (3 gal/min water) and X2b (20 gal water) and outputs Q2(t) oz salt and 2.5 gal/min water. External inputs to Y are Ya^in (1 gal/min, 3 oz/gal) and Yb^in (1.5 gal/min, 1 oz/gal). External outputs from Y are Ya^out (2.5 gal/min) and a bottom output (1.5 gal/min).

FIGURE 9. A dynamical system from Boyce and DiPrima interpreted over a wiring diagram \Phi = (X_1, X_2; Y; \varphi) in \mathbf{OW}.

\begin{array}{c|c|c|c|c|c} w \in X^{\text{in}} + Y^{\text{out}} & X_{1a}^{\text{in}} & X_{1b}^{\text{in}} & X_{2a}^{\text{in}} & X_{2b}^{\text{in}} & Y_a^{\text{out}} \\ \hline \varphi(w) \in X^{\text{out}} + Y^{\text{in}} & Y_b^{\text{in}} & X_{2b}^{\text{out}} & Y_a^{\text{in}} & X_{1a}^{\text{out}} & X_{2a}^{\text{out}} \end{array}

TABLE 4

We can invoke the yoga of Definition 5.2 to write \overline{\varphi} as a matrix below:

(17) \quad \begin{bmatrix} \overline{X_{1a}^{\text{out}}} \\ \overline{X_{2a}^{\text{out}}} \\ \overline{X_{2b}^{\text{out}}} \\ \overline{Y_a^{\text{in}}} \\ \overline{Y_b^{\text{in}}} \end{bmatrix} = \begin{bmatrix} 0 & 0 & I & 0 & 0 \\ 0 & 0 & 0 & 0 & I \\ 0 & I & 0 & 0 & 0 \\ I & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & I & 0 \end{bmatrix} \begin{bmatrix} \overline{X_{1a}^{\text{in}}} \\ \overline{X_{1b}^{\text{in}}} \\ \overline{X_{2a}^{\text{in}}} \\ \overline{X_{2b}^{\text{in}}} \\ \overline{Y_a^{\text{out}}} \end{bmatrix}

One can think of \overline{\varphi} as a block permutation matrix consisting of identity and zero matrix blocks. An identity matrix in block entry (i, j) represents the fact that the port whose state space corresponds to row i and the one whose state space corresponds to column j get linked by \Phi. In general, the dimension of each I is equal to the dimension of the corresponding state space and hence the formula in (17) is true, independent of the typing. In the specific example of this system, however, all of these ports are typed in \mathbb{R}, and so we have I = 1 in (17).

As promised in Example 4.1, we now write the open systems for the X_i in Figure 1 as elements of \mathcal{L}(X_i). The linear open systems below in (18) represent f_1 and f_2, respectively.

(18) \quad \begin{bmatrix} \dot{Q}_1 \\ X_{1a}^{\text{out}} \end{bmatrix} = \begin{bmatrix} -.1 & 1 & 1 \\ .1 & 0 & 0 \end{bmatrix} \begin{bmatrix} Q_1 \\ X_{1a}^{\text{in}} \\ X_{1b}^{\text{in}} \end{bmatrix}, \quad \begin{bmatrix} \dot{Q}_2 \\ X_{2a}^{\text{out}} \\ X_{2b}^{\text{out}} \end{bmatrix} = \begin{bmatrix} -.2 & 1 & 1 \\ .125 & 0 & 0 \\ .075 & 0 & 0 \end{bmatrix} \begin{bmatrix} Q_2 \\ X_{2a}^{\text{in}} \\ X_{2b}^{\text{in}} \end{bmatrix}

Note the proportion of zeros and ones in the f-matrices of (18)—this is perhaps why the making explicit of these details was an afterthought in (9). Because we may have arbitrary nonconstant coefficients, our formalism can capture more intricate systems.

We then use (17) to establish that X_{1b}^{\text{in}} = X_{2b}^{\text{out}} and X_{2b}^{\text{in}} = X_{1a}^{\text{out}}. This allows us to recover the equations in (9):

\begin{cases} \dot{Q}_1 = -.1Q_1 + X_{1a}^{\text{in}} + X_{1b}^{\text{in}} = -.1Q_1 + 1.5 + X_{2b}^{\text{out}} = -.1Q_1 + .075Q_2 + 1.5 \\ \dot{Q}_2 = -.2Q_2 + X_{2a}^{\text{in}} + X_{2b}^{\text{in}} = -.2Q_2 + 3 + X_{1a}^{\text{out}} = -.2Q_2 + .1Q_1 + 3 \end{cases}

The coherence map in Definition 5.4 gives us the combined tank system:

(\mathcal{Q}, f) := \mu_{\text{Lin}}(\{Q_1\}, f_1, \{Q_2\}, f_2) = (\{Q_1, Q_2\}, f_1 \times f_2) \in \mathcal{L}(X).

This system can then be written out as a matrix below

(19) \quad \begin{bmatrix} \dot{Q}_1 \\ \dot{Q}_2 \\ X_{1a}^{\text{out}} \\ X_{2a}^{\text{out}} \\ X_{2b}^{\text{out}} \end{bmatrix} = \begin{bmatrix} -.1 & 0 & 1 & 1 & 0 & 0 \\ 0 & -.2 & 0 & 0 & 1 & 1 \\ .1 & 0 & 0 & 0 & 0 & 0 \\ 0 & .125 & 0 & 0 & 0 & 0 \\ 0 & .075 & 0 & 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} Q_1 \\ Q_2 \\ X_{1a}^{\text{in}} \\ X_{1b}^{\text{in}} \\ X_{2a}^{\text{in}} \\ X_{2b}^{\text{in}} \end{bmatrix}

Finally, we can apply formula (13) to (19) above to express as a matrix the open system (Q, g) = (\Phi)f \in \mathcal{L}(Y) for the outer box Y.

\begin{bmatrix} \dot{Q}_1 \\ Q_2 \\ Y^{\text{out}} \end{bmatrix} = \begin{bmatrix} -.1 & .075 & 0 & 1 \\ .1 & -.2 & 1 & 0 \\ 0 & 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} Q_1 \\ Q_2 \\ Y_a^{\text{in}} \\ Y_b^{\text{in}} \end{bmatrix}

1.6. REFERENCES

  • [Aba15] Joseph Abadi. Orthogonal factorization systems on 1- and 2-cob. In preparation, 2015.
  • [AMMO10] Rob Arthan, Ursula Martin, Erik A. Mathiesen, and Paulo Oliva. A general framework for sound and complete Floyd-Hoare logics. ACM Trans. Comput. Log., 11(1):Art. 7, 31, 2010.
  • [Awo10] Steve Awodey. Category Theory, volume 52 of Oxford Logic Guides. Oxford University Press, Oxford, second edition, 2010.
  • [Bae13] John Baez. The foundations of applied mathematics. ePrint online: math.ucr.edu/home/baez/irvine/irvine.pdf, 5 2013.
  • [BB12] John C. Baez and Jacob Biamonte. A course on quantum techniques for stochastic mechanics. ePrint online: www.arXiv.org/abs/1209.3632, 2012.
  • [BD65] William E. Boyce and Richard C. DiPrima. Elementary Differential Equations and Boundary Value Problems. John Wiley & Sons, Inc., New York-London-Sydney, 1965.
  • [BS11] J. Baez and M. Stay. Physics, topology, logic and computation: a Rosetta Stone. In New Structures for Physics, volume 813 of Lecture Notes in Phys., pages 95–172. Springer, Heidelberg, 2011.
  • [Coe13] Bob Coecke. An alternative gospel of structure: order, composition, processes. ePrint online: www.arXiv.org/abs/1307.4038, 2013.
  • [DL10] Lee DeVille and Eugene Lerman. Dynamics on networks I. Combinatorial categories of modular continuous-time systems. ePrint online: www.arXiv.org/abs/1008.5359, 2010.
  • [DL14] Lee DeVille and Eugene Lerman. Modular dynamical systems on networks. JEMS (to appear). ePrint online: www.arXiv.org/abs/1303.3907, 2014.
  • [DL15] Lee DeVille and Eugene Lerman. Dynamics on networks of manifolds. SIGMA Symmetry Integrability Geom. Methods Appl., 11:Paper 022, 21, 2015.
  • [Gro13] Mikhail Gromov. In a search for a structure, part 1: On entropy. ePrint online: www.ihes.fr/~gromov/PDF/structure-search-entropy-july5-2012.pdf, 6 2013.
  • [JS91] André Joyal and Ross Street. The geometry of tensor calculus. I. Adv. Math., 88(1):55–112, 1991.
  • [JSV96] André Joyal, Ross Street, and Dominic Verity. Traced monoidal categories. Math. Proc. Cambridge Philos. Soc., 119(3):447–468, 1996.
  • [KFA69] R. E. Kalman, P. L. Falb, and M. A. Arbib. Topics in Mathematical System Theory. McGraw-Hill Book Co., New York-Toronto, Ont.-London, 1969.
  • [Koe67] Arthur Koestler. The Ghost in the Machine. Hutchinson & Co., 1967.
  • [Lei04] Tom Leinster. Higher Operads, Higher Categories, volume 298 of London Mathematical Society Lecture Note Series. Cambridge University Press, Cambridge, 2004.
  • [ML98] Saunders Mac Lane. Categories for the Working Mathematician, volume 5 of Graduate Texts in Mathematics. Springer-Verlag, New York, second edition, 1998.
  • [Sco71] Dana Scott. The lattice of flow diagrams. In Symposium on Semantics of Algorithmic Languages, pages 311–366. Lecture Notes in Mathematics, Vol. 188. Springer, Berlin, 1971.
  • [Sel11] P. Selinger. A survey of graphical languages for monoidal categories. In New structures for physics, volume 813 of Lecture Notes in Phys., pages 289–355. Springer, Heidelberg, 2011.
  • [Spi65] Michael Spivak. Calculus on Manifolds. A Modern Approach to Classical Theorems of Advanced Calculus. W. A. Benjamin, Inc., New York-Amsterdam, 1965.
  • [Spi13] David I. Spivak. The operad of wiring diagrams: formalizing a graphical language for databases, recursion, and plug-and-play circuits. ePrint online: www.arXiv.org/abs/arXiv:1305.0297, 2013.
  • [Spi14] David I. Spivak. Category Theory for the Sciences. MIT Press, 2014.
  • [SR13] David I. Spivak and Dylan Rupel. The operad of temporal wiring diagrams: formalizing a graphical language for discrete-time processes. ePrint online: www.arXiv.org/abs/1307.6894, 2013.
  • [SSR15] David I. Spivak, Patrick Schultz, and Dylan Rupel. Traced categories as lax functors out of free compact categories. (In preparation), 2015.
  • [Tes12] Gerald Teschl. Ordinary Differential Equations and Dynamical Systems, volume 140 of Graduate Studies in Mathematics. American Mathematical Society, Providence, RI, 2012.
  • [War83] Frank W. Warner. Foundations of Differentiable Manifolds and Lie Groups, volume 94 of Graduate Texts in Mathematics. Springer-Verlag, New York-Berlin, 1983. Corrected reprint of the 1971 edition.