This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Wiring diagrams as normal forms for
computing in symmetric monoidal categories

Evan Patterson    David I. Spivak    Dmitry Vagner
Abstract

Applications of category theory often involve symmetric monoidal categories (SMCs), in which abstract processes or operations can be composed in series and parallel. However, in 2020 there remains a dearth of computational tools for working with SMCs. We present an “unbiased” approach to implementing symmetric monoidal categories, based on an operad of directed, acyclic wiring diagrams. Because the interchange law and other laws of a SMC hold identically in a wiring diagram, no rewrite rules are needed to compare diagrams. We discuss the mathematics of the operad of wiring diagrams, as well as its implementation in the software package Catlab.

1 Introduction

The syntax for an algebraic structure is often derived from its traditional axiomatization, without additional thought. A symmetric monoidal category (SMC) is defined through operations of composition, identity, monoidal product, monoidal unit, and braiding, subject to various laws. Once it is decided how to assign symbols to these operations, such as \mathbin{\fatsemi} for composition and \otimes for the monoidal product, a symbolic syntax for constructing objects and morphisms follows immediately. So, given morphisms, say f:xxyf\colon x\to x\otimes y and g:yzzg\colon y\otimes z\to z, a new morphism can be constructed via such expressions as

(fidz)(idxg).(f\otimes\mathrm{id}_{z})\mathbin{\fatsemi}(\mathrm{id}_{x}\otimes g).

Symbolic syntax has a long tradition in algebra. Its utility derives, on the one hand, from its ease in writing and typesetting, and on the other, from its immediacy given an axiomatization of an algebraic structure as a generalized algebraic theory.

But these are not the only desiderata for mathematical syntax. In general, the mathematical objects denoted by two different expressions may be equal under the axioms. A good syntax narrows the gap between a mathematical object and its representation by avoiding redundancy. For example, since monoidal products are associative in a strict SMC, the expressions f(gh)f\otimes(g\otimes h) and (fg)h(f\otimes g)\otimes h denote the same morphism; thus, it is standard practice to eliminate parentheses around the monoidal product, writing simply fghf\otimes g\otimes h.

Encoding algebraic equations into a simplified yet unambiguous syntax has important cognitive and computational benefits. For humans, it substitutes visual inspection for equational reasoning, playing to our cognitive strengths. For computers, it reduces possibly complex algorithms for checking equality to a simple test of identity on a suitable data structure. From this perspective, the ideal syntax provides a normal form, making two expressions identical if and only if they denote equal mathematical objects.

What is the right syntax for symmetric monoidal categories? Beginning with the Penrose graphical notation for tensors [8], it was gradually understood that morphisms in a monoidal category are best depicted by a two-dimensional syntax, with one axis representing composition and the other representing monoidal product. For example, the above expression (fidz)(idxg)(f\otimes\mathrm{id}_{z})\mathbin{\fatsemi}(\mathrm{id}_{x}\otimes g) becomes the string diagram

ffgg xxxxyyzzzz

As string diagrams, both sides of the interchange law (fg)(hk)=(fh)(gk)(f\mathbin{\fatsemi}g)\otimes(h\mathbin{\fatsemi}k)=(f\otimes h)\mathbin{\fatsemi}(g\otimes k) of a monoidal category have the same representation, namely:

ffgg\vphantom{f}hh\vphantom{f}kk\vphantom{f}

String diagrams were first put on a rigorous footing by Joyal and Street, who showed that the diagrammatic language is sound and complete for the equations between morphisms deducible from the axioms of a strict symmetric monoidal category [5]. Diagrammatic languages are now known for other kinds of monoidal categories, such as traced monoidal categories and hypergraph categories [10, 3].

For Joyal and Street, string diagrams are geometric figures in the plane or in a higher-dimensional Euclidean space. This perspective, while intuitively appealing, is of little computational use, since geometric objects are not readily translated into data structures. For computational purposes, we would like to extract the combinatorial data defining a string diagram, much like a graph does for a graph embedding or graph drawing.

Wiring diagrams were introduced in [9]. Though they are often depicted graphically, wiring diagrams are combinatorial, rather than geometric, objects. They also differ from string diagrams in that they deal only with the syntax of composition, and do not include explicit morphisms from a given SMC. More precisely, wiring diagrams—say for representing compositions in symmetric monoidal categories—are organized as the morphisms of a typed operad 𝒲\mathcal{W}. Composition of morphisms corresponds to nesting of wiring diagrams, for example:

12 2 1\mathbin{\fatsemi}_{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}1}== (1)

Note that in the symbolic syntax of a symmetric monoidal category, there are infinitely-many ways to represent any of the wiring diagrams in (1), for example the middle one could be represented by tensoring with an arbitrary number of monoidal units, but the wiring diagram represents exactly one element of the set 𝒲(X1,X2;Y)\mathcal{W}({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}X_{1}},{\color[rgb]{0,0.5,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0.5,0}X_{2}};Y), where X1{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}X_{1}} and X2{\color[rgb]{0,0.5,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0.5,0}X_{2}} are the inner boxes and YY is the outer box.

A given model of 𝒲\mathcal{W}, which we can think of as a symmetric monoidal category 𝒞\mathcal{C}, is represented as a functor H:𝒲𝖲𝖾𝗍H\colon\mathcal{W}\to\mathsf{Set}, which we refer to as a 𝒲\mathcal{W}-algebra.111For now, we elide the fact that wires should be annotated by types corresponding to the objects of 𝒞\mathcal{C}. Each box (object in 𝒲\mathcal{W}) is sent by HH to the set of all 𝒞\mathcal{C}-morphisms of that shape, and each wiring diagram (morphism in 𝒲\mathcal{W}) is sent by HH to the function that takes morphisms in 𝒞\mathcal{C} and composes them accordingly.

Operads of wiring diagrams can be used to model various sorts of categories, such as traced or hypergraph categories [12, 3]—whose string diagram languages we mentioned above—or even just ordinary categories. Here we will focus on the operad 𝒲\mathcal{W} of wiring diagrams for symmetric monoidal categories.

The aim of this paper is to show how 𝒲\mathcal{W} can serve as a foundation for the computer algebra of symmetric monoidal categories, both practically and theoretically. Since the interchange law and other axioms of an SMC hold identically within 𝒲\mathcal{W}, wiring diagrams are nearly normal forms for morphisms in a free SMC, as will be explained. With this motivation, Section 2 describes an implementation of the operad of wiring diagrams in Catlab.jl, a Julia package for applied category theory [7]. The operad structure is taken as fundamental in Catlab and used to implement a diagrammatic syntax for symmetric monoidal categories. The wiring diagram operad is then extended to SMCs with extra structure, such as cartesian monoidal categories, biproduct categories, and traced monoidal categories. In contrast to systems like Quantomatic [6] and Cartographer [11], Catlab is not a graphical editor or a proof assistant; rather, it provides data structures and algorithms for computing with in symmetrical monoidal categories for scientific and engineering applications.

The remainder of the paper is about the mathematics of the operad of wiring diagrams. After some preliminaries on biproducts and spans in Section 3, an operad of wiring diagrams is constructed in Section 4. The directed wiring diagrams are defined to satisfy an acyclicity condition, making them suitable for symmetric monoidal categories. They are built using the categorical matrix calculus, which extends the notion of an adjacency matrix of a directed graph. Finally, Section 5 shows how algebras on the wiring diagram operad give rise to symmetric monoidal categories and, conversely, how symmetric monoidal categories yield algebras on this operad. These two constructions are not inverse equivalences; however, beginning with an SMC, the roundtrip does return an equivalent SMC. We will make the correspondence more precise in Theorems 5.2 and 5.3.

2 Wiring diagrams in Catlab

In the Julia package Catlab, wiring diagrams are implemented as combinatorial data structures. Wiring diagrams are akin to directed graphs but possess extra structure; namely each box—which plays the role of a node—has an explicit set of input and output ports. Every wiring diagram has an underlying directed graph, obtained by forgetting this extra structure. For implementation purposes, Catlab exploits this hierarchy by building its data structure for wiring diagrams on top of graph data structures that already exist in the Julia ecosystem.

The functionality for wiring diagrams is implemented in several layers. The bottom layer is the core data structure and a low-level imperative interface for mutating it. Operadic composition—or substitution—of wiring diagrams is defined using this interface. Finally, the operadic interface is used to define a syntax for morphisms in symmetric monoidal categories. The three layers are summarized in Sections 2.1, 2.2, and 2.3 respectively.

2.1 The wiring diagram data structure

The data structure for wiring diagrams is comprised of several data types. From the user’s perspective, these types are:

  1. 1.

    WiringDiagram: a quadruple consisting of (i) a list of input port types and (ii) a list of output port types, both for the outer box; (iii) a list of boxes, where the first and second entries are special values representing the input and output types of the outer box and the remaining entries are boxes inside the diagram, of type Box; and (iv) a set of wires, of type Wire.

  2. 2.

    Box: a triple consisting of (i) a label or value for the box, (ii) a list of input port types, (iii) and a list of output port types. Thus, a morphism f:xyzf:x\otimes y\to z would be represented as Box(:f, [:x,:y], [:z]), where the Julia syntax :x denotes a symbol named “x”.

  3. 3.

    Wire: a source-target pair, where both the source and target are pairs of numbers identifying a box in the diagram and an input or output port on that box. So, a wire from output port pp on box ii to input port qq on box jj is Wire((i,p) => (j,q)).

As a small but complete example, the wiring diagram corresponding to the composite fg:xzf\mathbin{\fatsemi}g:x\to z of morphisms f:xyf:x\to y and g:yzg:y\to z is implemented as:

WiringDiagram([:x], [:z],
[ 1 => {inputs}, 2 => {outputs}, 3 => Box(:f, [:x], [:y]), 4 => Box(:g, [:y], [:z]) ],
[ Wire((1,1) => (3,1)), Wire((3,1) => (4,1)), Wire((4,1) => (2,1)) ])

For performance reasons, the wires in a wiring diagram are not actually stored as a set. Instead, underlying each wiring diagram is a simple directed graph, as implemented by the Julia package LightGraphs.jl [1]. The vertices in the graph are numbered consecutively from 1 to n+2n+2, where nn is the number of boxes in the wiring diagram. Vertices 1 and 2, labelled {inputs} and {outputs} above, refer to the inputs and outputs of the outer box, respectively; the remaining vertices refer to boxes inside the diagram. There is an edge between two vertices if and only if there is at least one wire between the corresponding boxes.

Traversals on the wiring diagram are then delegated to the underlying directed graph. For example, to find the in-neighbors or out-neighbors of a box, one simply finds the in-neighbors or out-neighbors of the corresponding vertex in the underlying graph. The graph data structure is designed to do this efficiently. Wiring diagrams can be accessed and mutated through a simple imperative interface. Boxes, ports, and wires can be retrieved individually or iterated over, and boxes and wires can be added and removed from an existing diagram.

2.2 Implementing the operad of wiring diagrams

Operadic composition of wiring diagrams as in (1) is supported through the function ocompose, with two signatures:

