Abstract 1 Introduction 2 Mazurkiewicz traces 3 Resourceful traces and free effectful categories 4 Interference: from effectful categories to effectful signatures 5 Commuting tensor product of free effectful categories 6 Conclusion and further work References Appendix A Omitted details

Resourceful Traces for Commuting Processes

Matthew Earnshaw ORCID Tallinn University of Technology, Estonia
University of Tartu, Estonia
Chad Nester ORCID University of Tartu, Estonia Mario Román ORCID University of Oxford, UK
Abstract

We show that, when the actions of a Mazurkiewicz trace are considered not merely as atomic but as transformations from a specified type of inputs to a specified type of outputs, we obtain a novel notion of presentation for effectful categories (also known as generalized Freyd categories), a well-known algebraic structure in the semantics of side-effecting computation. Like the usual representation of traces as graphs, our notion of presentation gives rise to a graphical representation of morphisms in effectful categories. We use our presentations to give a construction of the commuting tensor product of free effectful categories, capturing the combination of systems in which the actions of each must commute with one another, while still permitting exchange of resources.

Keywords and phrases:
Mazurkiewicz traces, premonoidal categories, monoidal categories, effectful categories
Funding:
Matthew Earnshaw: Estonian Research Council grant PRG1210 and PRG2764.
Chad Nester: Estonian Research Council grant PRG2764.
Mario Román: Air Force Office of Scientific Research (AFOSR) award number FA9550-21-1-0038; Advanced Research + Invention Agency (ARIA), Safeguarded AI Programme.
Copyright and License:
[Uncaptioned image] © Matthew Earnshaw, Chad Nester, and Mario Román; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Concurrency
; Theory of computation Categorical semantics
Acknowledgements:
The authors thank Niels Voorneveld for discussions, and the anonymous reviewers for their detailed comments and suggestions on the manuscript.
Editors:
Stefano Guerrini and Barbara König

1 Introduction

Mazurkiewicz traces [5, 17] provide a simple but powerful model of concurrent systems. Traces are a generalization of words, in which specified pairs of symbols (thought of as actions) can commute. Commuting actions a and b are independent: their possible concurrent execution ab is observationally indistinguishable from ba.

Just as free monoids are the algebraic structure formed by words, free partially commutative monoids [8] or trace monoids [17, 25] are the algebraic structure formed by (Mazurkiewicz) traces. Traces therefore permit an algebraic approach to the analysis of concurrent systems, by analogy with the use of algebraic methods in automata theory.

Mazurkiewicz states that intuitively, “actions are state transformations of some resources of a system” and that “actions are independent if they act on disjoint sets of resources” [16]. We contend that this view conflates two notions of resource that might be present in a concurrent system, and it is the remit of this paper to show that by teasing them apart, we obtain a richer algebraic structure.

On the one hand are shared resources corresponding to definite noun phrases, such as “the database”, “the memory location”, or “the printer”. These indeed give rise to relations of (in)dependence between actions. In this paper, we shall refer to such resources as devices. On the other hand are the kinds of resources and their transformations axiomatized by monoidal categories, as in Coecke, Fritz and Spekkens [4]. These are resources which act like types, and generally correspond to indefinite noun phrases such as “a database query”, “an integer”, or “a message”. Given any two such resources, we can always consider their conjunction “in parallel”, and they do not necessarily lead to relations of (in)dependence between actions. In what follows, we shall refer to these simply as resources.

For example, consider Figure 1, which introduces a running example, in our graphical notation. The left-hand side of the figure corresponds to our analogue of the alphabet of actions underlying a trace: we call this an effectful signature. In our example, the effectful signature contains a process corresponding to the action of emitting a document, with a single output string, and two processes corresponding to the action of printing received data on two distinct printers. Note that these actions are no longer atomic: they have strings corresponding to resources (depicted as solid strings, in general annotated with particular resources), that here indicate the data to be printed. Crucially, the two printing actions are annotated by distinct devices, depicted as patterned strings. Intuitively, a resourceful trace is a string diagram (directed from a left to a right boundary) built by plugging generators together, while only allowing each device string to appear at most once in each vertical section.

Figure 1: (Left) An effectful signature. (Center) Resourceful trace over the first two elements of the effectful signature, i.e. involving only one printer. (Right) Resourceful trace involving two printers: printings are now independent of one another.

If we only admit one printer in our system, printing actions must occur in a specific order, and this is captured by the topology of the trace, as in the center of Figure 1. However, if we admit both printers, printing can occur concurrently, and this is again captured by the topology of the traces, such as on the right of Figure 1, where the printing actions may slide past one another or interchange. We shall see in Section 5 that this example in fact arises by a canonical combination of the “theory of a printer” with itself, called the commuting tensor product, generalizing the commuting tensor product of algebraic theories [9].

The collection of all resourceful traces over an effectful signature assembles into an effectful category [23], also known as generalized Freyd categories [10, 21], a well-known algebraic structure in the semantics of effectful computation. Indeed, one of the results of this paper is that resourceful traces are the morphisms in free effectful categories. That is, we show that there is an adjunction between effectful signatures and effectful categories, generalizing the classic maximal cliques construction for Mazurkiewicz traces.

Related work

That Mazurkiewicz traces can be seen as morphisms in certain free monoidal categories was elaborated by Sobociński and the first author [7]. By moving to effectful categories, we sharpen this viewpoint, recovering Mazurkiewicz traces precisely as the morphisms in free effectful categories with no resources (qua “indefinite noun phrases”). The construction of free effectful categories over effectful signatures with a single device was given by the third author, following Jeffrey [13, 22, 23]. The construction of the commuting tensor product of effectful categories appeared in [6], in terms of string diagrams, covering the case of morphisms supported by a finite number of devices. The central results of this paper are new, namely the existence of an adjunction between effectful signatures and effectful categories (Corollary 42), and Theorem 47 on the commuting tensor product of free effectful categories.

Outline

Section 2 recalls the notion of Mazurkiewicz trace, and their graphical representation. Section 3 introduces effectful signatures and effectful categories, via their underlying device signatures and monoidal signatures, generalizing the notion of distribution of an alphabet of actions. We give a construction of the free effectful category over an effectful signature, whose morphisms are resourceful traces. In Section 4, we show how the cliques construction from the theory of traces generalizes to effectful categories, and exhibits the free construction as a left adjoint. Finally, Section 5 gives a construction of the commuting tensor product of free effectful categories, capturing the combination of systems in which the morphisms of each are forced to commute with one another, even while they may exchange resources.

2 Mazurkiewicz traces

In this section, we recall the basic definitions of trace theory, including the graphical presentation of traces. For more details, we refer to Mazurkiewicz, Hoogeboom and Rozenberg [5]. For this section, we fix a set of actions Σ, and denote by Σ the monoid of words over Σ.

Definition 1.

A dependency relation, DΣ×Σ, is a reflexive, symmetric relation. Dependency relations form a preorder, 𝖣𝖾𝗉Σ, with order the inclusion of relations.

