Decorated cospans via the Grothendieck construction
This post is cross-posted at the Topos Institute blog.
Decorated cospans turn closed systems into open ones, which can be composed along their boundaries to form larger systems (Fong 2015). Continuous dynamical systems and a variety of combinatorial systems, such as graphs, Petri nets, and stock and flow diagrams, have all been made into open systems using this method. In addition, decorated cospans are thought to be more general than their simpler cousin, structured cospans (Baez, Courser, and Vasilakopoulou 2022).
Despite this versatility, decorated cospans do not encompass all categories with morphisms that could reasonably be called “cospans with decorations.” The standard example of decorated cospans are open graphs, made open by exposing vertices via a cospan of vertex sets. Yet the other kind of open graphs—those allowing “dangling edges,” where the incoming edges define the domain and the outgoing edges the codomain—are not decorated cospans, even though they can also be described as cospans, now of edge sets, plus some extra data. We know that because decorated cospan categories are “undirected” (more accurately, they are hypergraph categories), whereas the category of graphs with dangling edges has a definite directionality. In this post, we’ll explain how to generalize decorated cospans to include this and other interesting examples.
To do that, we’ll use the Grothendieck construction for double categories introduced in our previous blog post. It would be helpful to read that post before this one, but it’s not strictly necessary since we’ll review the specific case of the construction that we need. We’ll also start with a brief review of decorated cospans. For much more about decorated cospans, see the papers cited above or the several blog posts written over the years by John Baez at the n-Category Cafe.
Update (April 3, 2023): I have incorporated the content of this blog post into a new paper (Patterson 2023).
Review of decorated cospans
Given a category
- objects, the objects of
; - morphisms
, isomorphism classes of a cospan in together with an element .
For example, to obtain the category of isomorphism classes of open graphs, made open along vertices, we take the lax monoidal functor
send a pair of graphs
The original version of decorated cospans forgets about any morphisms which may have already existed between the original (closed) systems. In the case of open graphs, these morphisms are graph homomorphisms. Their absence is often a problem! To recover them, we need a more refined version of decorated cospans, furnishing not just a category but a double category.
Given a category
- objects, the objects of
; - arrows, the morphisms of
; - proarrows
, a cospan in together with an object ; - cells
, a map of cospans in , which is a commuatative diagram of the form below, together with a morphism in .
To get a double category of open graphs, we take the lax monoidal functor
A modular reconstruction of decorated cospans
Last time, we introduced a Grothendieck construction for double categories, whose input data is a lax double functor
Mapping #1. A monoidal category can be seen as a double category
Mapping #2. For any category
with
as well as unitors
Mapping #3. For any category
with
It is now clear how the usual data for decorated cospans, a lax monoidal functor
The resulting lax double functor
is the image under
in
The last two formulas are precisely the ones used to compose decorated cospans (Fong 2015; Baez, Courser, and Vasilakopoulou 2022).
This observation clears up a puzzle that had always slightly bothered me about decorated cospans: where does the composition law come from? Why does it involve two operations, instead of just one? Well, the answer is that the construction itself involves a composite! Specifically, it is precomposition with the lax double functor
Double Grothendieck construction on cospans
We now apply the double Grothendieck construction to decorate double categories of cospans. Abstractly speaking, this is no more than taking the Grothendieck construction of a lax double functor
Let
and the two natural transformations
having components
The double category of
- objects, pairs
with an object and a decorating object ; - arrows
, pairs with a morphism in and a decoration morphism in ; - proarrows, pairs
with a cospan in and a decorating object ; - cells
, pairs with a map of cospans in and a decoration morphism in .
Sources and targets in
- proarrows
, with , to and ; - cells
, with , to and .
A generic cell in the double category of
The laxators
whose domain is the pullback in
Furthermore, the external composite of cells
In case it got lost in the morass of notation, let us summarize the two key ways that this version of decorated cospans generalizes the existing one. First, and most importantly, the decorations allowed for a given cospan can depend on the whole cospan, not just on its apex. Second, the feet of the cospans (the objects of the double category) get their own decorations, which can be extracted from the cospan decorations by the transformations
Examples
Any existing example of decorated cospans gives an example of the new formalism via the reductions above. So let’s see a few examples that actually need the extra generality afforded by the double Grothendieck construction.
The comma construction
In synthetic treatments of statistics and machine learning, a natural thing to consider is a small category, regarded as a theory in the sense of categorical logic, that is equipped with a distinguished morphism. Especially motivating to me are the statistical theories studied in my PhD thesis (Patterson 2020). A statistical theory consists of a small Markov category with some extra structure, specifying the constituents of a statistical model, plus a distinguished morphism
Using comma categories and decorated cospans, we construct a double category whose proarrows consist of a cospan of categories together with a morphism in the apex category, such that its domain and codomain are images of objects in the left and right feet. Actually, to address my motivating examples in statistics or machine learning, we would need to use comma objects in a 2-category of categories with extra structure. For simplicity, we’ll just work with bare categories here.
Recall that the comma category of two functors
- objects, a pair of objects
and plus a morphism in ; - morphisms
, a pair of morphisms in and in inducing a commutative square in .
In addition, the comma category
The comma construction upgrades to a lax double functor, the comma double functor
where
to the map of spans
where the functor
For composable cospans
Here
The Grothendieck construction
- objects, a small category
together with an object ; - arrows
, a functor together with a morphism in ; - proarrows with source
and target , a cospan of categories together with a morphism in ; - cells
with source and target , a map of cospans as depicted above such that the following square commutes:
External composition is given by pushout of categories, followed by composition in the quotient category.
When transplanted to the setting of Markov categories, such a cell is a refinement of what I have called a lax morphism of statistical theories (Patterson 2020, sec. 3.5).
Graphs with dangling edges
Directed graphs with dangling edges are an intuitively simple concept that is surprisingly resistant to clean mathematical treatment. One elegant approach, suited to the combinatorics of properads, has been developed by Joachim Kock (Kock 2016). In this approach, a dangling-edge graph (called by Kock simply a “graph”) is a diagram of finite sets
where the functions
Dangling-edge graphs are evidently a subset of the objects of a copresheaf category. A morphism of dangling-edge graphs is a morphism in this copresheaf category, i.e., a commutative diagram:
The category of dangling-edge graphs is denoted
We are going to construct a double category whose objects are finite sets, regarded as shrubs, and whose proarrows are dangling-edge graphs with specified incoming and outgoing edges. Composition of proarrows will glue outgoing edges of the first graph to incoming edges of the second graph. To do this construction, we’ll need the edge-analogue of the functor that sends a finite set
Let
This requires some explanation. Given a dangling-edge graph
In effect, we take the edges
The functor
where the latter morphism belongs to
To see this, note that if
Another complication is that to compose dangling-edge graphs, we must restrict to cospans with monic legs. Given a finitely cocomplete category
With these preliminaries aside, we define a lax double functor
with
Finally, we define the laxators and unitors of the lax double functor
takes the pushout in
picks out the corresponding shrub.
The double category of dangling-edge graphs is the Grothendieck construction of the lax double functor
If the injectivity constraint in dangling-edge graphs is dropped, one obtains a structure isomorphic to whole-grain Petri nets (Kock 2022). A double category of whole-grain Petri nets with chosen incoming and outgoing transitions can be constructed similarly to that of dangling-edge graphs. In fact, the construction is much simpler because we can work in a copresheaf category.
Discussion
As noted in the previous post, there is a logical gap between our double Grothendieck construction, which assumes the double category is strict, and its application to decorated cospans, using the pseudo double category of cospans. This discrepancy could be resolved by strictifying or, better, by appropriate use of 2-categorical ideas.
Both of our examples should be not only double categories but monoidal double categories, with monoidal product derived from the coproduct. The principled way to address this would be to derive the Grothendieck construction for monoidal double categories, as hinted at last time, and apply it to