SLIDE 1 A compositional approach to networks
Brendan Fong, University of Oxford
Southampton ECS Seminar 4 February 2015
SLIDE 2
The big picture
Network-style diagrammatic languages have developed to represent and reason about many different sciences: Why? Can we formalise their key features and relationships? Can we unify them?
SLIDE 3
The big picture
Network-style diagrammatic languages have developed to represent and reason about many different sciences: Why? Can we formalise their key features and relationships? Can we unify them?
SLIDE 4 The big picture
Jan C. Willems: . . . classical system-theoretic thinking is unsuitable for
- dealing. . . with the basic tenets at which system theory
aims, namely, open and interconnected systems.
The behavioural approach to open and interconnected systems, 2007.
Joseph Goguen: Following clues from systems engineering, general systems theory and cybernetics. . . I decided that the most general concepts of engineering might be system, behavior, and interconnection. . .
Tossing algebraic flowers down the great divide, 1999.
SLIDE 5 The big picture
Jan C. Willems: . . . classical system-theoretic thinking is unsuitable for
- dealing. . . with the basic tenets at which system theory
aims, namely, open and interconnected systems.
The behavioural approach to open and interconnected systems, 2007.
Joseph Goguen: Following clues from systems engineering, general systems theory and cybernetics. . . I decided that the most general concepts of engineering might be system, behavior, and interconnection. . .
Tossing algebraic flowers down the great divide, 1999.
SLIDE 6 Categories
- Categories are a great algebraic framework for discussing
interconnection, or composition. They first arose in the 1940s in algebraic topology.
- From the 1980s, it became clear they had a role to play in
formalising uses of string/network diagrams, such as Feynman diagrams:
SLIDE 7 Categories
- Categories are a great algebraic framework for discussing
interconnection, or composition. They first arose in the 1940s in algebraic topology.
- From the 1980s, it became clear they had a role to play in
formalising uses of string/network diagrams, such as Feynman diagrams:
SLIDE 8 Categories
- Categories are a great algebraic framework for discussing
interconnection, or composition. They first arose in the 1940s in algebraic topology.
- From the 1980s, it became clear they had a role to play in
formalising uses of string/network diagrams, such as Feynman diagrams:
SLIDE 9 Categories
- A category C is the structure of one-dimensional flow
charts.
- They comprise objects, or types:
X, Y, etc. together with morphisms between these types: f
X Y
- We can compose morphisms of matching types to get new
morphisms: f g h
X
W
Y Z
The composition rule must have such pictures unambiguously describe a morphism.
SLIDE 10 Categories
- A category C is the structure of one-dimensional flow
charts.
- They comprise objects, or types:
X, Y, etc. together with morphisms between these types: f
X Y
- We can compose morphisms of matching types to get new
morphisms: f g h
X
W
Y Z
The composition rule must have such pictures unambiguously describe a morphism.
SLIDE 11 Categories
- A category C is the structure of one-dimensional flow
charts.
- They comprise objects, or types:
X, Y, etc. together with morphisms between these types: f
X Y
- We can compose morphisms of matching types to get new
morphisms: f g h
X
W
Y Z
The composition rule must have such pictures unambiguously describe a morphism.
SLIDE 12 Categories
- There are various types of categories that allow extra
- perations.
- A monoidal category is the structure of two-dimensional
flow charts. f g h k
X Y X Z V
V W X
The key point is that we have a notion of ‘parallel’ or tensor composition.
- A symmetric monoidal category further allows you to
cross wires:
X X Y Y
SLIDE 13 Categories
- There are various types of categories that allow extra
- perations.
- A monoidal category is the structure of two-dimensional
flow charts. f g h k
X Y X Z V
V W X
The key point is that we have a notion of ‘parallel’ or tensor composition.
- A symmetric monoidal category further allows you to
cross wires:
X X Y Y
SLIDE 14 Categories
- There are various types of categories that allow extra
- perations.
- A monoidal category is the structure of two-dimensional
flow charts. f g h k
X Y X Z V
V W X
The key point is that we have a notion of ‘parallel’ or tensor composition.
- A symmetric monoidal category further allows you to
cross wires:
X X Y Y
SLIDE 15 Categories
- A functor F : C → D is a map between categories.
- It turns morphisms
f
X Y
in C into morphisms Ff
FX FY
in D. This assignment must preserve composition. That is, the diagram Ff Fg
FX
FY
FZ
must be unambiguous.
SLIDE 16 Categories
- A functor F : C → D is a map between categories.
- It turns morphisms
f
X Y
in C into morphisms Ff
FX FY
in D. This assignment must preserve composition. That is, the diagram Ff Fg
FX
FY
FZ
must be unambiguous.
SLIDE 17 Categories
- Guiding principle: each diagrammatic language draws
morphisms in some symmetric monoidal category.
- In this talk we will consider symmetric monoidal categories
- f electrical circuits, signal flow graphs, and their
behaviours, and functors between them: Circ
(This is known as a commutative diagram.)
SLIDE 18 Categories
- Guiding principle: each diagrammatic language draws
morphisms in some symmetric monoidal category.
- In this talk we will consider symmetric monoidal categories
- f electrical circuits, signal flow graphs, and their
behaviours, and functors between them: Circ
(This is known as a commutative diagram.)
SLIDE 19 Categories
- Guiding principle: each diagrammatic language draws
morphisms in some symmetric monoidal category.
- In this talk we will consider symmetric monoidal categories
- f electrical circuits, signal flow graphs, and their
behaviours, and functors between them: Circ
(This is known as a commutative diagram.)
SLIDE 20 Circuits
- A (closed) circuit, for us, is a graph with edges labelled by
resistances. 2Ω 3Ω 1Ω 1Ω
- Given potentials on each node, the circuit induces
pointwise currents. The behaviour of a circuit is the collection of possible potential–current readings.
- For linear resistors, this is governed by Ohm’s law: the
induced current along an edge is equal to its potential difference divided by its resistance. Letting N be the set of nodes, the behaviour is thus a linear subspace of RN ⊕ RN.
SLIDE 21 Circuits
- A (closed) circuit, for us, is a graph with edges labelled by
resistances. 2Ω 3Ω 1Ω 1Ω
- Given potentials on each node, the circuit induces
pointwise currents. The behaviour of a circuit is the collection of possible potential–current readings.
- For linear resistors, this is governed by Ohm’s law: the
induced current along an edge is equal to its potential difference divided by its resistance. Letting N be the set of nodes, the behaviour is thus a linear subspace of RN ⊕ RN.
SLIDE 22 Circuits
- A (closed) circuit, for us, is a graph with edges labelled by
resistances. 2Ω 3Ω 1Ω 1Ω
- Given potentials on each node, the circuit induces
pointwise currents. The behaviour of a circuit is the collection of possible potential–current readings.
- For linear resistors, this is governed by Ohm’s law: the
induced current along an edge is equal to its potential difference divided by its resistance. Letting N be the set of nodes, the behaviour is thus a linear subspace of RN ⊕ RN.
SLIDE 23
Circuits
But what about interconnections of circuits? To compose circuits, we first mark input and output terminals: 2Ω 3Ω 1Ω 1Ω
SLIDE 24
Circuits
But what about interconnections of circuits? To compose circuits, we first mark input and output terminals: 2Ω 3Ω 1Ω 1Ω
SLIDE 25
Circuits
But what about interconnections of circuits? To compose circuits, we first mark input and output terminals: X Y 2Ω 3Ω 1Ω 1Ω
SLIDE 26 Circuits
Then compose by gluing along identified points:
X Y 2Ω 3Ω 1Ω 1Ω Z 5Ω 8Ω
⇓
X Z 2Ω 3Ω 1Ω 1Ω 5Ω 8Ω
SLIDE 27 Circuits
Then compose by gluing along identified points:
X Y 2Ω 3Ω 1Ω 1Ω Z 5Ω 8Ω
⇓
X Z 2Ω 3Ω 1Ω 1Ω 5Ω 8Ω
SLIDE 28 Circuits
Then compose by gluing along identified points:
X Y 2Ω 3Ω 1Ω 1Ω Z 5Ω 8Ω
⇓
X Z 2Ω 3Ω 1Ω 1Ω 5Ω 8Ω
SLIDE 29 Circuits
We also have monoidal composition, by placing circuits side-by-side:
X Y 2Ω 3Ω 1Ω 1Ω
⊗
X′ Y′ 5Ω 1Ω
⇒
X + X′ Y + Y′ 2Ω 3Ω 1Ω 1Ω 5Ω 1Ω
SLIDE 30 Circuits
We also have monoidal composition, by placing circuits side-by-side:
X Y 2Ω 3Ω 1Ω 1Ω
⊗
X′ Y′ 5Ω 1Ω
⇒
X + X′ Y + Y′ 2Ω 3Ω 1Ω 1Ω 5Ω 1Ω
SLIDE 31 Circuits
We also have monoidal composition, by placing circuits side-by-side:
X Y 2Ω 3Ω 1Ω 1Ω
⊗
X′ Y′ 5Ω 1Ω
⇒
X + X′ Y + Y′ 2Ω 3Ω 1Ω 1Ω 5Ω 1Ω
SLIDE 32
Circuits
We thus have a (symmetric monoidal) category Circ of circuit diagrams: Objects finite sets X of terminals Morphisms (0, ∞)-labelled graphs on a set N together with functions X → N and Y → N marking terminals Composition gluing along the shared terminals Tensor disjoint union of circuits
SLIDE 33
Circuits
We thus have a (symmetric monoidal) category Circ of circuit diagrams: Objects finite sets X of terminals Morphisms (0, ∞)-labelled graphs on a set N together with functions X → N and Y → N marking terminals Composition gluing along the shared terminals Tensor disjoint union of circuits
SLIDE 34
Circuits
We thus have a (symmetric monoidal) category Circ of circuit diagrams: Objects finite sets X of terminals Morphisms (0, ∞)-labelled graphs on a set N together with functions X → N and Y → N marking terminals Composition gluing along the shared terminals Tensor disjoint union of circuits
SLIDE 35
Circuits
We thus have a (symmetric monoidal) category Circ of circuit diagrams: Objects finite sets X of terminals Morphisms (0, ∞)-labelled graphs on a set N together with functions X → N and Y → N marking terminals Composition gluing along the shared terminals Tensor disjoint union of circuits
SLIDE 36 Behaviours
- The behaviour of a circuit is the collection of possible
potential–current readings at terminals, with the sign of the current at the ‘input’ terminals indicating the inward current, and vice versa for the ‘output’ terminals.
- The potentials and currents at non-terminal nodes are
those that minimize the power Q = IV of the circuit.
- The behaviour of a circuit X → Y is a linear subspace of
(RX ⊕ RX) ⊕ (RY ⊕ RY). This is also known as a linear relation RX ⊕ RX → RY ⊕ RY.
SLIDE 37 Behaviours
- The behaviour of a circuit is the collection of possible
potential–current readings at terminals, with the sign of the current at the ‘input’ terminals indicating the inward current, and vice versa for the ‘output’ terminals.
- The potentials and currents at non-terminal nodes are
those that minimize the power Q = IV of the circuit.
- The behaviour of a circuit X → Y is a linear subspace of
(RX ⊕ RX) ⊕ (RY ⊕ RY). This is also known as a linear relation RX ⊕ RX → RY ⊕ RY.
SLIDE 38 Behaviours
- The behaviour of a circuit is the collection of possible
potential–current readings at terminals, with the sign of the current at the ‘input’ terminals indicating the inward current, and vice versa for the ‘output’ terminals.
- The potentials and currents at non-terminal nodes are
those that minimize the power Q = IV of the circuit.
- The behaviour of a circuit X → Y is a linear subspace of
(RX ⊕ RX) ⊕ (RY ⊕ RY). This is also known as a linear relation RX ⊕ RX → RY ⊕ RY.
SLIDE 39 Behaviours
Ideal wire
The identity map on one point
X Y
acts as an ideal wire, having behaviour {(φ, i, φ, −i) | φ, i ∈ R} ⊂ (RX ⊕ RX) ⊕ (RY ⊕ RY).
SLIDE 40 Behaviours
Y-junction
The circuit
X Y
acts as a junction of three ideal wires. It thus has behaviour {(φ, −(i + j), φ, φ, i, j) | φ, i, j ∈ R} ⊂ (RX ⊕ RX) ⊕ (RY ⊕ RY).
SLIDE 41 Behaviours
Resistor
The resistor of resistance r
X Y r
acts according to Ohm’s law: V = rI. This means that the current must be 1
r times the signed
potential difference. It thus has behaviour {(φx, −1
r (φy−φx), φy, 1 r (φy−φx) | φx, φy ∈ R} ⊂ (RX⊕RX)⊕(RY⊕RY).
SLIDE 42 Behaviours
Resistor
The resistor of resistance r
X Y r
acts according to Ohm’s law: V = rI. This means that the current must be 1
r times the signed
potential difference. It thus has behaviour {(φx, −1
r (φy−φx), φy, 1 r (φy−φx) | φx, φy ∈ R} ⊂ (RX⊕RX)⊕(RY⊕RY).
SLIDE 43 Behaviours
Resistor
The resistor of resistance r
X Y r
acts according to Ohm’s law: V = rI. This means that the current must be 1
r times the signed
potential difference. It thus has behaviour {(φx, −1
r (φy−φx), φy, 1 r (φy−φx) | φx, φy ∈ R} ⊂ (RX⊕RX)⊕(RY⊕RY).
SLIDE 44
Behaviours
Given two relations R ⊂ U ⊕ V and S ⊂ V ⊕ W, their composite consists of all elements of (u, w) ∈ U ⊕ W such that there exists v ∈ V with (u, v) ∈ R and (v, w) ∈ S. We thus can define a monoidal category LinRel: Objects finite dimensional vector spaces V Morphisms linear relations R ⊆ V ⊕ W Composition composition of relations Tensor direct sum of relations
SLIDE 45
Behaviours
Given two relations R ⊂ U ⊕ V and S ⊂ V ⊕ W, their composite consists of all elements of (u, w) ∈ U ⊕ W such that there exists v ∈ V with (u, v) ∈ R and (v, w) ∈ S. We thus can define a monoidal category LinRel: Objects finite dimensional vector spaces V Morphisms linear relations R ⊆ V ⊕ W Composition composition of relations Tensor direct sum of relations
SLIDE 46
Behaviours
Given two relations R ⊂ U ⊕ V and S ⊂ V ⊕ W, their composite consists of all elements of (u, w) ∈ U ⊕ W such that there exists v ∈ V with (u, v) ∈ R and (v, w) ∈ S. We thus can define a monoidal category LinRel: Objects finite dimensional vector spaces V Morphisms linear relations R ⊆ V ⊕ W Composition composition of relations Tensor direct sum of relations
SLIDE 47
Behaviours
Given two relations R ⊂ U ⊕ V and S ⊂ V ⊕ W, their composite consists of all elements of (u, w) ∈ U ⊕ W such that there exists v ∈ V with (u, v) ∈ R and (v, w) ∈ S. We thus can define a monoidal category LinRel: Objects finite dimensional vector spaces V Morphisms linear relations R ⊆ V ⊕ W Composition composition of relations Tensor direct sum of relations
SLIDE 48
Behaviours
Given two relations R ⊂ U ⊕ V and S ⊂ V ⊕ W, their composite consists of all elements of (u, w) ∈ U ⊕ W such that there exists v ∈ V with (u, v) ∈ R and (v, w) ∈ S. We thus can define a monoidal category LinRel: Objects finite dimensional vector spaces V Morphisms linear relations R ⊆ V ⊕ W Composition composition of relations Tensor direct sum of relations
SLIDE 49 Behaviours
Theorem The above discussion defines a monoidal functor Circ − → LinRel In particular, composition of relations describes how behaviours
- f subcircuits compose to give the behaviour of a circuit.
SLIDE 50 Signal flow graphs
- Signal flow graphs were invented by Shannon to represent
signal flow in physical systems and their controllers.
- They are directed labelled graphs with two types of node: a
white node which requires the sum of signals out to equal the sum of signals in, and a black node which requires that all signals incident with the node are
- equal. The labels represent the factor by which a signal
traversing the given edge is multiplied by.
SLIDE 51 Signal flow graphs
- Signal flow graphs were invented by Shannon to represent
signal flow in physical systems and their controllers.
- They are directed labelled graphs with two types of node: a
white node which requires the sum of signals out to equal the sum of signals in, and a black node which requires that all signals incident with the node are
- equal. The labels represent the factor by which a signal
traversing the given edge is multiplied by.
SLIDE 52 Signal flow graphs
- In contrast with circuits, signal flow graphs are generally
considered open systems, with given inputs and outputs. As such, they represent a linear relation between the vector spaces generated by the inputs and outputs.
- For example, working over R, the signal flow graph
r
represents the subspace {(a, b, a + rb, b) | a, b ∈ R}
- f the four dimensional vector space generated by the two
inputs and two outputs.
SLIDE 53 Signal flow graphs
- In contrast with circuits, signal flow graphs are generally
considered open systems, with given inputs and outputs. As such, they represent a linear relation between the vector spaces generated by the inputs and outputs.
- For example, working over R, the signal flow graph
r
represents the subspace {(a, b, a + rb, b) | a, b ∈ R}
- f the four dimensional vector space generated by the two
inputs and two outputs.
SLIDE 54 Signal flow graphs
- In analogy with our discussion of circuits, we may also view
these signal flow graphs as ‘closed’ signal flow graphs with marked terminals.
- This gives a category SigFlow with objects sets comprising
‘black’ and ‘white’ elements, and morphisms closed signal flow diagrams with marked terminals, such as
r
- Continuing the analogy with circuits, we get a functor
SigFlow → LinRel.
SLIDE 55 Signal flow graphs
- In analogy with our discussion of circuits, we may also view
these signal flow graphs as ‘closed’ signal flow graphs with marked terminals.
- This gives a category SigFlow with objects sets comprising
‘black’ and ‘white’ elements, and morphisms closed signal flow diagrams with marked terminals, such as
r
- Continuing the analogy with circuits, we get a functor
SigFlow → LinRel.
SLIDE 56 Signal flow graphs
- In analogy with our discussion of circuits, we may also view
these signal flow graphs as ‘closed’ signal flow graphs with marked terminals.
- This gives a category SigFlow with objects sets comprising
‘black’ and ‘white’ elements, and morphisms closed signal flow diagrams with marked terminals, such as
r
- Continuing the analogy with circuits, we get a functor
SigFlow → LinRel.
SLIDE 57 Signal flow graphs
Theorem There is a functor from Circ to SigFlow mapping each finite set X
- f terminals to the disjoint union X ⊔ X, where the first copy of X is
coloured ‘black’ and the second ‘white’, and on morphisms mapping resistors
X Y r
to signal flow graphs
r X ⊔ X Y ⊔ Y
SLIDE 58 Signal flow graphs
Theorem Moreover, this functor makes the diagram Circ
commute.
SLIDE 59 Take home messages
- Categories give a good language in which to formalise
diagrammatic languages.
- Functors allow semantics for diagrams to be assembled
from the semantics of its parts (cf. functor Circ → LinRel).
- Functors also allow precise description of relationships
between diagrammatic languages (cf. functor Circ → SigFlow).
SLIDE 60 Take home messages
- Categories give a good language in which to formalise
diagrammatic languages.
- Functors allow semantics for diagrams to be assembled
from the semantics of its parts (cf. functor Circ → LinRel).
- Functors also allow precise description of relationships
between diagrammatic languages (cf. functor Circ → SigFlow).
SLIDE 61 Take home messages
- Categories give a good language in which to formalise
diagrammatic languages.
- Functors allow semantics for diagrams to be assembled
from the semantics of its parts (cf. functor Circ → LinRel).
- Functors also allow precise description of relationships
between diagrammatic languages (cf. functor Circ → SigFlow).
SLIDE 62 Thanks for listening. This is joint work with John Baez; see http://math.ucr.edu/baez/networks/. Slides will be available at http://www.cs.ox.ac.uk/people/brendan.fong/. Citations can be found by clicking on references and images.