Theory and Applications of Categories, Vol. 30, No. 33, 2015, pp. 1096–1120.

DECORATED COSPANS

BRENDAN FONG

Abstract. Let C be a category with finite colimits, writing its coproduct +, and let (D, ⊗) be a braided monoidal category. We describe a method of producing a symmetric monoidal category from a lax braided monoidal functor F: (C, +) → (D, ⊗), and of producing a strong monoidal functor between such categories from a monoidal natural transformation between such functors. The objects of these categories, our so-called ‘decorated cospan categories’, are simply the objects of C, while the morphisms are pairs comprising a cospan X → N ← Y in C together with an element 1 → F N in D. Moreover, decorated cospan categories are hypergraph categories—each object is equipped with a special commutative Frobenius monoid—and their functors preserve this structure.

1. Introduction

There is a well-known way to compose cospans in a category with finite colimits: given cospans

\xymatrix{ & N &  &  &  & M \\  &  &  & and \\ X \ar[uur]^{i_{X}} &  & Y \ar[uul]_{o_{Y}} &  & Y \ar[uur]^{i_{Y}} &  & Z, \ar[uul]_{o_{Z}}}

we take the pushout over their shared foot Y

\xymatrix{ &  & P \\  & N \ar[ur]^{j} &  & M \ar[ul]_{j′} \\ X \ar[ur]^{i_{X}} &  & Y \ar[ul]_{o_{Y}} \ar[ur]^{i_{Y}} &  & Z \ar[ul]_{o_{Z}}}

to get a cospan from X to Z. In many situations, however, we wish to compose ‘decorated’ cospans, where the apex of each cospan is equipped with some extra structure. In this article we detail a method for composing such decorated cospans.

I thank John Baez, Daniel Marsden, and an anonymous referee for careful, detailed feedback on drafts, Jamie Vicary for useful conversations, and the Clarendon Fund and Hertford College, Oxford, for their support.

Received by the editors 2015-02-01 and, in revised form, 2015-08-04. Transmitted by Tom Leinster. Published on 2015-08-06. 2010 Mathematics Subject Classification: 18C10, 18D10. Key words and phrases: cospan, decorated cospan, hypergraph category, well-supported compact

closed category, separable algebra, Frobenius algebra, Frobenius monoid.

\begin{matrix}c \\ ◯ \end{matrix} Brendan Fong, 2015. Permission to copy for private use granted.

Beyond category theoretic interest, the motivation for such a method lies in developing compositional accounts of semantics associated to topological diagrams. While this has long been a technique associated with topological quantum field theory, dating back to [Atiyah 1988], it has most recently had significant influence in the nascent field of categorical network theory, with application to automata and computation [Katis–Sabadini–Walters 2000, Spivak 2013], electrical circuits [Baez–Fong 2015], signal flow diagrams [Bonchi–Sobociński–Zanasi 2014, Baez–Erbele 2015], Markov processes [Baez–Fong–Pollard 2015, Albasini–Sabadini–Walters 2011], and dynamical systems [Vagner–Spivak–Lerman 2014], among others.

It has been recognised for some time that spans and cospans provide an intuitive framework for composing network diagrams [Katis–Sabadini–Walters 1997], and the material we develop here is a variant on this theme. In the case of finite graphs, the intuition reflected is this: given two graphs, we may construct a third by gluing chosen vertices of the first with chosen vertices of the second. It is our goal in this article to view this process as composition of morphisms in a category, in a way that also facilitates the construction of a composition rule for any semantics associated to the diagrams, and a functor between these two resulting categories.

To see how this works, let us start with the following graph:

0.2 1.3 0.8 2.0

We shall work with labelled, directed graphs, as the additional data help highlight the relationships between diagrams. Now, for this graph to be a morphism, we must equip it with some notion of ‘input’ and ‘output’. We do this by marking vertices using functions from finite sets:

\begin{matrix}X \\ Y \\ 0.2 \\ 1.3 \\ 0.8 \\ 2.0 \end{matrix}

Let N be the set of vertices of the graph. Here the finite sets X, Y, and N comprise one, two, and three elements respectively, drawn as points, and the values of the functions X → N and Y → N are indicated by the grey arrows. This forms a cospan in the category of finite sets, one with the set at the apex decorated by our given graph.

Given another such decorated cospan with input set equal to the output of the above cospan

\begin{matrix}Y \\ Z \\ 1.7 \\ 0.3 \end{matrix}

composition involves gluing the graphs along the identifications

\begin{matrix}X \\ Y \\ 0.2 \\ 1.3 \\ 0.8 \\ 2.0 \\ Z \\ 1.7 \\ 0.3 \end{matrix}

specified by the shared foot of the two cospans. This results in the decorated cospan

\begin{matrix}X \\ Z \\ 0.2 \\ 1.3 \\ 0.8 \\ 2.0 \\ 1.7 \\ 0.3 \end{matrix}

The decorated cospan framework generalises this intuitive construction.

More precisely: fix a set L. Then given a finite set N, we may talk of the collection of finite L-labelled directed multigraphs, to us just L-graphs or simply graphs, that have N as their set of vertices. Write such a graph (N, E, s, t, r), where E is a finite set of edges, s: E → N and t: E → N are functions giving the source and target of each edge respectively, and r: E → L equips each edge with a label from the set L. Next, given a function f: N → M, we may define a function from graphs on N to graphs on M mapping (N, E, s, t, r) to (M, E, f ∘ s, f ∘ t, r). After dealing appropriately with size issues, this gives a lax monoidal functor from (FinSet, +) to (Set, ×).^{1}

Now, taking any lax monoidal functor (F, φ): (C, +) → (D, ⊗) with C having finite colimits and coproduct written +, the decorated cospan category associated to F has as objects the objects of C, and as morphisms pairs comprising a cospan in C together with some morphism 1 → F N, where 1 is the unit in (D, ⊗) and N is the apex of the cospan.

1Here (FinSet, +) is the monoidal category of finite sets and functions with disjoint union as monoidal product, and (Set, ×) is the category of sets and functions with cartesian product as monoidal product.

One might ensure the collection of graphs forms a set in a number of ways. One such method is as follows:

the categories of finite sets and finite graphs are essentially small; replace them with equivalent small categories. We then constrain the graphs (N, E, s, t, r) to be drawn only from the objects of our small category of finite graphs.

In the case of our graph functor, this additional data is equivalent to equipping the apex N of the cospan with a graph. We thus think of our morphisms as having two distinct parts: an instance of our chosen structure on the apex, and a cospan describing interfaces to this structure. Our first theorem says that when (D, ⊗) is braided monoidal and (F, φ) lax braided monoidal, we may further give this data a composition rule and monoidal product such that the resulting ‘decorated cospan category’ is symmetric monoidal with a special commutative Frobenius monoid on each object.

Suppose now we have two such lax monoidal functors; we then have two such decorated cospan categories. Our second theorem is that, given also a monoidal natural transformation between these functors, we may construct a strict monoidal functor between their corresponding decorated cospan categories. These natural transformations can often be specified by some semantics associated to some type of topological diagram. A trivial case of such is assigning to a finite graph its number of vertices, but richer examples abound, including assigning to a directed graph with edges labelled by rates its depicted Markov process, or assigning to an electrical circuit diagram the current–voltage relationship such a circuit would impose.

An advantage of the decorated cospan framework is that the resulting categories are hypergraph categories, and the resulting functors respect this structure. As dagger compact categories, hypergraph categories themselves have a rich diagrammatic nature [Selinger 2011], and in cases when our decorated cospan categories are inspired by diagrammatic applications, the hypergraph structure provides language to describe natural operations on our diagrams, such as juxtaposing, rotating, and reflecting them.

