Concurrent Process Histories and Resource Transducers

We identify the algebraic structure of the material histories generated by concurrent processes. Specifically, we extend existing categorical theories of resource convertibility to capture concurrent interaction. Our formalism admits an intuitive graphical presentation via string diagrams for proarrow equipments. We also consider certain induced categories of resource transducers, which are of independent interest due to their unusual structure.


Introduction
Concurrent systems are abundant in computing, and indeed in the world at large.Despite the large amount of attention paid to the modelling of concurrency in recent decades (e.g., [Hoa78,Mil80,Pet66,Mil99,Abr14]), a canonical mathematical account has yet to emerge, and the basic structure of concurrent systems remains elusive.
In this paper we present a basic structure that captures what we will call the material aspect of concurrent systems: As a process unfolds in time it leaves behind a material history of effects on the world, like the way a slug moving through space leaves a trail of slime.This slime is captured in a natural way by resource theories in the sense of [CFS16], in which morphisms of symmetric monoidal categories -conveniently expressed as string diagramsare understood as transformations of resources.
From the resource theoretic perspective, objects of a symmetric monoidal category are understood as collections of resources, with the unit object denoting the empty collection and the tensor product of two collections consisting of their combined contents.Morphisms are understood as ways to transform one collection of resources into another, which may be 1.1.Contributions and Related Work.Related Work.Monoidal categories are ubiquitous -if often implicit -in theoretical computer science.An example from the theory of concurrency is [MM90], in which monoidal categories serve a purpose similar to their purpose here.String diagrams for monoidal categories seem to have been invented independently a number of times, but until recently were uncommon in printed material due to technical limitations.The usual reference is [JS91].We credit the resource-theoretic interpretation of monoidal categories and their string diagrams to [CFS16].Double categories first appear in [Ehr63].Free double categories are considered in [DP02] and again in [FPP08].The idea of a proarrow equipment first appears in [Woo82], albeit in a rather different form.Proarrow equipments have subsequently appeared under many names in formal category theory (see e.g., [Shu08,GP04]).String diagrams for double categories and proarrow equipments are treated precisely in [Mye16].We have been inspired by work on message passing and behavioural types, in particular [CP09], from which we have adopted our notation for exchanges.Contributions.The main contribution of this paper is the resource-theoretic interpretation of the free cornering and the observation that it captures the structure of concurrent process histories.Other contributions concern the categorical structure of the free cornering of a resource theory: we show that it has crossing cells and is consequently a monoidal double category in Lemma 4.5 and Lemma 4.7, argue that the vertical cells are the original monoidal category in Proposition 4.4, show that the induced monoidal category of horizontal cells can be understood as a category of resource transducers, and establish Lemma 6.2, Lemma 6.3, Observation 6.4, Lemma 6.5, Lemma 6.6, and Proposition 6.8 -all of which concern the structure of this category of horizontal cells.Finally, we give an axiomatization of the category of horizontal cells in terms of equations over a monoidal signature in Section 7. The original contributions of this paper over [Nes21b] are Lemma 6.2, Lemma 6.5, Lemma 6.6, Proposition 6.8, and the axiom scheme of Section 7. 1.2.Organization and Prerequisites.Prerequisites.This paper is largely self-contained, but we assume some familiarity with category theory, in particular with monoidal categories and their string diagrams.Some good references are [Mac71,Sel10,FS19].Organization.In Section 2 we review the resource-theoretic interpretation of symmetric monoidal categories.We continue by reviewing the theory of double categories in Section 3, specialized to the single object case.In Section 4 we recall the notion of proarrow equipment, introduce the free cornering of a resource theory, and exhibit the existence of crossing cells in the free cornering.In Section 5 we show how the free cornering of a resource theory inherits its resource-theoretic interpretation while enabling the concurrent decomposition of resource transformations.In Section 6 we consider the category of resource transducers and investigate its structure, and in Section 7 we give an axiom scheme for it.In Section 8 we conclude and consider directions for future work.

