<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[Azimuth]]></provider_name><provider_url><![CDATA[https://johncarlosbaez.wordpress.com]]></provider_url><author_name><![CDATA[John Baez]]></author_name><author_url><![CDATA[https://johncarlosbaez.wordpress.com/author/johncarlosbaez/]]></author_url><title><![CDATA[Cospans, Wiring Diagrams, and the Behavioral&nbsp;Approach]]></title><type><![CDATA[link]]></type><html><![CDATA[<p><i>joint with <b><a href="http://www.azimuthproject.org/azimuth/show/Brendan+Fong">Brendan Fong</a></b></i></p>
<p>We&#8217;re getting ready for the Turin workshop on the <a href=""><br />
</a><a href="https://johncarlosbaez.wordpress.com/2015/04/04/categorical-foundations-of-network-theory/">Categorical Foundations of Network Theory</a>.  So, we&#8217;re trying to get our thoughts in order.</p>
<p><a href>Last time</a> we talked about understanding types of networks as categories of decorated cospans.  <a href="https://johncarlosbaez.wordpress.com/2015/04/02/a-networked-world-part-3/">Earlier</a>, David Spivak told us about understanding networks as algebras of an operad.  Both these frameworks work at capturing notions of modularity and interconnection.  Are they then related?  How?</p>
<p>In this post we want to discuss some similarities between decorated cospan categories and algebras for <a href="http://arxiv.org/abs/1305.0297">Spivak&#8217;s operad of wiring diagrams</a>. The main idea is that the two approaches are &#8216;essentially&#8217; equivalent, but that compared to decorated cospans, Spivak&#8217;s operad formalism puts greater emphasis on the distinction between the &#8216;duplication&#8217; and &#8216;deletion&#8217; morphisms and other morphisms in our category.</p>
<p>The precise details are still to be worked out&#8212;jump in and help us!</p>
<h3> Operads </h3>
<p>We begin with a bit about operads in general. Recall that an operad is similar to a category, except that instead of a set <img src='https://s0.wp.com/latex.php?latex=%5Cmathrm%7Bhom%7D%28x%2Cy%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathrm{hom}(x,y)' title='&#92;mathrm{hom}(x,y)' class='latex' /> of morphisms from any object <img src='https://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' /> to any object <img src='https://s0.wp.com/latex.php?latex=y%2C&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='y,' title='y,' class='latex' /> you have a set <img src='https://s0.wp.com/latex.php?latex=%5Cmathrm%7Bhom%7D%28x_1%2C%5Cdots%2Cx_n%3By%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathrm{hom}(x_1,&#92;dots,x_n;y)' title='&#92;mathrm{hom}(x_1,&#92;dots,x_n;y)' class='latex' /> of <b>operations</b> from any finite list of objects <img src='https://s0.wp.com/latex.php?latex=x_1%2C...%2Cx_n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x_1,...,x_n' title='x_1,...,x_n' class='latex' /> to any object <img src='https://s0.wp.com/latex.php?latex=y+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='y .' title='y .' class='latex' /> If we have an operation <img src='https://s0.wp.com/latex.php?latex=f+%5Cin+%5Cmathrm%7Bhom%7D%28x_1%2C%5Cdots%2Cx_n%3By%29%2C&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f &#92;in &#92;mathrm{hom}(x_1,&#92;dots,x_n;y),' title='f &#92;in &#92;mathrm{hom}(x_1,&#92;dots,x_n;y),' class='latex' /> we can call <img src='https://s0.wp.com/latex.php?latex=x_1%2C+%5Cdots%2C+x_n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x_1, &#92;dots, x_n' title='x_1, &#92;dots, x_n' class='latex' /> the <b>inputs</b> of <img src='https://s0.wp.com/latex.php?latex=f&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f' title='f' class='latex' /> and call <img src='https://s0.wp.com/latex.php?latex=y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='y' title='y' class='latex' /> the <b>output</b> of <img src='https://s0.wp.com/latex.php?latex=f+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f .' title='f .' class='latex' /></p>
<p>We can compose operations in an operad.  To understand how, it&#8217;s easiest to use pictures.   We draw an operation in <img src='https://s0.wp.com/latex.php?latex=%5Cmathrm%7Bhom%7D%28x_1%2C%5Cdots%2Cx_n%3By%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathrm{hom}(x_1,&#92;dots,x_n;y)' title='&#92;mathrm{hom}(x_1,&#92;dots,x_n;y)' class='latex' /> as a little box with <img src='https://s0.wp.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='n' title='n' class='latex' /> wires coming in and one wire coming out:</p>
<div align="center">
<img width="100" src="https://i0.wp.com/math.ucr.edu/home/baez/mathematical/operad/operation.jpg" />
</div>
<p>The input wires should be labelled with the objects <img src='https://s0.wp.com/latex.php?latex=x_1%2C+%5Cdots%2C+x_n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x_1, &#92;dots, x_n' title='x_1, &#92;dots, x_n' class='latex' /> and the output wire with the object <img src='https://s0.wp.com/latex.php?latex=y%2C&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='y,' title='y,' class='latex' /> but I haven&#8217;t done this.</p>
<p>We are allowed to compose these operations as follows:</p>
<div align="center">
<img width="250" src="https://i1.wp.com/math.ucr.edu/home/baez/mathematical/operad/composition.jpg" />
</div>
<p>as long as the outputs of the operations <img src='https://s0.wp.com/latex.php?latex=g_1%2C%5Cdots%2Cg_n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='g_1,&#92;dots,g_n' title='g_1,&#92;dots,g_n' class='latex' /> match the inputs of the operation <img src='https://s0.wp.com/latex.php?latex=f+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f .' title='f .' class='latex' />   The result is a new operation which we call <img src='https://s0.wp.com/latex.php?latex=f+%5Ccirc+%28g_1%2C%5Cdots%2Cg_n%29+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f &#92;circ (g_1,&#92;dots,g_n) .' title='f &#92;circ (g_1,&#92;dots,g_n) .' class='latex' /></p>
<p>We demand that there be unary operations <img src='https://s0.wp.com/latex.php?latex=1_x+%5Cin+%5Cmathrm%7Bhom%7D%28x%3Bx%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='1_x &#92;in &#92;mathrm{hom}(x;x)' title='1_x &#92;in &#92;mathrm{hom}(x;x)' class='latex' /> serving as identities for composition, and we impose an <b>associative law</b> that makes a composite of composites like this well-defined:</p>
<div align="center">
<img width="400" src="https://i1.wp.com/math.ucr.edu/home/baez/mathematical/operad/associativity.jpg" />
</div>
<p>So far this is the definition of a operad without permutations.  In a full-fledged <b>permutative</b> operad, we can also permute the inputs of an operation <img src='https://s0.wp.com/latex.php?latex=f&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f' title='f' class='latex' /> and get a new operation:</p>
<div align="center">
<img width="100" src="https://i1.wp.com/math.ucr.edu/home/baez/mathematical/operad/permutation.jpg" />
</div>
<p>which we call <img src='https://s0.wp.com/latex.php?latex=f+%5Csigma&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f &#92;sigma' title='f &#92;sigma' class='latex' /> if <img src='https://s0.wp.com/latex.php?latex=%5Csigma&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' /> is the the permutation of the inputs.  We demand that <img src='https://s0.wp.com/latex.php?latex=%28f+%5Csigma%29+%5Csigma%27+%3D+f+%28%5Csigma+%5Csigma%27%29+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='(f &#92;sigma) &#92;sigma&#039; = f (&#92;sigma &#92;sigma&#039;) .' title='(f &#92;sigma) &#92;sigma&#039; = f (&#92;sigma &#92;sigma&#039;) .' class='latex' />   And finally, we demand that permutations act in a way that is compatible with composition.  For example:</p>
<div align="center">
<img width="450" src="https://i2.wp.com/math.ucr.edu/home/baez/mathematical/operad/compatibility.jpg" />
</div>
<p>Here we see that <img src='https://s0.wp.com/latex.php?latex=%28f+%5Csigma%29+%5Ccirc+%28g_1%2C+%5Cdots%2C+g_n%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='(f &#92;sigma) &#92;circ (g_1, &#92;dots, g_n)' title='(f &#92;sigma) &#92;circ (g_1, &#92;dots, g_n)' class='latex' /> is equal to some obvious other thing.</p>
<p>Finally, there is a law saying</p>
<p><img src='https://s0.wp.com/latex.php?latex=f+%5Ccirc+%28g_1+%5Csigma_1%2C+%5Cdots%2C+g_n+%5Csigma_n%29+%3D+%28f+%5Ccirc+%28g_1+%2C+%5Cdots%2C+g_n%29%29+%5Csigma+&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f &#92;circ (g_1 &#92;sigma_1, &#92;dots, g_n &#92;sigma_n) = (f &#92;circ (g_1 , &#92;dots, g_n)) &#92;sigma ' title='f &#92;circ (g_1 &#92;sigma_1, &#92;dots, g_n &#92;sigma_n) = (f &#92;circ (g_1 , &#92;dots, g_n)) &#92;sigma ' class='latex' /></p>
<p>for some choice of <img src='https://s0.wp.com/latex.php?latex=%5Csigma&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' /> that you can cook up from the permuations <img src='https://s0.wp.com/latex.php?latex=%5Csigma_i&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;sigma_i' title='&#92;sigma_i' class='latex' /> in an obvious way.  We leave it as an exercise to work out the details.   By the way, <a href="http://books.google.com/books/about/Operads_in_Algebra_Topology_and_Physics.html?id=Rqh8ZgUEAmMC">one well-known book on operads</a> accidentally omits this law, so here&#8217;s a rather more lengthy exercise: read this book, see which theorems require this law, and correct their proofs!</p>
<p>Operads are similar to symmetric monoidal categories. The idea is that in a symmetric monoidal category you can just form the tensor product <img src='https://s0.wp.com/latex.php?latex=x_1+%5Cotimes+%5Cdots+%5Cotimes+x_n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x_1 &#92;otimes &#92;dots &#92;otimes x_n' title='x_1 &#92;otimes &#92;dots &#92;otimes x_n' class='latex' /> and talk about the set of morphisms <img src='https://s0.wp.com/latex.php?latex=x_1+%5Cotimes+%5Ccdots+%5Cotimes+%5Ccdots+x_n+%5Cto+y+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x_1 &#92;otimes &#92;cdots &#92;otimes &#92;cdots x_n &#92;to y .' title='x_1 &#92;otimes &#92;cdots &#92;otimes &#92;cdots x_n &#92;to y .' class='latex' /> Indeed any symmetric monoidal category gives an operad in this way: just define <img src='https://s0.wp.com/latex.php?latex=%5Cmathrm%7Bhom%7D%28x_1%2C...%2Cx_n%3By%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathrm{hom}(x_1,...,x_n;y)' title='&#92;mathrm{hom}(x_1,...,x_n;y)' class='latex' /> to be <img src='https://s0.wp.com/latex.php?latex=%5Cmathrm%7Bhom%7D%28x_1+%5Cotimes+%5Ccdots+%5Cotimes+x_n%2C+y%29+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathrm{hom}(x_1 &#92;otimes &#92;cdots &#92;otimes x_n, y) .' title='&#92;mathrm{hom}(x_1 &#92;otimes &#92;cdots &#92;otimes x_n, y) .' class='latex' />  If we do this with Set, which is a symmetric monoidal category using the usual cartesian product of sets, we get an operad called <img src='https://s0.wp.com/latex.php?latex=%5Cmathrm%7BSet%7D.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathrm{Set}.' title='&#92;mathrm{Set}.' class='latex' /></p>
<p>An <b>algebra</b> for an operad <img src='https://s0.wp.com/latex.php?latex=O&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='O' title='O' class='latex' /> is an operad homomorphism <img src='https://s0.wp.com/latex.php?latex=O+%5Cto+%5Cmathrm%7BSet%7D.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='O &#92;to &#92;mathrm{Set}.' title='O &#92;to &#92;mathrm{Set}.' class='latex' />  We haven&#8217;t said what an operad homomorphism is, but you can probably figure it out yourself.  The point is this: an algebra for <img src='https://s0.wp.com/latex.php?latex=O&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='O' title='O' class='latex' /> turns the abstract operations in <img src='https://s0.wp.com/latex.php?latex=O&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='O' title='O' class='latex' /> into actual operations on sets!</p>
<p>Finally, we should warn you that operads come in several flavors, and we&#8217;ve been talking about &#8216;typed permutative operads&#8217;.  &#8216;Typed&#8217; means that there&#8217;s more than one object; &#8216;permutative&#8217; means that we have the ability to permute the input wires.  When people say &#8216;operad&#8217;, they often mean an <i>untyped</i> permutative operad.  For that, just specialize down to the case where there&#8217;s only one object <img src='https://s0.wp.com/latex.php?latex=x.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x.' title='x.' class='latex' /></p>
<p>You can see a fully precise definition of untyped permutative operads here:</p>
<p>&bull; <a href="https://en.wikipedia.org/wiki/Operad_theory">Operad theory</a>, Wikipedia.</p>
<p>along with the definition of an untyped operad without permutations.</p>
<h3>The operad of wiring diagrams</h3>
<p>Spivak&#8217;s favorite operad is the operad of wiring diagrams.  The operad of wiring diagrams <img src='https://s0.wp.com/latex.php?latex=WD&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='WD' title='WD' class='latex' /> is an operad version of <img src='https://s0.wp.com/latex.php?latex=%5Cmathrm%7BCospan%7D%28%5Cmathrm%7BFinSet%7D%29%2C&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathrm{Cospan}(&#92;mathrm{FinSet}),' title='&#92;mathrm{Cospan}(&#92;mathrm{FinSet}),' class='latex' /> constructed in the vein suggested above: the objects are finite sets, and an operation from a list of sets <img src='https://s0.wp.com/latex.php?latex=X_1%2C...%2CX_n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X_1,...,X_n' title='X_1,...,X_n' class='latex' /> to a set <img src='https://s0.wp.com/latex.php?latex=Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='Y' title='Y' class='latex' /> is a cospan</p>
<p><img src='https://s0.wp.com/latex.php?latex=X_1%2B+%5Ccdots+%2BX_n+%5Crightarrow+S+%5Cleftarrow+Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X_1+ &#92;cdots +X_n &#92;rightarrow S &#92;leftarrow Y' title='X_1+ &#92;cdots +X_n &#92;rightarrow S &#92;leftarrow Y' class='latex' /></p>
<p>Spivak draws such a thing as a big circle with <img src='https://s0.wp.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='n' title='n' class='latex' /> small circles cut out from the interior:</p>
<p><img width="450" src="https://i1.wp.com/math.ucr.edu/home/baez/networks/decorated_cospans/wiring_diagram.jpg" /></p>
<p>The outside of the big circle has a set <img src='https://s0.wp.com/latex.php?latex=Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='Y' title='Y' class='latex' /> of terminals marked on it, and each small circle has a set <img src='https://s0.wp.com/latex.php?latex=X_i&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X_i' title='X_i' class='latex' /> of terminals marked on it. Then in the interior of this shape there are wires connecting these terminals.  This what he calls a <b>wiring diagrams</b>.</p>
<p>You compose these wiring diagrams by pasting other wiring diagrams into each of the small circles.</p>
<p>The relationship with our Frobenius monoid diagrams is pretty simple: we draw our &#8216;wiring diagrams&#8217; <img src='https://s0.wp.com/latex.php?latex=X+%5Cto+Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X &#92;to Y' title='X &#92;to Y' class='latex' /> in a square, with the <img src='https://s0.wp.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X' title='X' class='latex' /> terminals on the left and <img src='https://s0.wp.com/latex.php?latex=Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='Y' title='Y' class='latex' /> terminals on the right. To get a Spivak-approved wiring diagram, glue the top and bottom edges of this square together, then flatten the cylinder you get down into an annulus, with the <img src='https://s0.wp.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X' title='X' class='latex' />-side on the inside and <img src='https://s0.wp.com/latex.php?latex=Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='Y' title='Y' class='latex' />-side on the outside. If <img src='https://s0.wp.com/latex.php?latex=X+%3D+X_1%2BX_2&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X = X_1+X_2' title='X = X_1+X_2' class='latex' /> you can imagine gluing opposite edges of the inside circle together to divide it into two small circles accordingly, and so on.</p>
<h3>Relational algebras of type <i>A</i></h3>
<p>Algebras for wiring diagrams tell you what components you have available to wire together with your diagrams. An algebra for the operad of wiring diagrams is an operad homomorphism</p>
<p><img src='https://s0.wp.com/latex.php?latex=WD+%5Cto+%5Cmathrm%7BSet%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='WD &#92;to &#92;mathrm{Set}' title='WD &#92;to &#92;mathrm{Set}' class='latex' /></p>
<p>What does this look like? Just like a functor for categories, it assigns to each natural number a set, and each wiring diagram a function.</p>
<p>In work related to decorated cospans (such as <a href="https://johncarlosbaez.wordpress.com/2015/04/28/a-compositional-framework-for-passive-linear-networks/">our paper on circuits</a> or <a href="http://arxiv.org/abs/1405.6881">John and Jason&#8217;s work on signal flow diagrams</a>), our semantics usually is constructed from a field of values&#8212;not a physicist&#8217;s &#8216;field&#8217;, bt an algebraist&#8217;s sort of &#8216;field&#8217;, where you can add, multiply, subtract and divide.   For example, we like being able to assign a real number like a velocity, or potential, or current to a variable.  This gives us vector spaces and a bunch of nice linear-algebraic structures.</p>
<p>Spivak works more generally: he&#8217;s interested in the structure when you just have a set of values. While this means we can&#8217;t do some of the nice things we could do with a field, it also means this framework can do things like talk about logic gates, where the variables are boolean ones, or number theoretic questions, where you&#8217;re interested in the natural numbers.</p>
<p>So to discuss semantics we pick a set <img src='https://s0.wp.com/latex.php?latex=A&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='A' title='A' class='latex' /> of values, such as the real numbers or natural numbers or booleans or colors. We imagine then associating elements of this set to each wire in a wiring diagram. More technically, the algebra</p>
<p><img src='https://s0.wp.com/latex.php?latex=%5Cmathrm%7BRel%7DA%3A+WD+%5Cto+%5Cmathrm%7BSet%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathrm{Rel}A: WD &#92;to &#92;mathrm{Set}' title='&#92;mathrm{Rel}A: WD &#92;to &#92;mathrm{Set}' class='latex' /></p>
<p>then maps each finite set <img src='https://s0.wp.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X' title='X' class='latex' /> to the power set <img src='https://s0.wp.com/latex.php?latex=%5Cmathcal%7BP%7D%28A%5EX%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathcal{P}(A^X)' title='&#92;mathcal{P}(A^X)' class='latex' /> of the set <img src='https://s0.wp.com/latex.php?latex=A%5EX&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='A^X' title='A^X' class='latex' /> of functions <img src='https://s0.wp.com/latex.php?latex=X+%5Cto+A+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X &#92;to A .' title='X &#92;to A .' class='latex' /></p>
<p>On the morphisms (the wiring diagrams themselves), this functor behaves as follows.  Note that a function (<img src='https://s0.wp.com/latex.php?latex=X+%5Cto+A&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X &#92;to A' title='X &#92;to A' class='latex' />) can be thought of as an &#8216;<i>X</i>-vector&#8217; <img src='https://s0.wp.com/latex.php?latex=%28a_1%2C...%2Ca_x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='(a_1,...,a_x)' title='(a_1,...,a_x)' class='latex' /> of &#8216;<i>A</i>-coordinates&#8217;. A wiring diagram <img src='https://s0.wp.com/latex.php?latex=X+%5Cto+Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X &#92;to Y' title='X &#92;to Y' class='latex' /> is just a cospan</p>
<p><img src='https://s0.wp.com/latex.php?latex=X+%5Cto+N++%5Cleftarrow+Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X &#92;to N  &#92;leftarrow Y' title='X &#92;to N  &#92;leftarrow Y' class='latex' /></p>
<p>in <img src='https://s0.wp.com/latex.php?latex=%5Cmathrm%7BFinSet%7D%2C&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathrm{FinSet},' title='&#92;mathrm{FinSet},' class='latex' /> so it can be thought of as some compares</p>
<p><img src='https://s0.wp.com/latex.php?latex=X+%5Cto+N&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X &#92;to N' title='X &#92;to N' class='latex' /></p>
<p>followed by some copies</p>
<p><img src='https://s0.wp.com/latex.php?latex=N+%5Cto+Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N &#92;to Y' title='N &#92;to Y' class='latex' /></p>
<p>Thus, given a wiring diagram <img src='https://s0.wp.com/latex.php?latex=X+%5Cto+Y%2C&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X &#92;to Y,' title='X &#92;to Y,' class='latex' /> we can consider a partial function that maps an <img src='https://s0.wp.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X' title='X' class='latex' />-vector to the <img src='https://s0.wp.com/latex.php?latex=Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='Y' title='Y' class='latex' />-vector by doing these compares, and if it passes them does the copies and returns the resulting <img src='https://s0.wp.com/latex.php?latex=Y&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='Y' title='Y' class='latex' />-vector, but if not returns &#8216;undefined&#8217;. We can then define a map <img src='https://s0.wp.com/latex.php?latex=%5Cmathcal%7BP%7D%28A%5EX%29+%5Cto+%5Cmathcal%7BP%7D%28A%5EY%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathcal{P}(A^X) &#92;to &#92;mathcal{P}(A^Y)' title='&#92;mathcal{P}(A^X) &#92;to &#92;mathcal{P}(A^Y)' class='latex' /> which takes a set of <img src='https://s0.wp.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X' title='X' class='latex' />-vectors to its image under this partial function.</p>
<p>This semantics is called the <b>relational <img src='https://s0.wp.com/latex.php?latex=WD&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='WD' title='WD' class='latex' />-algebra of type</b> <i>A</i>.  We can think of it as being like the &#8216;light operations&#8217; fragment of the signal flow calculus.  By &#8216;light operations&#8217;, we mean the operations of duplication and deletion, which form a cocommutative comonoid:</p>
<div align="center">
<img width="450" src="https://i0.wp.com/math.ucr.edu/home/baez/networks/signal_flow/relation_cocommutative_comonoid.jpg" alt="" /></div>
<p>and their time-reversed versions, &#8216;coduplication&#8217; and &#8216;codeletion&#8217;, which form a commutatative monoid:</p>
<div align="center">
<img width="450" src="https://i2.wp.com/math.ucr.edu/home/baez/networks/signal_flow/relation_commutative_monoid_dual.jpg" alt="" /></div>
<p>These fit together to form a <b>Frobenius monoid</b>, meaning that these equations hold:</p>
<div align="center">
<img width="250" src="https://i0.wp.com/math.ucr.edu/home/baez/networks/signal_flow/relation_frobenius_duplication.jpg" alt="" /></div>
<p>And it&#8217;s actually <b>extra-special</b>, meaning that these equations hold:</p>
<div align="center">
<img width="200" src="https://i0.wp.com/math.ucr.edu/home/baez/networks/signal_flow/relation_extraspecial_duplication.jpg" alt="" /></div>
<p>(If you don&#8217;t understand these hieroglyphics, please reread our post about <a href="https://johncarlosbaez.wordpress.com/2015/04/23/categories-in-control-2/">categories in control theory</a>, and ask some questions!)</p>
<p>Note that we can&#8217;t do the &#8216;dark operations&#8217;, because we only have a set <img src='https://s0.wp.com/latex.php?latex=A&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='A' title='A' class='latex' /> of values, not a field, and the dark operations involve addition and zero!</p>
<h3>Operads and the behavioral approach</h3>
<p>In formulating Frobenius monoids this way, Spivak achieves something that we&#8217;ve been working hard to find ways to achieve: a separation of the behavioral structure from the interconnection structure.</p>
<p>What do I mean by this? In his &#8216;<a href="http://homes.esat.kuleuven.be/~jwillems/Articles/JournalArticles/2007.1.pdf">behavioral approach</a>&#8216;, Willems makes the point that for all their elaborate and elegant formulation, in the end physical laws just come down to dividing the set of what might a priori be possible (the &#8216;universum&#8217;) into the set of things that actually are possible (the &#8216;behavior&#8217;), and the set of things that aren&#8217;t). Here the universum is the set <img src='https://s0.wp.com/latex.php?latex=A%5EX&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='A^X' title='A^X' class='latex' />: a priori, on each of the wires in <img src='https://s0.wp.com/latex.php?latex=X%2C&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X,' title='X,' class='latex' /> we might associate any value of <img src='https://s0.wp.com/latex.php?latex=A+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='A .' title='A .' class='latex' /> For example, to the two wires at the ends of a resistor, we might a priori associate any pair of currents. But physical law, here Kirchhoff&#8217;s current law, says otherwise: the currents must be equal and opposite. So the &#8216;behavior&#8217; is the subset <img src='https://s0.wp.com/latex.php?latex=%28i%2C-i%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='(i,-i)' title='(i,-i)' class='latex' /> of the universum <img src='https://s0.wp.com/latex.php?latex=%5Cmathbb%7BR%7D%5E2.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathbb{R}^2.' title='&#92;mathbb{R}^2.' class='latex' /></p>
<p>So you can say that to each object <img src='https://s0.wp.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='X' title='X' class='latex' /> in the operad of wiring diagrams the relational algebra of type <img src='https://s0.wp.com/latex.php?latex=A&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='A' title='A' class='latex' /> associates the set <img src='https://s0.wp.com/latex.php?latex=%5Cmathcal%7BP%7D%28A%5EX%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathcal{P}(A^X)' title='&#92;mathcal{P}(A^X)' class='latex' /> of possible behaviors&#8212;the universum is <img src='https://s0.wp.com/latex.php?latex=A%5EX+.&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='A^X .' title='A^X .' class='latex' /> (<img src='https://s0.wp.com/latex.php?latex=%5Cmathcal%7BP%7D%28A%5EX%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathcal{P}(A^X)' title='&#92;mathcal{P}(A^X)' class='latex' /> forms some sort of meta-universum, where you can discuss physical laws about physical laws, commonly called &#8216;principles&#8217;.)</p>
<p>The second key aspect of the behavioral approach is that the behaviors of larger systems can be constructed from the behaviors of its subsystems, if we understand the so-called &#8216;interconnection structure&#8217; well enough. This is a key principle in engineering: we build big, complicated systems from a much smaller set of components, whether it be electronics from resistors and inductors, or mechanical devices from wheels and rods and ropes, or houses from Lego bricks. The various interconnection structures here are the wiring diagrams, and our relational algebras say they act by what Willems calls &#8216;variable sharing&#8217;.</p>
<p>This division between behavior and interconnection motivates the decorated cospan construction (where the decorations are the &#8216;components&#8217;, the cospans the &#8216;interconnection&#8217;) and also the multigraph categories discussed by Aleks Kissinger (where morphisms are the &#8216;components&#8217;, and the Frobenius monoid operations are the &#8216;interconnection&#8217;):</p>
<p>&bull; Aleks Kissinger, <a href="http://arxiv.org/abs/1406.5942">Finite matrices are complete for (dagger-)multigraph categories</a>.</p>
<p>So it&#8217;s good to have this additional way of thinking about things in our repertoire: operads describe &#8216;interconnection&#8217;, their algebras &#8216;behaviors&#8217;.</p>
<p>The separation Spivak achieves, however, seems to me to come at the cost of neat ways to talk about individual components, and perhaps this can be seen as the essential difference between the two approaches. By including our components as morphisms, we can talk more carefully about them and additional structure individual components have. On the other hand, by lumping all the components into the objects, Spivak can talk more carefully about how the interconnection structure acts on all behaviors at once.</p>
<h3>Other operads of wiring diagrams</h3>
<p>One advantage of the operad approach is that you can easily tweak your operad to talk about different sorts of network structure. Sometimes you can make similar adjustments with decorated cospans too, such as working over the category of typed finite sets, rather than just finite sets, to discuss networks in which wires have types, and only wires of the same types can be connected together. A physical example is a model of a hydroelectric power plant, where you don&#8217;t want to connect a water pipe with an electrical cable! This is also a common technique in computer science, where you don&#8217;t want to try to multiply two strings of text, or try to interpret a telephone number as a truth value.</p>
<p>But some modifications are harder to do with decorated cospans. In some other papers, Spivak employs a more restricted operad of wiring diagrams, in which joining wires and terminating wires is not allowed, among other things. He uses this to formalise graphical languages for certain types of <a href="http://arxiv.org/abs/1307.6894">discrete-time processes</a>, <a href="http://arxiv.org/abs/1408.1598">open dynamical systems</a>, including <a href="http://arxiv.org/abs/1502.07380">mode-dependent ones</a>.</p>
<p>For more detail, read these:</p>
<p>&bull; Brendan Fong, <a href="http://arxiv.org/abs/1502.00872">Decorated cospans</a>.</p>
<p>&bull; David Spivak, <a href="http://arxiv.org/abs/1305.0297">The operad of wiring diagrams: formalizing a graphical language for databases, recursion, and plug-and-play circuits</a>.</p>
]]></html><thumbnail_url><![CDATA[https://i0.wp.com/math.ucr.edu/home/baez/mathematical/operad/operation.jpg?fit=440%2C330]]></thumbnail_url><thumbnail_height><![CDATA[291]]></thumbnail_height><thumbnail_width><![CDATA[155]]></thumbnail_width></oembed>