1.1. Outline. The structure of this paper is straightforward: in the following section we review some basic background material, which then allows us to give the constructions of decorated cospan categories and their functors in Sections 3 and 4 respectively. We then explicate these definitions through some examples in Section 5. For completeness, we supply further details of our proofs in the Appendix A.

1.2. Notation. We shall assume the following standard names for certain distinguished objects and morphisms, only disambiguating the symbols with subscripts when we judge that the extra clarity is worth the clutter. We write:

• 1 for both identity morphisms and monoidal units, leaving context to determine which one we mean.

• λ, ρ, a, and σ for respectively the left unitor, right unitor, associator, and, if present, braiding, in a monoidal category.

• ∅ for the initial object in a category.

• ! for the unique map from the initial object to a given object.

2. Background

2.1. Cospan categories. Recall that a cospan from X to Y in a category C is an object N in C with a pair of morphisms (i: X → N, o: Y → N):

\xymatrix{ & N \\ X \ar[ur]^{i} &  & Y. \ar[ul]_{o}}

We shall refer to X and Y as the feet, and N as the apex of the cospan. Cospans may be composed using the pushout from the common foot, when such a pushout exists: given cospans X ⟶^{i_{X}} N ⟵^{o_{Y}} Y from X to Y and Y ⟶^{i_{Y}} M ⟵^{o_{Z}} Z from Y to Z, their composite cospan is X ⟶^{j∘i_{X}} P ⟵^{j′∘i_{Z}} Z, where P, (j: N → P), and (j′: M → P) form the top half of the pushout square

\xymatrix{ &  & P \\  & N \ar[ur]^{j} &  & M \ar[ul]_{j′} \\ X \ar[ur]^{i_{X}} &  & Y \ar[ul]_{o_{Y}} \ar[ur]^{i_{Y}} &  & Z. \ar[ul]_{o_{Z}}}

A map of cospans is a morphism n: N → N′ in C between the apices of two cospans X ⟶^{i} N ⟵^{o} Y and X ⟶^{i′} N′ ⟵^{o′} Y with the same feet, such that both triangles

\xymatrix{ & N \ar[dd]^{n} \\ X \ar[ur]^{i} \ar[dr]_{i′} &  & Y \ar[ul]_{o} \ar[dl]^{o′} \\  & N′}

commute. Given a category C with pushouts, we may define a category Cospan(C) with objects the objects of C and morphisms isomorphism classes of cospans [Benabou 1967]. We will often abuse our terminology and refer to cospans themselves as morphisms in some cospan category Cospan(C); we of course refer instead to the isomorphism class of the said cospan.

2.2. Hypergraph categories. A Frobenius monoid (X, μ, δ, η, ϵ) in a monoidal category (C, ⊗) is an object X together with monoid (X, μ, η) and comonoid (X, δ, ϵ) structures such that

(1 ⊗ μ) ∘ (δ ⊗ 1) = δ ∘ μ = (μ ⊗ 1) ∘ (1 ⊗ δ): X ⊗ X ⟶ X ⊗ X.

A Frobenius monoid is further called special if

μ ∘ δ = 1: X ⟶ X,

and further called commutative if the ambient monoidal category is symmetric and the monoid and comonoid structures that comprise the Frobenius monoid are commutative and cocommutative respectively. Note that for Frobenius monoids commutativity of the monoid structure implies cocommutativity of the comonoid structure, and vice versa, so the use of the term ‘commutativity’ for both the Frobenius monoid and the constituent monoid is not ambiguous.

A hypergraph category is a symmetric monoidal category in which each object is equipped with a special commutative Frobenius structure (X, μ_{X}, δ_{X}, η_{X}, ϵ_{X}) such that

\begin{matrix}μ_{X⊗Y} = (μ_{X} ⊗ μ_{Y}) ∘ (1_{X} ⊗ σ_{Y X} ⊗ 1_{Y}) & η_{X⊗Y} = η_{X} ⊗ η_{Y} \\ δ_{X⊗Y} = (1_{X} ⊗ σ_{XY} ⊗ 1_{Y}) ∘ (δ_{X} ⊗ δ_{Y}) & ϵ_{X⊗Y} = ϵ_{X} ⊗ ϵ_{Y} . \end{matrix}

A functor (F, φ) of hypergraph categories, or hypergraph functor, is a strong symmetric monoidal functor (F, φ) that preserves the hypergraph structure. More precisely, the latter condition means that given an object X, the special commutative Frobenius structure on F X must be

(F X, F μ_{X} ∘ φ_{X,X}, φ^{−1} ∘ F δ_{X}, F η_{X} ∘ φ_{1}, φ_{1} ∘ ϵ_{X}).

This terminology was introduced recently [Kissinger 2014], in reference to the fact that these special commutative Frobenius monoids provide precisely the structure required to draw graphs with ‘hyperedges’: wires connecting any number of inputs to any number of outputs. Commutative special Frobenius monoids are also known as commutative separable algebras [Rosebrugh–Sabadini–Walters 2005], and hypergraph categories as well-supported compact closed categories [Carboni 1991].

Note that if an object X is equipped with a Frobenius monoid structure then the maps ϵ ∘ μ: X ⊗ X ⟶ 1 and δ ∘ η: 1 ⟶ X ⊗ X obey

(1 ⊗ (ϵ ∘ μ)) ∘ ((δ ∘ η) ⊗ 1) = 1_{X} = ((ϵ ∘ μ) ⊗ 1) ∘ (1 ⊗ (δ ∘ η)): X ⟶ X.

Thus if an object carries a Frobenius monoid it is also self-dual, and any hypergraph category is a fortiori self-dual compact closed. Mapping each morphism f: X → Y to its dual morphism

((ϵ_{Y} ∘ μ_{Y}) ⊗ 1_{X}) ∘ (1_{Y} ⊗ f ⊗ 1_{X}) ∘ (1_{Y} ⊗ (δ_{X} ∘ η_{X})): Y ⟶ X

further equips each hypergraph category with a so-called dagger functor—an involutive contravariant endofunctor that is the identity on objects—such that the category is a dagger compact category. Dagger compact categories were first introduced in the context of categorical quantum mechanics [Abramsky–Coecke 2004], under the name strongly compact closed category, and have been demonstrated to be a key structure in diagrammatic reasoning and the logic of quantum mechanics.

We shall see that every decorated cospan category is a hypergraph category, and hence also a dagger compact category.

2.3. Example. A central example of a hypergraph category is the category Cospan(C) of cospans in any category C with finite colimits. We will later see that decorated cospan categories are a generalisation of such categories, and each inherits a hypergraph structure from such.

First, Cospan(C) inherits a symmetric monoidal structure from C. We call a subcategory C of a category D wide if C contains all objects of D, and call a functor that is faithful and bijective-on-objects a wide embedding. Note then that we have a wide embedding

C ⟶ Cospan(C)

that takes each object of C to itself as an object of Cospan(C), and each morphism f: X → Y in C to the cospan

[figure: Y; X; f; Y,]

where the extended ‘equals’ sign denotes an identity morphism. This allows us to view C as a wide subcategory of Cospan(C).

Now as C has finite colimits, it can be given a symmetric monoidal structure with the coproduct the monoidal product; we write this monoidal category (C, +), and write ∅ for the initial object, the monoidal unit of this category. Then Cospan(C) inherits the same symmetric monoidal structure: since the monoidal product +: C × C → C is left adjoint to the diagram functor, it preserves colimits, and so extends to a functor +: Cospan(C) × Cospan(C) → Cospan(C). The remainder of the monoidal structure is inherited because C is a wide subcategory of Cospan(C).

Next, the Frobenius structure comes from copairings of identity morphisms. We call cospans

\xymatrix{ & N &  &  &  & N \\  &  &  & and \\ X \ar[uur]^{i} &  & Y \ar[uul]_{o} &  & Y \ar[uur]^{o} &  & X \ar[uul]_{i}}