Monoidal Categories as Resource Theories
Symmetric strict 1 monoidal categories can be understood as theories of resource transformation.Objects are interpreted as collections of resources, with A ⊗ B the collection consisting of both A and B, and I the empty collection.Arrows f : A → B are understood as ways to transform the resources of A into those of B. We call symmetric strict monoidal categories resource theories when we have this sort of interpretation in mind.
For example, let B be the free symmetric strict monoidal category with generating objects {bread, dough, water, flour, oven} and with generating arrows mix : water ⊗ flour → dough knead : dough → dough bake : dough ⊗ oven → bread ⊗ oven subject to no equations.B can be understood as a resource theory of baking bread.The arrow mix represents the process of combining water and flour to form a bread dough, knead represents kneading dough, and bake represents baking dough in an oven to obtain bread (and an oven).
The structure of symmetric strict monoidal categories provides natural algebraic scaffolding for composite transformations.For example, consider the following arrow of B: is the braiding.This arrow describes the transformation of two units of dough into loaves of bread by baking them one after the other in an oven.
It is often more intuitive to write composite arrows like this as string diagrams: Objects are depicted as wires, and arrows as boxes with inputs and outputs.Composition is represented by connecting output wires to input wires, and we represent the tensor product of two morphisms by placing them beside one another.Finally, the braiding is represented 1 We work with strict monoidal categories for the sake of convenience and readability.We expect the present development to apply equally well to the general case, and if pressed would appeal to the coherence theorem for monoidal categories [Mac71].
Each transformation gives a method of baking two loaves of bread.On the left, two batches of dough are mixed and kneaded before being baked one after the other.On the right, first one batch of dough is mixed, kneaded and baked and only then is the second batch mixed, kneaded, and baked.Their equality tells us that, according to B, the two procedures will have the same effect, resulting in the same bread when applied to the same ingredients with the same oven.In this way, VD forms a strict monoidal category, which we call the category of vertical cells of D. Similarly, HD is also a strict monoidal category (with collection of objects D V ) which we call the horizontal cells of D.

Cornerings and Crossings
In this section we introduce the free cornering of a resource theory, our primary technical device, and show that the free cornering contains special crossing cells with nice formal properties.We begin by recalling the notion of proarrow equipment, specialised to the case of single-object double categories: Tersely, the free cornering of a resource theory is the proarrow equipment obtained by freely adding corner cells.Explicitly, we define: Definition 4.2.Let A be a resource theory.Then the monoid A

Now the free cornering is given as follows:
Definition 4.3.Let A be a resource theory.Then the free cornering of A, written A , is the free single-object double category determined by the following data: • The horizontal edge monoid A H = (A 0 , ⊗, I) is given by the objects of A.
• The vertical edge monoid A V = A •• is the monoid of A-valued exchanges.
• The generating cells consist of corners for each object A of A as in Definition 4.1, subject to the yanking equations, along with a vertical cell f for each morphism f : A → B of A subject to equations as in: For a precise development of free double categories see [FPP08].In brief: cells are formed from the generating cells by horizontal and vertical composition, subject to the axioms of a double category in addition to any generating equations.We call this the "free" cornering both because it is freely generated, and because we imagine there is an adjunction relating proarrow equipments and arbitrary double categories under which A is "free" in a more principled sense.We leave the construction of such an adjunction for future work.An important property of the free cornering is that the vertical cells are the original resource theory: Proposition 4.4.There is an isomorphism of categories V A ∼ = A.
Proof.Intuitively V A ∼ = A because in a composite vertical cell every wire bent by a corner must eventually be un-bent by the matching corner, which by yanking is the identity.The only other generators are the cells f , and so any vertical cell in A can be written as g for some morphism g of A. A more rigorous treatment of corner cells can be found in [Mye16], to the same effect.
Before we properly explain our interest in A we develop a convenient bit of structure: crossing cells.For each B of A H and each X of A V we define a cell of A inductively as follows: In the case where X is A • or A • , respectively, define the crossing cell as in the diagrams below on the left and right, respectively: From this we obtain a "non-interaction" property of our crossing cells, similar to the naturality of braiding in symmetric monoidal categories: Corollary 4.6.For cells α of V A and β of H A , the following equation holds in A : These crossing cells greatly aid in the legibility of diagrams corresponding to cells in A , but also tell us something about the categorical structure of A , namely that it is a monoidal double category in the sense of [Shu10]: Lemma 4.7.If A is a symmetric strict monoidal category then A is a monoidal double category.That is, A is a pseudo-monoid object in the strict 2-category VDblCat of double categories, lax double functors, and vertical transformations.
Proof.We give the action of the tensor product on cells: This defines a pseudofunctor, with the component of the required vertical transformation given by exchanging the two middle wires as in: Notice that ⊗ is strictly associative and unital, in spite of being only pseudo-functorial.