ocompose(f::WiringDiagram, gs::Vector{<:WiringDiagram})::WiringDiagram
ocompose(f::WiringDiagram, i::Int, g::WiringDiagram)::WiringDiagram

The first signature corresponds to full (May-style) operadic composition \circ and the second corresponds to partial (Markl-style) operadic composition i\circ_{i}. Both methods are one-line wrappers around the procedure substitute, which substitutes wiring diagrams for one or more boxes in another wiring diagram. Mathematically, substitute simultaneously performs one or more non-overlapping partial operadic compositions.

Substitution of wiring diagrams is implemented using the imperative interface. In outline, the algorithm proceeds as follows:

  1. 1.

    Create a copy d of the original wiring diagram.

  2. 2.

    Add to d all the boxes from all the diagrams to be substituted.

  3. 3.

    Extend each wire in each substituted diagram to new a wire in d. This subroutine branches into four different cases, shown in pseudo-Julia code in Listing 1.

  4. 4.

    Remove from d all the boxes from the original diagram that were to be substituted, which in turn removes any extraneous wires created during step 3.

function substitute_wires!(d::WiringDiagram, v::Int, sub::WiringDiagram)
for wire in wires(sub)
# Case 1: Passing wire.
if {wire source and target are on outer box}
for in_wire in {wires in d incoming to source outer port}
for out_wire in {wires in d outgoing from target outer port}
{add wire to d fusing in_wire -> wire -> out_wire}
end
end
# Case 2: Incoming wire.
elseif {wire source is on outer box}
for in_wire in {wires in d incoming to source outer port}
{add wire to d fusing in_wire -> wire}
end
# Case 3: Outgoing wire.
elseif {wire target is on outer box}
for out_wire in {wires in d outgoing from target outer port}
{add wire to d fusing wire -> out_wire}
end
# Case 4: Fully internal wire.
else
{add wire to d}
end
end
end
Figure 1: Pseudo-Julia code for main subroutine in substitution algorithm. Each wire substituted into the new diagram is either passing, incoming, outgoing, or fully internal. The inner loops under each of the cases are needed because a port may have many or no incident wires, representing copying, merging, deleting, or creating.

2.3 Wiring diagrams as a syntax for SMCs

Having implemented the operad of wiring diagrams, it is now straightforward to define an alternate syntax for symmetric monoidal categories using wiring diagrams. That is, we construct a symmetric monoidal category whose morphisms are wiring diagrams in which each box has been filled with a morphism. To compute the series composition fgf\mathbin{\fatsemi}g of morphisms ff and gg, one forms the following wiring diagram

ffggff \vdots\vdots\vdots

and then performs an operadic composition. Apart from exception handling and formatting, the following Julia code for the procedure compose is identical to the implementation in Catlab.

function compose(f::WiringDiagram, g::WiringDiagram)::WiringDiagram
@assert length(codom(f)) == length(dom(g))
h = WiringDiagram(dom(f), codom(g))
fv, gv = add_box!(h, f), add_box!(h, g)
add_wires!(h, [[ (input_id(h),i) => (fv,i) for i in 1:length(dom(f)) ];
[ (fv,i) => (gv,i) for i in 1:length(codom(f)) ];
[ (gv,i) => (output_id(h),i) for i in 1:length(codom(g)) ]])
substitute(h, [fv,gv])
end

Similarly, to compute the parallel composition fgf\otimes g of two morphisms ff and gg, form the generic diagram with two boxes composed in parallel and then perform an operadic composition:

ffggff \vdots\vdots\vdots\vdots

The wiring diagram syntax provides a normal form for morphisms in a free symmetric monoidal category, up to (simple directed) graph isomorphism. Specifically, two morphisms represented by wiring diagrams are equal if and only if there is an isomorphism of the underlying graphs making the diagrams identical as Julia data structures. Although the graph isomorphism problem is not known to be solvable in polynomial time, in practice it can usually be solved efficiently. Moreover, the labels on the boxes drastically restrict the possible matchings. Wiring diagrams thus constitute an effective normal form for morphisms in a free SMC.

3 Biproducts, matrix calculus, and categories of spans

We will formally present a wiring diagram by encoding all the interconnections between its boxes as a single span. Since the category of spans enjoys a biproduct structure, we can represent wiring diagrams as matrices and their compositions using matrix algebra. We begin with a brief detour into biproduct categories.

3.1 Morphisms as matrices

Let (𝒞,,0)(\mathcal{C},\oplus,\textbf{0}) be a biproduct category, i.e., a monoidal category for which \oplus is both a product and a coproduct. Such categories can equivalently be seen as monoidal categories with a homomorphic supply of bimonoids [4]. Given a morphism

𝐭1𝐭m𝑓𝐯1𝐯n\mathbf{t}_{1}\oplus\cdots\oplus\mathbf{t}_{m}\xrightarrow{f}\mathbf{v}_{1}\oplus\cdots\oplus\mathbf{v}_{n}

in such a category, we can extract the component f𝐭i𝐯j{}_{\mathbf{t}_{i}}f{}_{\mathbf{v}_{j}} corresponding to a choice of direct summand 𝐭i\mathbf{t}_{i} in the domain and 𝐯j\mathbf{v}_{j} in the codomain, by pre- and post-composing ff with canonical inclusions and projections:

𝐭i{\mathbf{t}_{i}}𝐭1𝐭n{\mathbf{t}_{1}\oplus\cdots\oplus\mathbf{t}_{n}}𝐯1𝐯m{\mathbf{v}_{1}\oplus\cdots\oplus\mathbf{v}_{m}}𝐯j.{\mathbf{v}_{j}.}ι𝐭i\scriptstyle{\iota_{\mathbf{t}_{i}}}f\scriptstyle{f}π𝐯j\scriptstyle{\pi_{\mathbf{v}_{j}}} (2)

This procedure defines a map of type 𝒞(i:I𝐭i,j:J𝐯j)𝒞(𝐭i,𝐯j)\mathcal{C}\big{(}\bigoplus_{i:I}\mathbf{t}_{i},\,\bigoplus_{j:J}\mathbf{v}_{j}\big{)}\to\mathcal{C}(\mathbf{t}_{i},\mathbf{v}_{j}) for finite sets II and JJ, to which we can define a section by swapping the inclusion and projections in (2). We say that this section is the embedding of the component since it produces a morphism for which all other components are the zero morphisms 0:𝐭k𝐯l\textbf{0}:\mathbf{t}_{k}\to\mathbf{v}_{l}, i.e. the unique morphism of the form 𝐭k0𝐯l\mathbf{t}_{k}\to\textbf{0}\to\mathbf{v}_{l}.

Any biproduct category is enriched in commutative monoids, with the sum f+gf+g of two morphisms of type 𝐭𝐯\mathbf{t}\to\mathbf{v} given by 𝐭{\mathbf{t}}𝐭𝐭{\mathbf{t}\oplus\mathbf{t}}𝐯𝐯{\mathbf{v}\oplus\mathbf{v}}𝐯{\mathbf{v}}Δ\scriptstyle{\Delta}fg\scriptstyle{f\oplus g}\scriptstyle{\nabla}. Here Δ\Delta and \nabla are the diagonal and codiagonal morphisms arising from the universal property of product and coproduct. By the naturality of these maps, composition distributes over sums. This operation allows us to define the leftward map in the bijection 𝒞(i:I𝐭i,j:J𝐯j)(i,j):I×J𝒞(𝐭i,𝐯j)\mathcal{C}\big{(}\bigoplus_{i:I}\mathbf{t}_{i},\,\bigoplus_{j:J}\mathbf{v}_{j}\big{)}\cong\prod_{(i,j):I\times J}\mathcal{C}(\mathbf{t}_{i},\mathbf{v}_{j}) by simply summing across the embeddings of each component. By the universal property of the biproduct, a morphism is fully specified by its components. More formally, given a choice of direct sum decomposition on both domain and codomain, we can represent ff as the block matrix

f=[f𝐭1𝐯1f𝐭1𝐯nf𝐭m𝐯1f𝐭m𝐯n]f=\begin{bmatrix}{}_{\mathbf{t}_{1}}f{}_{\mathbf{v}_{1}}&\cdots&{}_{\mathbf{t}_{1}}f{}_{\mathbf{v}_{n}}\\ \vdots&\ddots&\vdots\\ {}_{\mathbf{t}_{m}}f{}_{\mathbf{v}_{1}}&\cdots&{}_{\mathbf{t}_{m}}f{}_{\mathbf{v}_{n}}\end{bmatrix}

meaning that we can reason about morphisms by simultaneously breaking up both domain and codomain into cases. As an example of this reasoning, we recover matrix multiplication from the composition of two morphisms

𝐬1𝐬k{\mathbf{s}_{1}\oplus\cdots\oplus\mathbf{s}_{k}}𝐭1𝐭m{\mathbf{t}_{1}\oplus\cdots\oplus\mathbf{t}_{m}}𝐯1𝐯n.{\mathbf{v}_{1}\oplus\cdots\oplus\mathbf{v}_{n}.}f\scriptstyle{f}g\scriptstyle{g}

The (fg)𝐬i𝐯j{}_{\mathbf{s}_{i}}(fg){}_{\mathbf{v}_{j}} component is defined as the composite (ι𝐬if)(gπ𝐯j)(\iota_{\mathbf{s}_{i}}f)(g\pi_{\mathbf{v}_{j}}), where ι𝐬if\iota_{\mathbf{s}_{i}}f is given by a sum of morphisms of type 𝐬i𝐭1𝐭m\mathbf{s}_{i}\to\mathbf{t}_{1}\oplus\cdots\oplus\mathbf{t}_{m} and gπ𝐯jg\pi_{\mathbf{v}_{j}} is given by a sum of morphisms of type 𝐭1𝐭m𝐯j\mathbf{t}_{1}\oplus\cdots\oplus\mathbf{t}_{m}\to\mathbf{v}_{j}:

ι𝐬if=(f𝐬i)𝐭1(ι𝐭1)++(f𝐬i)𝐭m(ι𝐭m)andgπ𝐯j=(π𝐭1)(g𝐭1)𝐯j++(π𝐭m)(g𝐭m)𝐯j.\iota_{\mathbf{s}_{i}}f=({}_{\mathbf{s}_{i}}f{}_{\mathbf{t}_{1}})(\iota_{\mathbf{t}_{1}})+\cdots+({}_{\mathbf{s}_{i}}f{}_{\mathbf{t}_{m}})(\iota_{\mathbf{t}_{m}})\qquad\text{and}\qquad g\pi_{\mathbf{v}_{j}}=(\pi_{\mathbf{t}_{1}})({}_{\mathbf{t}_{1}}g{}_{\mathbf{v}_{j}})+\cdots+(\pi_{\mathbf{t}_{m}})({}_{\mathbf{t}_{m}}g{}_{\mathbf{v}_{j}}).

Composing these sums, applying distributivity, and then noting that ι𝐭kπ𝐭l=δk,l\iota_{\mathbf{t}_{k}}\pi_{\mathbf{t}_{l}}=\delta_{k,l} (the Kronecker delta), we arrive at the familiar formula for the component of a matrix multiplication