that are reflections of each other opposite cospans. Given any object X in C, the copairing [1_{X}, 1_{X}]: X +X → X of two identity maps on X, together with the unique map !: ∅ → X from the initial object to X, define a monoid structure on X. Considering these maps as morphisms in Cospan(C), we may take them together with their opposites to give a special commutative Frobenius structure on X. In this way we consider each category Cospan(C) a hypergraph category.

It is a simple computation to check that the resulting dagger functor simply takes a cospan X ⟶^{i} N ⟵^{o} Y to its opposite cospan Y ⟶^{o} N ⟵^{i} X.

3. Decorated cospan categories

We now detail our central construction and state the main theorem.

3.1. Definition. Let C be a category with finite colimits, and

(F, φ): (C, +) ⟶ (D, ⊗)

be a lax monoidal functor. We define a decorated cospan, or more precisely an F - decorated cospan, to be a pair

( \xymatrix{ & N \\ X \ar[ur]^{i} & & Y \ar[ul]_{o}} , \xymatrix{F N \\ 1 \ar[u]_{s}} )

comprising a cospan X →^{i} N ←^{o} Y in C together with an element 1 →^{s} F N of the F -image F N of the apex of the cospan. We shall call the element 1 →^{s} F N the decoration of the decorated cospan. A morphism of decorated cospans

n: (X ⟶^{i_{X}} N ⟵^{o_{Y}} Y, 1 ⟶^{s} F N) ⟶ (X ⟶^{i′_{X}} N′ ⟵^{o′_{Y}} Y, 1 ⟶^{s′} F N′)

is a morphism n: N → N′ of cospans such that F n ∘ s = s′.

3.2. Proposition. There is a category F Cospan of F -decorated cospans, with objects the objects of C, and morphisms isomorphism classes of F -decorated cospans. On representatives of the isomorphism classes, composition in this category is given by pushout of cospans in C

\xymatrix{ &  & N +_{Y} M \\  & N \ar[ur]^{j_{N}} &  & M \ar[ul]_{j_{M}} \\ X \ar[ur]^{i_{X}} &  & Y \ar[ul]_{o_{Y}} \ar[ur]^{i_{Y}} &  & Z \ar[ul]_{o_{Z}}}

paired with the composite

1 ⟶^{λ^{−1}} 1 ⊗ 1 ⟶^{s⊗t} F N ⊗ F M ⟶^{φ_{N,M}} F (N + M) ⟶^{F [j_{N} ,j_{M}]} F (N +_{Y} M)

of the tensor product of the decorations with the F -image of the copairing of the pushout maps.

Proof. The identity morphism on an object X in a decorated cospan category is simply the identity cospan decorated as follows:

( [figure: X; X; X] , \xymatrix{F X \\ F ∅ \ar[u]_{F!} \\ 1 \ar[u]_{φ_{1}}} ) .

We must check that the composition defined is well-defined on isomorphism classes, is associative, and, with the above identity maps, obeys the unitality axiom. These are straightforward, but lengthy, exercises in using the available colimits and monoidal structure to show that the relevant diagrams of decorations commute. The interested reader can find details in the appendix (A.1–A.3).

3.3. Remark. While at first glance it might seem surprising that we can construct a composition rule for decorations s: 1 → F N and t: 1 → F M just from monoidal structure, the copair [j_{N}, j_{M}]: N + M → N +_{Y} M of the pushout maps contains the data necessary to compose them. Indeed, this is the key insight of the decorated cospan construction. To wit, the coherence maps for the lax monoidal functor allow us to construct an element of F (N + M) from the monoidal product s ⊗ t of the decorations, and we may then post-compose with F [j_{N}, j_{M}] to arrive at an element of F (N +_{Y} M). The map [j_{N}, j_{M}] encodes the identification of the image of Y in N with the image of the same in M, and so describes merging the ‘overlap’ of the two decorations.

Our main theorem is that when braided monoidal structure is present, the category of decorated cospans is a hypergraph category, and moreover one into which the category of ‘undecorated’ cospans widely embeds. This embedding motivates the monoidal and hypergraph structures we put on F Cospan.

3.4. Theorem. Let C be a category with finite colimits, (D, ⊗) a braided monoidal category, and (F, φ): (C, +) → (D, ⊗) be a lax braided monoidal functor. Then we may give F Cospan a symmetric monoidal and hypergraph structure such that there is a wide embedding of hypergraph categories

Cospan(C) ⟶ F Cospan.

Proof. Recall that the identity decorated cospan has apex decorated by 1 ⟶^{φ_{1}} F ∅ ⟶^{F!} F X. Given any cospan X → N ← Y, we call the decoration 1 ⟶^{φ_{1}} F ∅ ⟶^{F!} F N the empty decoration on N. We define a functor

Cospan(C) ⟶ F Cospan.

mapping each object of Cospan(C) to itself as an object of F Cospan, and each cospan in C to the same cospan decorated with the empty decoration on its apex. As the composite of two empty-decorated cospans is again empty-decorated (see Appendix A.4), this defines a functor.

We define the monoidal product of objects X and Y of F Cospan to be their coproduct X+Y in C, and define the monoidal product of decorated cospans (X ⟶^{i_{X}} N ⟵^{o_{Y}} Y, 1 ⟶^{s}

F N) and (X′ ⟶^{i_{X′}} N′ ⟵^{o_{Y′}} Y′, 1 ⟶^{t} F N′) to be

( \xymatrix{ & N + N′ \\ X + X′ \ar[ur]^{i_{X}+i_{X′}} & & Y + Y′ \ar[ul]_{o_{Y} +o_{Y′}}} , \xymatrix{F (N + N′) \\ F N ⊗ F N′ \ar[u]_{φ_{N,N′}} \\ 1 ⊗ 1 \ar[u]_{s⊗t} \\ 1 \ar[u]_{λ^{−1}}} ) .

Using the braiding in D, we can show that this proposed monoidal product is functorial (Appendix A.5). Choosing associator, unitors, and braiding in F Cospan to be the images of those in Cospan(C), we have a symmetric monoidal category. These transformations remain natural transformations when viewed in the category of F -decorated cospans as they have empty decorations (see Appendix A.6), and obey the required coherence laws as they are images of maps that obey these laws in Cospan(C).

Similarly, to arrive at the hypergraph structure on F Cospan, we simply equip each object X with the image of the special commutative Frobenius monoid specified by the hypergraph structure of Cospan(C). It is evident that this choice of structures implies the above wide embedding is a hypergraph functor.

Note that if the monoidal unit in (D, ⊗) is the initial object, then each object only has one possible decoration: the empty decoration. This immediately implies the following corollary.

3.5. Corollary. Let 1_{C}: (C, +) → (C, +) be the identity functor on a category C with finite colimits. Then Cospan(C) and 1_{C}Cospan are isomorphic as hypergraph categories.

Thus we see that there is always a hypergraph functor between decorated cospan categories 1_{C}Cospan → F Cospan. This provides an example of a more general way to construct hypergraph functors between decorated cospan categories. We detail this in the next section.

4. Functors between decorated cospan categories

Decorated cospans provide a setting for formulating various operations that we might wish to enact on the decorations, including the composition of these decorations, both sequential and monoidal, as well as dagger, dualising, and other operations afforded by the Frobenius structure. We now observe that these operations are formulated in a systematic way, so that transformations of the decorating structure—that is, monoidal transformations between the lax monoidal functors defining decorated cospan categories—respect these operations.

4.1. Theorem. Let C, C′ be categories with finite colimits, abusing notation to write the coproduct in each category +, and (D, ⊗), (D′, ⊠) be braided monoidal categories. Further let

(F, φ): (C, +) ⟶ (D, ⊗)

and

(G, γ): (C′, +) ⟶ (D′, ⊠)

be lax braided monoidal functors. This gives rise to decorated cospan categories F Cospan and GCospan.