Intuitively, a dependency relation specifies actions which should not occur concurrently, because they have some kind of dependency on each other, or the potential to interfere, such as writing to the same location in memory.

Definition 2.

Given a dependency relation DΣ×Σ, let D be the least congruence on Σ such that for every pair of actions a,bD, (a,b)D implies abDba. The free partially commutative monoid or trace monoid generated by D is the quotient monoid Σ/D. An element of the trace monoid is a Mazurkiewicz trace (or simply trace) over (Σ,D).

A trace is thus an equivalence class of words up to commutation of independent actions. Another construction of traces starts from distributions of the set of actions:

Definition 3.

A distribution of Σ is a function 𝖽𝖾𝗏:Σ𝒫({1,,k}) for some k1. Distributions form a preorder 𝖣𝗂𝗌𝗍Σ with 𝖽𝖾𝗏𝖽𝖾𝗏 if and only if for all a,bΣ, 𝖽𝖾𝗏(a)𝖽𝖾𝗏(b)=𝖽𝖾𝗏(a)𝖽𝖾𝗏(b)=.

Classically, 𝖽𝖾𝗏(σ) is known as the set of locations of σ. In line with the terminology introduced in the following, we call 𝖽𝖾𝗏(σ) the set of devices of σ. In terms of concurrency, we might consider 𝖽𝖾𝗏(σ) to be the set of shared resources on which σ depends, such as memory locations, execution threads, runtimes or peripherals.

We can represent a distribution graphically by introducing nodes (depicted as boxes) corresponding to actions in Σ, with interfaces (depicted as patterned strings) corresponding to the devices assigned to the action, as for example in Figure 2.

Figure 2: Graphical representation of a distribution: α and β share one device, and β and δ share one device, whereas γ has no devices.

Traces are the diagrams that we can build by plugging these components together, subject to the restriction that each device string occurs exactly once in each vertical slice of the diagram, such as in Figure 3. This is formalized by the algebra of (pre)monoidal categories, as we shall see in the next section. The collection of all such diagrams also forms a monoid, isomorphic to the trace monoid. More details can be found in the work of Sobociński and the first author [7], which builds on earlier work on the representation of traces as graphs [5].

Figure 3: Graphical representation of a trace over the distribution in Figure 2. As an equivalence class of words in the trace monoid, this trace would include for example γαβαδ and αβγδα: independence is captured by sliding actions, while keeping the boundaries fixed.

A classical construction lets us move between dependency relations and distributions: devices correspond to (non-trivial) maximal cliques in the graph of the dependency relation. For example, the dependency relation depicted in Figure 4 gives rise to the distribution in Figure 2. In Section 4, we shall apply a similar construction to effectful categories.

Definition 4.

The graph of a dependency relation ΣD×D has vertices the elements of Σ and an edge (a,b) for every (a,b)D.

Figure 4: Graph of a dependency relation, whose indicated non-trivial maximal cliques give rise to the distribution of Figure 2.
Proposition 5.

([7, §4.1]) Every dependency relation D on Σ gives rise to a distribution of Σ by taking a bijection of {1,,k} with the non-trivial maximal cliques of the graph of D, with 𝖽𝖾𝗏 sending an action to the subset of such cliques to which it belongs. This extends to a (contravariant) Galois insertion, 𝖼𝗅𝗂𝗊𝗎𝖾𝗌:𝖣𝖾𝗉Σ𝖣𝗂𝗌𝗍Σ.

Finally, we remark that any monoid has an underlying distribution, which can be found using the maximal cliques construction. A monoid M has a dependency relation D on its elements defined by (a,b)D just when a and b do not commute in M, and taking non-trivial maximal cliques in the graph of this dependency relation defines a distribution of M. We shall extend this idea to effectful categories in Section 4.

3 Resourceful traces and free effectful categories

In traces, actions are merely atomic names, equipped with a set of devices. In this section, we enrich the language of traces by allowing actions to additionally have input and output types, which we think of as resources that may be shared between actions. Actions therefore become morphisms, with a designated source and target.

In Section 3.1, we introduce the resourceful analogue of the distribution of a set of actions, which we call an effectful signature. In an effectful signature, in addition to a set of devices, every action is equipped with input and output types of resources. In Section 3.3, we show that just as a distribution generates a free partially commutative monoid, effectful signatures generate free effectful categories [23], also known as generalized Freyd categories [10, 21].

3.1 Effectful signatures

Effectful signatures refine distributions: not only by equipping actions with input and output types, but additionally by designating some central or pure actions, with only the impure actions being potentially able to interfere. In programming language theory, this is the division between values and computations [19, 15].

One reason for this can be seen already at the level of trace monoids. Morphisms of trace monoids are, a priori, simply morphisms of monoids, but these need not preserve centrality of actions. That is, if an action α commutes with all actions in a trace monoid M (i.e., α is central in M), then its image under a monoid homomorphism MN need not commute with all actions of N. Thus, certain actions that we might consider to be pure might change their role under a translation of systems. However, restricting the notion of morphism to require preservation of centrality is too strong, since it is possible for computations to be incidentally central: an example may be found in Staton and Levy [24, §5.2].

To overcome this, we explicitly designate which actions we want to consider as pure, and ask that centrality of just these actions is preserved. The chosen set of pure actions is specified by a monoidal signature:

Definition 6.

A monoidal signature M consists of a set of objects, VM; a set of arrows, EM; and a pair of functions δ0,δ1:EMVM assigning source and target lists of objects to each arrow. We can equivalently present a monoidal signature by a set of objects VM, and sets M(X1,,Xn;Y1,,Ym) of arrows for each pair of lists of objects: we shall find both perspectives useful.

We can picture a monoidal signature as on the left of Figure 5, where boxes depict the arrows, and their associated strings designate the sources and targets. We use solid strings for the objects of a monoidal signature.

Definition 7.

A morphism of monoidal signatures α:MN comprises two functions αE:EMEN and αV:VMVN commuting with δ0 and δ1, that is, δiαV=αEδi.

Equivalently, a morphism is specified by a function α on objects, and functions

M(X1,,Xn;Y1,,Ym)N(αX1,,αXn;αY1,,αYm).

It is easy to check that morphisms of monoidal signatures compose, the composite given by composing their underlying actions on arrows and objects, and that we have identities. Denote by 𝖬𝗈𝗇𝖦𝗋𝖺𝗉𝗁 the category of monoidal signatures and their morphisms.

The set of morphisms that may be equipped with devices, specifying dependencies between morphisms, is given by a device signature, which is simply a monoidal signature together with extra data associating a set of devices to each morphism:

Definition 8.

A device signature C comprises

  • a monoidal signature |C|,

  • a set 𝒟C of devices, and

  • a function 𝖽𝖾𝗏C:E|C|𝒫(𝒟C) assigning each arrow in |C| to a subset of the devices. We shall simply write 𝖽𝖾𝗏 when the device signature C is clear from context.