(fg)𝐬i=𝐯ji,j(f𝐬i)𝐭k(ι𝐭kπ𝐭l)(g𝐭l)𝐯j=k(f𝐬i)𝐭k(g𝐭k)𝐯j.{}_{\mathbf{s}_{i}}(fg){}_{\mathbf{v}_{j}}=\sum_{i,j}({}_{\mathbf{s}_{i}}f{}_{\mathbf{t}_{k}})(\iota_{\mathbf{t}_{k}}\pi_{\mathbf{t}_{l}})({}_{\mathbf{t}_{l}}g{}_{\mathbf{v}_{j}})=\sum_{k}({}_{\mathbf{s}_{i}}f{}_{\mathbf{t}_{k}})({}_{\mathbf{t}_{k}}g{}_{\mathbf{v}_{j}}).

We can narrativize this expression as answering the question “how can we go from 𝐬i\mathbf{s}_{i} to 𝐯j\mathbf{v}_{j}?” with the response “through any one of the 𝐭k\mathbf{t}_{k},” demonstrating that the sum can be interpreted as a disjunction. The capacity that biproduct categories possess for declaratively formalizing such reasoning motivates us to situate wiring diagrams in a certain biproduct category, which we now proceed to define.

3.2 Spans

Let 𝒞\mathcal{C} be an extensive category, i.e., one for which the coproduct functor 𝒞/x×𝒞/y𝒞/(x+y)\mathcal{C}/x\times\mathcal{C}/y\to\mathcal{C}/(x+y) is an equivalence of categories. For example, 𝒞\mathcal{C} could be any elementary topos. Recall the bicategory of 𝒞\mathcal{C}-spans, whose objects are 𝒞\mathcal{C}-objects, morphisms XYX\to Y are spans YSXY\leftarrow S\to X in 𝒞\mathcal{C}, and 2-morphisms from YSXY\leftarrow S\to X to YSXY\leftarrow S^{\prime}\to X are 𝒞\mathcal{C}-arrows SSS\to S^{\prime} commuting with the legs of the spans. Let 𝖲𝗉𝒞\mathsf{Sp}\mathcal{C} be the category whose objects are 𝒞\mathcal{C}-objects and whose morphisms are isomorphism classes of spans in the bicategory of 𝒞\mathcal{C}-spans. The coproduct in 𝒞\mathcal{C} is then the biproduct in 𝖲𝗉𝒞\mathsf{Sp}\mathcal{C}, which we denote as \oplus. This means that we can compute with spans using the matrix calculus of the previous subsection.

It is worthwhile to observe how the matrix calculus manifests itself in this concrete setting. Given a span Φ:𝐭1𝐭m𝐯1𝐯n\Phi:\mathbf{t}_{1}\oplus\cdots\oplus\mathbf{t}_{m}\to\mathbf{v}_{1}\oplus\cdots\oplus\mathbf{v}_{n} and indices 1im1\leq i\leq m and 1jn1\leq j\leq n, we can define a component sub-span Φ𝐭i:𝐯j𝐭i𝐯j{}_{\mathbf{t}_{i}}\Phi{}_{\mathbf{v}_{j}}:\mathbf{t}_{i}\to\mathbf{v}_{j} via the following limit:

Φ𝐭i𝐯j{{}_{\mathbf{t}_{i}}\Phi{}_{\mathbf{v}_{j}}}𝐭i{\mathbf{t}_{i}}Φ{\Phi}𝐯j{\mathbf{v}_{j}}𝐭1𝐭m{\mathbf{t}_{1}\oplus\cdots\oplus\mathbf{t}_{m}}𝐯1𝐯n{\mathbf{v}_{1}\oplus\cdots\oplus\mathbf{v}_{n}}

The multiplication 𝐭𝐭𝐭\mathbf{t}\oplus\mathbf{t}\to\mathbf{t} and unit 0𝐭\textbf{0}\to\mathbf{t} morphisms are given by the spans

𝐭𝐭{\mathbf{t}\oplus\mathbf{t}}𝐭𝐭{\mathbf{t}\oplus\mathbf{t}}𝐭{\mathbf{t}}id\scriptstyle{\mathrm{id}}\scriptstyle{\nabla}     00𝐭{\mathbf{t}}id\scriptstyle{\mathrm{id}}!\scriptstyle{!}

and the comultiplication and counit are their transposes.

Let τ\tau be a set, which we interpret as a set of types. We now specialize to the slice category 𝒞𝖲𝖾𝗍/τ\mathcal{C}\coloneqq\mathsf{Set}/\tau, for which an object is a function xτx\to\tau, regarded as a τ\tau-typed set; when we speak of its elements, we mean elements of xx. Note that 𝒞𝖲𝖾𝗍/τ\mathcal{C}\coloneqq\mathsf{Set}/\tau is extensive, so the above discussion applies. In the setting of 𝖲𝗉𝒞\mathsf{Sp}\mathcal{C} we will refer to elements of the domain and codomain of a map as ports, to elements of the apex as wires, and to the legs as attachment maps.

The sum of two spans 𝐭{\mathbf{t}}α{\alpha}𝐯{\mathbf{v}}f\scriptstyle{f_{-}}f+\scriptstyle{f_{+}} and 𝐭{\mathbf{t}}β{\beta}𝐯{\mathbf{v}}g\scriptstyle{g_{-}}g+\scriptstyle{g_{+}} is given by the span

𝐭{\mathbf{t}}αβ{\alpha\oplus\beta}𝐯{\mathbf{v}}fg\scriptstyle{f_{-}\triangledown g_{-}}f+g+\scriptstyle{f_{+}\triangledown g_{+}}

where, given f:𝐭𝐯f:\mathbf{t}\to\mathbf{v} and g:𝐮𝐯g:\mathbf{u}\to\mathbf{v}, fg:𝐭𝐮𝐯f\triangledown g:\mathbf{t}\oplus\mathbf{u}\to\mathbf{v} is the composition ι𝐭f+ι𝐮g\iota_{\mathbf{t}}f+\iota_{\mathbf{u}}g. We hence interpret this enrichment in commutative monoids as a disjunction: in αβ\alpha\oplus\beta, the 𝐭\mathbf{t} ports attach to the 𝐯\mathbf{v} ports via either α\alpha-wires or β\beta-wires. Of course, the zero span is 𝐭0𝐯\mathbf{t}\leftarrow\textbf{0}\to\mathbf{v}, also denoted 0.

In linear algebra, block matrices of linear maps correspond to direct sum decompositions, while ordinary matrices of scalars correspond to maximal decompositions into one-dimensional subspaces. Similarly, in 𝖲𝗉(𝖲𝖾𝗍/τ)\mathsf{Sp}(\mathsf{Set}/\tau), we have maximal decompositions into singleton sets. What serves as a basis in this context is simply a choice of ordering on a set, which we represent via enumeration as a tuple. In such a decomposition, every entry of the corresponding matrix represents a subspan whose domain and codomain are both singletons. In this case, the attachment maps are trivial, and hence we can, without loss of information, represent such entries via the set of wires that connect the domain and codomain singletons. Furthermore, for the sake of notational convenience, if a span Φ\Phi is given by a diagonal matrix, i.e. consists of a direct sum of singleton spans with apex sets S1,,SnS_{1},\dots,S_{n}, we will write S1SnS_{1}\oplus\cdots\oplus S_{n} for the total span.

Example 3.1.

The (r,s,t)(x,y,z)(r,s,t)\to(x,y,z) matrix

[0{B}0000{C}0{A,D}]\begin{bmatrix}\textbf{0}&\{B\}&\textbf{0}\\ \textbf{0}&\textbf{0}&\textbf{0}\\ \{C\}&\textbf{0}&\{A,D\}\end{bmatrix}

represents the span {r,s,t}{\{r,s,t\}}{A,B,C,D}{\{A,B,C,D\}}{x,y,z}{\{x,y,z\}}f\scriptstyle{f_{-}}f+\scriptstyle{f_{+}} given by

f(A)\displaystyle f_{-}(A) =t\displaystyle=t f(B)\displaystyle f_{-}(B) =r\displaystyle=r f(C)\displaystyle f_{-}(C) =t\displaystyle=t f(D)\displaystyle f_{-}(D) =t\displaystyle=t
f+(A)\displaystyle f_{+}(A) =z\displaystyle=z f+(B)\displaystyle f_{+}(B) =y\displaystyle=y f+(C)\displaystyle f_{+}(C) =x\displaystyle=x f+(D)\displaystyle f_{+}(D) =z\displaystyle=z

We note that the span matrix is like an adjacency matrix, except that rather than merely indicating the presence of connection via a truth value, the entries indicate the set of all such connections.

We note that the composite of the span {s}α{t}\{s\}\leftarrow\alpha\to\{t\} and the span {t}β{v}\{t\}\leftarrow\beta\to\{v\} is the span {s}α×β{v}\{s\}\leftarrow\alpha\times\beta\to\{v\}. We can hence perform matrix multiplication as in the following example.

Example 3.2.

The composite of the span matrices

(j,k)(j,k)(r,s,t)(r,s,t)(x,y,z)(x,y,z)[0{N}{L,M}{O,P}0{Q}]\begin{bmatrix}\textbf{0}&\{N\}&\{L,M\}\\ \{O,P\}&\textbf{0}&\{Q\}\end{bmatrix}[{F,G}{B}000{A,D}{C}0{E}]\begin{bmatrix}\{F,G\}&\{B\}&\textbf{0}\\ \textbf{0}&\textbf{0}&\{A,D\}\\ \{C\}&\textbf{0}&\{E\}\end{bmatrix}

is given by the following (j,k)(x,y,z)(j,k)\to(x,y,z) matrix

[{L,M}×{C}0{N}×{A,D}+{L,M}×{E}{O,P}×{F,G}+{Q}×{C}{O,P}×{B}{Q}×{E}]\begin{bmatrix}\{L,M\}\times\{C\}&\textbf{0}&\{N\}\times\{A,D\}+\{L,M\}\times\{E\}\\ \{O,P\}\times\{F,G\}+\{Q\}\times\{C\}&\{O,P\}\times\{B\}&\{Q\}\times\{E\}\\ \end{bmatrix}

Given our interpretation of apexes as wires, allowing non-bijective attachment maps corresponds to allowing wires to split, merge, terminate, and initiate. For the purposes of defining wiring diagrams for (strict) symmetric monoidal categories, we will (in Definition 4.1) restrict the legs of our spans to bijections; however, the more general definition can be readily used to define wiring diagrams for SMCs in which objects are supplied with monoids and/or comonoids. In particular, this bijectivity restriction is lifted in Listing 1, where ports can attach to multiple other ports on either side.