Suppose then that we have a finite colimit-preserving functor A: C → C′ with accompanying natural isomorphism α: A(−) + A(−) ⇒ A(− + −), a lax monoidal functor (B, β): (D, ⊗) → (D′, ⊠), and a monoidal natural transformation θ: (B ∘ F, Bφ ∘ β) ⇒ (G ∘ A, Gα ∘ γ). This may be depicted by the diagram:

[figure: (C, +); (F,φ); (A,α); θ; (D, ⊗); (B,β); (C′, +); (G,γ); (D′, ⊠).]

Then we may construct a hypergraph functor

(T, τ): F Cospan ⟶ GCospan

mapping objects X ∈ F Cospan to AX ∈ GCospan, and morphisms

( \xymatrix{ & N \\ X \ar[ur]^{i} &  & Y \ar[ul]_{o}} ,  \xymatrix{F N \\ 1_{D} \ar[u]_{s}} )  to  ( \xymatrix{ & AN \\ AX \ar@{-->}[ur]^{Ai} &  & AY \ar[ul]_{Ao}} ,  \xymatrix{GAN \\ BF N \ar[u]_{θ_{N}} \\ B1_{D} \ar[u]_{Bs} \\ 1_{D′} \ar[u]_{β_{1}}} ) .

Moreover, (T, τ) is a strict monoidal functor if and only if (A, α) is.

Proof. We must prove that (T, τ) is a functor, is strong symmetric monoidal, and that it preserves the special commutative Frobenius structure on each object.

Checking the functoriality of T is again an exercise in applying the properties of structure available—in this case the colimit-preserving nature of A and the monoidality of (D, ⊠), (B, β), and θ—to show that the relevant diagrams of decorations commute. Again, the interested reader may find details in the appendix (A.7).

The coherence maps of the functor are given by the coherence maps for the monoidal functor A, viewed now as cospans with the empty decoration. That is, we define the coherence maps τ to be the collection of isomorphisms

τ_{1} = ( [figure: A∅_{C}; ∅_{C′}; α_{1}; A∅_{C}] , \xymatrix{GA∅_{C} \\ G∅_{C′} \ar[u]_{G!} \\ 1_{D′} \ar[u]_{γ_{1}}} ) ,

τ_{X,Y} = ( [figure: A(X + Y); AX + AY; α_{X,Y}; A(X + Y)] , \xymatrix{GA(X + Y) \\ G∅_{C′} \ar[u]_{G!} \\ 1_{D} \ar[u]_{γ_{1}}} ) ,

where X, Y are objects of GCospan. As (A, α) is already strong symmetric monoidal and τ merely views these maps in C as empty-decorated cospans in GCospan, τ is natural in X and Y, and obeys the required coherence axioms for (T, τ) to also be strong symmetric monoidal (Appendix A.8). Moreover, as A is coproduct-preserving and the Frobenius structures on F Cospan and GCospan are built using various copairings of the identity map, (T, τ) preserves the hypergraph structure.

Finally, it is straightforward to observe that the maps τ are identity maps if and only if the maps α are, so (T, τ) is a strict monoidal functor if and only (A, α) is.

When the decorating structure comprises some notion of topological diagram, such as a graph, these natural transformations θ might describe some semantic interpretation of the decorating structure. In this setting the above theorem constructs functorial semantics for the decorated cospan category of diagrams. We conclude this paper with an example of this application of decorated cospans.

5. Examples

In this final section we outline two constructions of decorated cospan categories, based on labelled graphs and linear subspaces respectively, and a functor between these two categories interpreting each graph as an electrical circuit. We shall see that the decorated cospan framework allows us to take a notion of closed system and construct a corresponding notion of open or composable system, together with functorial semantics for these systems.

This electrical circuits example outlines the motivating application for the decorated cospan construction; further details can be found in [Baez–Fong 2015].

5.1. Labelled graphs. To begin we return to the example of this paper’s introduction.

Recall that a (0, ∞)-graph (N, E, s, t, r) comprises a finite set N of vertices (or nodes), a finite set E of edges, functions s, t: E → N describing the source and target of each edge, and a function r: E → (0, ∞) labelling each edge. The decorated cospan framework allows us to construct a category with, roughly speaking, these graphs as morphisms. More precisely, our morphisms will consist of these graphs, together with subsets of the nodes marked, with multiplicity, as ‘input’ and ‘output’ connection points.

As suggested in the introduction, pick small categories equivalent to the categories of finite sets and (0, ∞)-graphs such that we may talk about the set of all (0, ∞)-graphs on each finite set N. Then we may consider the functor

Graph: (FinSet, +) ⟶ (Set, ×) taking a finite set N to the set Graph(N) of (0, ∞)-graphs (N, E, s, t, r) with set of nodes N. On morphisms let it take a function f: N → M to the function that pushes labelled graph structures on a set N forward onto the set M:

Graph(f): Graph(N) ⟶ Graph(M);
(N, E, s, t, r) ⟼ (M, E, f ∘ s, f ∘ t, r).

As this map simply acts by post-composition, our map Graph is indeed functorial.

We then arrive at a lax braided monoidal functor (Graph, ζ) by equipping this functor with the natural transformation

ζ_{N,M}: Graph(N) × Graph(M) ⟶ Graph(N + M);
((N, E, s, t, r), (M, F, s′, t′, r′)) ⟼ (N + M, E + F, s + s′, t + t′, [r, r′]),

together with the unit map

ζ_{1} : 1 = {•} ⟶ Graph(∅);
• ⟼ (∅, ∅,!,!,!),

where we remind ourselves that we write [r, r′] for the copairing of the functions r and r′. The naturality of this collection of morphisms, as well as the coherence laws for lax braided monoidal functors, follow from the universal property of the coproduct.

Theorem 3.4 thus allows us to construct a hypergraph category GraphCospan. For an intuitive visual understanding of the morphisms of this category and its composition rule, see this paper’s introduction.

5.2. Linear relations. Another example of a decorated cospan category arising from a functor (FinSet, +) → (Set, ×) is closely related to the category of linear relations. Here we decorate each cospan in Set with a linear subspace of ℝ^{N} ⊕ (ℝ^{N})^{∗}, the sum of the vector space generated by the apex N over ℝ and its vector space dual.

First let us recall some facts about relations. Let R ⊆ X × Y be a relation; we write this also as R: X → Y. The opposite relation R^{opp} : Y → X, is the subset R^{opp} ⊆ Y × X such that (y, x) ∈ R^{opp} if and only if (x, y) ∈ R. We say that the image of a subset S ⊆ X under a relation R: X → Y is the subset of all elements of the codomain Y related by R to an element of S. Note that if X and Y are vector spaces and S and R are both linear subspaces, then the image R(S) of S under R is again a linear subspace.

Now any function f: N → M induces a linear map f^{∗}: ℝ^{M} → ℝ^{N} by precomposition. This linear map f^{∗} itself induces a dual map f_{∗}: (ℝ^{N})^{∗} → (ℝ^{M})^{∗} by precomposition. Furthermore f^{∗} has, as a linear relation f^{∗} ⊆ ℝ^{M} ⊕ ℝ^{N}, an opposite linear relation (f^{∗})^{opp} : ℝ^{N} → ℝ^{M}. Define the functor

LinSub: (FinSet, +) ⟶ (Set, ×) taking a finite set N to set of linear subspaces of the vector space ℝ^{N} ⊕(ℝ^{N})^{∗}, and taking a function f: N → M to the function LinSub(N) → LinSub(M) induced by the sum of these two relations:

LinSub(f): LinSub(N) ⟶ LinSub(M);
L ⟼ ((f^{∗})^{opp} ⊕ f_{∗})(L).

The above operations on f used in the construction of this map are functorial, and so it is readily observed that LinSub is indeed a functor.