Concurrency Through Cornering
We proceed to extend the resource-theoretic interpretation of some symmetric strict monoidal category A to its free cornering A .We interpret elements of We understand equality of cells in A much as we understand equality of morphisms in a resource theory: two cells should be equal in case the transformations they describe would have the same effect on the resources involved.In this way, cells of A allow us to break a transformation into many concurrent parts.Note that with the crossing cells, it is possible for cells that are not immediately adjacent to exchange resource across the cells in between them.In the above example, flour is sent from the rightmost cell to the leftmost cell across the middle cell.This makes the double-categorical structure less constraining that it may seem at first.For example we might rearrange our previous example into the following horizontally composable cells of B : When composed, we obtain a similar morphism of A: It is worth mentioning that the difference between oven ⊗ flour ⊗ water and water ⊗ oven ⊗ flour is negligible since any permutation of a collection of resources is naturally isomorphic to the original collection as an object of A.

Horizontal Cells as Resource Transducers
If A is a resource theory, then the category H A of horizontal cells of the free cornering can be understood as a category of (A-valued) resource transducers. 2Specifically, recall our interpretation of A •• = (H A ) 0 as A-valued exchanges, in which two parties Alice and Bob must supply or retreive the resources involved in the exchange in the order specified, with who gives whom what determined by the polarity of the resources (see Section 5).Let h : X → Y be an arrow of H A .We can understand h as a machine operated by a left and right participant, again called Alice and Bob respectively.To operate the machine, Alice must play the left hand role of the domain exchange X and Bob must play the right hand role of the codomain exchange Y .The morphism h describes the internals of the machine.For example, consider the following morphism of H A :

