key: cord-0637614-osfgei2i authors: Baez, John C.; Courser, Kenny; Vasilakopoulou, Christina title: Structured versus Decorated Cospans date: 2021-01-22 journal: nan DOI: nan sha: cd4d3ab79f8816b891281fb8d1a99d7b6e1daa2e doc_id: 637614 cord_uid: osfgei2i One goal of applied category theory is to understand open systems. We compare two ways of describing open systems as cospans equipped with extra data. First, given a functor $L colon mathsf{A} to mathsf{X}$, a"structured cospan"is a diagram in $mathsf{X}$ of the form $L(a) rightarrow x leftarrow L(b)$. If $mathsf{A}$ and $mathsf{X}$ have finite colimits and $L$ preserves them, it is known that there is a symmetric monoidal double category whose objects are those of $mathsf{A}$ and whose horizontal 1-cells are structured cospans. Second, given a pseudofunctor $F colon mathsf{A} to mathbf{Cat}$, a"decorated cospan"is a diagram in $mathsf{A}$ of the form $a rightarrow m leftarrow b$ together with an object of $F(m)$. Generalizing the work of Fong, we show that if $mathsf{A}$ has finite colimits and $F colon (mathsf{A},+) to (mathsf{Cat},times)$ is symmetric lax monoidal, there is a symmetric monoidal double category whose objects are those of $mathsf{A}$ and whose horizontal 1-cells are decorated cospans. We prove that under certain conditions, these two constructions become isomorphic when we take $mathsf{X} = int F$ to be the Grothendieck category of $F$. We illustrate these ideas with applications to electrical circuits, Petri nets, dynamical systems and epidemiological modeling. An 'open system' is any sort of system that can interact with the outside world. Experience has shown that open systems are nicely modeled using cospans [16, 20, 40] A is a diagram of this form: We call m the apex, a and b the feet, and i and o the legs of the cospan. The apex describes the system itself. The feet describe 'interfaces' through which the system can interact with the outside world. The legs describe how the interfaces are included in the system. If the category A has finite colimits, we can compose cospans using pushouts: this describes the operation of attaching two open systems together in series by identifying one interface of the first with one of the second. We can also 'tensor' cospans using coproducts: this describes setting open systems side by side, in parallel. Via these operations we obtain a symmetric monoidal double category with cospans in A as its horizontal 1-cells [15, 38] . However, we often want the system itself to have more structure than its interfaces. This led Fong to develop a theory of 'decorated' cospans [19] . Given a category A with finite colimits, a symmetric lax monoidal functor F : (A, +) → (Set, ×) can be used to equip the apex m of a cospan in A with some extra data: an element s ∈ F (m), which we call a decoration. Thus a decorated cospan is a pair: Fong proved that there is a symmetric monoidal category with objects of A as its objects and equivalence classes of decorated cospans as its morphisms. Such categories were used to describe a variety of open systems: electrical circuits, Markov processes, chemical reaction networks and dynamical systems [6, 7, 9] . Unfortunately, many applications of decorated cospans were flawed. The problem is that while Fong's decorated cospans are good for decorating the apex m with an element of a set F (m), they are unable to decorate it with an object of a category. An example would be equipping a finite set m with edges making its elements into the nodes of a graph. We would like the following 'open graph' to be a decorated cospan where the apex is the finite set m = {n 1 , n 2 , n 3 , n 4 }: We might hope to do this using a symmetric lax monoidal functor F : (FinSet, +) → (Set, ×) assigning to each finite set m the set of all graphs with m as their set of nodes. But this hope is doomed, for reasons painstakingly explained in [3, Section 5] . The key problem is that two graphs with m as their set of nodes but different sets of edges give distinct elements of F (m), and this prevents F from being symmetric lax monoidal. To solve this problem, we need to bring isomorphisms of graphs into the framework-so we need F (m) to be a category of graphs with m as their set of nodes. Here we implement this solution. Instead of basing the theory of decorated cospans on a symmetric lax monoidal functor F : (A, +) → (Set, ×), we use a symmetric lax monoidal pseudofunctor F : (A, +) → (Cat, ×). In Theorems 2.1 and 2.2, we use this data to construct a symmetric monoidal double category F Csp in which: • an object is an object of A, • a vertical 1-morphism is a morphism of A, • a horizontal 1-cell from a to b is a decorated cospan: In fact another solution to the problem is already known: the theory of structured cospans [3, 16] . Given a functor L : A → X, a structured cospan is a cospan in X whose feet come from a pair of objects in A: This is another way of letting the apex have more structure than the feet. When A and X have finite colimits and L preserves them, there is a symmetric monoidal double category L Csp(X) where: • an object is an object of A, • a vertical 1-morphism is a morphism of A, • a horizontal 1-cell from a to b is a diagram in X of this form: • a 2-morphism is a commutative diagram in X of this form: Many of the flawed applications of decorated cospans have been fixed using structured cospans [3, Section 6], but not every decorated cospan double category is equivalent to a structured cospan double category. Here we give sufficient conditions for a decorated cospan double category to be equivalent-and in fact, isomorphic-to a structured cospan double category. Suppose A has finite colimits and F : (A, +) → (Cat, ×) is a symmetric lax monoidal pseudofunctor. Then each category F (a) for a ∈ A becomes symmetric monoidal, and F becomes a pseudofunctor F : A → SymMonCat. Using the Grothendieck construction, F also gives an opfibration U : X → A where X = ∫F . Let Rex be the 2-category of categories with finite colimits, functors preserving finite colimits, and natural transformations. We show that if F : A → SymMonCat factors through Rex as a pseudofunctor, the opfibration U : X → A is also a right adjoint. From the accompanying left adjoint L : A → X, we construct a symmetric monoidal double category Outline In Section 2 we construct the double category of decorated cospans, F Csp, and show how to construct maps between decorated cospan double categories. In Section 3 we give a new construction of the double category of structured cospans, L Csp(X). In Section 4 we prove that the double categories of decorated cospans and structured cospans are isomorphic under suitable conditions. In Section 5 we establish the isomorphism between structured and decorated cospans at the level of bicategories and categories (via decategorification). In Section 6 we describe applications. In this paper, we use a sans-serif font like C for categories, boldface like B for bicategories or 2-categories, and blackboard bold like D for double categories. For double categories with names having more than one letter, like Csp(X), only the first letter is in blackboard bold. In this paper, 'double category' means 'pseudo double category', as in Definition A.3. A double category D has a category of objects and a category of arrows, and we call these D 0 and D 1 despite the fact that they are categories. Vertical composition in our double categories is strictly associative, while horizontal composition need not be. We use (C, ⊗) to stand for a monoidal or perhaps symmetric monoidal category with ⊗ as its tensor product. For composition or morphisms we use concatenation or occasionally •. In this section we build symmetric monoidal double categories of decorated cospans, and then study the functoriality of this construction. Theorem 2.1 explains how to construct a double category of decorated cospans from a lax monoidal pseudofunctor F : (A, +) → (Cat, ×) whenever A has finite colimits. Theorem 2.2 gives conditions under which this double category is symmetric monoidal. These results build on earlier work of Fong [19] , and we recommend his thesis for intuitive explanations of the fundamental ideas [20] . For concrete examples of the structures that follow, we refer the reader to Section 6. In all that follows, when we say a category 'has finite colimits' we mean it is equipped with a choice of colimit for every finite diagram. Thus, if A has finite colimits it gives a cocartesian monoidal category (A, +): that is, a symmetric monoidal category where the monoidal structure is given by the chosen binary coproducts and initial object. However, when we say a functor 'preserves finite colimits', it need only do this up to canonical isomorphism, unless otherwise specified. We recall the concept of lax monoidal pseudofunctor in Appendix A.1. Note that the decoration s ∈ F (m) is now an object in the category F (m), not an element of a set as in Fong's original approach. Vertical composition in F Csp is done using composition in A. The horizontal composite of F -decorated cospans is the usual composite via pushout of their underlying cospans, shown in dashed arrows here: together with the decoration t s ∈ F (m + b n) specified by this functor: Given two horizontally composable maps of F -decorated cospans α and β: their composite β α is the horizontal composite of the two maps of cospans in A: Accepted in Compositionality on 2022-02-14. Click on the title to verify. together with the decoration morphism τ β α : F (h 1 + g h 2 )(t s) → (t s ) specified by this natural transformation: where the middle isomorphism is (6) from the pseudonaturality of φ and the right-hand isomorphism comes from the pseudofunctoriality of F . A be a category with finite colimits and let (F, φ, φ 0 ) : (A, +) → (Cat, ×) be a symmetric lax monoidal pseudofunctor. Then the double category F Csp of Theorem 2.1 is symmetric monoidal, where the tensor product • of two objects a and b is their coproduct a + b in A, • of two 2-morphisms α and β is: with decoration morphism τ α⊗β given by the following diagram: We prove both these theorems using the work of Shulman [43] , who gives a general way to construct a double category from a 'Beck-Chevalley monoidal bifibration'-a concept recalled in Appendix A.2. • a vertical 1-morphism is a morphism of A, • a horizontal 1-cell is a pair of objects a, b ∈ A together with an object c ∈ C with Φ(c) = a + b, Proof. This is [43, Theorem 14.9 ]; Shulman proves a dual version in more detail in his Theorem 14.4. Note that when C is the arrow category of A and Φ maps any arrow in C to its domain, a horizontal 1-cell in Fr(Φ) simply amounts to a cospan in A. In this case Fr(Φ) is the double category of cospans in A. We shall use variations on this idea to construct double categories of decorated and structured cospans, and to prove that under certain conditions these double categories are equivalent. We begin with decorated cospans, proving Theorem 2.1 and 2.2 by applying Shulman's result to a particular monoidal bifibration built from a lax monoidal pseudofunctor F : (A, +) → (Cat, ×). The Grothendieck construction gives a bijection between pseudofunctors F : A → Cat and opfibrations U : ∫F → A. We need two refinements of this construction: one that gives monoidal opfibrations, and one that gives symmetric monoidal opfibrations. We recall pseudofunctors in Appendix A.1, and opfibrations in Appendix A.2; here we simply state the result we need. The second equivalence was observed earlier by Shulman [43] . Moreover, symmetric lax monoidal pseudofunctors correspond to symmetric monoidal opfibrations, and those to pseudofunctors into SymMonCat. In more detail, if (φ, φ 0 ) is the lax monoidal structure of the pseudofunctor F as recalled in Appendix A.1, the induced monoidal structure on the Grothendieck category X = ∫F (Definition A.1) is given by If F is a symmetric lax monoidal pseudofunctor, the induced monoidal structure in ∫F is symmetric via where β is the canonical symmetry for A and u is the natural isomorphism of (7). Moreover, each fiber X a = F (a) obtains a monoidal structure via where ∇ is the fold map, which is symmetric when F is, again via the components of u a,a . Also, each reindexing functor f ! = F (f ) obtains a strong monoidal structure with Accepted in Compositionality on 2022-02-14. Click on the title to verify. These 2-equivalences further restrict to the case when the Grothendieck category (X, ⊗ X ) is specifically cocartesian monoidal itself, with coproducts built up from (2) . In that case, opfibrations (X, +) → (A, +) that strictly preserve coproducts and initial object bijectively correspond to pseudofunctors into the 2-category of cocartesian categories. For more details, see [37, Corollary 4.7] and the related discussion. Now we are ready to use Shulman's result to prove Theorems 2.1 and 2. 2. An F -decorated cospan from a to b is a cospan a → m ← b in A together with an object s ∈ F (m). This can be seen as a pair (e → m, s ∈ F (m)) such that e equals a + b. But (m, s ∈ F (m)) is precisely an object of the Grothendieck category ∫F , and the opfibration U : ∫F → A sends this object to m. Thus, (e → m, s ∈ F (m)) can be seen as an object of the comma category A/U . Let Φ : A/U → A be the functor with Φ(e → m, s ∈ F (m)) = e. Then an F -decorated cospan from a to b amounts to an object c ∈ A/U such that Φ(c) = a + b. where f : a → a and g : b → b are morphisms in A such that this square commutes: As in any comma category we have a functor Φ : A/U → A given on objects by Φ(a i − → b, s) = a and on morphisms by Φ(f, g, h) = f . To apply Lemma 2.3 it suffices to prove that Φ is a Beck-Chevalley monoidal opfibration. First, there is a monoidal structure on A/U coming from the monoidality of U . On objects this is given by With this monoidal structure on A/U , it is easy to see that Φ is a strict monoidal functor. Next, one can check that Φ is a fibration. Given a morphism f : a → a in A and an object (a i − → b , s ) ∈ A/U over a , one can show that a cartesian lifting of f to this object is given by Denoting the cartesian lifting of f to an object z ∈ A/U by Cart(f, z), the tensor product of A/U preserves such cartesian liftings, in fact strictly, in the sense that Cart( One can also check that Φ is an opfibration. Given a morphism f : a → a in A and an object (a i − → b, s) ∈ A/U over a, one can show that a cocartesian lifting of f is given by Accepted in Compositionality on 2022-02-14. Click on the title to verify. where g, i and b + a a arise from this pushout square in A: To show that (f, g, 1) is a cocartesian lifting of f , suppose we are given a morphism in A/U and a morphism k : a → a in A such that Φ(f , g , h ) = kf . We need to show there exists a unique morphism To achieve this we choosef = k,h = h , and defineg using the universal property of the pushout: after noting that g i = i f = i kf by the commuting square condition obeyed by morphisms in A/U . One can check that with these choices, (f ,g,h) obeys the desired conditions and is the unique morphism to do so. It follows that Φ is a bifibration. Denoting the cocartesian lifting of a morphism f to an object z ∈ A/U by Cocart(f, z), we have that Cocart(f 1 , z 1 ) ⊗ Cocart(f 2 , z 2 ) ∼ = Cocart(f 1 + f 2 , z 1 ⊗ z 2 ) by the universal map between two colimits of the same diagram. Thus, Φ is a monoidal bifibration. Lastly, we need to check that Φ satisfies the Beck-Chevalley condition. Merely from the fact that Φ is a bifibration, for any commutative square in A: (8) . We need to prove that when the square in A is a pushout, θ is a natural isomorphism. Namely, we have θ = (1, ζ, 1). But when the original square in A (at upper left above) is a pushout, its pasting with the other pushout gives a pushout, so ζ and hence θ is an isomorphism. This shows that Φ obeys the Beck-Chevalley condition. Having checked all the hypotheses of Lemma 2.3, we can define F Csp to be Fr(Φ) and conclude the proof of Theorem 2.1. The decorated cospan formalism gives not only double categories, but also maps between these. Suppose we have two categories A, A with finite colimits and two lax monoidal pseudofunctors F : A → Cat and F : A → Cat. Then we can obtain a map between their decorated cospan double categories, namely a double functor H : F Csp → F Csp, from: • a functor H : A → A that preserves finite colimits, • a lax monoidal pseudofunctor (E, φ, φ 0 ) : Cat → Cat, Accepted in Compositionality on 2022-02-14. Click on the title to verify. • a natural transformation θ : EF ⇒ F H: The intuition behind this square is that while the pseudofunctors F and F serve to assign categories of possible decorations to the objects of A and A , respectively, the functor H lets us turn objects of A into objects of A , and the pseudofunctor E lets us change decorations as prescribed by F into those as prescribed by F , up to the transformation θ. In applications E and H are often identities. The double functor H : F Csp → F Csp is defined as follows: In other words, the object component H 0 of the double functor H is the functor H. • The image of an F -decorated cospan is the following F -decorated cospan: is the following map of F -decorated cospans in F Csp: where the decoration morphism H(τ ) is defined as follows. Treating τ as a natural transformation as in (1), H(τ ) is given by The square at right commutes strictly because θ is a natural transformation. We described A/U and its monoidal structure in the proof of Theorem 2.1, and of course the case of A /U is analogous. We define G : A/U → A /U as follows. On objects G is given by where to define s we treat s ∈ F (b) as a functor s : 1 → F (b) and let s ∈ F (H(b)) be the composite functor 1 On and let h : F (H(g))(s) → s be this natural transformation: Accepted in Compositionality on 2022-02-14. Click on the title to verify. One can check that with these definitions G is a functor. To make G into a monoidal functor, we need to equip it with a laxator Note that where φ is the laxator for F . Since H preserves finite colimits, the laxator γ is obvious except . This is given by the following natural transformation: We also need a natural transformation expressing lax preservation of the unit object by G, which is defined similarly. One can show that this laxator and unit morphism satisfy the coherence laws of a lax monoidal functor, and they are invertible, so G is strong monoidal functor. If furthermore F, F and E are symmetric, one can check that G is symmetric monoidal, and that H is a symmetric monoidal double functor. Structured cospans are an alternative approach to equipping the apex of a cospan with extra data [3] . Here we recall this formalism and give a new construction of the double category of structured cospans that clarifies their relation to decorated cospans. This new construction again uses Shulman's Lemma 2.3. For concrete examples of this formalism, see Section 6. Theorem 3.1. Given categories A and X with finite colimits and L : A → X a functor preserving finite colimits, there is a symmetric monoidal double category L Csp(X) in which • an object is an object of A, Vertical composition is done using composition in A, while horizontal composition is done using pushouts in X. The tensor product of two horizontal 1-cells is where i + i and o + o are defined using the fact that L preserves binary coproducts, and tensor product of two 2-morphisms is given by: Proof. This was proved in [3, Theorems 2.3 & 3.9], where all the structures are specified in detail. In fact, the double category structure only requires that X have pushouts, whereas the symmetric monoidal structure also requires that X and A have finite coproducts and that L preserve these [16, Theorem 3.2.3]. Our new proof is analogous to that of Theorem 2.1 in that we apply Lemma 2.3 to a Beck-Chevalley symmetric monoidal bifibration Ψ : L/X → A, and define L Csp(X) to be Fr(Ψ). First, note that in the comma category L/X: • an object is a pair (a, L(a) − → x) consisting of an object a ∈ A and a morphism L(a) is a pair (f, g) of morphisms f : a → a and g : x → x such that this square commutes: The comma category L/X has finite colimits because A and X have finite colimits and L preserves them. It thus becomes symmetric monoidal with the chosen finite coproducts providing the monoidal structure. The tensor product of two objects (a, L(a) The functor Ψ is both a fibration and an opfibration. Suppose we are given a morphism For any object (a, L(a) i − → x) in L/X over a, a cocartesian lifting of f is given by where κ and θ arise from the pushout in this diagram: This diagram also gives the proof that (f, κ) is a cocartesian lifting of f . Both cartesian and cocartesian liftings are clearly preserved by the tensor product of L/X, so Ψ is a monoidal bifibration. Lastly, we show that Ψ : L/X → A satisfies the Beck-Chevalley condition. For this, given a pushout square in A: we need to show that the natural transformation by taking the following pushout: Then going left, we precompose with in (L/X) c . As in the proof of Theorem 2.1, this arises from the universal property of the pushout: Namely, we have θ = (1, ζ). But when the original square in A is a pushout, the square at left above is also a pushout, since L preserves finite colimits. Since the pasting of pushout squares is a pushout, ζ and hence θ is an isomorphism, so Ψ satisfies the Beck-Chevalley condition. We now compare structured and decorated cospans. In Theorem 2.1 we built a double category of decorated cospans from a bifibration Φ : A/U → A. In Theorem 3.1, we built a double category of structured cospans from a bifibration Ψ : L/X → A in a very similar way. We now show that under certain conditions L is left adjoint to U . Whenever this happens, A/U is isomorphic to L/X, by a simple and general fact about arrow categories. The bifibrations Φ and Ψ are also isomorphic. Because Shulman's construction in Lemma 2.3 is actually functorial, it follows that the double category of decorated cospans is isomorphic to the double category of structured cospans. The key issue is thus to determine when L is left adjoint to U . For this, let Rex be the 2-category of categories with finite colimits, functors preserving finite colimits, and natural transformations. Also let SymMonCat be the 2-category of symmetric monoidal categories, symmetric strong monoidal functors and natural transformations. Recall that for us a category C ∈ Rex comes with a choice of finite colimits, so it gives a specific cocartesian monoidal category (C, +), and this induces a 2-functor Rex → SymMonCat. Our main result is this: that the induced fiberwise monoidal structure is cocartesian. Expanding on this a bit: the fibers of U are the same as the categories F (a) for all a ∈ A. The lax monoidal pseudofunctor structure of F gives rise to a specific symmetric monoidal structure on each category F (a), as in (3). The hypothesis of the theorem asks that the resulting pseudofunctor F : A → SymMonCat factors through Rex. This implies that the symmetric monoidal structure on each category F (a) is cocartesian. It will be important to know that under the hypotheses of Theorem 4.1 the opfibration U preserves all finite colimits. For this we need the following lemma. Lemma 4.2 (Hermida) . Suppose J is a small category and U : X → A is an opfibration where the base A has J-colimits. Then the following are equivalent: 1. all fibers have J-colimits, and the reindexing functors preserve them; 2. the total category X has J-colimits, and U preserves them. Moreover, if X has J-colimits and U preserves them, for any choice of J-colimits in A, they can be chosen in X in such a way that U strictly preserves them. Proof. See [29, Corollary 4.9] , and for the final statement [29, Remark 4.11] . The first part of this lemma asserts the existence of colimits locally in each fiber, and if we let J range over all finite categories it says that the corresponding pseudofunctor F : A → Cat lands in the sub-2-category Rex. The second part formulates the existence of colimits globally in the total category ∫F , and if we let J range over all finite categories it says that X has finite colimits and U preserves all finite colimits. In what follows we also need a left adjoint L to the opfibration U . The following result provides sufficient conditions for that. Following Gray [26] , we say a functor has a 'left adjoint right inverse' or lari if it has a left adjoint where the unit of the adjunction is the identity. Lemma 4.4 (Gray) . Let U : X → A be an opfibration. Then U has a lari if its fibers have initial objects that are preserved by the reindexing functors. Proof. This is [26, Proposition 4.4] . Suppose each fiber X a of the opfibration U has an initial object ⊥ a and these objects are preserved (up to isomorphism) by the reindexing functors. Define L : A → X on objects a ∈ A by L(a) = ⊥ a . Given a morphism f : a → a in A, define L(f ) to be the composite where Cocart(f, ⊥ a ) is the cocartesian lifting of f to ⊥ a and χ a is the unique isomorphism between two initial objects in the fiber above a . The functor L then becomes left adjoint to U with unit ι a : a → U (L(a)) being the identity, using the fact that U (L(a)) = U (⊥ a ) = a. We now have all the necessary background to construct an isomorphism between the double category of decorated cospans and the double category of structured cospans, starting from a symmetric lax monoidal pseudofunctor F : (A, +) → (Cat, ×) whose corresponding pseudofunctor F : A → SymMonCat factors through Rex. Proof of Theorem 4.1. Since we are assuming the pseudofunctor F : A → SymMonCat factors through Rex, Corollary 4.3 implies that the Grothendieck construction gives rise to a category ∫F with finite colimits, and we can choose these in such a way that the corresponding opfibration U : ∫F → A strictly preserves them. We do this in what follows. By Lemma 4.4, U has a left adjoint L : A → ∫F with U L = 1 A . Diagrammatically, describes the construction of the adjunction from the original F . Explicitly, the left adjoint maps each object a ∈ A to the initial object in its fiber X a , namely L(a) = (a, I a ), where I a is defined as in (3). As a left adjoint, L preserves all colimits that exist between the categories A and ∫F , which have finite colimits. Thus, we can construct the symmetric monoidal double category of structured cospans L Csp(∫F ) as in Theorem 3.1. To show that this is isomorphic to the symmetric monoidal double category of decorated cospans F Csp given by Theorem 2.2, we use a result of Shulman [44, Theorem 14.11] . Namely, the Fr construction of Lemma 2.3 extends to a 2-functor Given two monoidal bifibrations Φ : A → B and Φ : A → B , a 'strong monoidal morphism of bifibrations' from Φ to Φ consists of a pair of strong monoidal functors F 1 and F 2 making the following square commute not just as functors but as strong monoidal functors. In our case the two monoidal bifibrations are the functors Φ and Ψ of Theorems 2.2 and 3.1, respectively. These share A as a common base, so we only need a single strong monoidal functor F : A/U → L/X making this diagram of strong monoidal functors commute: There is an isomorphism F : A/U → L/X arising from the fact that U is right adjoint to L. It is clear that F is strong monoidal via componentwise binary coproducts which are preserved by both L and U , and that ΨF = Φ as strong monoidal functors. As F is an isomorphism, we obtain an isomorphism Fr(F ) : Fr(Φ) → Fr(Ψ) between the two monoidal double categories Fr(Φ) = F Csp and Fr(Ψ) = L Csp(∫F ) of Theorems 2.2 and 3.1, respectively. One can check by hand that this isomorphism is symmetric monoidal. Given the hypothesis of Theorem 4.1, the isomorphism Fr(F ) between decorated and structured cospans works concretely as follows. First recall that X = ∫F , so that an object of X is a pair (a, s) with a ∈ A and s ∈ F (a). The functor U : X → A maps (a, s) to a. Its left adjoint L : A → X maps a ∈ A to (a, I a ) , where I a ∈ F (a) is the trivial decoration given by the composite The object L(a) = (a, I a ) is the initial object in the fiber of ∫F over a. The to this map of structured cospans: While double categories are a natural context for studying cospans, bicategories are more familiarand of course, categories are even more so! Luckily, all our results phrased in the language of double categories have analogues for bicategories and categories. We explain those here. As discussed for example by Shulman [44] , any double category D has a horizontal bicategory, denoted D, in which: • objects are objects of D, • morphisms are horizontal 1-cells of D, • 2-morphisms are globular 2-morphisms of D, meaning 2-morphisms whose source and target vertical 1-morphisms are identities, • composition of morphisms is given by composition of horizontal 1-cells in D, • vertical and horizontal composition of 2-morphisms are given by vertical and horizontal composition of 2-morphisms in D. The bicategory D has a decategorification, a category D in which: • objects are objects of D, Accepted in Compositionality on 2022-02-14. Click on the title to verify. • morphisms are isomorphism classes of morphisms of D. Thus, the double category F Csp of structured cospans constructed in Theorem 2.1 automatically gives rise to a bicategory F Csp, and a category F Csp. In Theorem 2.2 we gave conditions under which the double category F Csp becomes symmetric monoidal. We would like the bicategory F Csp and the category F Csp to become symmetric monoidal under the same conditions, and indeed this is true. A double category is 'fibrant' if every vertical 1-morphism has a 'companion' and a 'conjoint'concepts explained in Definition A.10. Shulman (Theorem A.12) proved that when a double category D is fibrant, any symmetrical monoidal structure on D gives one on D. We can apply this to decorated cospans as follows: Proof. We show that any vertical 1-morphism f : a → b in F Csp has a companion and a conjoint. First, we can make this horizontal 1-cellf : where I b is the trivial decoration given by into a companion of f using the following 2-morphisms: where the decoration morphism τ f is the isomorphism given by pseudofunctoriality of F : These 2-morphisms satisfy the equations (9) required of a companion, involving vertical and horizontal composition of 2-morphisms in this double category: Note that the right hand side of the first equation is U f , while the second equation involves the left and right unitors for : these are maps from a horizontal composite of two decorated cospans to a single decorated cospan. The conjoint of f is given by this horizontal 1-cellf , which is just the opposite of the companion above: Just asf obeys the equations required of a companion,f obeys the equations required of a conjoint with similar structure 2-morphisms to those of a companion above. Proof. This follows by applying Theorem A.12 to the fibrant symmetric monoidal double category F Csp. This symmetric monoidal bicategory F Csp generalizes one constructed by the second author [15] . We can decategorify F Csp to obtain a symmetric monoidal category of decorated cospans generalizing those considered by Fong [19] : In Theorem 4.1 we gave conditions under which the symmetric monoidal double category of decorated cospans F Csp is isomorphic to the symmetric monoidal double category of structured cospans L Csp(∫F ). We now show that under the same conditions we get an isomorphism of symmetric monoidal bicategories, and of categories. Proof. Hansen and Shulman [28] showed that the passage from symmetric monoidal double categories to symmetric monoidal bicategories is functorial in a suitable sense. This implies that an isomorphism of symmetric monoidal double categories D ∼ = D gives an isomorphism of symmetric monoidal bicategories D ∼ = D . Since the process of decategorifying a bicategory merely discards 2-morphisms and takes isomorphism classes of 1-morphisms, the isomorphism of symmetric monoidal bicategories D ∼ = D in turn induces an isomorphism of symmetric monoidal categories D ∼ = D . Thus, the theorem follows from Theorem 4.1. Thinking about systems and processes categorically dates back to early works by Lawvere [35] , Bunge-Fiore [13] , Joyal-Nielsen-Winskel [31] , Katis-Sabadini-Walters [32] and others. Spivak and others have used wiring diagrams and sheaves to capture compositional features of dynamical systems [10, 42, 46] . Another approach uses signal flow diagrams and other string diagrams [5, 11, 21] to understand systems behaviorally, following ideas of Willems [48] . Decorated cospans were introduced by Fong [19, 20] to describe open systems as cospans equipped with extra data. They were then applied to open electrical circuits [6] , Markov processes [7] , and chemical reaction networks [9] . Unfortunately, some of these applications were marred by technical flaws, which were later fixed using structured cospans [3] . Here we explain how they can also be fixed using our new decorated cospans. We compare the two approaches in applications to graphs, electrical circuits, Petri nets, reaction networks and dynamical systems. In some cases, Theorem 4.1 shows that the structured and decorated cospan approaches are equivalent: Sections 6.1 to 6.3 illustrate this. However, in some cases decorated cospans appear to be necessary, and in Section 6.4 we explain why Theorem 4.1 does not apply to open dynamical systems. One of the simplest kinds of network is a graph. For us a graph will be a pair of functions s, t : E → N where E and N are finite sets. We call elements of E edges and elements of N nodes. There is a category Graph where the objects are graphs and a morphism from the graph s, t : E → N to the graph s , t : E → N is a pair of functions f : N → N , g : E → E such that these diagrams commute: We can easily build a double category with 'open graphs' as horizontal 1-cells using the machinery of structured cospans [3, Section 5] . Let L : FinSet → Graph be the functor that assigns to a finite set N the discrete graph on N : the graph with no edges and N as its set of vertices. Both FinSet and Graph have finite colimits, and the functor L : FinSet → Graph is left adjoint to the forgetful functor R : Graph → FinSet that assigns to a graph G its underlying set of vertices R(G). Thus, using structured cospans and appealing to Theorem 3.1, we get a symmetric monoidal double category L Csp(Graph) in which: • objects are finite sets, • a horizontal 1-cell from X to Y is an open graph from X to Y , meaning a cospan in Graph of this form: • a 2-morphism is a commuting diagram in Graph of this form: Here is an example of an open graph: We can also build a double category with open graphs as horizontal 1-cells using decorated cospans. For any finite set N , there is a category F (N ) where: • an object is a graph structure on N : that is, a graph s, t : E → N , • a morphism from s, t : E → N to s , t : E → N is a morphism of graphs that is the identity on N : that is, a function g : E → E such that these diagrams commute: In general, decorated cospans involve a pseudofunctor to Cat, but in this example there is actually an honest functor F : Set → Cat that assigns to a set N the above category F (N ). Given a function f : M → N , we define F (f ) : F (M ) → F (N ) as the functor that maps any graph structure s, t : E → M to the graph structure f s, f t : E → N . We can make F into a symmetric lax monoidal pseudofunctor F : (FinSet, +) → (Cat, ×) by equipping it with suitable functors The functor φ 0 is uniquely determined since F (∅) is the terminal category. More interesting is φ N,N . This functor maps a pair of graph structures s, t : E → N and s , t : E → N to the graph structure s + s , t + t : E + E → N + N . In other words, it sends a pair of graph structures to their 'disjoint union'. Surprisingly, though F is a functor, this choice of φ N,N does not make F into a symmetric lax monoidal functor, but only a symmetric lax monoidal pseudofunctor, since it obeys the required laws only up to natural isomorphism, as in (5) . See [3, Section 5] for a proof that these laws fail to hold on the nose. This fact is what necessitated a generalization of Fong's original approach to decorated cospans. It is well known, and easy to check, that the Grothendieck category ∫F is isomorphic to the category Graph. The other side of this observation is that the opfibration U : ∫F → FinSet is isomorphic to the forgetful functor R : Graph → FinSet. In fact one can check that U : ∫F → FinSet and R : Graph → FinSet are isomorphic as symmetric monoidal opfibrations, where all the categories involved are given cocartesian monoidal structures. Starting from the symmetric lax monoidal pseudofunctor F : (FinSet, +) → (Cat, ×), Theorem 2.2 gives us a symmetric monoidal double category F Csp in which: • objects are finite sets, • a vertical 1-morphism from X to X is a function f : X → X , which can also be thought of as an open graph from X to Y , We thus have two symmetric monoidal double categories: L Csp(Graph) obtained from structured cospans and F Csp obtained from decorated cospans. Each of these double categories has FinSet as its category of objects, open graphs as horizontal 1-cells, and maps of open graphs as 2-morphisms. This suggests that L Csp(Graph) and F Csp are isomorphic as symmetric monoidal double categories-and indeed this follows from Theorem 4.1. Structured and decorated cospans are a powerful tool for studying categories where the morphisms are electrical circuits-see [3, Section 6.1] and [4, 6] . The key idea is to use open graphs with labeled edges to describe circuits, where the labels can stand for resistors with any chosen resistance, capacitors with any chosen capacitance, or other circuit elements. The whole theory of open graphs discussed in the previous section can be recapitulated for labeled graphs. Since the abstract formalism works the same way, we can be brief. Concrete applications of this formalism are Volume 4 Issue 3 ISSN 2631-4444 discussed in the above references, and in [7] a class of Markov processes were also handled using this formalism, by reducing them to circuits of resistors. Fix a set L to serve as edge labels. Define an L-graph to be a graph s, t : E → N equipped with a function : E → L. There is a category Graph L where the objects are L-graphs and a morphism from the L-graph is a pair of functions f : N → N , g : E → E such that these diagrams commute: There is a functor U : Graph L → FinSet that takes an L-graph to its underlying set of nodes. This has a left adjoint L : FinSet → Graph L sending any set to the L-graph with that set of nodes and no edges. Both FinSet and Graph L have colimits, and L preserves them. This sets the stage for structured cospans: Theorem 3.1 gives us a symmetric monoidal double category L Csp(Graph L ) where a horizontal 1-cell is an open L-graph, also called an L-circuit: that is, a cospan in Graph L of this form: The edges here represent wires, with the positive real numbers labeling them serving to describe the resistance of resistors on the wires. The elements of the sets X and Y represent 'terminals': that is, points where we allow ourselves to attach a wire from another circuit. We can now also describe L-circuits using our new approach to decorated cospans. There is a symmetric lax monoidal pseudofunctor F : (FinSet, +) → (Cat, ×) such that for any finite set N , the category F (N ) has: • objects being L-graph structures on N : that is, L-graphs where the set of nodes is N , • morphisms being morphisms of L-graphs that are the identity on the set of nodes. This gives a symmetric monoidal double category F Csp, and using Theorem 4.1 we can show that this is isomorphic, as a symmetric monoidal double category, to L Csp(Graph L ). Petri nets are widely used as models of systems in engineering and computer science [22, 39] . Structured cospans have been used to define a symmetric monoidal double category of 'open Petri nets' [8] , which lets us build large Petri nets out of smaller pieces. We can also use decorated cospans to create a double category of open Petri nets. Again this example is very similar to the example of open graphs. A Petri net is a pair of finite sets S and T and functions s, t : T → N[S]. Here S is the set of places, T is the set of transitions, and N[S] is the underlying set of the free commutative monoid on S. Each transition thus has a formal sum of places as its source and target as prescribed by the functions s and t, respectively. Here is an example: This Petri net has a single transition α with 2H + O as its source and H 2 O as its target. There is a category Petri with Petri nets as objects, where a morphism from the Petri net s, t : T → N[S] to the Petri net s , t : T → N[S ] is a pair of functions f : S → S , g : T → T such that the following diagrams commute: There is a functor R : Petri → FinSet sending any Petri net to its set of places, and this has a left adjoint L : FinSet → Petri sending any finite set S to the Petri net with S as its set of places and no transitions [8, Lemma 11] . Since both FinSet and Petri have finite colimits and L preserves them, Theorem 3.1 yields a symmetric monoidal double category L Csp(Petri) in which: • objects are finite sets, • vertical 1-morphisms are functions, • horizontal 1-cells are open Petri nets, which are cospans in Petri of the form: • 2-morphisms are diagrams in Petri of the form: We can equivalently describe open Petri nets using decorated cospans. This works very much like the previous examples. There is a symmetric lax monoidal pseudofunctor F : (FinSet, +) → (Cat, ×) such that for any finite set S, the category F (S) has: • morphisms given by morphisms of Petri nets that are the identity on the set of places. This gives a symmetric monoidal double category F Csp, and using Theorem 4.1 we can show that this is isomorphic, as a symmetric monoidal double category, to L Csp(Petri). The machinery of structured cospans has been used to provide a semantics for open Petri nets [8] : a symmetric monoidal double functor from L Csp(Petri) to a symmetric monoidal double category of 'open commutative monoidal categories'. Presumably this double functor can equivalently be obtained using the machinery of decorated cospans, with the help of Theorem 2.5. However, it should be clear by now that so far, in cases where either structured or decorated cospans can be used, structured cospans are simpler. We next turn to an example where decorated cospans are necessary. In chemistry, population biology, epidemiology and other fields, modelers use 'Petri nets with rates', where the transitions are labeled with nonnegative real numbers called 'rate constants' [27, 34, 47] . From any Petri net with rates one can systematically construct a dynamical system. Mathematical chemists have proved deep theorems relating the topology of Petri nets with rates to the qualitative behavior of their dynamical systems [17] . Pollard and the first author showed how to construct an open dynamical system from any open Petri net with rates, thus defining a functor from a category with open Petri nets with rates as morphisms to one with open dynamical systems as morphisms [9] . They used Fong's original decorated cospans to do this. Here we show we show how to promote these categories to double categories using our new approach to decorated cospans. First, to briefly illustrate these ideas, here is an open Petri net with rates: It is an open Petri net where the transitions are labeled with rate constants r 1 , r 2 ≥ 0. Here is the corresponding open dynamical system: Here I 1 (t), I 2 (t), I 3 (t) and O 1 (t) are arbitrary smooth functions of time, which describe inflows and outflows at the points i 1 , i 2 , i 3 ∈ X and o 1 ∈ Y . If we drop these inflow and outflow terms, we obtain a dynamical system: an autonomous system of coupled nonlinear first-order ordinary differential equations. In fact these equations are a famous model of infectious disease, the 'SIR model', where S(t), I(t) and R(t) describe the populations of susceptible, infected and recovered individuals, respectively. The inflow and outflow terms allow individuals to enter or leave the population. This in turn lets us couple the SIR model to other models, and build larger models from smaller pieces. Indeed, a group of researchers has recently used open Petri nets and the mathematics of structured cospans in their software tool for building and manipulating epidemiological models [1, 2] . Now we turn to the details. A Petri net with rates is a Petri net s, t : T → N[S] together with a function r : T → [0, ∞) assigning to each transition τ ∈ T a nonnegative real number called its rate constant. There is a category Petri r whose objects are Petri nets with rates, where a morphism from is a morphism of the underlying Petri nets whose map g : T → T obeys for all τ ∈ T . This definition was suggested by Sophie Libkind; it agrees with the earlier definition [9] in the case of isomorphisms, but not in general, and the difference is important here. We can describe open Petri nets with rates using decorated cospans. There is a symmetric lax monoidal pseudofunctor F : (FinSet, +) → (Cat, ×) such that for any finite set S, the category F (S) has: • objects given by Petri nets with rates whose set of places is S, • morphisms given by morphisms of Petri nets with rates that are the identity on the set of places. There is also a symmetric monoidal double category of open dynamical systems. A dynamical system is a vector field, thought of as giving a system of first-order ordinary differential equations. A Petri net with rates gives a special sort of dynamical system: an algebraic vector field on R S for some finite set S, meaning a vector field whose components are polynomials in the coordinates. We shall think of such a vector field as a special sort of function v : R S → R S . Using Fong's original approach to decorated cospans, Pollard and the first author constructed a symmetric monoidal category for which the morphisms are open dynamical systems [9, Theorem 17] . This category is constructed from a symmetric lax monoidal functor D : FinSet → Set such that: • D maps any finite set S to • D maps any function f : S → S between finite sets to the function D(f ) : D(S) → D(S ) given as follows: where the pullback f * : R S → R S is given by while the pushforward f * : R S → R S is given by The functorality of D is proved in [9, Lemma 15] while the symmetric lax monoidal stucture is given in Lemma 16 of that paper. Since every set gives a discrete category with that set of objects, we can reinterpret D as a symmetric lax monoidal pseudofunctor D : (FinSet, +) → (Cat, ×) which happens to actually be a functor. Applying Theorem 2.2 we obtain a symmetric monoidal double category DCsp where: • objects are finite sets, Accepted in Compositionality on 2022-02-14. Click on the title to verify. • vertical 1-morphisms are functions, • a horizontal 1-cell from X to Y is an open dynamical system, that is, a cospan in FinSet together with an algebraic vector field v ∈ D(S), • a 2-morphism from Here θ is given as follows. For any finite set S, θ S : F (S) → D(S) maps any Petri net with rates to an algebraic vector field on R S , say v. This vector field is defined using a standard prescription taken from chemistry, called 'the law of mass action'. Namely, for any c ∈ R s , we set where v is defined as above and I : R → R X and O : R → R Y are arbitrary smooth functions describing inflows and outflows, respectively. Applying this prescription to the open Petri net with rates shown at the start of this section one gets the differential equations (4) . Other examples are worked out in [9] . We now show that the decorated cospan double category DCsp of open dynamical systems is not isomorphic to a structured cospan double category via Theorem 4.1. Recall that in this theorem we start with the data required to build a decorated cospan category, namely a symmetric lax monoidal pseudofunctor F : (A, +) → (Cat, ×), and show that if the resulting pseudofunctor F : A → SymMonCat factors through Rex, then the opfibration U : X = ∫F → A has a left adjoint L : A → X. We then obtain an isomorphism between decorated and structured cospan double categories, F Csp ∼ = L Csp(X). We now show that in the case at hand, where F = D is the functor sending each finite set S to the set of dynamical systems on R S , the opfibration U does not have a left adjoint. Thus, the conditions of Theorem 4.1 cannot hold in this case: F does not factor through Rex. Taking D as above, it is easy to see that in the category ∫D • an object is a pair (S, v) where S is a finite set and v is an algebraic vector field v : Because the empty set is initial in FinSet, the comma category ∅ ↓ U is just ∫D. This contains an object (∅, v ∅ ), where v ∅ is the only possible vector field on R ∅ , namely, the zero vector field. The only object in ∫D with any morphisms to (∅, v ∅ ) is (∅, v ∅ ) itself, so no other object can be initial. However (∅, v ∅ ) is not initial either, because it has no morphisms to an object (S, v) unless v is the zero vector field on R S . Thus by Lemma 6.1, U does not have a left adjoint. We have given conditions under which a decorated cospan double category is isomorphic to a structured cospan double category, in Theorem 4.1. The converse question is also interesting: is every structured cospan double category isomorphic to a decorated cospan double category? The answer is similar to the previous one: yes, under certain conditions that let us pass from an appropriate functor L : A → X to an appropriate pseudofunctor F : A → Cat. Let us now sketch the story; details will appear in a forthcoming paper [14] . Suppose the conditions hold for constructing the double category of structured cospans L Csp(X) as in Theorem 3.1. That is, suppose A and X have finite colimits and L : A → X preserves them. If L also has a right adjoint 'left inverse' (meaning the unit is the identity) U : X → A, which moreover strictly preserves the chosen pushouts, it can be shown that U is an opfibration. Consequently, U corresponds to a pseudofunctor F : A → Cat by the inverse Grothendieck construction, as in the first part of Theorem A.2. Furthermore, if U preserves finite coproducts, F acquires the structure of a symmetric lax monoidal pseudofunctor F : (A, +) → (Cat, ×) by the special case of the cocartesian monoidal Grothendieck construction discussed under Lemma 2.4. As a result, F now has enough structure to induce a double category of decorated cospans F Csp as in Theorem 2.2. Finally, it can be shown that the structured and decorated cospan double categories are isomorphic as symmetric monoidal double categories: L Csp(X) ∼ = F Csp. To give a better sense of how the pseudofunctor F : A → Cat is constructed: for each object a ∈ A, F (a) is defined to be the fiber of U over a, namely the category of all objects in x ∈ X such that U (x) = a and morphisms k : x → y such that U (k) = 1 a . Given a morphism f : a → b, there is a functor F (f ) : F (a) → F (b) that maps x ∈ F (a) to the following pushout: La Lb with a natural isomorphism in the middle. The connection between opfibrations and laris goes back to Gray's Lemma 4.4, but we need to specialize it to a class suitable for both the structured and decorated cospan constructions. This would imply that starting from an appropriate middle ground, these two constructions are essentially the same. We leave such considerations for future work. Finally, it is worth mentioning a structured cospan double category to which the argument sketched above does not apply. For any functor φ : C → D between small categories, precomposition with φ gives a functor R : D → C between presheaf categories which has a left adjoint L : C → D. Since presheaf categories have all small colimits and L preserves them, the conditions of Theorem 3.1 apply and we obtain a symmetric monoidal double category of structured cospans, L Csp( D). However, the right adjoint R is not always an opfibration-and when it is not, the above arguments cannot be used to show that L Csp( D) is a decorated cospan double category. A simple example where R is not an opfibration was provided to us by Morgan Rogers. Take φ : 1 + 1 → 1 to be the unique functor where 1 is the terminal category. Then R : Set → Set 2 is the diagonal, and the morphism (0, 0) → (0, 1) in Set 2 admits no lift at all to 0 ∈ Set. It will be interesting to find conditions on φ : C → D that guarantee L Csp( D) is isomorphic to a decorated double cospan category. In this appendix, we gather some well-known concepts required to make the material self-contained, as well as references to more detailed expositions. For standard 2-categorical material, we refer the reader to [33] . For monoidal 2-categories see [18] , and for detailed definitions concerning monoidal bicategories see [23, 36, 45] . Briefly, a monoidal bicategory A comes with a pseudofunctor ⊗ : A × A → A and a unit object I that are associative and unital up to coherent equivalence. A braided monoidal bicategory also comes with a pseudonatural equivalence β a,b : a ⊗ b → b ⊗ a and appropriate invertible modifications obeying certain equations; it is sylleptic if there is an invertible modification 1 a⊗b β b,a • β a,b obeying its own equation, and symmetric if one further axiom holds. A lax monoidal pseudofunctor (called weak monoidal homomorphism in some earlier references) between monoidal bicategories F : A → B is a pseudofunctor equipped with pseudonatural transformations with components φ a,b : F a ⊗ F b → F (a ⊗ b) and φ 0 : I → F I along with invertible modifications for associativity and unitality with components subject to coherence conditions listed in [18, Definition 2] . In particular, pseudonaturality of the monoidal structure means that it comes with isomorphisms of this form: natural in f and g. A braided lax monoidal pseudofunctor between braided monoidal bicategories comes with an invertible modification with components subject to two axioms found e.g. in [18, Definition 14] . A sylleptic lax monoidal pseudofunctor satisfies one extra condition and a symmetric lax monoidal pseudofunctor between symmetric monoidal bicategories is just a sylleptic one. Basic material regarding the theory of fibrations can be found, for example, in [12, 26] . Recall that a functor U : X → A is an opfibration if for every x ∈ X with U (x) = a and f : a → b in A, there exists a cocartesian lifting of f to x, namely a morphism β in X with domain x with U (β) = f and the following universal property: for any g : b → b in A and γ : x → y in X above the composite g • f , there exists a unique δ : y → y such that U (δ) = g and γ = δ • β as shown below. The category X is called the total category and A is called the base category of the opfibration. For any a ∈ A, the fiber above a is the category X a consisting of all objects that map to a and vertical morphisms between them, i.e., morphisms mapping to 1 a . Assuming the axiom of choice, we may select a cocartesian lifting of each morphism f : a → b in A to each x ∈ X a , denoted by Cocart(f, x) : x → f ! (x), rendering U a so-called cloven opfibration. This choice induces reindexing functors f ! : X a → X b between the fibers, which by the lifting's universal property come equipped with natural isomorphisms (1 a With the help of these, any cloven opfibration U : X → A gives a pseudofunctor F : A → Cat, where A is viewed as a 2-category with trivial 2-morphisms, F (a) = X a for each object a ∈ A, and F (f ) = f ! for each morphism f in A. In fact, there is a 2-equivalence between opfibrations and pseudofunctors induced by the socalled 'Grothendieck construction', or more specifically the 'covariant' Grothendieck construction, since there is also a version of this construction for fibrations. Let OpFib(A) denote the 2subcategory of the slice 2-category Cat/A of opfibrations over A, functors that preserve cocartesian liftings, and natural transformations with vertical components. • objects pairs (a, s ∈ F (a)) and The identity morphism of (a, s ∈ F (a)) is (1 a : a → a, F (1 a )(s) ∼ − → s) and the composite of (f, k) : (a, s) → (b, t) and (g, ) : (b, t) → (c, u) is This is an opfibered category over A via the obvious forgetful functor, with fibers (∫F ) a = F (a) and reindexing functors f ! = F (f ). The constructions sketched so far-the Grothendieck construction and the construction of a pseudofunctor into Cat from a cloven opfibration-are the two halves of the following equivalence. 1. Every opfibration X → A gives rise to a pseudofunctor A → Cat. The double natural transformation α is a double natural isomorphism if both α 0 and α 1 are natural isomorphisms. Let Dbl denote the 2-category of double categories, double functors and double transformations. One can check that Dbl has finite products, and in any 2-category with finite products we can define a 'pseudomonoid', which is a categorified analogue of a monoid [18] . For example, a pseudomonoid in Cat is a monoidal category. We can also define symmetric pseudomonoids, which in Cat are symmetric monoidal categories. Explicitly, a monoidal double category is a double category D with: • monoidal structures on both D 0 and D 1 (each with tensor product denoted ⊗, associator a, left unitor and right unitor r and unit object I), such that U : D 0 → D 1 strictly preserves the unit objects and S, T : D 1 → D 0 are strict monoidal, • the structure of a double functor on ⊗: that is, invertible globular 2-morphisms obeying a list of equations that can be found after [28, Definition 2.10] and also [3, Definition A.5] . Definition A.7. A symmetric monoidal double category is a symmetric pseudomonoid in Dbl. Explicitly, a symmetric monoidal double category is a monoidal double category D such that: • D 0 and D 1 are symmetric monoidal categories, with braidings both denoted β. • The functors S and T are symmetric strict monoidal functors. • The following diagrams commute, expressing that the braiding is a transformation of double categories: Explicitly, a symmetric monoidal double functor is a double functor F : D → E such that: • F 0 and F 1 are symmetric monoidal functors, • we have equalities F 0 S D = S E F 1 and F 0 T D = T E F 1 of monoidal functors, and • the following diagrams commute, expressing that φ is a transformation of double categories: (F(M 2 ) ⊗ F(N 2 )) (F(M 1 ) ⊗ F(N 1 )) (F(M 2 ) F(M 1 )) ⊗ (F(N 2 ) F(N 1 )) 9. An isomorphism of symmetric monoidal double categories is a symmetric monoidal double functor F : D → E that has an inverse. A symmetric monoidal double functor is an isomorphism if it is bijective on objects, vertical 1-morphisms, horizontal 1-cells and 2-morphisms. such that the following equations hold. A conjoint of f , denotedf : B → A, is a companion of f in the double category obtained by reversing the horizontal 1-cells, but not the vertical 1-morphisms, of D. AlgebraicPetri team An algebraic framework for structured epidemic modeling Structured cospans Props in network theory Categories in control A compositional framework for passive linear networks A compositional framework for Markov processes Open Petri nets A compositional framework for reaction networks Categorical semantics of cyber-physical systems theory A categorical semantics of signal flow graphs Handbook of Categorical Algebra Unique factorisation lifting functors and categories of linearlycontrolled processes On adjoints and fibrations A bicategory of decorated cospans Open Systems: a Double Categorical Perspective Understanding bistability in complex enzyme-driven reaction networks Monoidal bicategories and Hopf algebroids Decorated cospans The Algebra of Open and Interconnected Systems A categorical approach to open and interconnected dynamical systems Petri Nets for Systems Engineering: a Guide to Modeling, Verification, and Applications Coherence for tricategories Limits in double categories Adjoints for double categories Fibred and cofibred categories Stochastic Petri Nets: Modelling, Stability, Simulation Constructing symmetric monoidal bicategories functorially Some properties of Fib as a fibred 2-category Categorical Logic and Type Theory Bisimulation from open maps On the algebra of systems with feedback and boundary Review of the elements of 2-categories, in Category Seminar Petri nets-a mathematical formalism to analyze chemical reaction networks State categories and response functors, unpublished manuscript Monoidal Grothendieck construction Span, cospan, and other double categories Petri Net Theory and the Modeling of Systems Open Markov Processes and Reaction Networks Category Theory In Context Dynamical systems and sheaves Framed bicategories and monoidal fibrations Constructing symmetric monoidal bicategories Compact closed bicategories Algebras of open dynamical systems on the operad of wiring diagrams Stochastic Modelling for Systems Biology The behavioral approach to open and interconnected systems We thank Daniel Cicala, Brendan Fong, Sophie Libkind, Joe Moeller and Morgan Rogers for helpful conversations, and the referees for their many useful suggestions. We especially thank Michael Shulman for suggesting a proof strategy that greatly improved this paper. The third author would like to thank the General Secretariat for Research and Technology (GSRT) and the Hellenic Foundation for Research and Innovation (HFRI). Proof. The idea goes back to Grothendieck; a proof can be found in, for example, [30, Section 1.10 ].All the above concepts and results have analogues for fibrations. A functor Φ : X → A a fibration if and only if Φ op : X op → A op is an opfibration. Equivalently, Φ is a fibration if and only if for every y ∈ X with U (y) = b and f : a → b in A there exists a cartesian lifting of f to y, where this concept is defined dually to cocartesian lifting. Furthermore, if Φ is a fibration there is a contravariant reindexing functorfor each morphism f : a → b. Moreover, Φ : X → A is a bifibration if it is both a fibration and opfibration. If X and A are (symmetric) monoidal categories, a (symmetric) monoidal fibration Φ : X → A is a fibration that is also a (symmetric) strict monoidal functor, such that the tensor product preserves cartesian liftings. Similarly, a (symmetric) monoidal opfibration is an opfibration that is also a (symmetric) strict monoidal functor, such that the tensor product preserves cocartesian liftings. Finally, a (symmetric) monoidal bifibration is a bifibration that is also a (symmetric) strict monoidal functor such that the tensor product preserves both cartesian and cocartesian liftings.In where θ is built as a composite involving the unit of the adjunction between g ! and g * and the counit of the adjunction between k ! and k * :If θ is a natural isomorphism whenever the original square in A is a pushout, we say that the bifibration Φ is Beck-Chevalley. ( For double categories we follow the notation of our paper on structured cospans [3] , which in turn follows that of Hansen and Shulman [28, 44] . Our double categories are always 'pseudo' double categories, where composition of horizontal 1-cells is unital and associative only up to coherent isomorphism [24, 25, 43] .