Figure 5: Left: monoidal signature with arrows α:Xε, β:XYX. Right: device signature with the same underlying monoidal signature as on the left. α and β share a device, but β has an additional device. The devices of an action all appear in both the source and target, but need not occur in a specific order.

When a generator has a finite subset of devices, we can depict a device signature as on the right of Figure 5. Patterned strings denote devices (with arbitrary order of appearance). In contrast to resource strings, device strings must thread through the process: this enforces a definite ordering of dependent processes.

Example 9.

A device signature in which the underlying monoidal signature has an empty set of objects and set of arrows Σ is precisely a distribution of Σ in the sense of Definition 3, although we allow the set of devices to be infinite. In practice, a finite set of devices often suffices. For example, if the device signature has a finite number of arrows, then an infinite number of devices can be shown to be redundant.

Definition 10.

Morphisms f and g in a device signature C are said to be orthogonal, denoted fCg just when they share no devices, 𝖽𝖾𝗏(f)𝖽𝖾𝗏(g)=. Note that any f with no devices is orthogonal to every g. We write fg when C is clear from context, and fg when f and g are not orthogonal.

A morphism of device signatures must preserve orthogonality, that is

Definition 11.

A morphism of device signatures, α:CD, comprises

  • a morphism of underlying monoidal signatures, α:|C||D|,

  • such that for all arrows f,gC, if fCg then α(f)Dα(g).

Composition of these morphisms is given by composition of their underlying morphisms of monoidal signatures. It is easily checked that preservation of orthogonality is satisfied by a composite, and so device signatures and their morphisms form a category 𝖣𝖾𝗏𝖦𝗋𝖺𝗉𝗁.

We now have the ingredients required to define effectful signatures.

Definition 12.

An effectful signature 𝒢:VC comprises

  • a monoidal signature V,

  • a device signature C over the same set of objects as V,

  • an identity-on-objects morphism of monoidal signatures 𝒢:V|C|,

  • such that 𝖽𝖾𝗏(𝒢v)= for all arrows v in V.

We usually think of V in terms of its image in C, and thus when we speak of a morphism in an effectful signature, we are referring to the arrows of the device signature C.

Example 13.

In the effectful signature in Figure 1, the monoidal signature comprises solely the “document” generator, while the device signature includes all three generators, with the morphism of monoidal signatures simply including the “document” generator.

Definition 14.

A morphism of effectful signatures (α0,α):(𝒢:VC)(:WD) comprises

  • a morphism of monoidal signatures α0:VW, and

  • a morphism of device signatures α:CD,

  • such that the square of morphisms of monoidal signatures commutes, 𝒢α=α0.

Since both 𝖬𝗈𝗇𝖦𝗋𝖺𝗉𝗁 and 𝖣𝖾𝗏𝖦𝗋𝖺𝗉𝗁 are categories, it follows easily that

Proposition 15.

Effectful signatures and their morphisms form a category 𝖤𝖿𝖿𝖦𝗋𝖺𝗉𝗁.

Note that effectful signatures generalize the effectful polygraphs of Sobociński and the third author [23], precisely by allowing each action to have a different set of devices, rather than all actions having a single, global device. The construction of effectful categories in the next section also refines that from effectful polygraphs [23], in that it builds in extra independence equations between processes.

3.2 Effectful categories

Effectful signatures generate effectful categories. An effectful category comprises a monoidal category 𝕍, a premonoidal category , and an identity-on-objects premonoidal functor 𝕍. In this paper, we work with strict versions of these notions, since not only are the free such structures strict, but coherence theorems exist which state that any (pre)monoidal category is equivalent to a strict one [20].

Just as with effectful signatures, the idea is that 𝕍 is a category of pure actions (generated by a monoidal signature), is a category of effectful actions (generated by a device signature), and the functor is thought of as an inclusion of 𝕍 into . Let us build up to their definition.

Definition 16.

A strict monoidal category is a category 𝕍 equipped with

  • a functor :𝕍×𝕍𝕍, called the monoidal product,

  • a distinguished object I, called the monoidal unit,

  • such that A(BC)=(AB)C and AI=A=IA,

  • and such that the following equations hold for all morphisms f,g,h:

    f(gh)=(fg)h1If=f=f1I.

Premonoidal categories refine monoidal categories by only requiring the monoidal product to be functorial separately in each variable: in particular, there is no operation combining arbitrary morphisms in parallel.

Definition 17.

A strict premonoidal category is a category, , equipped with functors (A): (the “left-whiskering” by A) and (A): (the “right-whiskering” by A), for every object A of , and a distinguished object I (the “monoidal unit”), such that,

  • AB=AB, allowing us to denote this object as AB,

  • A(BC)=(AB)C and AI=A=IA,

  • and such that the following equations hold, stating coherence of left- and right-whiskering with each other and with the monoid structure

    (Af)B=A(fB)If=f=fI
    (AB)f=A(Bf)f(AB)=(fA)B.

Note that every monoidal category is a premonoidal category in which partial applications of the monoidal product define the left- and right- whiskerings. The key equations that hold for every pair of morphisms in a monoidal category, but not generally in a given premonoidal category, are those expressing interchange (i.e., commutation) of morphisms:

Definition 18.

For morphisms f:AB and g:AB in a premonoidal category ,

  • we write fg in case (fA)(Bg)=(Ag)(fB),

  • we say that f and g interchange in case fg and gf,

  • we say that f and g interfere, written fg, in case they do not interchange,

  • we say that f is central in case it interchanges with every morphism of .

Graphically, interchange of morphisms is precisely the sliding of morphisms past one another, as discussed for example in Figure 3.

Definition 19.

Let and 𝔻 be strict premonoidal categories. A strict premonoidal functor is a functor F:𝔻 that

  • maps objects as a monoid homomorphism, F(AB)=F(A)F(B) and F(I)=I,

  • and preserves whiskerings, F(Af)=F(A)F(f) and F(fA)=F(f)F(A).

When and 𝔻 are moreover strict monoidal categories, we call this a strict monoidal functor.

Strict monoidal categories and strict premonoidal categories, along with strict functors form categories, 𝖬𝗈𝗇𝖢𝖺𝗍 and 𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍. Finally, we reach the definition of effectful categories:

Definition 20.

A (strict) effectful category :𝕍 comprises

  • a strict monoidal category 𝕍,

  • a strict premonoidal category with the same objects as 𝕍, 𝗈𝖻𝗃=𝕍𝗈𝖻𝗃,

  • an identity-on-objects strict premonoidal functor :𝕍,

  • such that the image of :𝕍 is central.

Definition 21.

A morphism of (strict) effectful categories, (α0,α):(:𝕍)(:𝕎𝔻), comprises a strict monoidal functor α0:𝕍𝕎 and a strict premonoidal functor α:𝔻 such that α=α0 in 𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍 (eliding the inclusion of 𝖬𝗈𝗇𝖢𝖺𝗍𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍).

From the fact that 𝖬𝗈𝗇𝖢𝖺𝗍 and 𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍 are categories, it follows easily that:

Proposition 22.

Effectful categories and their morphisms form a category 𝖤𝖿𝖿𝖢𝖺𝗍.

3.3 Free effectful category over an effectful signature

Our goal now is to define a functor :𝖤𝖿𝖿𝖦𝗋𝖺𝗉𝗁𝖤𝖿𝖿𝖢𝖺𝗍. We will see in the next section that this functor has a right adjoint, and so constructs the free effectful category on an effectful signature. We begin with the free premonoidal category over a device signature.

Definition 23.

For a device signature G, we construct a premonoidal category G on G as follows. The underlying category has,

  • set of objects VG, the free monoid on VG, whose elements are lists. We shall denote by the concatenation of lists.

  • set of morphisms EG/, where EG is the set inductively defined by rules for identities, the whiskering of generating arrows, and composition,

  • and is the least congruence for generated by (uv)w=u(vw), 1Xu=u=u1Y

whenever these are well typed, along with equations allowing (whiskerings of) orthogonal generating arrows to interchange, i.e. for every pair, f:UV and g:UV, of arrows in EG that are orthogonal, 𝖽𝖾𝗏(f)𝖽𝖾𝗏(g)=, and each triple of objects X,Y,Z in VG,
(XfYUZ)(XVYgZ)=(XUYgZ)(XfYVZ).

It is immediate that this data forms a category. For the premonoidal structure, we define I to be the empty list, left and right whiskerings act on objects by list concatenation (denoted ), and their action on morphisms is defined inductively by