Alice Bob
To operate the transducer, Alice must supply water and then receive bread, while Bob must supply flour, receive dough, and then supply bread.The effect of the machine is to mix the flour and water initially supplied into the dough Bob receives, and then to send the bread Bob supplies to Alice.
The transducer interpretation (along with our previous interpretation of the whole of A ) makes H A into a category of independent interest, and in this section we will study it.Compounding our interest is the fact that H A is rather unusual.It is of course a monoidal category (see Section 3) but fails to have any of the properties common to monoidal categories.Selinger's survey paper [Sel10] lists many such properties, for example: Definition 6.1 [Sel10].A monoidal category is spatial in case for all objects X and arrows h : I → I we have: It is easy to see that H A has the property of being spatial: Lemma 6.2.H A is spatial.
Proof.We use the fact that every symmetric monoidal category is spatial.The proof is by induction on the type X of the wire.If X is A • we have: and so the spatial axiom holds.Similarly the spatial axiom holds if X is A • .If X is I the spatial axiom holds trivially, and the inductive case is immediate.
We note that H A has no other property found in the aforementioned survey paper.
Much of the structure that H A does have consists of isomorphisms formed of corner cells.While isomorphic objects in V A ∼ = A can be thought of as equivalent collections of resources -being freely transformable into each other -we understand isomorphic objects in H A as equivalent exchanges.For example, there are many ways for Alice to give Bob an A and a B: Simultaneously, as A ⊗ B; one after the other, as A and then B; or in the other order, as B and then A. While these are different sequences of events, they achieve the same thing, and are thus equivalent.Similarly, for Alice to give Bob an instance of I is equivalent to nobody doing anything.Formally, we have: Lemma 6.3.In H A we have for any A, B of A: (1) Proof.(1) For I ∼ = I • , consider the •-corners corresponding to I: we know that these satisfy the yanking equations: which exhibits an isomorphism I ∼ = I • .Similarly, I ∼ = I • .Thus, we see formally that exchanging nothing is the same as doing nothing.
(2) The •-corner case is the interesting one: Define the components of our isomorphism to be: and then for both of the required composites we have: This captures formally the fact that if Alice is going to give Bob an A and a B, it doesn't really matter which order she does it in.
(3) Here it is convenient to switch between depicting a single wire of sort A ⊗ B and two wires of sort A and B respectively in our string diagrams.To this end, we allow ourselves to depict the identity on A ⊗ B in multiple ways, using the notation of [CS17]: Then the components of our isomorphism (A ⊗ B) and and, much as in (ii), it is easy to see that the two possible composites are both identity maps.Similarly, (A ⊗ B) ).This captures formally the fact that giving away a collection is the same thing as giving away its components.
For example, we should be able to compose the cells on the left and right below horizontally, since their right and left boundaries, respectively, indicate equivalent exchanges: Our lemma tells us that in cases like this there will be a mediating isomorphism, as above in the middle, making composition possible.
It is worth noting that we do not have one direction, defined by but there need not be a morphism in the other direction, and this is not in general invertible.In particular, H A is monoidal, but need not be symmetric.
This observation reflects formally the intuition that if I receive some resources before I am required to send any, then I can send some of the resources that I receive.However, if I must send the resources first, this is not the case.In this way, H A contains a sort of causal structure.
Next, we find that H A contains the original resource theory A as a subcategory in two different ways, one for each polarity: and is therefore strong monoidal as a consequence of Lemma 6.3.Further (−) • is faithful because A is freely generated.It is full because of the coherence theorem of [Mye16], which implies that for any horizontal cell (morphism of H A ) h : A • → B • we may yank all of the wires straight to obtain an equal morphism f • = h for some f : A → B of A. Similarly, (−) • is functorial, strong monoidal, full, and faithful.
There is also a contravariant involution (−) * : H A op → H A .As an intermediate step we define an operation on the cells of A as follows: For We discuss one final bit of structure in H A , concerning the following arrows: These are reminiscent of the string diagrams for rigid monoidal categories, these arrows make A • into the left dual of A • (and so make A • into the right dual of A • ).However, H A is neither left nor right rigid: for example A • ⊗ B • has neither a left nor right dual.It is natural to ask whether the arrows introduced above carry significant categorical structure.
We give one answer, and in doing so connect the present work to Cockett and Pastro's logic of message passing [CP09].In particular, the categorical semantics of this logic of message passing is given by linear actegories.If A is a symmetric monoidal category, a linear A-actegory is given by a linearly distributive category X (see e.g., [CS17]) together with two functors: with nine natural families of arrows subject to a large number of coherence conditions.The category H A exhibits similar, if much simpler, structure.In particular the strong monoidal functors (−) • and (−) • of Lemma 6.5 allow us to define Echoing the definition of a linear actegory, we have: 3 It is tempting to call this a contravariant monoidal involution, but in the covariant case a monoidal involution (−) ι has the property that (f ⊗ g) ι = g ι ⊗ f ι , twisting the tensor product [Egg11].We refrain from coining any new technical terms lest a "contravariant monoidal involution" turn out to be better suited to describing contravariant involutions that twist the tensor product instead of those that do not.Now, every monoidal category is a linearly distributive category (with both monoidal operations given by ⊗), and it turns out that H A forms a (somewhat degenerate) linear actegory.Of the nine natural families of arrows required by the definition, four are accounted for by the isomorphisms of Lemma 6.3, a further four become identities in our setting, and the final one is given by the d • • morphisms from Observation 6.4.The coherence conditions all hold trivially.We record: Proposition 6.8.Let A be a resource theory.Then H A is a linear actegory.This is intriguing insofar as it exhibits a formal connection between the free cornering of a resource theory and existing work on behavioural types.For example, the message-passing interpretation of classical linear logic presented by Wadler in [Wad14] corresponds to the message-passing interpretation of linear actegories in the special case of a *-autonomous category acting on itself (Example 4.2(4) of [CP09]).There may be an even stronger connection to the behavioural type interpretation of intuitionistic linear logic due to Caires and Pfenning [CP10], although here the connection to the logic of message passing is weaker (Example 4.2(1) of [CP09]).We leave the full investigation of these connections for future work.