It is moreover lax braided monoidal as the sum of linear subspace of ℝ^{N} ⊕(ℝ^{N})^{∗} and a linear subspace of ℝ^{M} ⊕(ℝ^{M})^{∗} may be viewed as a subspace of ℝ^{N} ⊕(ℝ^{N})^{∗}⊕ℝ^{M} ⊕(ℝ^{M})^{∗} ≅ ℝ^{N+M} ⊕ (ℝ^{N+M})^{∗} ≅ ℝ^{M+N} ⊕ (ℝ^{M+N})^{∗}, and the empty subspace is a linear subspace of each ℝ^{N} ⊕ (ℝ^{N})^{∗}.

We thus have a hypergraph category LinSubCospan.

5.3. Electrical circuits. Electrical circuits and their diagrams are the motivating application for the decorated cospan construction. Specialising to the case of networks of linear resistors, we detail here how we may use the category LinSubCospan to provide semantics for the morphisms of GraphCospan as diagrams of networks of linear resistors.

Intuitively, after choosing a unit of resistance, say ohms (Ω), each (0, ∞)-graph can be viewed as a network of linear resistors, with the (0, ∞)-graph of the introduction now more commonly depicted as

\begin{matrix}0.2Ω \\ 1.3Ω \\ 0.8Ω \\ 2.0Ω \end{matrix}

GraphCospan may then be viewed as a category with morphisms circuits of linear resistors equipped with chosen input and output terminals.

The suitability of this language is seen in the way the different categorical structures of GraphCospan capture different operations that can be performed with circuits. To wit, the sequential composition expresses the fact that we can connect the outputs of one circuit to the inputs of the next, while the monoidal composition models the placement of circuits side-by-side. Furthermore, the symmetric monoidal structure allows us reorder input and output wires, the compactness captures the interchangeability between input and output terminals of circuits—that is, the fact that we can choose any input terminal to our circuit and consider it instead as an output terminal, and vice versa—and the Frobenius structure expresses the fact that we may wire any node of the circuit to as many additional components as we like.

Moreover, Theorem 4.1 provides semantics. Each node in a network of resistors can be assigned an electric potential and a net current outflow at that node, and so the set N of vertices of a (0, ∞)-graph can be seen as generating a space ℝ^{N} ⊕ (ℝ^{N})^{∗} of electrical states of the network. We define a natural transformation

Res: Graph ⟹ LinSub

mapping each (0, ∞)-graph on N, viewed as a network of resistors, to the linear subspace of ℝ^{N} ⊕ (ℝ^{N})^{∗} of electrical states permitted by Ohm’s law.^{2} In detail, let ψ ∈ ℝ^{N}. We define the power Q: ℝ^{N} → ℝ corresponding to a (0, ∞)-graph (N, E, s, t, r) to be the function

Q(ψ) = ∑_{e∈E} \frac{1}{r(e)}(ψ(t(e)) − ψ(s(e)))^{2}.

Then the states of a network of resistors are given by a potential ϕ on the nodes and the gradient of the power at this potential:

Res_{N}: Graph(N) ⟶ LinSub(N)
(N, E, s, t, r) ⟼ {(ϕ, ∇Q_{ϕ}) | ϕ ∈ ℝ^{N}}.

This defines a monoidal natural transformation. Hence, by Theorem 4.1, we obtain a hypergraph functor GraphCospan → LinSubCospan.

The semantics provided by this functor match the standard interpretation of networks of linear resistors. The maps of the Frobenius monoid take on the interpretation of perfectly conductive wires, forcing the potentials at all nodes they connect to be equal, and the sum of incoming currents to equal the sum of outgoing currents—precisely the behaviour implied by Kirchhoff’s laws. More generally, let (X →^{i} N ←^{o} Y, (N, E, s, t, r)) be a morphism of GraphCospan, with Q the power function corresponding to the graph Γ = (N, E, s, t, r). The image of this decorated cospan in LinSubCospan is the decorated cospan (X →^{i} N ←^{o} Y, {(ϕ, ∇Q_{ϕ}) | ϕ ∈ ℝ^{N}}). Then it is straightforward to check that the subspace

LinSub[i, o]( Res_{N}(Γ)) ⊆ ℝ^{X+Y} ⊕ (ℝ^{X+Y})^{∗}

is the subspace of electrical states on the terminals X+Y such that currents and potentials can be chosen across the network of resistors (N, E, s, t, r) that obey Ohm’s and, on its interior, Kirchhoff’s laws. In particular, after passing to a subspace of the terminals in this way, composition in LinSubCospan corresponds to enforcing Kirchhoff’s laws on the shared terminals of the two networks. A full exposition of this example can be found in [Baez–Fong 2015].

A. Appendix: Proofs

In this appendix we include the more technical aspects of the proofs that the proposed constructions are well-defined and have the properties claimed. This requires checking that a number of diagrams in decorated cospan categories commute. In particular, here we check that the decorations agree; the required properties of cospans themselves are well-established. While many of these computations are on the routine side, we err on the side of more detail in the hope that these details might be instructive in understanding more precisely which aspects of monoidal functors imply given aspects of decorated cospan categories.

2Note that these states need not obey Kirchhoff’s current law.

A.1. Representation independence for composition of isomorphism classes of decorated cospans.

Let

n: (X ⟶^{i_{X}} N ⟵^{o_{Y}} Y, 1 ⟶^{s} F N) ⟶ (X ⟶^{i′_{X}} N′ ⟵^{o′_{Y}} Y, 1 ⟶^{s′} F N′)

and

m: (Y ⟶^{i_{Y}} M ⟵^{o_{Z}} Z, 1 ⟶^{t} F M) ⟶ (Y ⟶^{i′_{Y}} M′ ⟵^{o′_{Z}} Z, 1 ⟶^{t′} F M′)

be isomorphisms of decorated cospans. We wish to show that the composite of the decorated cospans on the left is isomorphic to the composite of the decorated cospans on the right. As discussed, it is well-known that the composite cospans are isomorphic, and it remains to us to check the decorations agree too. Let p: N +_{Y} M → N′ +_{Y} M′ be the isomorphism given by the universal property of the pushout and the isomorphisms n: N → N′ and m: M → M′. Then the two decorations in question are given by the top and bottom rows of the following diagram.

[figure: F N ⊗ F M; F n⊗F m; ∼; φ_{N,M}; F (N + M); F (n+m); ∼; F [j_{N} ,j_{M}]; F (N +_{Y} M); F p; ∼; 1; λ^{−1}; 1 ⊗ 1; s⊗t; s′⊗t′; (I); (F); (C); F N′ ⊗ F M′; φ_{N′,M′}; F (N′ + M′); F [j_{N′},j_{M′}]; F (N′ +_{Y} M′)]

The triangle (I) commutes as n and m are morphisms of decorated cospans and − ⊗ − is functorial, (F) commutes by the monoidality of F, and (C) commutes by properties of colimits in C and the functoriality of F. This proves the claim.

A.2. Associativity.

Suppose we have morphisms

(X ⟶^{i_{X}} N ⟵^{o_{Y}} Y, 1 ⟶^{s} F N),

(Y ⟶^{i_{Y}} M ⟵^{o_{Z}} Z, 1 ⟶^{t} F M),

(Z ⟶^{i_{Z}} P ⟵^{o_{W}} W, 1 ⟶^{u} F P).

It is well-known that composition of isomorphism classes of cospans via pushout of representatives is associative; this follows from the universal properties of the relevant colimit.

We must check that the pushforward of the decorations is also an associative process. Write

ã: (N +_{Y} M) +_{Z} P ⟶ N +_{Y} (M +_{Z} P)

for the unique isomorphism between the two pairwise pushouts constructions from the above three cospans. Consider then the following diagram, with leftmost column the decoration obtained by taking the composite of the first two morphisms first, and the rightmost column the decoration obtained by taking the composite of the last two morphisms first.