We denote the category of τ\tau-typed finite sets and typed bijections between them as 𝖡𝗂𝗃τ\mathsf{Bij}_{\tau} and the associated category of spans by 𝖲𝗉(𝖡𝗂𝗃τ)\mathsf{Sp}(\mathsf{Bij}_{\tau}). One might remark that spans of bijections are equivalent simply to bijections and wonder why Definition 4.1 uses the former. Indeed, since 𝖲𝗉(𝖡𝗂𝗃τ)\mathsf{Sp}(\mathsf{Bij}_{\tau}) is equivalent to 𝖡𝗂𝗃τ\mathsf{Bij}_{\tau}, we could have in principle simply defined such wiring diagrams in the latter category. However, our composition formula mirrors the case analysis of Listing 1 by leveraging the matrix calculus of the biproduct category 𝖲𝗉(𝖲𝖾𝗍/τ)\mathsf{Sp}(\mathsf{Set}/\tau).

4 The operad of acyclic wiring diagrams

We are now equipped to characterize unbiased compositions of morphisms in a strict symmetric monoidal category. We make the strictness assumption for a couple of reasons. First, any monoidal category is monoidally equivalent to a strict one and hence no loss of generality is incurred. Second, the graphical languages of string and wiring diagrams prohibits bracketing of parallel wires and hides unit wires, corresponding to strict associativity and unitality.

In addition to requiring that our symmetric monoidal category be strict, we define the monoidal product in an unbiased manner, as in [2]. Thus, we index the hom-sets by a pair of typed finite sets—rather than typed finite ordinals—whose monoidal product give the domain and codomain respectively. In the context of computer science, this choice corresponds to a dictionary-like representation of domain and codomain rather than the more traditional list-like representation. We note that this does not imply that we enforce commutativity of the monoidal product. For instance, the typed finite sets f,g:{a1,a2}τf,g:\{a_{1},a_{2}\}\rightrightarrows\tau given by f(a1)=t1,f(a2)=t2f(a_{1})=t_{1},f(a_{2})=t_{2} and g(a1)=t2,g(a2)=t1g(a_{1})=t_{2},g(a_{2})=t_{1} are distinct, though isomorphic.

Fix a set τ\tau, whose elements we think of as types. Next we will define the operad 𝒲τ\mathcal{W}_{\tau} of acyclic wiring diagrams. Roughly speaking, morphisms in 𝒲τ\mathcal{W}_{\tau} specify compositions (serial, parallel, etc.) of morphisms in an arbitrary strict unbiased SMC 𝒞\mathcal{C} that has been equipped with a function τOb(𝒞)\tau\to\operatorname{Ob}(\mathcal{C}), i.e., for which an object of 𝒞\mathcal{C} has been chosen for each element of τ\tau.

Definition 4.1.

Let τ\tau be a set, elements of which we call types. We define the τ\tau-typed operad 𝒲τ\mathcal{W}_{\tau} of acyclic wiring diagrams as follows.

  • an object, called a box, 𝐭\mathbf{t} is a τ\tau-typed signed set; i.e. a pair (𝐭,𝐭+)(\mathbf{t}_{-},\mathbf{t}_{+}) of τ\tau-typed sets, where a τ\tau-typed set is an object of 𝖲𝖾𝗍/τ\mathsf{Set}/\tau; we call 𝐭\mathbf{t}_{-} the inputs and 𝐭+\mathbf{t}_{+} the outputs.

  • a morphism, called a wiring diagram, Φ\Phi of type 𝐭1,,𝐭n𝐯\mathbf{t}^{1},\dots,\mathbf{t}^{n}\to\mathbf{v} is a span in 𝖡𝗂𝗃τ\mathsf{Bij}_{\tau}

    𝐯𝐭+{\mathbf{v}_{-}\oplus\mathbf{t}_{+}}ω{\omega}𝐭𝐯+{\mathbf{t}_{-}\oplus\mathbf{v}_{+}}Φsrc\scriptstyle{\Phi_{\text{src}}}Φtgt\scriptstyle{\Phi_{\text{tgt}}}

    where 𝐭±i=1n𝐭±i\mathbf{t}_{\pm}\coloneqq\bigoplus_{i=1}^{n}\mathbf{t}^{i}_{\pm}. We call ω\omega-elements wires and enforce the following:

    • \star

      progress condition: imposing 𝐭i𝐭j\mathbf{t}^{i}\prec\mathbf{t}^{j} whenever there is a wire AωA\in\omega for which both Φsrc(A)𝐭+i\Phi_{\text{src}}(A)\in\mathbf{t}^{i}_{+} and Φtgt(A)𝐭j\Phi_{\text{tgt}}(A)\in\mathbf{t}^{j}_{-}, the result must be a partial order on the 𝐭i\mathbf{t}^{i}.

  • the identity morphism 𝗂𝗇𝖾𝗋𝗍𝐭:𝐭𝐭\mathsf{inert}_{\mathbf{t}}:\mathbf{t}\to\mathbf{t} is given by the identity span

    𝐭𝐭+{\mathbf{t}_{-}\oplus\mathbf{t}_{+}}𝐭𝐭+{\mathbf{t}_{-}\oplus\mathbf{t}_{+}}𝐭𝐭+{\mathbf{t}_{-}\oplus\mathbf{t}_{+}}𝟏\scriptstyle{\mathbf{1}}𝟏\scriptstyle{\mathbf{1}}

    we note that the block matrix form in the summands is given by the identity matrix.

  • given wiring diagrams Ψ:𝐬i1,,𝐬imi𝐭i\Psi:\mathbf{s}^{i_{1}},\dots,\mathbf{s}^{i{}_{m_{i}}}\to\mathbf{t}^{i} and Φ:𝐭1,,𝐭n𝐯\Phi:\mathbf{t}^{1},\dots,\mathbf{t}^{n}\to\mathbf{v}, we now define their ithi^{\text{th}} partial composite (sometimes called “circle-ii” composition)

    ΨiΦ:𝐭1,,𝐬i1,,𝐬imi,𝐭n𝐯\Psi\mathbin{\fatsemi}_{i}\Phi:\mathbf{t}^{1},\dots,\mathbf{s}^{i_{1}},\dots,\mathbf{s}^{i{}_{m_{i}}},\dots\mathbf{t}^{n}\to\mathbf{v}

    Letting 𝐭±¬i𝐭±jji\mathbf{t}^{\neg i}_{\pm}\coloneqq\bigoplus{}_{j\neq i}\mathbf{t}^{j}_{\pm}, we make the following abbreviations

    𝐮𝐯𝐭+¬i𝐮+𝐭¬i𝐯+\mathbf{u}_{-}\coloneqq\mathbf{v}_{-}\oplus\mathbf{t}^{\neg i}_{+}\hskip 42.67912pt\mathbf{u}_{+}\coloneqq\mathbf{t}^{\neg i}_{-}\oplus\mathbf{v}_{+}

    The composite ΨiΦ\Psi\mathbin{\fatsemi}_{i}\Phi is then given by the block matrix of type 𝐮𝐬+𝐬𝐮+\mathbf{u}_{-}\oplus\mathbf{s}_{+}\to\mathbf{s}_{-}\oplus\mathbf{u}_{+}

    ΨiΦ=[(Φ𝐮)𝐭i(Ψ𝐭i)𝐬Φ𝐮+𝐮+(Φ𝐮)𝐭i(Ψ𝐭i)𝐭+i(Φ𝐭+i)𝐮+Ψ𝐬+𝐬(Ψ𝐬+)𝐭+i(Φ𝐭+i)𝐮+]\Psi\mathbin{\fatsemi}_{i}\Phi=\begin{bmatrix}({}_{\mathbf{u}_{-}}\Phi{}_{\mathbf{t}^{i}_{-}})({}_{\mathbf{t}^{i}_{-}}\Psi{}_{\mathbf{s}_{-}})&{}_{\mathbf{u}_{-}}\Phi{}_{\mathbf{u}_{+}}+({}_{\mathbf{u}_{-}}\Phi{}_{\mathbf{t}^{i}_{-}})({}_{\mathbf{t}^{i}_{-}}\Psi{}_{\mathbf{t}^{i}_{+}})({}_{\mathbf{t}^{i}_{+}}\Phi{}_{\mathbf{u}_{+}})\\ {}_{\mathbf{s}_{+}}\Psi{}_{\mathbf{s}_{-}}&({}_{\mathbf{s}_{+}}\Psi{}_{\mathbf{t}^{i}_{+}})({}_{\mathbf{t}^{i}_{+}}\Phi{}_{\mathbf{u}_{+}})\end{bmatrix} (3)

    If Φ\prec^{\Phi} and Ψ\prec^{\Psi} are the orderings induced on the 𝐭i\mathbf{t}^{i} and 𝐬j\mathbf{s}^{j} by Φ\Phi and Ψ\Psi respectively, then one can define an ordering \prec on {𝐭1,,𝐬k1,,𝐬kmk,𝐭n}\{\mathbf{t}^{1},\dots,\mathbf{s}^{k_{1}},\dots,\mathbf{s}^{k{}_{m_{k}}},\dots\mathbf{t}^{n}\} as follows

    𝐬ki𝐬kj\displaystyle\mathbf{s}^{k_{i}}\prec\mathbf{s}^{k_{j}} 𝐬kiΨ𝐬kj\displaystyle\coloneqq\mathbf{s}^{k_{i}}\prec^{\Psi}\mathbf{s}^{k_{j}} 𝐬ki𝐭j\displaystyle\mathbf{s}^{k_{i}}\prec\mathbf{t}^{j} 𝐭kΦ𝐭j\displaystyle\coloneqq\mathbf{t}^{k}\prec^{\Phi}\mathbf{t}^{j}
    𝐭j𝐬ki\displaystyle\mathbf{t}^{j}\prec\mathbf{s}^{k_{i}} 𝐭jΦ𝐭k\displaystyle\coloneqq\mathbf{t}^{j}\prec^{\Phi}\mathbf{t}^{k} 𝐭i𝐭j\displaystyle\mathbf{t}^{i}\prec\mathbf{t}^{j} 𝐭iΦ𝐭j\displaystyle\coloneqq\mathbf{t}^{i}\prec^{\Phi}\mathbf{t}^{j}

    Thus ΨiΦ\Psi\mathbin{\fatsemi}_{i}\Phi satisfies the progress condition.

We remark that the composite formula (3) is a declarative version of the imperative substitution algorithm presented in Listing 1. In particular, the four cases in the algorithm correspond to the four entries in the composite matrix: incoming wire, passing wire, fully internal wire, and outgoing wire. Furthermore, the products within each component, e.g. (Φ𝐮)𝐭i(Ψ𝐭i)𝐭+i(Φ𝐭+i)𝐮+({}_{\mathbf{u}_{-}}\Phi{}_{\mathbf{t}^{i}_{-}})({}_{\mathbf{t}^{i}_{-}}\Psi{}_{\mathbf{t}^{i}_{+}})({}_{\mathbf{t}^{i}_{+}}\Phi{}_{\mathbf{u}_{+}}), correspond to the fusing together of wires. Finally, the sum in the upper right-hand entry codifies the fact that the composite wiring diagram still includes all of the wires, Φ𝐮𝐮+{}_{\mathbf{u}_{-}}\Phi{}_{\mathbf{u}_{+}}, that did not interact with input box 𝐭i\mathbf{t}_{i}.

