The Algebra of Open and
Interconnected Systems
Brendan Fong
Hertford College
University of Oxford
A thesis submitted for the degree of
Doctor of Philosophy in Computer Science
Trinity 2016
For all those who have prepared food so I could eat and created homes so I could live over the past four years. You too have laboured to produce this; I hope I have done your labours justice.
Abstract
Herein we develop category-theoretic tools for understanding networkstyle diagrammatic languages. The archetypal network-style diagrammatic language is that of electric circuits; other examples include signal flow graphs, Markov processes, automata, Petri nets, chemical reaction
networks, and so on. The key feature is that the language is comprised
of a number of components with multiple (input/output) terminals, each
possibly labelled with some type, that may then be connected together along these terminals to form a larger network. The components form
hyperedges between labelled vertices, and so a diagram in this language forms a hypergraph. We formalise the compositional structure by introducing the notion of a hypergraph category. Network-style diagrammatic languages and their semantics thus form hypergraph categories, and semantic interpretation gives a hypergraph functor.
The first part of this thesis develops the theory of hypergraph categories. In particular, we introduce the tools of decorated cospans and corela-
tions. Decorated cospans allow straightforward construction of hypergraph categories from diagrammatic languages: the inputs, outputs, and their composition are modelled by the cospans, while the ‘decorations’ specify the components themselves. Not all hypergraph categories can be constructed, however, through decorated cospans. Decorated corelations are a more powerful version that permits construction of all hypergraph categories and hypergraph functors. These are often useful for constructing the semantic categories of diagrammatic languages and functors from diagrams to the semantics. To illustrate these principles, the second part of this thesis details applications to linear time-invariant dynamical systems and passive linear networks.
Contents
Preface
v
I Mathematical Foundations
1
1 Hypergraph categories: the algebra of interconnection
1.1 The algebra of interconnection . . . . . . . . . . . . . . . . . . . . . . 1.2 Symmetric monoidal categories . . . . . . . . . . . . . . . . . . . . .
1.2.1 Monoidal categories . . . . . . . . . . . . . . . . . . . . . . . . 1.2.2 String diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.3 Symmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
25679
1.3 Hypergraph categories . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.1 Frobenius monoids . . . . . . . . . . . . . . . . . . . . . . . . 10 1.3.2 Hypergraph categories . . . . . . . . . . . . . . . . . . . . . . 12 1.3.3 Hypergraph categories are self-dual compact closed . . . . . . 13 1.3.4 Coherence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.4 Example: cospan categories . . . . . . . . . . . . . . . . . . . . . . . 17
2 Decorated cospans: from closed systems to open
22
2.1 From closed systems to open . . . . . . . . . . . . . . . . . . . . . . . 22 2.2 Decorated cospan categories . . . . . . . . . . . . . . . . . . . . . . . 25
2.2.1 Composing decorated cospans . . . . . . . . . . . . . . . . . . 26 2.2.2 The hypergraph structure . . . . . . . . . . . . . . . . . . . . 30 2.2.3 A bicategory of decorated cospans . . . . . . . . . . . . . . . . 35
2.3 Functors between decorated cospan categories . . . . . . . . . . . . . 35 2.4 Decorations in Set are general . . . . . . . . . . . . . . . . . . . . . . 40 2.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.5.1 Labelled graphs . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.5.2 Linear relations . . . . . . . . . . . . . . . . . . . . . . . . . . 44
i
2.5.3 Electrical circuits . . . . . . . . . . . . . . . . . . . . . . . . . 45
3 Corelations: a tool for black boxing 48
3.1 The idea of black boxing . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.2 Corelations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.2.1 Factorisation systems . . . . . . . . . . . . . . . . . . . . . . . 53 3.2.2 Corelations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 3.2.3 Categories of corelations . . . . . . . . . . . . . . . . . . . . . 58
3.3 Functors between corelation categories . . . . . . . . . . . . . . . . . 62 3.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.4.1 Equivalence relations as corelations in Set . . . . . . . . . . . 67 3.4.2 Linear relations as corelations in Vect . . . . . . . . . . . . . . 68
4 Decorated corelations: black-boxed open systems
71
4.1 Black-boxed open systems . . . . . . . . . . . . . . . . . . . . . . . . 71 4.2 Decorated corelations . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.2.1 Adjoining right adjoints . . . . . . . . . . . . . . . . . . . . . 75 4.2.2 Decorated corelations . . . . . . . . . . . . . . . . . . . . . . . 76 4.2.3 Categories of decorated corelations . . . . . . . . . . . . . . . 78
4.3 Functors between decorated corelation categories . . . . . . . . . . . 80 4.4 All hypergraph categories are decorated corelation categories . . . . . 84
4.4.1 Representing a morphism with its name . . . . . . . . . . . . 85 4.4.2 A categorical equivalence . . . . . . . . . . . . . . . . . . . . . 89 4.4.3 Factorisations as decorations . . . . . . . . . . . . . . . . . . . 91
4.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.5.1 Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 4.5.2 Two constructions for linear relations . . . . . . . . . . . . . . 97
II Applications
99
5 Signal flow diagrams
100
5.1 Behavioural control theory . . . . . . . . . . . . . . . . . . . . . . . . 100 5.2 Linear time-invariant dynamical systems . . . . . . . . . . . . . . . . 106 5.3 Presentation of LTI . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.3.1 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 5.3.2 Presentations of Mat k[s, s−1] and Cospan Mat k[s, s−1] . . . . 111 5.3.3 Corelations in Mat k[s, s−1] . . . . . . . . . . . . . . . . . . . . 114
ii
5.3.4 Presentation of Corel Mat k[s, s−1] . . . . . . . . . . . . . . . . 116
5.4 Operational semantics . . . . . . . . . . . . . . . . . . . . . . . . . . 119 5.5 Controllability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.5.1 A categorical characterisation . . . . . . . . . . . . . . . . . . 122 5.5.2 Control and interconnection . . . . . . . . . . . . . . . . . . . 124 5.5.3 Comparison to matrix methods . . . . . . . . . . . . . . . . . 125
6 Passive linear networks
128
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 6.2 Circuits of linear resistors . . . . . . . . . . . . . . . . . . . . . . . . 136
6.2.1 Circuits as labelled graphs . . . . . . . . . . . . . . . . . . . . 137 6.2.2 Ohm’s law, Kirchhoff’s laws, and the principle of minimum power139 6.2.3 A Dirichlet problem . . . . . . . . . . . . . . . . . . . . . . . . 142 6.2.4 Equivalent circuits . . . . . . . . . . . . . . . . . . . . . . . . 145 6.2.5 Dirichlet forms . . . . . . . . . . . . . . . . . . . . . . . . . . 148
6.3 Inductors and capacitors . . . . . . . . . . . . . . . . . . . . . . . . . 150
6.3.1 The frequency domain and Ohm’s law revisited . . . . . . . . 151 6.3.2 The mechanical analogy . . . . . . . . . . . . . . . . . . . . . 154 6.3.3 Generalized Dirichlet forms . . . . . . . . . . . . . . . . . . . 155 6.3.4 A generalized minimizability result . . . . . . . . . . . . . . . 157
6.4 A compositional perspective . . . . . . . . . . . . . . . . . . . . . . . 160
6.4.1 The category of open circuits . . . . . . . . . . . . . . . . . . 161 6.4.2 An obstruction to black boxing . . . . . . . . . . . . . . . . . 163 6.4.3 The category of Dirichlet cospans . . . . . . . . . . . . . . . . 165 6.4.4 A category of behaviours . . . . . . . . . . . . . . . . . . . . . 168
6.5 Networks as Lagrangian relations . . . . . . . . . . . . . . . . . . . . 170
6.5.1 Symplectic vector spaces . . . . . . . . . . . . . . . . . . . . . 170 6.5.2 Lagrangian subspaces from quadratic forms . . . . . . . . . . 173 6.5.3 Lagrangian relations . . . . . . . . . . . . . . . . . . . . . . . 175 6.5.4 The symmetric monoidal category of Lagrangian relations . . 177
6.6 Ideal wires and corelations . . . . . . . . . . . . . . . . . . . . . . . . 178
6.6.1 Ideal wires as corelations . . . . . . . . . . . . . . . . . . . . . 179 6.6.2 Potentials on corelations . . . . . . . . . . . . . . . . . . . . . 180 6.6.3 Currents on corelations . . . . . . . . . . . . . . . . . . . . . . 182 6.6.4 The symplectification functor . . . . . . . . . . . . . . . . . . 183 6.6.5 Lagrangian relations as decorated corelations . . . . . . . . . . 186
iii
6.7 The black box functor . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.7.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 6.7.2 Minimization via composition of relations . . . . . . . . . . . 191 6.7.3 Proof of functoriality . . . . . . . . . . . . . . . . . . . . . . . 192
7 Further directions
195
7.1 Bound colimits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 7.2 Open circuits and other systems . . . . . . . . . . . . . . . . . . . . . 198
Bibliography
200
iv
Preface
This is a thesis in the mathematical sciences, with emphasis on the mathematics. But before we get to the category theory, I want to say a few words about the scientific
tradition in which this thesis is situated.
Mathematics is the language of science. Twinned so intimately with physics, over the past centuries mathematics has become a superb—indeed, unreasonably effective—language for understanding planets moving in space, particles in a vacuum,
the structure of spacetime, and so on. Yet, while Wigner speaks of the unreasonable
effectiveness of mathematics in the natural sciences [Wig60], equally eminent mathematicians, not least Gelfand, speak of the unreasonable ineffectiveness of mathematics
in biology [Mon07] and related fields. Why such a difference?
A contrast between physics and biology is that while physical systems can often