[figure: F ((N+_{Y} M)+_{Z}P); F ã; F (N+_{Y} (M+_{Z}P)); (C); F ((N+_{Y} M)+P); F [j_{N+_{Y} M} ,j_{P}]; F (N+(M+_{Z}P)); F [j_{N} ,j_{M+_{Z} P}]; F ((N+M)+P); F ([j_{N} ,J_{M}]+1_{P}); F a; F (N+(M+P)); F (1_{N} +[j_{M} ,j_{P}]); (F2); (F3); F (N+_{Y} M)⊗F P; φ_{N+_{Y} M,P}; (F1); F N⊗F (M+_{Z}P); φ_{N,M+_{Z} P}; F (N+M)⊗F P; F [j_{N} ,j_{M}]⊗1_{F P}; φ_{N+M,P}; F N⊗F (M+P); 1_{F N} ⊗F [j_{M} ,j_{P}]; φ_{N,M+P}; (F N⊗F M)⊗F P; φ_{N,M} ⊗1_{F P}; a; F N⊗(F M⊗F P); 1_{F N} ⊗φ_{M,P}; (D2); (1⊗1)⊗1; (s⊗t)⊗u; a; 1⊗(1⊗1); s⊗(t⊗u); (D1); 1⊗1; ρ^{−1}⊗1; 1⊗λ^{−1}; 1; λ^{−1}]

This diagram commutes as (D1) is the triangle coherence equation for the monoidal category (D, ⊗), (D2) is naturality for the associator a, (F1) is the associativity condition for the monoidal functor F, (F2) and (F3) commute by the naturality of φ, and (C) commutes as it is the F -image of a hexagon describing the associativity of the pushout. This shows that the two decorations obtained by the two different orders of composition of our three morphisms are equal up to the unique isomorphism ã between the two different pushouts that may be obtained. Our composition rule is hence associative.

A.3. Identity morphisms.

We shall show that the claimed identity morphism on Y, the decorated cospan

(Y ⟶^{1_{Y}} Y ⟵^{1_{Y}} Y, 1 ⟶^{F!∘φ_{1}} F Y),

is an identity for composition on the right; the case for composition on the left is similar. The cospan in this pair is known to be the identity cospan in Cospan(C). We thus need to check that, given a morphism

(X ⟶^{i} N ⟵^{o} Y, 1 ⟶^{s} F N),

the composite of the product s⊗(F!∘φ_{1}) with the F -image of the copairing [1_{N}, i_{Y}]: N + Y → N of the pushout maps is again the same element s; this composite being, by definition, the decoration of the composite of the given morphism and the claimed identity map. This is shown by the commutativity of the diagram below, with the path along the lower edge equal to the aforementioned pushforward.

[figure: 1; s; ρ_{1}^{−1}; F N; (D1); (F1); 1 ⊗ 1; s⊗1; s⊗(F!∘φ_{1}); F N ⊗ 1; ρ_{F N}; 1_{F N} ⊗φ_{1}; F N ⊗ F ∅; φ_{N,∅}; 1_{F N} ⊗F!; F (N + ∅) (C); F ρ_{N} =F [1_{N} ,!]; F (1_{N} +!); (D2); (F2); F N ⊗ F Y; φ_{N,M}; F (N + Y); F [1_{N} ,i_{Y} ]]

This diagram commutes as each subdiagram commutes: (D1) commutes by the naturality of ρ, (D2) by the functoriality of the monoidal product in D, (F1) by the unit axiom for the monoidal functor F, (F2) by the naturality of φ, and (C) due to the properties of colimits in C and the functoriality of F.

A.4. Empty decorations.

We generalise the previous observation for identity morphisms. Let

(X ⟶^{i_{X}} N ⟵^{o_{Y}} Y, 1 ⟶^{s} F N),

be a decorated cospan, and suppose we have an empty-decorated cospan

(Y ⟶^{i_{Y}} M ⟵^{o_{Z}} Z, 1 ⟶^{φ∘F!} F M).

Here we show that the composite of these decorated cospans is

(X ⟶^{j_{N} ∘i_{X}} N +_{Y} M ⟵^{j_{M} ∘o_{Z}} Z, 1 ⟶^{F j_{N} ∘s} F (N +_{Y} M)).

In particular, the decoration on the composite is the decoration s pushed forward along the F -image of the map j_{N}: N → N +_{Y} M to become an F -decoration on N +_{Y} M. We say that the empty decoration acts trivially on other decorations. The analogous statement holds for composition with an empty-decorated cospan on the left.

As is now familiar, a statement of this sort is proved by a large commutative diagram:

[figure: 1; s; ρ_{1}^{−1}; F N; F j_{N}; F (N +_{Y} M); (D1); (F1); (C1); 1 ⊗ 1; s⊗1; s⊗(F!∘φ_{1}); F N ⊗ 1; ρ_{F N}; 1_{F N} ⊗φ_{1}; F N ⊗ F ∅; φ_{N,∅}; 1_{F N} ⊗F!; F (N + ∅) (C2); F ρ_{N} =F [1_{N} ,!]; F [j_{N} ,!]; F (1_{N} +!); (D2); (F2); F N ⊗ F M; φ_{N,M}; F (N + M); F [j_{N} ,j_{M}]]

This subdiagrams in this diagram commute for the same reasons as their corresponding regions in the previous diagram.

A consequence of the trivial action of the empty decoration is that the composite of two empty-decorated cospans is again empty-decorated. This is crucial for the functoriality of the embedding Cospan(C) ↪ F Cospan.

A.5. Functoriality of monoidal product.

Suppose we have decorated cospans

(X ⟶^{i_{X}} N ⟵^{o_{Y}} Y, 1 ⟶^{s} F N), (Y ⟶^{i_{Y}} M ⟵^{o_{Z}} Z, 1 ⟶^{t} F M),

(U ⟶^{i_{U}} P ⟵^{o_{V}} V, 1 ⟶^{u} F P), (V ⟶^{i_{V}} Q ⟵^{o_{W}} W, 1 ⟶^{v} F Q).

We must check the so-called interchange law: that the composite of the column-wise monoidal products is equal to the monoidal product of the row-wise composites.

Again, for the cospans we take this equality as familiar fact. Write

b: (N + P) +_{(Y +V)} (M + Q) ⟶^{∼} (N +_{Y} M) + (P +_{V} Q).

for the isomorphism between the two resulting representatives of the isomorphism class of cospans. The two resulting decorations are then given by the leftmost and rightmost columns respectively of the diagram below.

[figure: F ((N+P)+_{(Y +V )}(M+Q)); F b; ∼; F ((N+_{Y} M)+(P +_{V} Q)); (C); F ((N+P)+(M+Q)); F [j_{N+P} ,j_{M+Q}]; (F2); F (N+_{Y} M)⊗F (P +_{V} Q); φ_{N+_{Y} M,P +_{V} Q}; F (N+P)⊗F (M+Q); φ_{N+P,M+Q}; F (N+M)⊗F (P +Q); F [j_{N} ,j_{M}]⊗F [j_{P} ,j_{Q}]; (F1); (F N⊗F P)⊗(F M⊗F Q); φ_{N,P} ⊗φ_{M,Q}; (F N⊗F M)⊗(F P ⊗F Q); φ_{N,M} ⊗φ_{P,Q}; (D); (1⊗1)⊗(1⊗1); (s⊗u)⊗(t⊗v); (s⊗t)⊗(u⊗v); 1; (λ^{−1}⊗λ^{−1})∘λ^{−1}]