(Xf):={1XYif f=1Y,(Xg)(Xh)if f=uv,XYfZif f=YfZ,
(fX):={1YXif f=1Y,(gX)(hX)if f=uv,YgZXif f=YgZ.

It is easily verified that these mappings are well-defined, functorial, and satisfy the required coherence equations of Definition 17.

The morphisms of G are resourceful traces over G, and can be depicted intuitively as “string diagrams” (from an input boundary to an output boundary), built by combining whiskered generators of G via the operations of premonoidal categories. Generators correspond to boxes as in Figure 5, identity morphisms correspond to strings, composition is given by joining resource strings and any matching device strings, leading to a morphism with the union of the two sets of devices, and whiskering by juxtaposing strings with boxes. Whiskering by the empty list is simply depicted by drawing no whiskering string. We illustrate this in Figure 6. The requirement that every device string appear at most once in every vertical slice through the diagram, as in Section 2, is enforced by the fact that we have no operation for combining morphisms in parallel. The following lemma shows that interchange of generating arrows extends to the morphisms of G via the device assignment described above.

Figure 6: (Left to right): Whiskering of a generating arrow by a resource, composition of morphisms with matching devices, composition of morphisms with distinct devices. Composition gives a morphism whose devices are the union of the components.
Definition 24.

Device assignment extends inductively from a device signature G to a well-defined function on the morphisms of G (Definition 23) as follows

𝖽𝖾𝗏G(f):={if f=1A,𝖽𝖾𝗏G(f)if f=XfY,𝖽𝖾𝗏G(g)𝖽𝖾𝗏G(h)if f=gh.
Lemma 25.

Let f,g be two morphisms of G. If f and g are orthogonal, 𝖽𝖾𝗏G(f)𝖽𝖾𝗏G(g)=, then fg and gf.

Proof.

See Appendix A.

Example 26.

As noted in Example 9, a device signature G with empty set of objects is precisely a distribution of an alphabet. In this case, G has a single object, the empty list, and hence is a monoid (with trivial whiskerings). This monoid is isomorphic to the trace monoid over the corresponding distribution.

Lemma 27.

Each morphism of device signatures, α:GH, induces a strict premonoidal functor, (α):GH, defined as follows. The action on objects is the lifting of αV to lists, αV:VGVH. The action on morphisms is given by

(α)(f):={1α(X)if f=1X,(α)(X)αE(f)(α)(Y)if f=XfY(α)(g)(α)(h)if f=gh.

and this action is well-defined.

Proof.

Well-definedness follows from the fact G and H are categories and that α preserves orthogonality by definition. The action on objects is a morphism of monoids, so to see that (α) is a strict premonoidal functor, it remains to check that it preserves whiskerings: this follows by a straightforward induction on f.

It is clear that the mapping preserves composition and identities, and thus

Proposition 28.

The assignments of Definition 23 and Lemma 27 define a functor :𝖣𝖾𝗏𝖦𝗋𝖺𝗉𝗁𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍.

To define the free effectful category over an effectful signature, we simply combine the construction of the free monoidal category on a monoidal signature (Construction 48) with the construction of the free premonoidal category on a device signature (Definition 23), as follows.

Definition 29.

Let 𝒢:VC be an effectful signature. This generates the following effectful category 𝒢:VC, which Proposition 30 checks is well-defined.

  • The monoidal category is the free monoidal category V on the monoidal signature V,

  • the premonoidal category C is the free premonoidal category on the device signature C,

  • 𝒢:VC is taken to be identity-on-objects, and is defined by structural induction on its arguments, following Construction 48. The interesting case is, for g1:A1B1, g2:A2B2,

    𝒢(g1g2):=(𝒢(g1)A2)(B1𝒢(g2))=(A1𝒢(g2))(𝒢(g1)B2).

    For this equality to hold, we must have that 𝒢(g1) and 𝒢(g2) are orthogonal for all g1 and g2 in V, since then we can conclude from Lemma 25 that they interchange. It suffices to show that 𝒢(g) has no devices for all g in V, which follows by structural induction (c.f. Construction 48).

Proposition 30.

Definition 29 has the structure of an effectful category.

Proof.

By the definitions of device signature, free monoidal category and free premonoidal category, we have that (C)𝗈𝖻𝗃=(V)𝗈𝖻𝗃:=V𝗈𝖻𝗃. We must check that 𝒢:VC is a strict premonoidal functor with central image. 𝒢 is identity-on-objects and so a monoid homomorphism. Furthermore it preserves left-whiskering since

𝒢(Af):=(𝒢(𝗂𝖽A)B)(A𝒢(f))=A𝒢(f),

using the equations of strict premonoidal categories, and preserves right-whiskerings in a similar fashion. It follows from Lemma 25 that the image of 𝒢 is central since the definition of device signature asks that 𝖽𝖾𝗏𝒢(v):= for all vV, and so by Definition 24, 𝖽𝖾𝗏(𝒢(g))= for all gV.

Proposition 31.

Let (α0,α):(𝒢:VC)(:WD) be a morphism of effectful signatures. This generates a morphism of effectful categories (α0,α):𝒢 defined as follows:

  • the underlying strict monoidal functor is α0:VW,

  • the underlying strict premonoidal functor α:CD is that given by Lemma 27,

  • and the required square commutes by functoriality.

It is easily checked that this assignment on morphisms preserves identities and composition.

Proposition 32.

The assignments of Proposition 30 and Proposition 31 extend to a functor :𝖤𝖿𝖿𝖦𝗋𝖺𝗉𝗁𝖤𝖿𝖿𝖢𝖺𝗍.

4 Interference: from effectful categories to effectful signatures

In this section we show that every effectful category has an underlying effectful signature, given by a generalization of the clique construction of Proposition 5. Rather than taking the elements of a monoid as the vertices, we take the vertices to be the morphisms of a premonoidal category.

Definition 33.

The interference graph of a premonoidal category , denoted by , is the graph whose vertices are the arrows of , with an edge (f,g) if and only if f and g interfere in (denoted fg): that is, they do not interchange.

Definition 34.

Let be a strict premonoidal category. We define its underlying device signature 𝒰() as follows:

  • For the underlying monoidal signature we take V𝒰():=𝗈𝖻𝗃, and for every pair of lists X1,,Xn and Y1,,Ym of objects of 𝗈𝖻𝗃, we take a set of arrows

    𝒰()(X1,,Xn;Y1,,Ym):=(X1Xn;Y1Ym).

    That is, there is an arrow X1,,XnY1,,Ym in 𝒰() for every morphism X1XnY1Ym in . Since each Xi and Yj is an object of , whose set of objects already forms a monoid with operation denoted , a morphism f:X1XnY1Ym is included both in 𝒰()(X1Xn;Y1Ym) and 𝒰()(X1,,Xn;Y1,,Ym). The complete set of arrows E𝒰() is the coproduct of all such sets, over every pair of lists of objects in .

  • The set of devices, 𝖼𝗅𝗂𝗊𝗎𝖾𝗌(), is given by the set of non-trivial maximal cliques in the interference graph, . A clique is trivial just when it is a singleton. A clique is maximal just in case any morphism that interferes with every other morphism of the clique is in the clique. The device assignment, 𝖽𝖾𝗏:E𝒰()𝒫(𝖼𝗅𝗂𝗊𝗎𝖾𝗌()), assigns an arrow to the subset of non-trivial maximal cliques to which it belongs.

Lemma 35.

For F:𝕏𝕐 a strict premonoidal functor, we have that fg implies F(f)F(g) (interchange is preserved), and that F(f)F(g) implies fg (interference is reflected).

Proof.

Immediate.

Proposition 36.

For every strict premonoidal functor F:𝔻, there is a morphism of device signatures 𝒰(F):𝒰()𝒰(𝔻) given by the action of F.

Proof.

That this defines a morphism of the underlying monoidal signatures follows from the fact that a functor preserves sources and targets. We show that orthogonality of morphisms is preserved by proving the contrapositive, 𝒰(F)(f)𝒰(F)(g)fg. Suppose that C𝖽𝖾𝗏𝒰(𝔻)(𝒰(F)(f))𝖽𝖾𝗏𝒰(𝔻)(𝒰(F)(g)) for some C𝖼𝗅𝗂𝗊𝗎𝖾𝗌(𝔻). Then 𝒰(F)(f)=F(f)C and 𝒰(F)(g)=F(g)C, and we have F(f)F(g). Then Lemma 35 gives fg, which means f,gC for some C𝖼𝗅𝗂𝗊𝗎𝖾𝗌(), in which case C𝖽𝖾𝗏𝒰()(f)𝖽𝖾𝗏𝒰()(g), that is, fg, which is what we wanted to show.

Lemma 37.

The assignments of Definitions 34 and 36 extend to a functor 𝒰:𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍𝖣𝖾𝗏𝖦𝗋𝖺𝗉𝗁.

We can now define a functor 𝒰:𝖤𝖿𝖿𝖢𝖺𝗍𝖤𝖿𝖿𝖦𝗋𝖺𝗉𝗁. We begin with the action on effectful categories.

Proposition 38.

Let :𝕍 be an effectful category. Then 𝒰():𝒰(𝕍)𝒰() is the effectful signature with

  • monoidal signature 𝒰(𝕍), the underlying monoidal signature of 𝕍 (Definition 50),

  • device signature 𝒰(),

  • morphism of monoidal signatures 𝒰():𝒰(𝕍)|𝒰()| defined to be identity-on-objects, and f(f) on arrows.

Proof.

To see that this is well-defined, first note that by definition, 𝒰() has the same set of objects as 𝒰(𝕍). It remains to show that 𝖽𝖾𝗏(𝒰()(v))= for all arrows v in 𝒰(𝕍). By definition of 𝒰(), we have 𝒰()(v)=(v). Also, by definition :𝕍 has central image, and so (v) must constitute a trivial clique in .

It follows straightforwardly by combining Definition 50 and Proposition 38, that every morphism of effectful categories has an underlying morphism of effectful signatures, and furthermore that these assignments extend to a functor:

Proposition 39.

Let 𝒢:𝕍 and :𝕎𝔻 be effectful categories and (α0,α):(𝒢:𝕍)(:𝕎𝔻) a morphism of effectful categories. Then, there is an underlying morphism of effectful signatures, 𝒰(α0,α):=(𝒰(α0),𝒰(α)), where 𝒰 is the underlying morphism of monoidal signatures.

Proposition 40.

The assignments of Propositions 38 and 39 extend to a functor
𝒰:𝖤𝖿𝖿𝖢𝖺𝗍𝖤𝖿𝖿𝖦𝗋𝖺𝗉𝗁.

Finally, we show that our free and forgetful functors form an adjunction. Proofs can be found in Appendix A.

Theorem 41.

The free construction of premonoidal categories over a device signature (Definition 23) is left adjoint to forming the underlying device signature of a premonoidal category (Definition 34). That is, 𝒰:𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍𝖣𝖾𝗏𝖦𝗋𝖺𝗉𝗁.

Corollary 42.

The adjunction of Theorem 41 extends to an adjunction between effectful signatures and effectful categories. That is, 𝒰:𝖤𝖿𝖿𝖢𝖺𝗍𝖤𝖿𝖿𝖦𝗋𝖺𝗉𝗁.

5 Commuting tensor product of free effectful categories

In their abstract investigation of the notion of commutativity, Garner and López Franco deduce the existence of a commuting tensor product of effectful categories [10, §9.4]. In this section, we show how our construction of free effectful categories from effectful signatures gives rise to a simple, concrete construction of this commuting tensor product.

Roughly speaking, given two free effectful categories generated by effectful signatures over the same monoidal signature of chosen pure actions, their commuting tensor product is given by taking the free effectful category over a sort of “disjoint union” of the two underlying effectful signatures. In particular, the set of devices is a disjoint union, and so actions from one graph are forced to interchange with those from the other. However, the set of resources is left unchanged, and so the actions from each graph may share resources when they are composed into resourceful traces, as in Figure 1 (see also Example 44, below).

Construction 43.

Given effectful signatures 𝒢:WC and :WD over the same monoidal signature W, we construct their commuting tensor product 𝒢:WCD as follows. The monoidal signature of pure morphisms is simply W. The device signature CD has,

  • objects VCD:=VW=VC=VD,

  • arrows ECD:=EC+EWED, i.e., the following pushout of sets,

  • devices 𝒟CD:=𝒟C+𝒟D,

  • device assignment 𝖽𝖾𝗏CD:EC+EWED𝒫(𝒟CD) the unique map induced by the universal property of the pushout via the assignments 𝖽𝖾𝗏C and 𝖽𝖾𝗏D,

  • 𝒢:WCD is identity-on-objects and 𝒢ELEC,D(=EREC,D) on arrows.

Example 44.

A simple example is given by our printer example from Section 1, reproduced in Figure 7 (left), with the chosen monoidal signature of pure actions W made explicit: in this case, it comprises the only pure action, namely the “document” generator. The commuting tensor product of this effectful signature with itself is the effectful signature in Figure 7 (right), in which we have two distinct printers.

Figure 7: (Left) effectful signature corresponding to the simple “theory of a printer”. (Right) Commuting tensor product of this effectful signature with itself: the theory of two printers that may be used in parallel.

Our next goal is to show that the free effectful category over a commuting tensor product of effectful signatures is isomorphic to the commuting tensor product of the free effectful categories over those graphs. First, we recall the definition of commuting tensor product of effectful categories given by Garner and López Franco [10, §9.4], see also [6, Proposition 4.6.4]. The definition builds on the auxiliary notion of commuting cospan.

Definition 45 (Commuting cospan).

A cospan of effectful categories

F:(𝒜:𝕍𝔸)(𝒦:𝕍𝕂)(:𝕍𝔹):G,

over the same monoidal category 𝕍, is said to be commuting when, for every f in 𝔸 and g in 𝔹, we have F(f)G(g), i.e. F(f) and G(g) interchange in 𝕂.

Definition 46.

Let 𝒜 and be effectful categories over a monoidal category 𝕍. The commuting tensor product of 𝒜 and , denoted 𝒜, is defined to be the apex of the initial commuting cospan L:𝒜𝒜:R of effectful categories over 𝕍. Explicitly, for any other commuting cospan, F:𝒜𝒦:G of effectful categories over 𝕍, there exists a unique morphism of effectful categories 𝒜𝒦 such that:

Theorem 47.

Given effectful signatures 𝒢:WC and :WD over the same monoidal signature W, (𝒢)𝒢.

Proof.

It suffices to show that (𝒢) is the apex of the initial commuting cospan of effectful categories over the free monoidal category on W. In particular, we will show that:

is an initial commuting cospan, where L𝒢,:𝒢𝒢 is the morphism of effectful signatures that is identity on objects and pure generators, and given by the left pushout injection LEC,D on generators (Construction 43), and similarly for R𝒢,:𝒢. This cospan is commuting because of the way in which 𝖽𝖾𝗏CD is constructed using the universal property of the pushout given by LEC,D and REC,D. In particular, we have by construction that for any xEC and yED, LC,D(x)CDRC,D(y). It follows that (L𝒢,)(f)(𝒢)(R𝒢,)(g) for any morphisms f in (𝒢) and g in (), from which it follows in turn that the cospan in question is commuting.

To see that it is initial, suppose that we have another commuting cospan of effectful categories over W, call it 𝒢𝑃(𝒦:W𝒦)𝑄. We obtain a function (PQ)E:ECDE𝒰(𝒦) by the universal property of the pushout, where η denotes inclusion of generators,

This mapping on generators of the device signatures defines a morphism of effectful signatures PQ:𝒢𝒰(𝒦), where the fact that P and Q are a commuting cospan ensures that f𝒢g(PQ)(f)𝒰(𝒦)(PQ)(g). Using the bijection of hom-sets given by Corollary 42, we obtain a morphism (PQ)#:(𝒢)𝒦 of 𝖤𝖿𝖿𝖢𝖺𝗍 such that

Any other such morphism, transported back across the adjunction, induces another filler for our pushout diagram, and must therefore be equal to (PQ)#.

6 Conclusion and further work

We have shown how morphisms in free effectful categories can be seen as generalizations of Mazurkiewicz traces, by introducing a new notion of generating data for effectful categories, namely effectful signatures. This point of view also leads to a simple presentation of the commuting tensor product of free effectful categories. In this paper, we have not given a treatment of presentations involving equations but this would be a natural next step, and would allow us to express richer descriptions of concurrent systems, such as commuting tensor products of global state [23].

Prior work has generalized Mazurkiewicz traces along different lines, such as to contextual traces [2] or semicommutations [3], so these might be investigated in light of this paper. For example, semicommutations generalize Mazurkiewicz traces by allowing commutations to be directed, and this may correspond to a notion of order-enriched effectful category.

Since effectful categories are equivalent to strong promonads [22, 10], recasting our concepts from that point of view would bring our work adjacent to the literature on combining monads [12], whose relation to the commuting tensor product should be investigated. This may also suggest appropriate generalizations. For example, we might be able to see device information as corresponding to a grading of a strong promonad.

String diagrams bearing some resemblance to resourceful traces have been used informally by Melliès in a treatment of the local state monad [18]. The local state monad arises as a combination of global state monads, linked by a theory of allocation: connections to our commuting tensor product should be investigated. Similarly, Barrett, Heijltjes, and McCusker [1] have made informal use of string diagrams bearing resemblance to resourceful traces, in which devices stand for distinct effects in an effectful λ-calculus. These instances suggest that it would be worthwhile to formalize the diagrammatic point of view. Sobociński and the third author [23] proved that string diagrams over effectful signatures with a single global device do indeed give free premonoidal categories. However, since it is possible to construct effectful categories whose interference graphs contain an infinite number of maximal cliques, making the string-diagrammatic construction formal in our setting would require restricting to an appropriate subcategory of finitary effectful signatures. With this restriction, we see no reason why string diagrams for effectful categories should not extend to our setting.

References

  • [1] Chris Barrett, Willem Heijltjes, and Guy McCusker. The Functional Machine Calculus II: Semantics. In Bartek Klin and Elaine Pimentel, editors, 31st EACSL Annual Conference on Computer Science Logic (CSL 2023), volume 252 of Leibniz International Proceedings in Informatics (LIPIcs), pages 10:1–10:18, Dagstuhl, Germany, 2023. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.CSL.2023.10.
  • [2] Christian Choffrut and Robert Mercas. Contextual partial commutations. Discrete Mathematics & Theoretical Computer Science, 12, 2010.
  • [3] Mireille Clerbout and Michel Latteux. Semi-commutations. Information and computation, 73(1):59–74, 1987. doi:10.1016/0890-5401(87)90040-X.
  • [4] Bob Coecke, Tobias Fritz, and Robert W Spekkens. A mathematical theory of resources. Information and Computation, 250:59–86, 2016. doi:10.1016/J.IC.2016.02.008.
  • [5] Volker Diekert and Grzegorz Rozenberg. The Book of Traces. World Scientific, 1995. doi:10.1142/2563.
  • [6] Matthew Earnshaw. Languages of String Diagrams. PhD thesis, Tallinn University of Technology, 2025. doi:10.23658/TALTECH.2/2025.
  • [7] Matthew Earnshaw and Pawel Sobociński. String Diagrammatic Trace Theory. In MFCS, volume 272, 2023. doi:10.4230/LIPIcs.MFCS.2023.43.
  • [8] Dominique Foata and Pierre Cartier. Problèmes combinatoires de commutation et réarrangements. Lecture notes in mathematics, 85, 1969.
  • [9] P. Freyd. Algebra valued functors in general and tensor products in particular. Colloquium Mathematicum, 14(1):89–106, 1966. doi:10.4064/cm-14-1-89-106.
  • [10] Richard Garner and Ignacio López Franco. Commutativity. Journal of Pure and Applied Algebra, 220(5):1707–1751, 2016.
  • [11] Philip Hackney and Marcy Robertson. On the category of props. Applied Categorical Structures, 23(4):543–573, August 2015. doi:10.1007/s10485-014-9369-4.
  • [12] Martin Hyland, Gordon Plotkin, and John Power. Combining effects: Sum and tensor. Theoretical computer science, 357(1-3):70–99, 2006. doi:10.1016/J.TCS.2006.03.013.
  • [13] Alan Jeffrey. Premonoidal categories and a graphical view of programs. Preprint, 1997.
  • [14] André Joyal and Ross Street. The geometry of tensor calculus, I. Advances in Mathematics, 88(1):55–112, 1991. doi:10.1016/0001-8708(91)90003-P.
  • [15] Paul Blain Levy, John Power, and Hayo Thielecke. Modelling environments in call-by-value programming languages. Information and Computation, 185(2):182–210, 2003. doi:10.1016/S0890-5401(03)00088-9.
  • [16] Antoni Mazurkiewicz. Concurrent program schemes and their interpretations. DAIMI Report Series, 6(78), July 1977. doi:10.7146/dpb.v6i78.7691.
  • [17] Antoni Mazurkiewicz. Basic notions of trace theory. In J. W. de Bakker, W. P. de Roever, and G. Rozenberg, editors, Linear Time, Branching Time and Partial Order in Logics and Models for Concurrency, pages 285–363, Berlin, Heidelberg, 2005. Springer Berlin Heidelberg.
  • [18] Paul-André Melliès. Local states in string diagrams. In Rewriting and Typed Lambda Calculi: Joint International Conference, pages 334–348. Springer, 2014. doi:10.1007/978-3-319-08918-8_23.
  • [19] John Power. Premonoidal categories as categories with algebraic structure. Theoretical Computer Science, 278(1):303–321, 2002. Mathematical Foundations of Programming Semantics 1996. doi:10.1016/S0304-3975(00)00340-6.
  • [20] John Power and Edmund Robinson. Premonoidal categories and notions of computation. Math. Struct. Comput. Sci., 7(5):453–468, 1997. doi:10.1017/S0960129597002375.
  • [21] John Power and Hayo Thielecke. Closed freyd- and κ-categories. In Jirí Wiedermann, Peter van Emde Boas, and Mogens Nielsen, editors, Automata, Languages and Programming, pages 625–634, Berlin, Heidelberg, 1999. Springer Berlin Heidelberg.
  • [22] Mario Román. Promonads and string diagrams for effectful categories. In Applied Category Theory, volume 380 of Electronic Proceedings in Theoretical Computer Science, pages 344–361. Open Publishing Association, 2023. doi:10.4204/EPTCS.380.20.
  • [23] Mario Román and Paweł Sobociński. String diagrams for premonoidal categories. Logical Methods in Computer Science, Volume 21, Issue 2, April 2025. doi:10.46298/lmcs-21(2:9)2025.
  • [24] Sam Staton and Paul Blain Levy. Universal properties of impure programming languages. In Proceedings of the 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’13, pages 179–192, New York, NY, USA, 2013. Association for Computing Machinery. doi:10.1145/2429069.2429091.
  • [25] Wieslaw Zielonka. Notes on finite asynchronous automata. RAIRO - Theoretical Informatics and Applications - Informatique Théorique et Applications, 21(2):99–135, 1987. doi:10.1051/ITA/1987210200991.

Appendix A Omitted details

Lemma 25. [Restated, see original statement.]

Let f,g be two morphisms of G. If f and g are orthogonal, 𝖽𝖾𝗏G(f)𝖽𝖾𝗏G(g)=, then fg and gf.

Proof.

By structural induction on f and g. The cases where one of f and g are an identity or both morphisms are whiskered generators are straightforward by the equations of premonoidal categories, or by the imposed interchange equations for whiskered generators. Let f=f1f2, then by assumption we obtain 𝖽𝖾𝗏G(f1)𝖽𝖾𝗏G(g)=𝖽𝖾𝗏G(f2)𝖽𝖾𝗏G(g)=, and by hypothesis f1g and f2g. Say f1:AB,f2:BC,g:DE. We need to show ((f1f2)D)(Cg)=(Ag)((f1f2)E). By the functoriality of and associativity of , the left-hand side is equal to (f1D)((f2D)(Cg)). Using the two induction hypotheses, this becomes (Ag)((f1E)(f2E)) which is finally equal to the right-hand side by the functoriality of . The argument for g||f is symmetric, as well as the case when g is a composite.

The following tautological construction of the free strict monoidal category on a monoidal signature is standard (see e.g. [11, Appendix A]).

Construction 48 (Free strict monoidal category).

For a monoidal signature G, we construct a strict monoidal category G on G as follows. The underlying category of G has:

  • set of objects VG, the free monoid on VG,

  • set of morphisms constructed according to the following rules:

    subject to the equations,

    (fg)h=f(gh)1Af=f=f1B(1A1B)=1AB
    (f1f2)(g1g2)=(f1g1)(f2g2)(fg)h=f(gh)
  • composition and identities are given by the corresponding inference rules.

The first two equations ensure that this data forms a category and the remaining equations ensure that the evident monoidal product is functorial.

Similarly, the free strict monoidal functor on a morphism of monoidal signatures is given by the evident inductive extension.

Proposition 49.

The construction of defines a functor :𝖬𝗈𝗇𝖦𝗋𝖺𝗉𝗁𝖬𝗈𝗇𝖢𝖺𝗍.

Definition 50.

The underlying monoidal signature 𝒰M of a monoidal category M is defined to have set of objects the set of objects of M, and set of arrows,

(X1M𝗈𝖻𝗃,,XnM𝗈𝖻𝗃)(Y1M𝗈𝖻𝗃,,YmM𝗈𝖻𝗃)M(X1Xn;Y1Ym)

with the obvious assignments of sources and targets of arrows. For a strict monoidal functor F:MN, its underlying morphism of monoidal signatures 𝒰(F) is given by the action of F on objects and arrows.

Proposition 51.

Definition 50 defines a functor 𝒰:𝖬𝗈𝗇𝖢𝖺𝗍𝖬𝗈𝗇𝖦𝗋𝖺𝗉𝗁.

Proposition 52.

There is an adjunction 𝒰:𝖬𝗈𝗇𝖢𝖺𝗍𝖬𝗈𝗇𝖦𝗋𝖺𝗉𝗁.

Proof.

A left adjoint to 𝒰 is constructed via string diagrams by Joyal and Street [14].

Theorem 41. [Restated, see original statement.]

The free construction of premonoidal categories over a device signature (Definition 23) is left adjoint to forming the underlying device signature of a premonoidal category (Definition 34). That is, 𝒰:𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍𝖣𝖾𝗏𝖦𝗋𝖺𝗉𝗁.

Proof.

We begin constructing the unit, η:1𝖣𝖾𝗏𝖦𝗋𝖺𝗉𝗁𝒰. A component ηG:G𝒰((G)) acts on objects by inclusion as a singleton list, which we again denote simply as A,

(ηG)V:VGV𝒰((G)):AA.

On arrows, recall that by definition,

E𝒰((G))=(X1(G)𝗈𝖻𝗃,,Xn(G)𝗈𝖻𝗃)(Y1(G)𝗈𝖻𝗃,,Ym(G)𝗈𝖻𝗃)G(X1Xn;Y1Ym),

where is list concatenation. Let Ai,Bj be elements of VG, and f:A1,,AnB1,,Bm a morphism in (G). Let us denote the coproduct injection into the component (A1,,An),(B1,,Bm) of E𝒰((G)) by 𝗂𝗇. Then we define,

(ηG)E:EGE𝒰((G)):f𝗂𝗇f,

where f denotes the primitive left-right whiskering of f by the empty list, as in Definition 23. It is easy to check that this is a morphism of the underlying monoidal signatures. For the preservation of orthogonality, if fGg then by definition fg and gf in (G). Therefore, f and g are not connected in the interference graph of (G). Now, two maps in 𝒰((G)) will be orthogonal as long as they do not have a device in common, but were they to share a device, they would belong to a common maximal clique and thus be connected. This is a contradiction, so they must be orthogonal, ηG(f)𝒰((G))ηG(g).

It remains to show that η is natural. We must show that for any α:GH in 𝖣𝖾𝗏𝖦𝗋𝖺𝗉𝗁 we have:

We proceed by showing that the two above composite device signature morphisms have equal object mappings, and equal arrow mappings. First note 𝒰((α))V=αV by definition, so we have,

((ηH)VαV)A=αV(A)=αV(A)
=(αV(ηG)V)A=(𝒰((α))V(ηG)V)A

for all AVG, as required. For the arrows, recall that by Lemma 27, (α)(f)=αE(f), which gives:

((ηH)EαE)f=(ηH)E(αE(f))=𝗂𝗇αE(f)=𝗂𝗇F(α)(f)
=𝒰(F(α))E(𝗂𝗇f)=𝒰(F(α))E(ηGf)=(𝒰(F(α))E(ηG))f

establishing the naturality of η:1𝖣𝖾𝗏𝖦𝗋𝖺𝗉𝗁𝒰.

We now turn our attention to the counit ε:𝒰1𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍, where ε:(𝒰()) has action on objects (ε)(A1,,An):=A1An, where is the monoidal operation on objects that exists in a premonoidal category. The action on morphisms is defined by structural recursion as follows:

ε(f)={1ε(A) if f=1Aε(g)ε(h) if f=ghε(X)fε(Y) if f=X𝗂𝗇fY,

where 𝗂𝗇 denotes a coproduct injection. It is straightforward to check that this is well-defined, is a monoid morphism on objects, and preserves whiskerings. It remains to show that ε is natural. We must show that for any F:𝔻 in 𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍 we have:

We proceed by showing that the two composite functors have equal object mappings and equal arrow mappings. For the mapping on objects we have,

(Fε)(A1,,An)=F(A1An)
=F(A1)F(An)=(ε𝔻(𝒰(F)))(A1,,An).

For the arrow mappings, we proceed by induction on f. The interesting case is when f=X𝗂𝗇fY, for 𝗂𝗇f an arrow of 𝒰(),

(Fε)(X𝗂𝗇fY)=F(ε(X)fε(Y))=F(ε(X))F(f)F(ε(Y))
=ε𝔻((𝒰(F))(X))F(f)ε𝔻((𝒰(F))(Y))
=ε𝔻((𝒰(F))(X𝗂𝗇fY))=(ε𝔻(𝒰(F)))(X𝗂𝗇fY).

The other cases follow directly from the inductive hypothesis together with the fact that each composite is a strict premonoidal functor. It follows that ε:𝒰1𝖯𝗋𝖾𝗆𝗈𝗇𝖢𝖺𝗍 is natural.

Finally, to obtain an adjunction we must show the triangle identities:

For the first triangle, we have:

(ε𝒰𝒰η)(f)=ε𝒰(η𝒰(f))=𝒰(ε)(𝗂𝗇f)=f=1𝒰()(f),

from which we may conclude that the triangle in question commutes. For the second triangle, we proceed by induction on f. The interesting case is when f is a whiskered generating arrow, f=X𝗂𝗇fY,

(εη)G(X𝗂𝗇fY)=εG(ηG(X𝗂𝗇fY))
=εG((ηG)(X𝗂𝗇fY))
=εG((ηG)(X)(ηG)(𝗂𝗇f)(ηG)(Y)))
=εG([X]ηG(𝗂𝗇f)[Y])
=εG([X])𝗂𝗇fεG([Y])
=X𝗂𝗇fY,

where for X=X1,,Xn, we denote by [X] the list [X1],,[Xn]. The case where f is 1A follows from the (easily checked) fact that the claim holds for the object mapping, and the case of composition follows directly from the inductive hypothesis together with the fact that the composite is a strict premonoidal functor.

Corollary 42. [Restated, see original statement.]

The adjunction of Theorem 41 extends to an adjunction between effectful signatures and effectful categories. That is, 𝒰:𝖤𝖿𝖿𝖢𝖺𝗍𝖤𝖿𝖿𝖦𝗋𝖺𝗉𝗁.

Proof.

We shall make use of the adjunction of Theorem 41 and the adjunction between monoidal signatures and monoidal categories ([14]). Let :VG be an effectful signature. We first define the components of the unit, namely a morphism of effectful signatures

η:(:VG)(𝒰)(:VG),

by letting the morphism between the monoidal signatures be the unit of the adjunction between monoidal signatures and monoidal categories, ηV:V𝒰V, and the morphism between the device signatures be given by the unit ηG:G𝒰G of the adjunction constructed in Theorem 41. It is straightforward to verify that the required square commutes.

Let :𝕍 be an effectful category. For the components of the counit, we define a morphism of effectful categories,

ε:(𝒰)

by letting the component between the monoidal categories be given by the counit of the adjunction between monoidal signatures and monoidal categories, ε:𝒰, and the morphism between premonoidal categories be given by the counit of the adjunction constructed in Theorem 41.

It remains to show that the unit and counit satisfy the triangle identities, which follows simply from the triangle identities of the two adjunctions involved.