Axioms for Resource Transducers
We have seen that the category of horizontal cells of the free cornering of a resource theory is an interesting object of study in its own right: it is a planar monoidal category that arises naturally and is different from those typically considered.In this section we give a direct presentation of H A both to deepen our understanding of its structure and to facilitate its use as an example (or counterexample) in the future.While there are many axioms, they are mostly intuitive, and are conveniently organized into pairs by the contravariant involution (−) * of Lemma 6.6.
Let A be a resource theory.Define T(A) to be the free spatial strict monoidal category with the generating objects as in: and the generating morphisms given by: The rules • and • correspond to the image of the functors from Lemma 6.5.All of , , , , , , , , σ•, σ• correspond to the isomorphisms of Lemma 6.3, and the η and ε rules correspond to the morphisms considered at the end of Section 6 that lead to Proposition 6.8.Before presenting the equations for T(A) we give the following string-diagrammatic conventions for our generators: Proof.That M is full follows from the cohrerence theorem for string diagrams for proarrow equipments [Mye16].Intuitively, every arrow of H A is either in the image of (−) • or (−) • , or is built out of corner cells and crossing cells.Every horizontal cell of H A that can be built out of only corner cells and does not decompose into multiple such cells is the image of one of the generators of T(A), and so we know that M is full.Perhaps surprising is that the horizontal cell d To show that M is faithful is to show that the equations T(A) capture all equations between horizontal cells of A when taken together with the equations of a spatial strict monoidal category.Recall that all of the equations of A are generated by the yanking equations, along with any equations of A. The yanking equations are local, in that each instance of one of the yanking equations involves exactly two cells of A , so we need only consider local interactions of cells of H A in our analysis.It is relatively straightforward to verify that the defining equations of T(A) are precisely the equations that arise in this way, and so M is faithful.4Finally, M is clearly identity-on-objects.
It follows that our axiomatization of H A is correct.We record: Corollary 7.2.There is an isomorphism of categories H A ∼ = T(A).

Conclusions and Future Work
We have shown how to decompose the material history of a process into concurrent components by working in the free cornering of an appropriate resource theory.We have explored the structure of the free cornering in light of this interpretation and found that it is consistent with our intuition about how this sort of thing ought to work.We do not claim to have solved all problems in the modelling of concurrency, but we feel that our formalism captures the material aspect of concurrent systems very well.
We find it quite surprising that the structure required to model concurrent resource transformations is precisely the structure of a proarrow equipment.This structure is already known to be important in formal category theory, and we are appropriately intrigued by its apparent relevance to models of concurrency -a far more concrete setting than the usual context in which one encounters proarrow equipments!Further, we have considered categories of resource transducers that are induced by our construction.We have identified some structure they do and do not exhibit, and have provided a more direct axiomatization of them.We are not aware of any categories with similar structure, which we feel makes these categories of resource transducers worthy of further study, and of potential value as a counterexample.
There are of course many directions for future work.For one, it would be nice to connect the development here to the wider literature on concurrent processes.An obstacle to this is that the free cornering does not allow us to express branching or recursion, both of which feature heavily in more general theories of process communication.If we assume that our monoidal category A has binary coproducts then we may represent a limited sort of branching computation in which (A + B) • and (A + B) • represent choices to be made by the left and right participant respectively, but this is less flexible than the protocol-level choice that one finds in e.g.session types or the nondeterminism of process calculi.We speculate that this is best approached through the "situated transition systems" introduced in [Nes21a], in which the concurrent resource transformations developed in [Nes21b] (which this paper extends) are used to augment the category of spans of reflexive graphs -interpreted as open transition systems [KSW97] -to generate material history over some resource theory as transitions unfold in time.Alternatively, one might impose additional structure on the free cornering to allow nondeterministic choice and repetition.
Another direction for future work is to pursue the connection with the message passing logic of Cockett and Pastro [CP09] (established in Proposition 6.8) and the wider programme of behavioural types influenced by linear logic including [Wad14] and [CP10].Finally, the presence of proarrow equipments here is rather mysterious, and we wonder if some deeper reason for it might exist.