These two decorations are related by the isomorphism b as the diagram commutes. We argue this more briefly than before, as the basic structure of these arguments is now familiar to us. Briefly then, there exist dotted arrows of the above types such that the subdiagram (D) commutes by the naturality of the associators and braiding in D, (F1) commutes by the coherence diagrams for the braided monoidal functor F, (F2) commutes by the naturality of the coherence map φ for F, and (C) commutes by the properties of colimits in C and the functoriality of F.

Using now routine methods, it also is straightforward to show that the monoidal product of identity decorated cospans on objects X and Y is the identity decorated cospan on X + Y; for the decorations this amounts to the observation that the monoidal product of empty decorations is again an empty decoration.

A.6. Naturality of coherence maps.

We consider the case of the left unitor; the naturality of the right unitor, associator, and braiding follows similarly, using the relevant axiom where here we use the left unitality axiom.

Given a decorated cospan (X ⟶^{i} N ⟵^{o} Y, 1 ⟶^{s} F N), we must show that the diagram of decorated cospans

\xymatrix{X + ∅ \ar[r]^{i+1} \ar[d]_{λ_{C}} & N + ∅ & Y + ∅ \ar[l]_{i+1} \ar[d]^{λ_{C}} \\ X \ar[r]_{i} & N & Y \ar[l]^{o}}

commutes, where the λ_{C} are the maps of the left unitor in C considered as empty-decorated cospans, and where the top cospan has decoration

1 ⟶^{λ_{D}^{−1}} 1 ⊗ 1 ⟶^{s⊗φ_{1}} F N ⊗ F ∅ ⟶^{φ_{N,∅}} F (N + ∅),

and the lower cospan simply has decoration 1 ⟶^{s} F N.

Now as the λ are isomorphisms in C and have empty decorations, by Appendix A.4 the composite through the upper right corner is isomorphic to the decorated cospan

(X + ∅ ⟶^{i+1} N + ∅ ⟵^{(o+1)∘λ_{C}^{−1}} Y, 1 ⟶^{φ_{N,∅}∘(s⊗φ_{1})∘λ_{D}^{−1}} F (N + ∅)),

while the composite through the lower left corner is isomorphic to the decorated cospan

(X + ∅ ⟶^{[i,!]} N ⟵^{o} Y, 1 ⟶^{s} F N).

Furthermore, λ_{C}: N + ∅ → N gives an isomorphism between these two cospans, and the naturality of the left unitor and the left unitality axiom in D imply that this is in fact an isomorphism of decorated cospans:

\xymatrix{1 \ar[rrr]^{s} \ar[d]_{λ_{D}^{−1}} &  &  & F N \\ 1 ⊗ 1 \ar[r]_{s⊗1} & F N ⊗ 1 \ar[r]_{1⊗φ_{1}} \ar[urr]^{λ_{D}} & F N ⊗ F ∅ \ar[r]_{φ_{N,∅}} & F (N + ∅). \ar[u]_{F λ_{C}}}

A.7. Functoriality of functors between decorated cospan categories. Let

(X ⟶^{i_{X}} N ⟵^{o_{Y}} Y, 1 ⟶^{s} F N) and (Y ⟶^{i_{Y}} M ⟵^{o_{Z}} Z, 1 ⟶^{t} F M),

be morphisms in F Cospan. As the composition of the cospan part is by pushout in C in both cases, and as T acts as the colimit preserving functor A on these cospans, it is clear that T preserves composition of isomorphism classes of cospans. Write

c: AX +_{AY} AZ ⟶^{∼} A(X +_{Y} Z)

for the isomorphism from the cospan obtained by composing the A-images of the above two decorated cospans to the cospan obtained by taking the A-image of their composite. To see that this extends to an isomorphism of decorated cospans, observe that the decorations of these two cospans are given by the rightmost and leftmost columns respectively in the following diagram:

[figure: GA(N +_{Y} M); G(AN +_{AY} AM); Gc; ∼; (A); BF (N +_{Y} M); θ_{N+Y M}; (T2); GA(N + M); GA[j_{N} ,j_{M}]; G(AN + AM); G[j_{AN} ,j_{AM}]; ∼; Gα; BF (N + M); BF [j_{N} ,j_{M}]; θ_{N,M}; (T1); GAN ⊠ GAM; γ_{AN,AM}; B(F N ⊗ F M); Bφ_{N,M}; BF N ⊠ BF M; θ_{N} ⊠θ_{M}; β_{F N,F M}; (B2); B(1_{D} ⊗ 1_{D}); B(s⊗t); B1_{D} ⊠ B1_{D}; Bs⊠Bt; β_{1,1}; (B1); (D2); B1_{D}; βλ_{1}^{−1}; λ_{B1}^{−1}; 1_{D′} ⊠ B1_{D}; β_{1}⊠1; 1_{D′} ⊠ 1_{D′}; β_{1}⊠β_{1}; 1⊠β_{1}; (D1); 1_{D′}; β_{1}; λ_{1}^{−1}]

From bottom to top, (D1) commutes by the naturality of λ, (D2) by the functoriality of the monoidal product − ⊠ −, (B1) by the unit law for (B, β), (B2) by the naturality of β, (T1) by the monoidality of the natural transformation θ, (T2) by the naturality of θ, and (A) by the colimit preserving property of A and the functoriality of G.

We must also show that identity morphisms are mapped to identity morphisms. Let

(X ⟶^{1_{X}} X ⟵^{1_{X}} X, 1 ⟶^{F!∘φ_{1}} F X)

be the identity morphism on some object X in the category of F -decorated cospans. Now this morphism has T -image

(AX ⟶^{1_{AX}} AX ⟵^{1_{AX}} AX, 1 ⟶^{θ_{X}∘B(F!∘φ_{1})∘β_{1}} GAX).

But we have the following diagram

[figure: BF ∅_{C}; BF!; θ_{∅}; B1_{D}; Bφ_{1}; BF X; θ_{X}; (T1); (T2); 1_{D′}; β_{1}; γ_{1}; γ_{1}; G∅_{C′}; Gα_{1}; GA∅_{C}; GA!; GAX; (A1); (A2); G∅_{C′}; ∼; G!; G!]

Here (A1) and (A2) commute by the fact A preserves colimits, (T1) commutes by the unit law for the monoidal natural transformation θ, and (T2) commutes by the naturality of θ.

Thus we have the equality of decorations θ_{X} ∘ B(F! ∘ φ_{1}) ∘ β_{1} = G! ∘ γ_{1} : 1 → GAX, and so T sends identity morphisms to identity morphisms.

A.8. Monoidality of functors between decorated cospan categories.

The monoidality of a functor (T, τ) has two aspects: the naturality of the transformation τ, and the coherence axioms. We discuss the former; since τ is just an emptydecorated version of α, the latter then immediately follow from the coherence of α.

The naturality of τ may be proved via the same method as that employed in Appendix A.6; we first use Appendix A.4 to compute the two paths around the naturality square, and then use the naturality of the coherence map α to show that these two decorated cospans are isomorphic.

In slightly more detail, suppose we have decorated cospans

(X ⟶^{i_{X}} N ⟵^{o_{Z}} Z, 1 ⟶^{s} F N) and (Y ⟶^{i_{Y}} M ⟵^{o_{W}} W, 1 ⟶^{t} F M).

Then naturality demands that the cospans

AX + AY ⟶^{Ai_{X}+Ai_{Y}} AN + AM ⟵^{(o_{Z}+o_{W})∘α^{−1}} A(Z + W)

and

AX + AY ⟶^{A(i_{X}+i_{Y} )∘α} A(N + M) ⟵^{A(o_{Z}+o_{W})} A(Z + W)

are isomorphic as decorated cospans, with decorations the top and bottom rows of the diagram below respectively.