Each of the entries in the fully decomposed matrix representation of a bijective span as in Definition 4.1 is either the empty set or a singleton; we will write 0 in the former case and write AA for the singleton set {A}\{A\}. Similarly, we will write (A,B)(A,B) for {A}×{B}\{A\}\times\{B\}.

Example 4.2.

We now define wiring diagrams corresponding to core SMC operations. We call these 𝒲\mathcal{W}-representations for any set τ\tau; though we introduce them in an example, they will play an important role in the theory.

  • Symmetry. Consider wires ω\omega, no inner boxes, and outer box 𝐭=(ω,ω)\mathbf{t}=(\omega,\omega). For any permutation σ:ωω\sigma:\omega\xrightarrow{\sim}\omega, the 𝒲\mathcal{W}-representation of symmetry is given by the 0-ary wiring diagram 𝗌𝗒𝗆ωσ:()𝐭\mathsf{sym}^{\sigma}_{\omega}:()\to\mathbf{t} represented by the permutation matrix of σ\sigma. We let 𝗎𝗇𝗂𝗍ω𝗌𝗒𝗆ωid\mathsf{unit}_{\omega}\coloneqq\mathsf{sym}_{\omega}^{\mathrm{id}}. For instance here is the wiring diagram and matrix form in the case where σ\sigma is the transposition of two elements.

    AB[0AB0]\leavevmode\hbox to29.25pt{\vbox to29.86pt{\pgfpicture\makeatletter\hbox{\qquad\lower-14.93118pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.6pt}\pgfsys@invoke{ }{}{} {}{{}}{ {}}{}{{}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{ {}}{}{{}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{{}}{}{ {}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{{}}{}{ {}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{}\pgfsys@moveto{-14.22636pt}{4.84389pt}\pgfsys@moveto{-14.22636pt}{4.84389pt}\pgfsys@lineto{-14.22636pt}{4.84389pt}\pgfsys@moveto{-14.22636pt}{-4.84389pt}\pgfsys@moveto{-14.22636pt}{-4.84389pt}\pgfsys@lineto{-14.22636pt}{-4.84389pt}\pgfsys@moveto{14.22636pt}{4.84389pt}\pgfsys@moveto{14.22636pt}{4.84389pt}\pgfsys@lineto{14.22636pt}{4.84389pt}\pgfsys@moveto{14.22636pt}{-4.84389pt}\pgfsys@moveto{14.22636pt}{-4.84389pt}\pgfsys@lineto{14.22636pt}{-4.84389pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{\hbox{\hbox{\hbox{\hbox{\hbox{\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} \hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}}{}{}{}{}{} {\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{}\pgfsys@moveto{12.22638pt}{14.53119pt}\pgfsys@lineto{-12.22638pt}{14.53119pt}\pgfsys@curveto{-13.33096pt}{14.53119pt}{-14.22638pt}{13.63577pt}{-14.22638pt}{12.53119pt}\pgfsys@lineto{-14.22638pt}{-12.53119pt}\pgfsys@curveto{-14.22638pt}{-13.63577pt}{-13.33096pt}{-14.53119pt}{-12.22638pt}{-14.53119pt}\pgfsys@lineto{12.22638pt}{-14.53119pt}\pgfsys@curveto{13.33096pt}{-14.53119pt}{14.22638pt}{-13.63577pt}{14.22638pt}{-12.53119pt}\pgfsys@lineto{14.22638pt}{12.53119pt}\pgfsys@curveto{14.22638pt}{13.63577pt}{13.33096pt}{14.53119pt}{12.22638pt}{14.53119pt}\pgfsys@closepath\pgfsys@moveto{-14.22638pt}{-14.53119pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{0.0pt}{0.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}{}}{{}{}}{{}} {{{}}{{}}}{{}}{{}{}}{{{}}{{}}}{{}}{}{{}}{}{}{}{}{}{}{}{{}}{}\pgfsys@moveto{-14.22636pt}{4.84389pt}\pgfsys@curveto{-2.49138pt}{4.84389pt}{2.49138pt}{-4.84389pt}{14.22636pt}{-4.84389pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-9.07047pt}{6.96317pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$A$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}{}}{{}{}}{{}} {{{}}{{}}}{{}}{{}{}}{{{}}{{}}}{{}}{}{{}}{}{}{}{}{}{}{}{{}}{}\pgfsys@moveto{-14.22636pt}{-4.84389pt}\pgfsys@curveto{-2.49138pt}{-4.84389pt}{2.49138pt}{4.84389pt}{14.22636pt}{4.84389pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-9.18938pt}{-10.37982pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$B$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope{{ {}{}{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}\hskip 72.26999pt\begin{bmatrix}\textbf{0}&A\\ B&\textbf{0}\end{bmatrix}
  • Sequential composition. Consider wires ω={A,B,C}\omega=\{A,B,C\}, inner boxes 𝐭,𝐭\mathbf{t},\mathbf{t}^{\prime}, and outer box 𝐯\mathbf{v}. The 𝒲\mathcal{W} representation of sequential composition (shown left) is given by the wiring diagram 𝗌𝖾𝗊(A,B,C):𝐭,𝐭𝐯\mathsf{seq}_{(A,B,C)}:\mathbf{t},\mathbf{t}^{\prime}\to\mathbf{v} with matrix of type 𝐯𝐭+𝐭+𝐭𝐭𝐯+\mathbf{v}_{-}\oplus\mathbf{t}_{+}\oplus\mathbf{t}^{\prime}_{+}\to\mathbf{t}_{-}\oplus\mathbf{t}^{\prime}_{-}\oplus\mathbf{v}_{+} shown right:

    𝐭𝐭 𝐯ABC[A000B000C]\leavevmode\hbox to56.06pt{\vbox to31.43pt{\pgfpicture\makeatletter\hbox{\qquad\lower-15.71411pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.6pt}\pgfsys@invoke{ }{}{} {}{{}}{ {}}{}{{}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{{}}{}{ {}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{}\pgfsys@moveto{-5.69055pt}{0.0pt}\pgfsys@moveto{-5.69055pt}{0.0pt}\pgfsys@lineto{-5.69055pt}{0.0pt}\pgfsys@moveto{5.69055pt}{0.0pt}\pgfsys@moveto{5.69055pt}{0.0pt}\pgfsys@lineto{5.69055pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{\hbox{\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} \hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}}{}{}{}{}{} {\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{}\pgfsys@moveto{3.69055pt}{4.9203pt}\pgfsys@lineto{-3.69055pt}{4.9203pt}\pgfsys@curveto{-4.79514pt}{4.9203pt}{-5.69055pt}{4.02489pt}{-5.69055pt}{2.9203pt}\pgfsys@lineto{-5.69055pt}{-2.9203pt}\pgfsys@curveto{-5.69055pt}{-4.02489pt}{-4.79514pt}{-4.9203pt}{-3.69055pt}{-4.9203pt}\pgfsys@lineto{3.69055pt}{-4.9203pt}\pgfsys@curveto{4.79514pt}{-4.9203pt}{5.69055pt}{-4.02489pt}{5.69055pt}{-2.9203pt}\pgfsys@lineto{5.69055pt}{2.9203pt}\pgfsys@curveto{5.69055pt}{4.02489pt}{4.79514pt}{4.9203pt}{3.69055pt}{4.9203pt}\pgfsys@closepath\pgfsys@moveto{-5.69055pt}{-4.9203pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.49303pt}{-1.5873pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$\mathbf{t}$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{ {}{}{}}{}{}{{{{}{}{}}}}{{}}{ {}}{}{{}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{{}}{}{ {}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{}\pgfsys@moveto{17.07166pt}{0.0pt}\pgfsys@moveto{17.07166pt}{0.0pt}\pgfsys@lineto{17.07166pt}{0.0pt}\pgfsys@moveto{28.45276pt}{0.0pt}\pgfsys@moveto{28.45276pt}{0.0pt}\pgfsys@lineto{28.45276pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{\hbox{\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} \hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}}{}{}{}{}{} {\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{}\pgfsys@moveto{26.45276pt}{5.31412pt}\pgfsys@lineto{19.07166pt}{5.31412pt}\pgfsys@curveto{17.96707pt}{5.31412pt}{17.07166pt}{4.4187pt}{17.07166pt}{3.31412pt}\pgfsys@lineto{17.07166pt}{-3.31412pt}\pgfsys@curveto{17.07166pt}{-4.4187pt}{17.96707pt}{-5.31412pt}{19.07166pt}{-5.31412pt}\pgfsys@lineto{26.45276pt}{-5.31412pt}\pgfsys@curveto{27.55734pt}{-5.31412pt}{28.45276pt}{-4.4187pt}{28.45276pt}{-3.31412pt}\pgfsys@lineto{28.45276pt}{3.31412pt}\pgfsys@curveto{28.45276pt}{4.4187pt}{27.55734pt}{5.31412pt}{26.45276pt}{5.31412pt}\pgfsys@closepath\pgfsys@moveto{17.07166pt}{-5.31412pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{20.53793pt}{-1.98111pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$\mathbf{t}^{\prime}$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{ {}{}{}}{{{ {}{}{}}}}{{{{}{}{}}}}{{{ {}{}{}}}}{{{ {}{}{}}}}{ {}{}{}}{{{ {}{}{}}}}{{{{}{}{}}}}{{{ {}{}{}}}}{{{ {}{}{}}}}{} {{}}{ {}}{}{{}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{{}}{}{ {}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{}{}}{}{{}}{}\pgfsys@moveto{-15.69055pt}{0.0pt}\pgfsys@moveto{-15.69055pt}{0.0pt}\pgfsys@lineto{-15.69055pt}{0.0pt}\pgfsys@moveto{38.45276pt}{0.0pt}\pgfsys@moveto{38.45276pt}{0.0pt}\pgfsys@lineto{38.45276pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{\hbox{\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} \hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}}{}{}{}{}{} {\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{}\pgfsys@moveto{36.45276pt}{15.31412pt}\pgfsys@lineto{-13.69055pt}{15.31412pt}\pgfsys@curveto{-14.79514pt}{15.31412pt}{-15.69055pt}{14.4187pt}{-15.69055pt}{13.31412pt}\pgfsys@lineto{-15.69055pt}{-13.31412pt}\pgfsys@curveto{-15.69055pt}{-14.4187pt}{-14.79514pt}{-15.31412pt}{-13.69055pt}{-15.31412pt}\pgfsys@lineto{36.45276pt}{-15.31412pt}\pgfsys@curveto{37.55734pt}{-15.31412pt}{38.45276pt}{-14.4187pt}{38.45276pt}{-13.31412pt}\pgfsys@lineto{38.45276pt}{13.31412pt}\pgfsys@curveto{38.45276pt}{14.4187pt}{37.55734pt}{15.31412pt}{36.45276pt}{15.31412pt}\pgfsys@closepath\pgfsys@moveto{-15.69055pt}{-15.31412pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.69055pt}{0.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\minipage[t]{34.14331pt}\leavevmode\hbox{}\tiny{}\endminipage} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} { {}{}{}}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{9.38461pt}{-11.6811pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$\mathbf{v}$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{}{{}} {}{}{}{}{{{}{}}}{}\pgfsys@moveto{-15.69055pt}{0.0pt}\pgfsys@lineto{-5.69055pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-13.28087pt}{3.63301pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$A$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{}{{}} {}{}{}{}{{{}{}}}{}\pgfsys@moveto{5.69055pt}{0.0pt}\pgfsys@lineto{17.07166pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{8.67188pt}{3.63301pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$B$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{}{{}} {}{}{}{}{{{}{}}}{}\pgfsys@moveto{28.45276pt}{0.0pt}\pgfsys@lineto{38.45276pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{30.79266pt}{3.63301pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$C$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope{{ {}{}{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}\hskip 72.26999pt\begin{bmatrix}A&\textbf{0}&\textbf{0}\\ \textbf{0}&B&\textbf{0}\\ \textbf{0}&\textbf{0}&C\end{bmatrix}
  • Parallel composition. Consider wires ω={A,A,B,B}\omega=\{A,A^{\prime},B,B^{\prime}\}, inner boxes 𝐭,𝐭\mathbf{t},\mathbf{t}^{\prime}, and outer box 𝐯\mathbf{v}. The 𝒲\mathcal{W} representation of parallel composition is given by the wiring diagram 𝗉𝖺𝗋𝖺[ABAB]:𝐭,𝐭𝐯\mathsf{para}_{\tiny\left[\begin{smallmatrix}A&B\\ A^{\prime}&B^{\prime}\end{smallmatrix}\right]}:\mathbf{t},\mathbf{t}^{\prime}\to\mathbf{v} with matrix of type 𝐯𝐭+𝐭+𝐭𝐭𝐯+\mathbf{v}_{-}\oplus\mathbf{t}_{+}\oplus\mathbf{t}^{\prime}_{+}\to\mathbf{t}_{-}\oplus\mathbf{t}^{\prime}_{-}\oplus\mathbf{v}_{+}, where both 𝐯\mathbf{v}_{-} and 𝐯+\mathbf{v}_{+} are two-dimensional.

    𝐭𝐭 𝐯ABAB[A0000A0000B0000B]\leavevmode\hbox to39.31pt{\vbox to45.16pt{\pgfpicture\makeatletter\hbox{\qquad\lower-32.26242pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.6pt}\pgfsys@invoke{ }{}{} {}{{}}{ {}}{}{{}}{}{}{{}}{}{{{}{}}{}}{{}}{}{{}} {{}{}}{}{{}}{{}}{}{ {}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{{}{}}{}}{}{{}}{}\pgfsys@moveto{-5.69055pt}{0.0pt}\pgfsys@moveto{-8.19055pt}{0.0pt}\pgfsys@lineto{-5.69055pt}{0.0pt}\pgfsys@moveto{5.69055pt}{0.0pt}\pgfsys@moveto{5.69055pt}{0.0pt}\pgfsys@lineto{8.19055pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{\hbox{\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} \hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}}{}{}{}{}{} {\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{}\pgfsys@moveto{3.69055pt}{4.9203pt}\pgfsys@lineto{-3.69055pt}{4.9203pt}\pgfsys@curveto{-4.79514pt}{4.9203pt}{-5.69055pt}{4.02489pt}{-5.69055pt}{2.9203pt}\pgfsys@lineto{-5.69055pt}{-2.9203pt}\pgfsys@curveto{-5.69055pt}{-4.02489pt}{-4.79514pt}{-4.9203pt}{-3.69055pt}{-4.9203pt}\pgfsys@lineto{3.69055pt}{-4.9203pt}\pgfsys@curveto{4.79514pt}{-4.9203pt}{5.69055pt}{-4.02489pt}{5.69055pt}{-2.9203pt}\pgfsys@lineto{5.69055pt}{2.9203pt}\pgfsys@curveto{5.69055pt}{4.02489pt}{4.79514pt}{4.9203pt}{3.69055pt}{4.9203pt}\pgfsys@closepath\pgfsys@moveto{-5.69055pt}{-4.9203pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.49303pt}{-1.5873pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$\mathbf{t}$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{ {}{}{}}{}{}{{{ {}{}{}}}}{{}}{ {}}{}{{}}{}{}{{}}{}{{{}{}}{}}{{}}{}{{}} {{}{}}{}{{}}{{}}{}{ {}}{}{}{{}}{}{{}{}}{{}}{}{{}} {{{}{}}{}}{}{{}}{}\pgfsys@moveto{-5.69055pt}{-13.24829pt}\pgfsys@moveto{-8.19055pt}{-13.24829pt}\pgfsys@lineto{-5.69055pt}{-13.24829pt}\pgfsys@moveto{5.69055pt}{-13.24829pt}\pgfsys@moveto{5.69055pt}{-13.24829pt}\pgfsys@lineto{8.19055pt}{-13.24829pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{\hbox{\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}}\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} \hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}}{}{}{}{}{} {\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{}\pgfsys@moveto{3.69055pt}{-7.93419pt}\pgfsys@lineto{-3.69055pt}{-7.93419pt}\pgfsys@curveto{-4.79514pt}{-7.93419pt}{-5.69055pt}{-8.8296pt}{-5.69055pt}{-9.93419pt}\pgfsys@lineto{-5.69055pt}{-16.56242pt}\pgfsys@curveto{-5.69055pt}{-17.667pt}{-4.79514pt}{-18.56242pt}{-3.69055pt}{-18.56242pt}\pgfsys@lineto{3.69055pt}{-18.56242pt}\pgfsys@curveto{4.79514pt}{-18.56242pt}{5.69055pt}{-17.667pt}{5.69055pt}{-16.56242pt}\pgfsys@lineto{5.69055pt}{-9.93419pt}\pgfsys@curveto{5.69055pt}{-8.8296pt}{4.79514pt}{-7.93419pt}{3.69055pt}{-7.93419pt}\pgfsys@closepath\pgfsys@moveto{-5.69055pt}{-18.56242pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.22427pt}{-15.22942pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$\mathbf{t}^{\prime}$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}{{}{}}{}}{{}}{ {}{}{}}{{{ {}{}{}}}}{{{{}{}{}}}}{{{ {}{}{}}}}{{{ {}{}{}}}}{} {{}}{}\pgfsys@stroke\pgfsys@invoke{ } \hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}}{}{}{}{}{} {\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{}\pgfsys@moveto{15.69055pt}{12.50212pt}\pgfsys@lineto{-15.69055pt}{12.50212pt}\pgfsys@curveto{-16.79514pt}{12.50212pt}{-17.69055pt}{11.6067pt}{-17.69055pt}{10.50212pt}\pgfsys@lineto{-17.69055pt}{-29.56242pt}\pgfsys@curveto{-17.69055pt}{-30.667pt}{-16.79514pt}{-31.56242pt}{-15.69055pt}{-31.56242pt}\pgfsys@lineto{15.69055pt}{-31.56242pt}\pgfsys@curveto{16.79514pt}{-31.56242pt}{17.69055pt}{-30.667pt}{17.69055pt}{-29.56242pt}\pgfsys@lineto{17.69055pt}{10.50212pt}\pgfsys@curveto{17.69055pt}{11.6067pt}{16.79514pt}{12.50212pt}{15.69055pt}{12.50212pt}\pgfsys@closepath\pgfsys@moveto{-17.69055pt}{-31.56242pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.69055pt}{-9.53015pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\minipage[t]{11.3811pt}\leavevmode\hbox{}\tiny{}\endminipage} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} { {}{}{}}{{}}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.99649pt}{-28.92941pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$\mathbf{v}$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{}{{ {}{}{}}{}{{}}{}} {}{}{}{}{{{}{}}}{}\pgfsys@moveto{-8.19055pt}{0.0pt}\pgfsys@lineto{-17.69055pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-15.53087pt}{3.63301pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$A$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{}{{{}{}{}}{}{{}}{}} {}{}{}{}{{{}{}}}{}\pgfsys@moveto{8.19055pt}{0.0pt}\pgfsys@lineto{17.69055pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{10.23132pt}{3.63301pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$B$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{}{{ {}{}{}}{}{{}}{}} {}{}{}{}{{{}{}}}{}\pgfsys@moveto{-8.19055pt}{-13.24829pt}\pgfsys@lineto{-17.69055pt}{-13.24829pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-16.26212pt}{-9.61528pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$A^{\prime}$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{}{{{}{}{}}{}{{}}{}} {}{}{}{}{{{}{}}}{}\pgfsys@moveto{8.19055pt}{-13.24829pt}\pgfsys@lineto{17.69055pt}{-13.24829pt}\pgfsys@stroke\pgfsys@invoke{ }\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{9.50008pt}{-9.61528pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{\tiny{$B^{\prime}$}} }}\pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope}}} \pgfsys@invoke{ }\pgfsys@endscope{{ {}{}{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}\hskip 72.26999pt\begin{bmatrix}A&\textbf{0}&\textbf{0}&\textbf{0}\\ \textbf{0}&A^{\prime}&\textbf{0}&\textbf{0}\\ \textbf{0}&\textbf{0}&B&\textbf{0}\\ \textbf{0}&\textbf{0}&\textbf{0}&B^{\prime}\end{bmatrix}
Example 4.3.

Non-example. Consider the following wiring diagram Φ\Phi, which has a loop.

𝐭\mathbf{t}𝐭\mathbf{t}^{\prime} 0AABB

This wiring diagram is of type 𝐭,𝐭0\mathbf{t},\mathbf{t}^{\prime}\to\textbf{0}, with wires {A,B}\{A,B\}, given by the span

Φsrc(A)\displaystyle\Phi_{\text{src}}(A) =𝐭+\displaystyle=\mathbf{t}_{+} Φtgt(A)\displaystyle\Phi_{\text{tgt}}(A) =𝐭\displaystyle=\mathbf{t}^{\prime}_{-} Φsrc(B)\displaystyle\Phi_{\text{src}}(B) =𝐭+\displaystyle=\mathbf{t}^{\prime}_{+} Φtgt(B)\displaystyle\Phi_{\text{tgt}}(B) =𝐭\displaystyle=\mathbf{t}_{-}

The ordering \prec from Definition 4.1 is not a partial order: both 𝐭𝐭\mathbf{t}\prec\mathbf{t}^{\prime} and 𝐭𝐭\mathbf{t}^{\prime}\prec\mathbf{t}. Therefore this diagram fails to satisfy the progress condition of Definition 4.1.

Example 4.4.

Interchange Law. To demonstrate composition, we will prove that 𝒲\mathcal{W}-representations satisfy the interchange law.

𝐭11\mathbf{t}^{11}𝐭12\mathbf{t}^{12}𝐭21\mathbf{t}^{21}𝐭22\mathbf{t}^{22} 𝐯\mathbf{v}𝐮1\mathbf{u}^{1\bullet}𝐮2\mathbf{u}^{2\bullet}B1B^{1}\vphantom{A^{1}_{+}}B2B^{2}\vphantom{A^{1}_{+}}A+1A^{1}_{+}A1A^{1}_{-}A+2A^{2}_{+}A2A^{2}_{-}C1C^{1}_{-}C+1C^{1}_{+}C2C^{2}_{-}C+2C^{2}_{+}𝐭11\mathbf{t}^{11}𝐭12\mathbf{t}^{12}𝐭21\mathbf{t}^{21}𝐭22\mathbf{t}^{22} 𝐯\mathbf{v}𝐮1\mathbf{u}^{\bullet 1}𝐮2\mathbf{u}^{\bullet 2}B01B^{1}_{0}\vphantom{A^{1}_{0}}B1B^{1}_{-}\vphantom{A^{1}_{0}}B+1B^{1}_{+}\vphantom{A^{1}_{0}}B02B^{2}_{0}\vphantom{A^{1}_{0}}B2B^{2}_{-}\vphantom{A^{1}_{0}}B+2B^{2}_{+}\vphantom{A^{1}_{0}}A+1A^{1}_{+}\vphantom{A^{1}_{0}}A1A^{1}_{-}\vphantom{A^{1}_{0}}A+2A^{2}_{+}\vphantom{A^{1}_{0}}A2A^{2}_{-}\vphantom{A^{1}_{0}}C1C^{1}_{-}\vphantom{A^{1}_{0}}C+1C^{1}_{+}\vphantom{A^{1}_{0}}C2C^{2}_{-}\vphantom{A^{1}_{0}}C+2C^{2}_{+}\vphantom{A^{1}_{0}}=

We wish to show the following diagram commutes:

𝐭11,𝐭21,𝐭12,𝐭22{\mathbf{t}^{11},\mathbf{t}^{21},\mathbf{t}^{12},\mathbf{t}^{22}}𝐮1,𝐮2{\mathbf{u}^{1\bullet},\mathbf{u}^{2\bullet}}𝐮1,𝐮2{\mathbf{u}^{\bullet 1},\mathbf{u}^{\bullet 2}}𝐯{\mathbf{v}}𝗌𝖾𝗊ω1,𝗌𝖾𝗊ω2\scriptstyle{\mathsf{seq}_{\omega^{1}}{,}\mathsf{seq}_{\omega^{2}}}𝗉𝖺𝗋𝖺η1,𝗉𝖺𝗋𝖺η2\scriptstyle{\mathsf{para}_{\eta^{1}}{,}\mathsf{para}_{\eta^{2}}}𝗉𝖺𝗋𝖺η\scriptstyle{\mathsf{para}_{\eta}}𝗌𝖾𝗊ω\scriptstyle{\mathsf{seq}_{\omega}}

where 𝐭11,𝐭12,𝐭21,𝐭22\mathbf{t}^{11},\mathbf{t}^{12},\mathbf{t}^{21},\mathbf{t}^{22} are inner boxes, 𝐮1,𝐮2,𝐮1,𝐮2\mathbf{u}^{1\bullet},\mathbf{u}^{2\bullet},\mathbf{u}^{\bullet 1},\mathbf{u}^{\bullet 2} are intermediary boxes, 𝐯\mathbf{v} is the outer box, and the subscripts on the morphisms correspond to the following wire tuples:

ω1\displaystyle\omega^{1} =(A+1,B1,C1)\displaystyle=(A^{1}_{+},B^{1},C^{1}_{-}) ω2\displaystyle\omega^{2} =(A+2,B2,C2)\displaystyle=(A^{2}_{+},B^{2},C^{2}_{-}) ω\displaystyle\omega =(A1A2,B01B02,C+1C+2)\displaystyle=(A^{1}_{-}\oplus A^{2}_{-},B^{1}_{0}\oplus B^{2}_{0},C^{1}_{+}\oplus C^{2}_{+})
η1\displaystyle\eta^{1} =[A+1B1A+2B2]\displaystyle=\begin{bmatrix}A^{1}_{+}&B^{1}_{-}\\ A^{2}_{+}&B^{2}_{-}\end{bmatrix} η2\displaystyle\eta^{2} =[B+1C1B+2C2]\displaystyle=\begin{bmatrix}B^{1}_{+}&C^{1}_{-}\\ B^{2}_{+}&C^{2}_{-}\end{bmatrix} η\displaystyle\eta =[A1C+1A2C+2]\displaystyle=\begin{bmatrix}A^{1}_{-}&C^{1}_{+}\\ A^{2}_{-}&C^{2}_{+}\end{bmatrix}

The composite spans are represented as matrices of type

𝐯𝐭+11𝐭+21𝐭+12𝐭+22𝐭11𝐭21𝐭12𝐭22𝐯+\mathbf{v}_{-}\oplus\mathbf{t}^{11}_{+}\oplus\mathbf{t}^{21}_{+}\oplus\mathbf{t}^{12}_{+}\oplus\mathbf{t}^{22}_{+}\to\mathbf{t}^{11}_{-}\oplus\mathbf{t}^{21}_{-}\oplus\mathbf{t}^{12}_{-}\oplus\mathbf{t}^{22}_{-}\oplus\mathbf{v}_{+}

where 𝐯±\mathbf{v}_{\pm} are two-dimensional; we now compute these composites to be as follows:

𝗌𝖾𝗊ω1,𝗌𝖾𝗊ω2𝗉𝖺𝗋𝖺η\displaystyle\mathsf{seq}_{\omega^{1}},\mathsf{seq}_{\omega^{2}}\mathbin{\fatsemi}\mathsf{para}_{\eta} =[(A1,A+1)000000(A2,A+2)000000B1000000B2000000(C1,C+1)000000(C2,C+2)]\displaystyle=\scriptsize\begin{bmatrix}(A^{1}_{-},A^{1}_{+})&\textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}\\ \textbf{0}&(A^{2}_{-},A^{2}_{+})&\textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}\\ \textbf{0}&\textbf{0}&B^{1}&\textbf{0}&\textbf{0}&\textbf{0}\\ \textbf{0}&\textbf{0}&\textbf{0}&B^{2}&\textbf{0}&\textbf{0}\\ \textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}&(C^{1}_{-},C^{1}_{+})&\textbf{0}\\ \textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}&(C^{2}_{-},C^{2}_{+})\end{bmatrix}
𝗉𝖺𝗋𝖺η1,𝗉𝖺𝗋𝖺η2𝗌𝖾𝗊ω\displaystyle\mathsf{para}_{\eta^{1}},\mathsf{para}_{\eta^{2}}\mathbin{\fatsemi}\mathsf{seq}_{\omega} =[(A1,A+1)000000(A2,A+2)000000(B1,B01,B+1)000000(B2,B02,B+2)000000(C1,C+1)000000(C2,C+2)]\displaystyle=\scriptsize\begin{bmatrix}(A^{1}_{-},A^{1}_{+})&\textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}\\ \textbf{0}&(A^{2}_{-},A^{2}_{+})&\textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}\\ \textbf{0}&\textbf{0}&(B^{1}_{-},B^{1}_{0},B^{1}_{+})&\textbf{0}&\textbf{0}&\textbf{0}\\ \textbf{0}&\textbf{0}&\textbf{0}&(B^{2}_{-},B^{2}_{0},B^{2}_{+})&\textbf{0}&\textbf{0}\\ \textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}&(C^{1}_{-},C^{1}_{+})&\textbf{0}\\ \textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}&\textbf{0}&(C^{2}_{-},C^{2}_{+})\end{bmatrix}

These matrices of sets are isomorphic since they have isomorphic sets (singleton and empty sets) in corresponding entries.

5 Operad algebras and symmetric monoidal categories

With the operad 𝒲τ\mathcal{W}_{\tau} of acyclic wiring diagrams (whose wires are labeled by a chosen set τ\tau) in hand, we now formalize how it captures the compositional structure of symmetric monoidal categories. Recall that a 𝒲τ\mathcal{W}_{\tau}-algebra is an operad functor:

H:𝒲τ𝖲𝖾𝗍,H\colon\mathcal{W}_{\tau}\to\mathsf{Set},

where 𝖲𝖾𝗍\mathsf{Set} is the operad corresponding to the symmetric monoidal category (𝖲𝖾𝗍,×,1)(\mathsf{Set},\times,1). We will now show precisely how such algebras correspond to strict SMC’s. Before doing so, we will first characterize 𝒲τ\mathcal{W}_{\tau} in terms of generators.

Lemma 5.1.

The operad 𝒲τ\mathcal{W}_{\tau} is generated by 𝗌𝗒𝗆,𝗌𝖾𝗊,𝗉𝖺𝗋𝖺\mathsf{sym},\mathsf{seq},\mathsf{para} defined in Example 4.2, and these satisfy the usual axioms (parallel and sequential unitality and associativity, interchange, and permutation).

Sketch of proof.

We proceed by induction on the number of inner boxes. Let Φ:𝐭1,,𝐭n𝐯\Phi\colon\mathbf{t}_{1},\ldots,\mathbf{t}_{n}\to\mathbf{v} be a morphism. If n=0n=0 then this is just some wire permutation 𝗌𝗒𝗆σ\mathsf{sym}_{\sigma}. For n0n\geq 0, the progress condition gives a partial ordering on boxes. Without loss of generality, suppose that 𝐭1\mathbf{t}_{1} is minimal. Then we can rewrite the diagram in the form

𝐭1\mathbf{t}_{1}𝐭1\mathbf{t}_{1} (4)

where all the wires shown can represent multiple wires (possibly none). The wiring diagram in (4) can be written as a sequential composite of parallel composites. An example axiom relating series and parallel composition was proved in Example 4.4. ∎

We now show how 𝒲\mathcal{W}-algebras give rise to SMC’s.

Theorem 5.2.

Let τ\tau be a set. There is a fully faithful functor from the category of 𝒲τ\mathcal{W}_{\tau}-algebras to that of strict SMC’s whose objects are τ\tau-typed finite sets and whose morphisms are identity-on-objects symmetric monoidal functors.

Sketch of proof.

Let H:𝒲τ𝖲𝖾𝗍H\colon\mathcal{W}_{\tau}\to\mathsf{Set} be a functor. We need to define an SMC (𝒞,,I)(\mathcal{C},\otimes,I) with objects τ\tau-typed finite sets; in particular, we need to define the hom-set for a given pair of objects (𝐭,𝐭+)Ob(𝒞)(\mathbf{t}_{-},\mathbf{t}_{+})\in\operatorname{Ob}(\mathcal{C}). But since objects in 𝒲τ\mathcal{W}_{\tau} are exactly such pairs, we may simply use HH:

𝒞(𝐭,𝐭+)H(𝐭,𝐭+).\mathcal{C}(\mathbf{t}_{-},\mathbf{t}_{+})\coloneqq H(\mathbf{t}_{-},\mathbf{t}_{+}). (5)

We will obtain the identities, composition, and monoidal structure of 𝒞\mathcal{C}, by applying HH to various wiring diagrams.

For any object AOb(𝒞)A\in\operatorname{Ob}(\mathcal{C}), consider the box 𝐭=(A,A)\mathbf{t}=(A,A) and the 0-ary wiring diagram 𝗎𝗇𝗂𝗍A:()𝐭\mathsf{unit}_{A}\colon()\to\mathbf{t} given by tAAAA. We obtain a function H(𝗎𝗇𝗂𝗍A):1H(A,A)H(\mathsf{unit}_{A})\colon 1\to H(A,A), and we define the identity on AA to be the image of the unique element.

Given objects A,B,COb(𝒞)A,B,C\in\operatorname{Ob}(\mathcal{C}), we need a function Hom(A,B)×Hom(B,C)Hom(A,C)\operatorname{Hom}(A,B)\times\operatorname{Hom}(B,C)\to\operatorname{Hom}(A,C). We obtain it by applying HH to the wiring diagram 𝗌𝖾𝗊(A,B,C):(A,B),(B,C)(A,C)\mathsf{seq}_{(A,B,C)}:(A,B),(B,C)\to(A,C), giving

A,B,C\displaystyle\mathbin{\fatsemi}_{A,B,C} H(𝗌𝖾𝗊(A,B,C)):H(A,B)×H(B,C)H(A,C).\displaystyle\coloneqq H(\mathsf{seq}_{(A,B,C)})\colon H(A,B)\times H(B,C)\to H(A,C).
Similarly, given objects A,A,B,BOb(𝒞)A,A^{\prime},B,B^{\prime}\in\operatorname{Ob}(\mathcal{C}), parallel composition is defined by
A,A,B,B\displaystyle\otimes_{A,A^{\prime},B,B^{\prime}} H(𝗉𝖺𝗋𝖺[ABAB]):H(A,B)×H(A,B)H(AA,BB).\displaystyle\coloneqq H\Big{(}\mathsf{para}_{\tiny\left[\begin{smallmatrix}A&B\\ A^{\prime}&B^{\prime}\end{smallmatrix}\right]}\Big{)}\colon H(A,B)\times H(A^{\prime},B^{\prime})\to H(A\otimes A^{\prime},B\otimes B^{\prime}).

These two compositions are respectively depicted below.

AABBCC         AABBAA^{\prime}BB^{\prime}

The interchange law was established in Example 4.4, and the others, unitality and associativity of serial composition, and unitality, associativity, and symmetry of parallel composition, are similar.

It remains to show that for any two 𝒲τ\mathcal{W}_{\tau}-algebras H,HH,H^{\prime} with associated SMCs 𝒞,𝒞\mathcal{C},\mathcal{C}^{\prime}, we have a bijection between the set of natural transformations HHH\to H^{\prime} and that of identity-on-objects symmetric monoidal functors 𝒞𝒞\mathcal{C}\to\mathcal{C}^{\prime}. A natural transformation α:HH\alpha\colon H\to H^{\prime} defines a function H(𝐭,𝐭+)H(𝐭,𝐭+)H(\mathbf{t}_{-},\mathbf{t}_{+})\to H^{\prime}(\mathbf{t}_{-},\mathbf{t}_{+}), which by (5) defines the required functor on hom-sets. This functor respects identity, composition, and the symmetric monoidal structure by the naturality of α\alpha with respect to the morphisms in 𝒲τ\mathcal{W}_{\tau} that correspond to these structures. ∎

The SMC resulting from the procedure in Theorem 5.2 is free-on-objects. In the next theorem we will prove that the functor from Theorem 5.2 is 2-essentially surjective: every symmetric monoidal category is equivalent to one coming from an 𝒲\mathcal{W}-algebra.

Theorem 5.3.

To every SMC (𝒞,,I)(\mathcal{C},\otimes,I) there is an associated 𝒲Ob(𝒞)\mathcal{W}_{\operatorname{Ob}(\mathcal{C})}-algebra H𝒞H_{\mathcal{C}}. If we then apply the construction of Theorem 5.2 to H𝒞H_{\mathcal{C}} to obtain an SMC 𝒞\mathcal{C}^{\prime}, there is an induced equivalence of symmetric monoidal categories 𝒞𝒞\mathcal{C}^{\prime}\to\mathcal{C}.

Sketch of proof.

Let (𝒞,,I)(\mathcal{C},\otimes,I) be a symmetric monoidal category. We define a functor H𝒞:𝒲Ob(𝒞)𝖲𝖾𝗍H_{\mathcal{C}}\colon\mathcal{W}_{\operatorname{Ob}(\mathcal{C})}\to\mathsf{Set} as follows. Suppose given a box, i.e. an object (𝐭,𝐭+)(\mathbf{t}_{-},\mathbf{t}_{+}) in 𝒲Ob(𝒞)\mathcal{W}_{\operatorname{Ob}(\mathcal{C})}, where 𝐭:SOb(𝒞)\mathbf{t}_{-}\colon S_{-}\to\operatorname{Ob}(\mathcal{C}) and 𝐭+:S+Ob(𝒞)\mathbf{t}_{+}\colon S_{+}\to\operatorname{Ob}(\mathcal{C}) are the typed finite sets. To it we assign the hom-set

H𝒞(𝐭,𝐭+)𝒞(sS𝐭(s),sS+𝐭+(s)).H_{\mathcal{C}}(\mathbf{t}_{-},\mathbf{t}_{+})\coloneqq\mathcal{C}\left(\bigotimes_{s\in S_{-}}\mathbf{t}_{-}(s),\bigotimes_{s\in S_{+}}\mathbf{t}_{+}(s)\right). (6)

By Lemma 5.1, 𝒲Ob(𝒞)\mathcal{W}_{\operatorname{Ob}(\mathcal{C})} is generated by the morphisms 𝗉𝖺𝗋𝖺,𝗌𝖾𝗊\mathsf{para},\mathsf{seq}, and 𝗌𝗒𝗆\mathsf{sym} corresponding to parallel composition, series composition, and permutation, and that these morphisms satisfy well-known relations. Thus to give the action of H𝒞H_{\mathcal{C}} on morphisms, it suffices to say how it acts on these generators, and show that relations hold. For the morphism 𝗌𝖾𝗊(A,B,C)\mathsf{seq}_{(A,B,C)} in 𝒲Ob(𝒞)\mathcal{W}_{\operatorname{Ob}(\mathcal{C})} representing series composition

𝐭\mathbf{t}𝐭\mathbf{t}^{\prime} 𝐯\mathbf{v}AABBCC

we need to give a function H𝒞(A,B)×H𝒞(B,C)H𝒞(A,C)H_{\mathcal{C}}(A,B)\times H_{\mathcal{C}}(B,C)\to H_{\mathcal{C}}(A,C). By definition this is just a function 𝒞(A,B)×𝒞(B,C)𝒞(A,C)\mathcal{C}(A,B)\times\mathcal{C}(B,C)\to\mathcal{C}(A,C), and of course we use the composition function A,B,C\mathbin{\fatsemi}_{A,B,C} from 𝒞\mathcal{C} as a category. The case for parallel composition (resp. symmetry) is similar: one uses the monoidal product (resp. symmetry) from 𝒞\mathcal{C}. These satisfy the required diagrammatic relations because by definition 𝒞\mathcal{C} satisfies the laws of monoidal categories.

Finally we consider the roundtrip, starting with 𝒞\mathcal{C}, constructing H𝒞H_{\mathcal{C}} as above, and then applying the construction of Theorem 5.2 to obtain a new SMC 𝒞\mathcal{C}^{\prime}. The objects of 𝒞\mathcal{C}^{\prime} are the Ob(𝒞)\operatorname{Ob}(\mathcal{C})-typed finite sets, and there is a surjection Ob(𝒞)Ob(𝒞)\operatorname{Ob}(\mathcal{C}^{\prime})\to\operatorname{Ob}(\mathcal{C}) given by sending 𝐭:SOb(𝒞)\mathbf{t}\colon S\to\operatorname{Ob}(\mathcal{C}) to sS𝐭(s)\bigotimes_{s\in S}\mathbf{t}(s). At this point, (5) and (6) provide a bijection 𝒞(𝐭,𝐭+)𝒞(sS𝐭(s),sS+𝐭+(s))\mathcal{C}^{\prime}(\mathbf{t}_{-},\mathbf{t}_{+})\to\mathcal{C}(\bigotimes_{s\in S_{-}}\mathbf{t}_{-}(s),\bigotimes_{s\in S_{+}}\mathbf{t}_{+}(s)), which one can check is part of a surjective-on-objects fully faithful symmetric monoidal functor. ∎

Acknowledgments

David Spivak acknowledges support from AFOSR grants FA9550-19-1-0113 and FA9550-17-1-0058. The authors also appreciate the helpful reviews of the ACT2020 program committee, which improved the quality of this paper.

References

  • [1] Seth Bromberger, James Fairbanks and contributors “LightGraphs.jl: an optimized graphs package for the Julia programming language”, 2017 DOI: 10.5281/zenodo.889971
  • [2] Pierre Deligne and James S. Milne “Tannakian categories” In Hodge cycles, motives, and Shimura varieties, 1982, pp. 101–228 URL: https://www.jmilne.org/math/xnotes/tc2018.pdf
  • [3] Brendan Fong and David I. Spivak “Hypergraph categories” In Journal of Pure and Applied Algebra 223.11, 2019, pp. 4746–4777 DOI: 10.1016/j.jpaa.2019.02.014
  • [4] Brendan Fong and David I. Spivak “Supplying bells and whistles in symmetric monoidal categories”, 2019 arXiv:1908.02633
  • [5] André Joyal and Ross Street “The geometry of tensor calculus, I” In Advances in mathematics 88.1, 1991, pp. 55–112
  • [6] Aleks Kissinger and Vladimir Zamdzhiev “Quantomatic: A proof assistant for diagrammatic reasoning” In International Conference on Automated Deduction, 2015, pp. 326–336 DOI: 10.1007/978-3-319-21401-6˙22
  • [7] Evan Patterson and contributors “Catlab.jl: a framework for applied and computational category theory”, 2020 DOI: 10.5281/zenodo.598366
  • [8] Roger Penrose “Applications of negative dimensional tensors” In Combinatorial mathematics and its applications 1, 1971, pp. 221–244
  • [9] Dylan Rupel and David I. Spivak “The operad of temporal wiring diagrams: formalizing a graphical language for discrete-time processes”, 2013 arXiv:1307.6894
  • [10] Peter Selinger “A survey of graphical languages for monoidal categories” In New structures for physics, 2010, pp. 289–355 DOI: 10.1007/978-3-642-12821-9˙4
  • [11] Pawel Sobocinski, Paul W Wilson and Fabio Zanasi “CARTOGRAPHER: A Tool for String Diagrammatic Reasoning (Tool Paper)” In 8th Conference on Algebra and Coalgebra in Computer Science (CALCO 2019), 2019 Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik DOI: 10.4230/LIPIcs.CALCO.2019.20
  • [12] David I. Spivak, Patrick Schultz and Dylan Rupel “String diagrams for traced and compact categories are oriented 1-cobordisms” In Journal of Pure and Applied Algebra 221.8, 2017, pp. 2064–2110 DOI: 10.1016/j.jpaa.2016.10.009