3.
Single-Object Double Categories In this section we set up the rest of our development by presenting the theory of singleobject double categories, being those double categories D with exactly one object.In this case D consists of a horizontal edge monoid D H = (D H , ⊗, I), a vertical edge monoid D V = (D V , ⊗, I), and a collection of cells where A, B ∈ D H and X, Y ∈ D V .Given cells α, β where the right boundary of α matches the left boundary of β we may form a cell α|β -their horizontal composite -and similarly if the bottom boundary of α matches the top boundary of β we may form α β -their vertical composite -with the boundaries of the composite cell formed from those of the component cells using ⊗.We depict horizontal and vertical composition, respectively, as in: and Horizontal and vertical composition of cells are required to be associative and unital.We omit wires of sort I in our depictions of cells, allowing us to draw horizontal and vertical identity cells, respectively, as in: and Finally, the horizontal and vertical identity cells of type I must coincide -we write this cell as I and depict it as empty space, see below on the left -and vertical and horizontal composition must satisfy the interchange law.That is, α β | γ δ = α|γ β|δ , allowing us to unambiguously interpret the diagram below on the right: Every single-object double category D defines strict monoidal categories VD and HD, consisting of the cells for which the D H and D V valued boundaries respectively are all I, as in: and That is, the collection of objects of VD is D H , composition in VD is vertical composition of cells, and the tensor product in VD is given by horizontal composition: Definition 4.1.Let D be a single-object double category.D is called a proarrow equipment in case for each A ∈ D H there are distinguished elements A • and A • of D V along with distinguished cells of D: called •-corners and •-corners respectively, which satisfy the yanking equations: objects of A, whose elements we write A • and A • .Intuitively, elements of A •• describe a sequence of resources moving between participants in the exchange, where A • denotes an instance of A moving from left to right, and A • denotes an instance of A moving from right to left (see Section 5).
in the case where X is I, define the crossing cell as in the diagram below on the left, and in the composite case define the crossing cell as in the diagram below on the right: We prove a technical lemma: 7:9 Lemma 4.5.For any cell α of A we have Proof.By structural induction on cells of A .For the •-corners we have: and for the •-corners, similarly: the final base cases are the f maps: There are two inductive cases.For vertical composition, we have: Horizontal composition is similarly straightforward, and the claim follows by induction.
a left participant and a right participant giving each other resources in sequence, with A • indicating that the left participant should give the right participant an instance of A, and A • indicating the opposite.For example say the left participant is Alice and the right participant is Bob.Then we can picture the exchange A • ⊗ B • ⊗ C • as: Alice Bob Think of these exchanges as happening in order.For example the exchange pictured above demands that first Alice gives Bob an instance of A, then Bob gives Alice an instance of B, and then finally Bob gives Alice an instance of C. We interpret cells of A as concurrent transformations.Each cell describes a way to transform the collection of resources given by the top boundary into that given by the bottom boundary, via participating in A-valued exchanges along the left and right boundaries.For example, consider the following cells of B : From left to right, these describe: A procedure for transforming water into nothing by mixing it with flour obtained by exchange along the right boundary, then sending the resulting dough away along the right boundary; A procedure for transforming an oven into an oven, receiving flour along the right boundary and sending it out the left boundary, then receiving dough along the left boundary, which is baked in the oven, with the resulting bread sent out along the right boundary; Finally, a procedure for turning flour into bread by giving it away and then receiving bread along the left boundary.When we compose these concurrent transformations horizontally in the evident way, they give a transformation of resources in the usual sense, i.e., a morphism of A ∼ = V A :

Lemma 6. 5 .
There are strong monoidal functors (−) • : A → H A and (−) • : A op → H A defined respectively on f : A → B of A by: and Further, each of these functors is full and faithful.Proof.(−) • is functorial as in: It interacts with the tensor product in A as in: and (X ⊗ Y ) * = X * ⊗ Y * .On cells of A we also define (−) * inductively: The base cases are 7:15 f * = f along with: * cases are: * → * → Informally, α * is the mirror image of α.It is easy to see that we have α * * = α for any cell α of A .Thus, restricting (−) * to H A gives: Lemma 6.6.There is a contravariant involution (−) * : H A op → H A with the property that (f ⊗ g) * = f * ⊗ g * . 3 Lemma 6.7.• is the paramaterised left adjoint of •.That is, for all A ∈ A the functors A • − : H A → H A and A • − : H A → H A defined on h : X → Y by, respectively: and are such that A • − A • −.Proof.Fix an object A ∈ A. We require natural families of morphisms η A,X : X → A•(A•X) and ε A,X : A • (A • X) → X in H A that satisfy the triangle identities.Define η A,X and ε A,X , respectively, by and Now the triangle identities hold by repeated yanking, as in: and We therefore conclude that A • − A • −, as required.
Observation 6.4 decomposes in this way, being the image under M of the following morphism in T(A):