\xymatrix{ & 1 ⊗ 1 \ar[r]^{β_{1}⊗β_{1}} & B1 ⊗ B1 \ar[r]^{Bs⊗Bt} & BF N ⊗ BF M \ar[r]^{θ_{N} ⊗θ_{M}} & GAN ⊗ GAM \ar[r]^{γ_{AN,AM}} & G(AN + AM) \ar[dd]^{Gα_{N,M}} \\ 1 \ar[ur]^{λ^{−1}} \ar[dr]_{β_{1}} \\  & B1 \ar[r]_{Bλ^{−1}} & B(1 ⊗ 1) \ar[r]_{B(s⊗t)} & B(F N ⊗ F M) \ar[r]_{Bφ_{N,M}} & B(F (N + M)) \ar[r]_{θ_{N,M}} & G(A(N + M)).}

As it is a subdiagram of the large commutative diagram in Appendix A.7, this diagram commutes. The diagrams required for α_{N,M} to be a morphism of cospans also commute, so our decorated cospans are indeed isomorphic. This proves τ is a natural transformation.

References

[Abramsky–Coecke 2004] S. Abramsky, B. Coecke, A categorical semantics of quantum protocols, Proceedings of the 19th IEEE conference on Logic in Computer Science (LiCS’04). IEEE Computer Science Press (2004). Available as arXiv:quant-ph/0402130.

[Albasini–Sabadini–Walters 2011] L. Albasini, N. Sabadini, R. F. C. Walters, The compositional construction of Markov processes, Appl. Categ. Structures 19 (2011), 425–437. DOI: 10.1007/s10485-010-9233-0.

[Atiyah 1988] Michael Atiyah, Topological quantum field theories, Inst. Hautes Études Sci. Publ. Math. 68 (1988), 175–186.

[Baez–Erbele 2015] J. C. Baez,  J. Erebele,  Categories in con-

trol, Theory Appl. Categ. 30 (2015), 836–881. Available at http://www.tac.mta.ca/tac/volumes/30/24/30-24abs.html.

[Baez–Fong 2015] J. C. Baez, B. Fong, A compositional framework for passive linear networks, preprint. Available as arXiv:1504.05625.

[Baez–Fong–Pollard 2015] J. C. Baez, B. Fong, B. Pollard, A compositional framework for Markov processes, in preparation.

[Benabou 1967] J. Bénabou, Introduction to bicategories I. In Reports of the Midwest Category Seminar, Lecture Notes in Mathematics 47:1–77, Springer, 1967.

[Bonchi–Sobociński–Zanasi 2014] F. Bonchi, P. Sobociński, F. Zanasi, A categorical semantics of signal flow graphs. In CONCUR 2014—Concurrency Theory, Lecture Notes in Computer Science 8704:435–450, Springer, 2014.

[Carboni 1991] A. Carboni, Matrices, relations and group representations, J. Algebra, 138:497-529, 1991.

[Katis–Sabadini–Walters 1997] P. Katis, N. Sabadini, R. F. C. Walters, Span(Graph): A Categorial Algebra of Transition Systems, AMAST ’97 Proceedings of the 6th International Conference on Algebraic Methodology and Software Technology, (1997), 307–321.

[Katis–Sabadini–Walters 2000] P. Katis, N. Sabadini, R. F. C. Walters, On the algebra of systems with feedback & boundary, Rendiconti del Circolo Matematico di Palermo Serie II, Suppl. 63 (2000), 123–156.

[Kissinger 2014] A. Kissinger, Finite matrices are complete for (dagger-)hypergraph categories, preprint. Available as arXiv:1406.5942.

[Rosebrugh–Sabadini–Walters 2005] R. Rosebrugh, N. Sabadini and R. F. C. Walters, Generic commutative separable algebras and cospans of graphs, Theory Appl. Categ. 15 (2005), 264–277. Available at http://www.tac.mta.ca/tac/volumes/15/6/15-06abs.html.

[Selinger 2011] P. Selinger, A survey of graphical languages for monoidal categories. In B. Coecke, ed., New Structures for Physics, Lecture Notes in Physics 813:289–355, Springer, 2011. Available as arXiv:0908.3347.

[Spivak 2013] D. I. Spivak, The operad of wiring diagrams: formalizing a graphical language for databases, recursion, and plug-and-play circuits, preprint. Available as arXiv:1305.0297.

[Vagner–Spivak–Lerman 2014] D. Vagner, D. I. Spivak, E. Lerman, Algebras of open dynamical systems on the operad of wiring diagrams, preprint. Available as arXiv:1408.1598.

Department of Computer Science University of Oxford United Kingdom OX1 3QD

Email: brendan.fong@cs.ox.ac.uk
This article may be accessed at http://www.tac.mta.ca/tac/

THEORY AND APPLICATIONS OF CATEGORIES (ISSN 1201-561X) will disseminate articles that significantly advance the study of categorical algebra or methods, or that make significant new contributions to mathematical science using categorical methods. The scope of the journal includes: all areas of pure category theory, including higher dimensional categories; applications of category theory to algebra, geometry and topology and other areas of mathematics; applications of category theory to computer science, physics and other mathematical sciences; contributions to scientific knowledge that make use of categorical methods. Articles appearing in the journal have been carefully and critically refereed under the responsibility of members of the Editorial Board. Only papers judged to be both significant and excellent are accepted for publication. Full text of the journal is freely available from the journal’s server at http://www.tac.mta.ca/tac/. It is archived electronically and in printed paper format.

Subscription information Individual subscribers receive abstracts of articles by e-mail as they are published. To subscribe, send e-mail to tac@mta.ca including a full name and postal address. For institutional subscription, send enquiries to the Managing Editor, Robert Rosebrugh, rrosebrugh@mta.ca.

Information for authors The typesetting language of the journal is TEX, and L^{A}TEX2e is required. Articles in PDF format may be submitted by e-mail directly to a Transmitting Editor. Please obtain detailed information on submission format and style files at http://www.tac.mta.ca/tac/.

Managing editor. Robert Rosebrugh, Mount Allison University: rrosebrugh@mta.ca

TEXnical editor. Michael Barr, McGill University: barr@math.mcgill.ca

Assistant TEX editor. Gavin Seal, Ecole Polytechnique Fédérale de Lausanne:

gavin seal@fastmail.fm

Transmitting editors.

Clemens Berger, Université de Nice-Sophia Antipolis: cberger@math.unice.fr Richard Blute, Université d’ Ottawa: rblute@uottawa.ca Lawrence Breen, Université de Paris 13: breen@math.univ-paris13.fr Ronald Brown, University of North Wales: ronnie.profbrown(at)btinternet.com

Valeria de Paiva: valeria.depaiva@gmail.com

Ezra Getzler, Northwestern University: getzler(at)northwestern(dot)edu Kathryn Hess, Ecole Polytechnique Fédérale de Lausanne: kathryn.hess@epfl.ch Martin Hyland, University of Cambridge: M.Hyland@dpmms.cam.ac.uk Anders Kock, University of Aarhus: kock@imf.au.dk Stephen Lack, Macquarie University: steve.lack@mq.edu.au F. William Lawvere, State University of New York at Buffalo: wlawvere@buffalo.edu Tom Leinster, University of Edinburgh: Tom.Leinster@ed.ac.uk Ieke Moerdijk, Radboud University Nijmegen: i.moerdijk@math.ru.nl Susan Niefield, Union College: niefiels@union.edu Robert Paré, Dalhousie University: pare@mathstat.dal.ca Jiri Rosicky, Masaryk University: rosicky@math.muni.cz Giuseppe Rosolini, Università di Genova: rosolini@disi.unige.it Alex Simpson, University of Ljubljana: Alex.Simpson@fmf.uni-lj.si James Stasheff, University of North Carolina: jds@math.upenn.edu Ross Street, Macquarie University: street@math.mq.edu.au Walter Tholen, York University: tholen@mathstat.yorku.ca Myles Tierney, Rutgers University: tierney@math.rutgers.edu R. J. Wood, Dalhousie University: rjwood@mathstat.dal.ca