<<

External traced monoidal categories

Nick Hu St. Catherine’s College University of Oxford Supervised by Dr Jamie Vicary

A dissertation submitted for the degree of MSc Mathematics and Foundations of Computer Science Trinity 2019 Abstract String diagrams provide a novel technique for modern developments in theory, and in particular, higher . Many results about category theory can only be properly stated in the setting of 2-categories. We analyse the approach of using profunctors, which are a of relations, to study category theory itself. Specifically, we examine the structure of ∗-autonomous categories and various other categories with duals, and develop a new characterisation of traced monoidal categories with respect to Prof: the 2-category of categories, profunctors, and natural transformations. We discuss at length the topic of diagrammatic methods, and advocate for a fancy kind of called an internal string diagram.

i Contents

1 Introduction 1 1.1 The philosophy of category theory ...... 1 1.1.1 Picturing mathematics ...... 1 1.1.2 Peeking inside ...... 1 1.1.3 Externalising mathematics ...... 2 1.2 The context of our work ...... 2 1.3 Contributionandoutline...... 2

2 Preliminary material 4 2.1 Coends...... 4 2.1.1 Yoneda reductions ...... 6 2.2 Profunctors ...... 7 2.2.1 Relationship to ...... 9 2.3 2-categories ...... 11 2.3.1 Prof, the compact closed monoidal weak 2-category of categories, profunctors and natural transformations ...... 15

3 Characterising traced monoidal categories internal to Prof 18 3.1 Traced monoidal categories ...... 18 3.2 A 2- for tracing ...... 19 3.2.1 Sliding and naturality hold automatically ...... 21 3.3 Presentations of higher algebraic structure and the diagrammatic calculus ...... 23 3.4 The internal string diagram construction ...... 27 3.4.1 Actions of generating 2- ...... 29 3.5 Presentation of a traced ...... 31 3.5.1 Action of Tr ...... 33

4 Sketches of internal traced ∗-autonomous categories 39 4.1 ∗-autonomous categories internal to Prof ...... 39 4.1.1 Recovering ⊗ ...... 41 4.1.2 The exponential bifunctor − ⊸= ...... 44 4.2 Tracing and other extensions ...... 45 4.2.1 Compact closedness as a presentation ...... 45 4.2.2 Relationship to linear distributivity ...... 46 4.2.3 Results on tracing ...... 47

5 Conclusion 55 5.1 Futurework...... 55

References 56

ii 1. Introduction Category theory has become a universal language for the mathematical sciences. Beginning as an offshoot of traditional pure mathematics, in the school of algebraic topology, it has since come a long way, and is now the object of study for physicists, logicians, computer scientists, linguists, economists, and even philosophers. An argument can be put forward that no working mathematician’s toolbox is complete without a dab of category theory. The progression of this subfield of mathematics, and the proliferation of it in the mathematical sciences, has warranted that category theory becomes an for study itself, rather than merely a means to describe different parts of algebra. Indeed, the situation has turned on its head — the discovery of the Yoneda lemma, which is arguably the first ‘real theorem’ of category theory, has had large impacts on modern developments in algebraic geometry and representation theory. Although we do not make it explicit, this whole dissertation is built out of Yoneda, as we make extensive use of profunctors. 1.1. The philosophy of category theory Perhaps the most important use of Yoneda is its philosophy; while a formal statement is perfectly fine for a mathematician, there is an important lesson to learn from asking ‘what does Yoneda really mean?’ One answer is the following: You work at a particle accelerator. You want to understand some particle. All you can do are throw other particles at it and see what happens. If you understand how your mystery particle responds to all possible test particles at all possible test energies, then you know everything there is to know about your mystery particle. Ravi Vakil (2009) on the Yoneda lemma Another is summarised by the common saying you can tell a lot about a person by the company they keep. That is, the big picture of how things relate to each other is more important than the details inside, and this fits into the general theme of category theory: we do not look at what an object is, but instead how it interacts. Category theory is most often used with objects which are inherently set-like, but we can never ‘peek inside’ — instead, our attention is diverted to the connections between objects: the morphisms. The tenet of this approach is that things should be compositional, and crucial to any definition of a category is a definition of how its morphisms compose. Computer scientists have secretly been doing this for decades, under a different name: abstraction. To build large and complicated software, the more-or-less only viable approach is to piece it together from smaller pieces. But if one is too focused on the implementation details, then interfacing becomes impossible; hence, an abstraction barrier is necessary. Fundamentally, we don’t care how a data structure is implemented, so long as it provides a suitable abstract interface. This is precisely what we do when we prove general theorems about categories with structure: by abstracting vector spaces, Hilbert spaces, and relations down to compact closed categories, we can prove things for them all in one go by proving theorems about compact closed categories. 1.1.1. Picturing mathematics. In our preferred flavour of category theory, the development is particularly radical, thanks to the technique of string diagrams. No longer is algebra confined to one-dimensional lines of equations; instead, we represent algebraic expressions with diagrams of strings which fully exploit the two-dimensional geometry of the page, and our innate natural intuitions of homotopy. In our work, we shall make full use of the diagrammatic calculus (Joyal and Street 1991) to perform abstract mathematics in a novel fashion. Our philosophy is that this is the most effective method of working with higher categories, and in an anti-traditional fashion we deliberately give only a relatively informal definition of our diagrammatic methods. This is done in good faith — formal foundations exist1 and are absolutely necessary, but we are of the opinion that they are not particularly helpful from a pedagogical perspective, especially for those who are seeing the diagrammatic calculus for the first time. 1.1.2. Peeking inside. As we have described it, category theory provides an arena for formal mathematics with which one can study traditional mathematical structures. The natural question arises: what is the arena for formal category theory? One answer leads to Cat, the category of small categories and functors. Given that the objects of this category are categories, and that we are familiar with the internals of a category, it seems that if we wish to make statements about these categories we need to violate our previous principle of not ‘peeking inside’ the objects by breaking the abstraction barrier. To do this in a principled way, we transition from ordinary (1-)category theory to the theory of 2-categories2, which was born from generalising Cat. In this setting, we can formally study naturally category-theoretic phenomena, like adjunctions (also called dualities in the general 2-category theory world). However, new challenges also present themselves. Just as when moving from traditional mathematics to category theory, the notion of isomorphism between structures becomes formalised and important, when moving to 2-category theory, we also have the notion of isomorphism between morphisms. This motivates coherence, which we discuss later. Furthermore, traditional algebraic methods become unwieldy; intuitively simple 2-categorical generalisations of well-understood 1-categorical concepts require several pages of coherence equations to properly define. The case is even worse for 3-category theory, as the number of equations required explodes combinatorially. Even though important formalisations are missing, through sheer mathematical effort3 we fortunately have plenty of machinery to work with

1. This is a big topic in itself, unsuitable for exposition here. We refer the reader to Selinger (2009) for a lengthy discussion. 2. These are frequently referred to as in the literature. 3. To see what we mean, compare Michael Stay (2013, Definition 4.11) with the 1-categorical counterpart.

1 in the 2-categorical case. As we touched upon earlier, we will rely heavily on diagrammatic methods to provide human-digestible results.

1.1.3. Externalising mathematics. Our guiding principle is that of (vertical) categorification: the procedure of lifting structures from 푛-category theory to 푛 + 1-category theory4. By this, we mean the externalisation/internalisation of mathematics. This terminology is confusing, because often the reference frame is not made explicit. The most basic example of this is the correspondence between an element of aset 푥 ∈ 푋 and a {∗} → 푋 given by ∗ ↦ 푥5; in the category Set, the former describes the property of ‘having 푥’ internally to 푋 — the membership relation ∈ ‘peeks inside’ the Set object 푋 — whereas the latter gives it externally to 푋 (or equivalently, internally to Set) by describing the property as the existence of a function (i.e. a Set morphism). An easier example to see is that of the . Consider the following two equivalent definitions:

A set 푀 equipped with an associative unital binary An object 푀 of Set, with morphisms 푀×푀 −−→푀 and operation ⋅. 퐼 −→푀 such that the compositions of these are associative and unital: ≅ ≅ ≅

Again, the former is a monoid described internally to 푀 (an implementation), and the latter is a monoid external to 푀 (an abstract interface), or equivalently a monoid internal to Set. It is often fruitful to transplant these external definitions to other categories: a monoid internal to Cat is precisely a monoidal category. By taking this approach, we can achieve everything we want to do by ‘peeking inside’ objects in an external setting instead, and so we do not have to violate our abstraction barrier principle after all — this is what we mean by using 2-category theory in a principled way. As a bonus, this technique has high affinity with diagrammatic methods, and allows us to develop fancier string diagrams and techniques: categories inside categories begets strings inside strings.

1.2. The context of our work

The idea of studying categories as settings in which ‘information flows’, using diagrams with nodes connected by edges to represent composition, is too vague to point to a specific origin. Monoidal categories were invented by Benabou (1963), and the first coherence theorem (namely, that every monoidal category is equivalent to a strict one) was stated and proved by Lane (1963), and this gives a basis for the relationship between string diagrams and monoidal categories. The formalisation of string diagrams is attributed to Joyal and Street (1991). Profunctors as we know them are described by Borceux (1994, sec. 7.8) as ‘distributors’. Our approach is to mix this with the coend formulation, as described by Loregian (2015, sec. 5), where they appear as ‘relators’. Rather than point to one article, we provide our own comprehensive development of Prof, the compact closed monoidal weak 2-category of categories, profunctors, and natural transformations in Section 2.3.1, drawing on many sources. The idea of using profunctors to enable the development of formal category theory inside a 2-category can be attributed to Wood (1982), which introduced the idea of a 2-category equipped with proarrows, but note that our usage does not follow this development whatsoever (the concept seems to be at least superficially similar however). Traced monoidal categories in the symmetric case, along with their graphical calculus, are introduced by Joyal, Street, and Verity (1996). The straightforward non-symmetric generalisation that we focus on appears in Selinger (2009, sec. 5.1). In Section 4, our work also focuses heavily on the eponymous result of Hajgató and Hasegawa (2013), and this was the initial motivation. Weak 2-categories were introduced by Bénabou (1967) as ‘bicategories’, and now the relationship between 푛-categories and monoidal structure is somewhat understood (Baez and Dolan 1995). The diagrammatic calculus for Prof which we use is derived from Baez and Dolan (ibid., sec. 7)6. It is our view that our work descends from the tradition of 푛-categorical physics (Baez and Lauda 2011), minus the physics. Finally, we cannot fail to mention the wonderful article that is Baez and Mike Stay 2009, which eloquently explains how category theory links physics, topology, logic, and computation, with extensive use of string diagrams.

1.3. Contribution and outline

Section 2 introduces the various pieces of category theory that will be used frequently, and culminates in a description of Prof, the compact closed 2-category of profunctors. The results presented here are not original, but to our knowledge are scattered across the literature with some minor details missing, so it was necessary to collect them in one place

4. Set theory can be thought of as 0-category theory. 5. This function is typically called the global element of 푥. 6. For those familiar with the ‘standard’ diagrammatic calculus of Cat, given by the Poincaré dual of pasting diagrams (natural transformations are vertices, functors are edges, and categories are areas): this approach is effectively given by generalising this to an arbitrary 2-category (substitute natural transformations for 2-morphisms, functors for 1-morphisms, categories for objects), and then projecting out one dimension. That is, objects are not represented geometrically, 1-morphisms are represented by vertices (or in our preferred terminology, tiles), and 2-morphisms are represented by ‘movies’ of tile transformations which preserve tile boundaries at each step. We will expand on this in Section 3.3.

2 under the same notational conventions for adequate exposition in later sections. We assume an understanding of basic category theory; the standard texts are Borceux (1994) and Mac Lane (1998), but Awodey (2010) and Leinster (2014) are more suitable for computer scientists and logicians. An entertaining and informal introduction to the topic, from the perspective of programming, is given by Milewski (2017). A familiarity with monoidal 1-categories and string diagrams is helpful but by no means required. The main contribution of this work is to give a characterisation of traced monoidal categories as a categorified algebra, which in the context of Prof yields the ordinary notion of traced monoidal category, in the sense of Selinger (2009, sec. 5.1). The full details of this is given in Section 3, and in particular we make heavy use of the tools originally introduced in Bartlett et al. (2015) and Schommer-Pries (2011). In essence, we utilise these tools to demonstrate how ‘categories with structure’ can be encoded as a categorified algebra in terms ofa presentation, and then give a traced presentation which can be interpreted in Prof in an appropriate sense as the traced monoidal categories7. By this, we mean that we prove the categories obtained by our construction satisfy the axioms of a traced monoidal category. Furthermore, we also make a case for internal string diagrams (first appearing in Bartlett et al. (2015)) as a proof methodology. We are extremely grateful for the use of the TikZ code used to typeset that paper, as we heavily adapt it for this dissertation. Our secondary contribution is to examine the result of Hajgató and Hasegawa (2013), in the hope that we can strengthen it within our framework (removing the need to assume symmetry). This generalisation, the way it is phrased by Hajgató and Hasegawa (ibid.), is not at all straightforward. The other aim is to vastly simplify the existing result, which is technical and highly non-intuitive. We do this by examining the notions of ∗-autonomous and compact closed (a.k.a. symmetric autonomous) in terms of presentations in Section 4, and sketch a proof of this result in the non-symmetric case.

7. In general, we call this doing category theory externally (with respect to the category under examination), or internally with respect to Prof.

3 2. Preliminary material In this section, we introduce the main category theory tools we shall be using: coends, profunctors, and the language of 2-categories.

2.1. Coends In category theory, one is often interested in colimits, which are given by universal cocones. A cocone is a from a diagram 퐹 to the constant functor of some object 푑, Δ푑. Coends are essentially the result of generalising this process from natural transformation to dinatural transformations. First, we describe dinaturality. Definition 1 (Dinatural transformation). Given categories C and D, along with functors 푃 Cop × C ⇉ D, 푄 훼 a dinatural transformation 푃 ⇒⤑ 푄 is a family of morphisms in D:

훼푐 �푃(푐, 푐) −−→푄(푐, 푐)|푐 ∈ C� ,

푓 such that for all morphisms 푐 −→푐′, 푃(푐′, 푐)

푃(푓,id푐) 푃(id푐′,푓)

푃(푐, 푐) 푃(푐′, 푐′)

훼푐 훼푐′ (din)

푄(푐, 푐) 푄(푐′, 푐′)

푄(id푐,푓) 푄(푓,id푐′) 푄(푐, 푐′) commutes. We call this the dinaturality condition. The dinatural analogue of a cocone is a cowedge.

Definition 2 (Cowedge). Assume the setup for Definition 1, and additionally that 푄 is the constant functor Δ푑 for 훿 some object 푑 of D. A cowedge for 푃 is a dinatural transformation 푃 ⇒⤑ Δ푑. That is, a collection of morphisms from 푃(푐, 푐) to 푑 in D, for every 푐 in C. Equation (din) reduces to the commutativity of 푃(푐′, 푐)

푃(푓,id푐) 푃(id푐′,푓)

푃(푐, 푐) 푃(푐′, 푐′) (cow-din)

훿푐 훿푐′ 푑 Definition 3 (Coend). The initial cowedge of a functor is a coend, written (assuming the setup for Definition 2) 휇푃 푥 푃 ⇒⤑ Δ∫ 푃(푥,푥). 푥 When 푃 is unambiguous from context, we will drop the superscript. We refer to the D-object ∫ 푃(푥, 푥) as the coend. Explicitly, this means that any other cowedge for 퐹, 훽, factors through 휇, like so:

푃(id ′,푓) 푃(푐′, 푐) 푐 푃(푐′, 푐′)

휇 ′ 푃(푓,id푐) 푐

푥 훽푐′ 푃(푐, 푐) ∫ 푃(푥, 푥) 휇푐

푢 훽푐 푑

4 That is, 푢 is the unique morphism making this diagram commute. The concept of an end is dual to a coend, and is written ∫ 푃(푥, 푥). 푥 Informally, this diagram looks the same as a pushout diagram, subject to an extra dinaturality condition. This intuition that a coend is some kind of colimit is useful, and can be made more precise. 푃 Lemma 1 (Coend as a colimit). Given a functor Cop × C −→ D, if C is small and D is cocomplete, then we can characterise 푥 the coend ∫ 푃(푥, 푥) as the coequaliser of � 푃(푐, 푐) ⇇ � 푃(푐, 푐′). 푐∈C 푐→푐′ Proof. This follows from the correspondence between coends in C and colimits in Tw (C), the twisted arrow category of C (Loregian 2015, sec. 1.3). We will use this result to show that cocontinuous functors preserve coends, and dually that continuous functors preserve ends. As the Hom-functor is continuous in both arguments, and contravariant in its first, we have 푥 C �� 푃(푥, 푥), 푐� ≅ � C (푃(푥, 푥), 푐) . (Hom-∫) 푥 Thus, the contravariant Hom-functor (with the covariant argument fixed) sends coends to ends. Natural transformations give mappings between coends, in the following sense. 훼 Lemma 2 (Natural transformations induce change of base). Each natural transformation 푃 =⇒푄 induces a morphism 푥 푥 between coends ∫ 푃(푥, 푥) → ∫ 푄(푥, 푥). Proof. Observe that the commutativity of

푃(푓,id ) 푃(푐′, 푐) 푐 푃(푐, 푐)

훼(푐′,푐) 훼(푐,푐)

′ 푄(푐 , 푐) 푄(푓,id푐) 푄(푐, 푐)

푃 푃(id푐′,푓) 휇푐

푄 푄(id푐′,푓) 휇푐 푥 ′ ′ 푃 푃(푐 , 푐 ) 휇푐′ ∫ 푃(푥, 푥)

훼(푐′,푐′)

′ ′ 푄 푥 푄(푐 , 푐 ) 휇푐′ ∫ 푄(푥, 푥)

푥 푥 induces the morphism ∫ 푃(푥, 푥)⇢ ∫ 푄(푥, 푥). More explicitly, it arises via the of the coend, as in

푃(id ′,푓) 푃(푐′, 푐) 푐 푃(푐′, 푐′)

휇푃 푃(푓,id푐) 푐′ 푄 휇푐′∘훼(푐′,푐′) 푥 ∫ (1) 푃(푐, 푐) 푃 푃(푥, 푥) 휇푐

푥 푄 ∫ 푄(푥, 푥) 휇푐 ∘훼(푐,푐)

푃 푥 This implies that the action of sending a functor Cop × C −→ D to a coend ∫ 푃(푥, 푥) is functorial. 푥 Proposition 1 (Functoriality of ∫ −(푥, 푥)). We define the coend functor 푥 ∫ −(푥, 푥) ∶ [Cop × C, D] ⟶ D 퐹 푥 Cop × C −→ D ⟼ ∫ 퐹(푥, 푥) 훼 푥 푢 푥 퐹 =⇒퐺 ⟼ ∫ 퐹(푥, 푥)⇢ ∫ 퐺(푥, 푥),

5 where 푢 is the unique morphism induced by Lemma 2. Proof. To see that identities are preserved, observe that

퐹(id ′,푓) 퐹(푐′, 푐) 푐 퐹(푐′, 푐′)

휇 ′ 퐹(푓,id푐) 푐

푥 휇푐′ 퐹(푐, 푐) ∫ 퐹(푥, 푥) 휇푐

휇푐 푥 ∫ 퐹(푥, 푥)

id퐹 푥 trivially commutes; thus, by uniqueness, 퐹 ==⇒퐹 is mapped to id∫ 퐹(푥,푥). By a similar argument, preservation of composition arises from the uniqueness along the dashed arrows in

푃(푓,id ) 푃(푐′, 푐) 푐 푃(푐, 푐)

훼(푐′,푐) 훼(푐,푐)

′ 푄(푐 , 푐) 푄(푓,id푐) 푄(푐, 푐) 훽 ′ (푐 ,푐) 푃 푃(id푐′,푓) 훽(푐,푐) 휇푐

′ 푅(푐 , 푐) 푅(푓,id푐) 푅(푐, 푐)

푄 푄(id푐′,푓) 휇푐 푥 ′ ′ 푃 푃(푐 , 푐 ) 휇푐′ ∫ 푃(푥, 푥)

훼 ′ ′ 푅 푅(id푐′,푓) (푐 ,푐 ) 휇푐

′ ′ 푄 푥 푄(푐 , 푐 ) 휇푐′ ∫ 푄(푥, 푥)

훽(푐′,푐′) 푥 ′ ′ ∫ 푅(푐 , 푐 ) 푅 푅(푥, 푥) 휇푐′

2.1.1. Yoneda reductions. In this section, we rephrase the Yoneda lemma in terms of ends and coends. This culminates in an elegant result called the ninja Yoneda lemma. 퐹 Lemma 3 (Natural transformations correspond to ends). The set of natural transformations between two functors C ⇉ D 퐺 is in bijective correspondence with the end of the functor D(퐹(−), 퐺(=)):

[C, D](퐹, 퐺) ≅ � D(퐹(푥), 퐺(푥)). 푥 Proof. Without developing the theory of ends, we cannot do this proof justice, so instead we refer the reader to Loregian (2015, Theroem 1.18). 퐹 Lemma 4 (Classical Yoneda). Given a presheaf Cop −→ Set, [Cop, Set](C(−, 푐), 퐹) ≅ 퐹(푐). 퐺 Dually, given a copresheaf C −→ Set, [C, Set](C(푐, =), 퐺) ≅ 퐺(푐). Proof. See any book on basic category theory, e.g. (Leinster 2014, Theorem 4.2.1). Corollary 1. � Set (C(푥, 푐), 퐹(푥)) ≅ 퐹(푐), and � Set (C(푐, 푥), 퐺(푥)) ≅ 퐺(푐). 푥 푥

6 퐹 퐺 Proposition 2 (Ninja Yoneda/Density). For every presheaf Cop −→ Set and copresheaf C −→ Set, 푥 푥 퐹 ≅ � 퐹(푥) × C(−, 푥), 퐺 ≅ � 퐺(푥) × C(푥, =).

Proof. We will utilise the fact that the Yoneda functor is an embedding, i.e. that 푋 ≅ 푌 in C if and only if for all objects 푍 of C, C(푋, 푍) ≅ C(푌, 푍) in Set. Now, for the former, observe 푥 Set �∫ 퐹(푥) × C(푐, 푥), 푐′� ≅ { Equation (Hom-∫) } ∫ Set (퐹(푥) × C(푐, 푥), 푐′) 푥 ≅ { Tensor-Hom adjunction 퐴× =⊣ Set (퐴, =) in Set } ∫ Set (C(푐, 푥), Set (퐹(푥), 푐′)) 푥 Set(퐹(=),푐′) ≅ { Corollary 1 with respect to copresheaf C −−−−−−−−−→ Set } Set (퐹(푐), 푐′) ; the latter is analogous: 푥 Set �∫ 퐺(푥) × C(푥, 푐), 푐′� ≅ { Equation (Hom-∫) } ∫ Set (퐺(푥) × C(푥, 푐), 푐′) 푥 ≅ { Tensor-Hom adjunction 퐴⊗ =⊣ 퐴 ⊸= in Set } ∫ Set (C(푥, 푐), 퐺(푥) ⊸ 푐′) 푥 퐺(−)⊸푐′ ≅ { Corollary 1 with respect to presheaf Cop −−−−−−−→ Set } Set (퐺(푐), 푐′) .

In particular, because C(−, 푐′) is a presheaf Cop → Set, where 푐′ is any object of C, we have that 푥 푥 C(푐, 푐′) ≅ � C(푥, 푐′) × C(푐, 푥) ≅ � C(푐, 푥) × C(푥, 푐′), for all objects 푐 of C, where the second isomorphism arises from ×. Similarly, this can also be derived by noticing that C(푐, =) is a copresheaf C → Set. This result lets us ‘fuse’ Hom-sets along a coend, and intuitively is like specifying that 푓 푢 푣 for 푐 −→푐′, there exist morphisms 푐 −→푥 and 푥 −→푐′ such that

푓 푢 푣 푐 −→푐′ = 푐 −→푥 −→푐′. The intuition that a coend is like an existential quantifier is particularly useful later. We have only touched on the elegance of the coend integral calculus. An important result which we have not yet stated is the Fubini theorem, which states that adjacent integrals can be freely interchanged or combined up to canonical isomorphism. We refer the reader to Loregian (2015) to learn more about end/coend calculus8.

2.2. Profunctors

Here we introduce profunctors, which in some sense generalise functors. Definition 4 (Profunctor). A profunctor 퐹 from a category C to D, denoted by 퐹∶ C ⇸ D is a functor 퐹′ ∶ Dop × C → Set. Profunctors are to functors as relations are to functions: a functor, like a function, uniquely maps things in its domain to things in its codomain; but a profunctor takes a pair of domain-codomain and gives a set, similar to the way a relation is given by specifying whether each pair of domain-codomain are related or not. To help with mixed variance, it is helpful to introduce a new piece of notation. Definition 5 (Einstein notation). A profunctor always has a contravariant argument and then a covariant argument; to track this variance, we will write 푑 퐹푐 ≔ 퐹(푑, 푐)

8. There, they define a profunctor C ⇸ D to be a functor Cop × D → Set, which is different to our conventions.

7 퐹 푓 푔 where C ⇸ D is a profunctor. Similarly, for a C-morphism 푐 −→푐′ and D-morphism 푑 −→푑′, we write 푔 퐹푓 퐹(푔,푓) 푑′ 푑 ′ ′ 퐹푐 −−→퐹푐′ ≔ 퐹(푑 , 푐) −−−−−→퐹(푑, 푐 ), and given a natural transformation between profunctors

퐹 op D × C 훼 Set 퐺 we write 훼푑 훼(푑,푐) 푑 푐 푑 퐹푐 −−→퐺푐 ≔ 퐹(푑, 푐) −−−−→퐺(푑, 푐). Profunctors also compose like relations: recall that two relations 푅 and 푆 compose to form 푆 ∘ 푅, with 푥(푆 ∘ 푅)푦 ⇔ ∃푧.푥푅푧 ∧ 푧푆푦. In this setting, we use the coend in place of an existential quantification. 퐹 퐺 Definition 6 (Composition of profunctors). For two profunctors C ⇸ D and D ⇸ E, their composite profunctor C 퐹 D 퐺 E ⇸ ⇸ is defined as 푥 − 푥 퐺 ⋄ 퐹 ≔ � 퐺푥 × 퐹=. We will expand this out using Lemma 1. First, that this set is well-defined and always exists follows from the 푥 cocompleteness of Set. Recall that the coequaliser in Set is some set ∫ 퐺(푒, 푥) × 퐹(푥, 푐) and a function such that 푥 � 퐺(푒, 푥) × 퐹(푥, 푐)⇠ � 퐺(푒, 푑) × 퐹(푑, 푐) ⇇ � 퐺(푒, 푑) × 퐹(푑′, 푐) 푑∈D 푑→푑′ 푓 ∐ ′ ′ ′ is a universal morphism. The set 푑→푑′ 퐺(푒, 푑) × 퐹(푑 , 푐) is the set of all 푥 ∈ 퐺(푒, 푑), 푦 ∈ 퐹(푑 , 푐), and 푑 −→푑 , where 푑 and 푑′ are objects of D, and 푓 is a D-morphism. We obtain from this two functions9:

푓 푓 퐺(푒,푑−→푑′) 퐹(푑′←−푑,푐) 퐺(푒, 푑) −−−−−−−−−→퐺(푒, 푑′), and 퐹(푑′, 푐) −−−−−−−−→퐹(푑, 푐), ∐ ′ ∐ which can be thought of as giving a left and right actions sending the set 푑→푑′ 퐺(푒, 푑) × 퐹(푑 , 푐) to 푑∈D 퐺(푒, 푑) × 퐹(푑, 푐) in the sense of 푓 푓 (푥, 푦) ↦ (퐺(푒, 푑 −→푑′)(푥), 푦), and (푥, 푦) ↦ (푥, 퐹(푑 −→푑′, 푐)(푦)). We can write this more informatively as (푥, 푦) ↦ (푥 ⋅ 푓, 푦), and (푥, 푦) ↦ (푥, 푓 ⋅ 푦). ⋅ is in a sense is some sort of ‘formal’ composition, and when 퐺 and 퐹 are representable it really is composition: e.g. suppose that 퐺 and 퐹 are given by the Hom-functor D; then 푓 푓 D(푒, 푑 −→푑′) = 푓 ∘ −, and D(푑′ ←−푑, 푐) = − ∘ 푓. 푔 The coequaliser in Set for two functions 푋 ⇉ 푌 is given by 푌 quotiented by the least equivalence relation ∼ such ℎ that ∀푥 ∈ 푋.푔(푥) ∼ ℎ(푥). So, up to canonical isomorphism, we can concretely characterise the coend as the set

�� 퐺(푒, 푑) × 퐹(푑, 푐)� / ∼, 푑∈D where ∼ is the least equivalence relation generated by (푥 ⋅ 푓, 푦) ∼ (푥, 푓 ⋅ 푦). (∼) We will only use this concrete characterisation occasionally, most of the time preferring to work at the higher level of abstraction given by coends. For a full development, see Borceux (1994, sec 7.8). There is an obvious functor Cop × C → Set, and as we have alluded to the importance of Yoneda, it is not surprising that this functor is an important profunctor. Definition 7 (Identity profunctor). The identity profunctor on C,

idC ∶ C ⇸ C,

푓 푓 9. We use leftwards arrows to emphasise morphisms which appear in an : the C-morphism 푐 −→푐′ is written as 푐′ ←−푐 when we wish to emphasise that we are focusing on 푓 as a morphism of Cop.

8 is given by the Hom-functor C(−, =) ∶ Cop × C ⟶ Set (푋, 푌) ⟼ C(푋, 푌) 푓 푔 (푋′ −→푋, 푌 −→푌′) ⟼ C(푋′, 푌) → C(푋, 푌′) ℎ 푓 ℎ 푔 푋′ −→푌 ⟼ 푋 −→푋′ −→푌 −→푌′. Now we use the coend calculus to show that composition is weakly unital and associative, which is essential in the process of organising profunctors into a 2-category. 퐹 Proposition 3 (Profunctor composition is (weakly) unital). For any profunctor C ⇸ D, we have C(−, =) ⋄ 퐹 ≅ 퐹, 퐹 ⋄ C(−, =) ≅ 퐹. Proof. Immediate from Proposition 2 combined with Definition 6. 퐹 퐺 퐻 Proposition 4 (Profunctor composition is (weakly) associative). For all profunctors C ⇸ D ⇸ E ⇸ F, we have (퐹 ⋄ 퐺) ⋄ 퐻 ≅ 퐹 ⋄ (퐺 ⋄ 퐻). Proof. (퐹 ⋄ 퐺) ⋄ 퐻 ≅ { Definition 6 } 푥 �∫ 퐹(−, 푥) × 퐺(푥, =)� ⋄ 퐻 ≅ { Definition 6 } 푦 푥 ∫ �∫ 퐹(−, 푥) × 퐺(푥, 푦)� × 퐻(푦, =) ≅ { Cocontinuity } 푦 푥 ∫ ∫ 퐹(−, 푥) × 퐺(푥, 푦) × 퐻(푦, =) ≅ { Fubini theorem } 푥 푦 ∫ ∫ 퐹(−, 푥) × 퐺(푥, 푦) × 퐻(푦, =) ≅ { Cocontinuity } 푥 푦 ∫ 퐹(−, 푥) × �∫ 퐺(푥, 푦) × 퐻(푦, =)� ≅ { Definition 6 } 푦 퐹 ⋄ �∫ 퐺(−, 푦) × 퐻(푦, =)� ≅ { Definition 6 } 퐹 ⋄ (퐺 ⋄ 퐻).

퐹 2.2.1. Relationship to functors. Let C −→ D be a functor. There are two natural ways to turn 퐹 into a profunctor: a covariant one, and a contravariant one, which we describe next.

Definition 8 (퐹∗). Define

퐹∗ ∶ 퐶 ⇸ 퐷 (푑, 푐) ⟼ D(푑, 퐹(푐)) 푝 푞 (푑′ ←−푑, 푐 −→푐′) ⟼ D(푑′, 퐹(푐)) → D(푑, 퐹(푐′)) 푟 푝 푟 퐹(푞) 푑′ −→퐹(푐) ↦ 푑 −→푑′ −→퐹(푐) −−−→퐹(푐′). 푝 So the action of 퐹∗푞 is 퐹(푞) ∘ − ∘ 푝.

푃 퐹∗ A profunctor C ⇸ D which is isomorphic (in a 2-categorical sense, as we describe later) to C ⇸ D for some functor 퐹 C −→ D is called representable. Definition 9 (퐹∗). Define 퐹∗ ∶ 퐷 ⇸ 퐶 (푐, 푑) ⟼ D(퐹(푐), 푑) 푞 푝 (푐′ ←−푐, 푑 −→푑′) ⟼ D(퐹(푐′), 푑) → D(퐹(푐), 푑′) 푟 퐹(푞) 푟 푝 퐹(푐′) −→푑 ↦ 퐹(푐) −−−→퐹(푐′) −→푑 −→푑′.

9 ∗푞 So the action of 퐹 푝 is 푝 ∘ − ∘ 퐹(푞). 퐺∗ 퐺 Similarly, if 푃 is isomorphic to C ⇸ D for some functor D −→ C, then it is called corepresentable. ∗ Theorem 1 (퐹∗ ⊣ 퐹 ). In Prof, for every functor 퐹 we have an adjunction

∗ 퐹∗ ⊣ 퐹 . Proof. We will construct the unit and counit

∗ 휂∶ C(−, =) ⇒ 퐹 ⋄ 퐹∗, and ∗ 휀∶ 퐹∗ ⋄ 퐹 ⇒ D(−, =) 푥 푥 ( ∗ )푎 ∫ ∗푎 푥 ∫ D D D explicitly. First observe that 퐹 ⋄ 퐹∗ 푏 = 퐹 푥 × 퐹∗푏 = (퐹(푎), 푥) × (푥, 퐹(푏)) ≅ (퐹(푎), 퐹(푏)). So we need to construct components 푎 휂푏 ∶ C(푎, 푏) → D(퐹(푎), 퐹(푏)); for this we just use the morphism mapping of 퐹. 푥 푥 ( ∗)푎 ∫ 푎 ∗푥 ∫ D D Next we expand the coend in Set to calculate 퐹∗ ⋄ 퐹 푏 = 퐹∗푥 × 퐹 푏 = (푎, 퐹(푥)) × (퐹(푥), 푏) = ∐ D D 푥∈D ( (푎, 퐹(푥)) × (퐹(푥), 푏)) / ∼. The counit we are trying to build is of type 푎 휀푏 ∶ � (D(푎, 퐹(푥)) × D(퐹(푥), 푏)) / ∼→ D(푎, 푏). 푥∈D An element of the source set is an equivalence class consisting of pairs of morphisms (푎 → 퐹(푑), 퐹(푑) → 푏) for some object 푑 of D, so given one of those we can construct a morphism 푎 → 푏 by composition. Now, we must show that the triangle equations hold:

퐹 휂 휂퐹∗ ∗ ∗ ∗ ∗ ∗ 퐹∗ 퐹∗ ⋄ 퐹 ⋄ 퐹∗ 퐹 ⋄ 퐹∗ ⋄ 퐹 퐹

휀퐹∗ 퐹∗휀

∗ 퐹∗ 퐹 For the first one, observe that 푎 푎 �퐹∗휂� 푏 (휀퐹∗)푏 푎 ( C )푎 ∗ 푎 ∗ 푎 (D )푎 푎 퐹∗푏 ≅ 퐹∗ ⋄ (−, =) 푏 −−−−−→ 퐹∗ ⋄ (퐹 ⋄ 퐹∗)푏 ≅ (퐹∗ ⋄ 퐹 ) ⋄ 퐹∗푏 −−−−−→ (−, =) ⋄ 퐹∗ 푏 ≅ 퐹∗푏 푓 푓 푓 푓 푓 푎 −→퐹(푏) ↦ [(푎 −→퐹(푏), id푏)] ⟼ [(푎 −→퐹(푏), 퐹(id푏))] ⟼ [(id푎, 푎 −→퐹(푏))] ↦ 푎 −→퐹(푏), and for the second 푎 �휂퐹∗� ∗ 푎 푏 (퐹 휀)푏 ∗푎 (C ∗)푎 ∗ ∗푎 ∗ ∗ 푎 ( ∗ D )푎 ∗푎 퐹 푏 ≅ (−, =) ⋄ 퐹 푏 −−−−−→ (퐹 ⋄ 퐹∗) ⋄ 퐹 푏 ≅ 퐹 ⋄ (퐹∗ ⋄ 퐹 )푏 −−−−−→ 퐹 ⋄ (−, =) 푏 ≅ 퐹 푏 푔 푔 푔 푔 푔 퐹(푎) −→푏 ↦ [(id푎, 퐹(푎) −→푏)] ⟼ [(퐹(id푎), 퐹(푎) −→푏)] ⟼ [(퐹(푎) −→푏, id푏)] ↦ 퐹(푎) −→푏.

∗ In fact, (−)∗ and (−) extend to pseudofunctors rather easily.

Definition 10 (Covariant (−)∗ embedding). Define the pseudofunctor

(−)∗ ∶ Cat ⟶ Prof C ⟼ C 퐹 퐹∗ C −→ D ⟼ C ⇸ D 퐹 퐹∗ p C 훽 D ⟼ C 훽∗ D p 퐺 퐺∗ where 훽∗ is defined component-wise by

훽 푑 ∶ 퐹 푑 = D(푑, 퐹(푐)) ⟶ D(푑, 퐺(푐)) = 퐺 푑 ∗푐 ∗푐 ∗푐 푓 푓 훽푐 푑 −→퐹(푐) ⟼ 푑 −→퐹(푐) −→퐺(푐).

10 Definition 11 (Contravariant (−)∗ embedding). Define the pseudofunctor (−)∗ ∶ Catop ⟶ Prof C ⟼ C 퐹 퐹∗ C ←− D ⟼ D ⇸ C 퐹 퐹∗ p C 훽 D ⟼ C 훽∗ D 퐺 퐺p∗ where 훽∗ is defined component-wise by 훽∗푐 ∶ 퐺∗푐 = D(퐺(푐), 푑) ⟶ D(퐹(푐), 푑) = 퐹∗푐 푑 푑 푑 푔 훽푐 푔 퐺(푐) −→푑 ⟼ 퐹(푐) −→퐺(푐) −→푑. Next, we might ask when does a profunctor C ⇸ D correspond to a functor C → D? The answer is exactly when said profunctor has a right adjoint, up to Cauchy completion. Developing the notion of Cauchy completion here would be too much of a digression, and is not at all the focus of this work. Instead, we direct the reader to Borceux (1994, sec 7.9). However, the concept of adjointness in Prof is highly relevant, and will be covered in due course.

2.3. 2-categories

This section provides a brief introduction to the topic of 2-categories. Our motivation is to develop enough machinery to organise profunctors into a suitably rich 2-category; this category should be like a categorification of Rel, or alternatively a ‘relationification’ of Cat following our ‘profunctors are like generalised relations’ analogy. Definition 12 (Weak 2-category/). A weak 2-category, C, consists of the following data:

• a collection of objects, also called 0-morphisms, drawn: 푋,

• for each pair of objects, 푋 and 푌, a small Hom-category C(푋, 푌) whose objects form the collection of (1-)morphisms 훽 from 푋 to 푌, and morphisms 푓 =⇒푔 form the collection of 2-morphisms from 푓 to 푔; we draw a 1-morphism 푓 with domain 푋 and codomain 푌 as 푓 푋 −→푌, 푓 훽 and given two 1-morphisms with coincident domain and codomain, 푋 ⇉ 푌, we draw a 2-morphism 푓 =⇒푔 like 푔 so: 푓 푋 훽 푌, 푔

푓 푔 • a composition operation ∘ along 1-morphisms, which for each pair of morphisms 푋 −→푌 and 푌 −→푍 (where the 푔∘푓 푓 푔 codomain of 푓 matches the domain of 푔) yields a composite 푋 −−−→푍 or alternatively 푋 −→푌 −→푍 such that

id푋 푝 – for each object 푋, we have an identity 1-morphism 푋 −−−→푋; furthermore, for all morphisms10 푋 −→푌, 휌푝 휆푝 we have invertible 2-morphisms 푝 ∘ id푋 =⇒푝 and id푌 ∘ 푝 =⇒푝 called left and right unitors, subject to naturality conditions: ⎛ ⎞ ⎜ 푝 ⎟ ⎜ 푌 ⎟ ⎜ 훽 푝 ⎟ ⎜ 푋 푞 푌 푌 = ⎟ ⎜ 휆푝 ⎟ ⎜ ⎟ ⎜ 휆푞 ⎟ ⎜ 푋 푝 푌 ⎟ ⎜ 푞 ⎟ ⎜ 훽 ⎟ ⎜ ⎟ 푝 ⎜ ⎟ ⎜ 푞 ⎟ ∀ 푋 훽 푌 . ⎜ ⎟ ⎜ 푝 ⎟ 푞 ⎜ 푋 ⎟ ⎜ 훽 푝 ⎟ ⎜ ⎟ ⎜ 푋 푋 푞 푌 = ⎟ ⎜ 휌푝 ⎟ ⎜ ⎟ ⎜ 휌푞 ⎟ ⎜ 푋 푝 푌 ⎟ ⎜ ⎟ ⎜ 푞 ⎟ ⎜ 훽 ⎟ ⎝⎜ ⎠⎟ 푞

10. We will frequently draw identity 1-morphisms like 푋 푋 .

11 푓 푔 ℎ 훼ℎ,푔,푓 – for each triple of morphisms 푋 −→푌 −→푍 −→푊, we have an invertible 2-morphism (ℎ ∘ 푔) ∘ 푓 ===⇒ℎ ∘ (푔 ∘ 푓) 휇 휈 휎 called the associator, such that for all 푓 =⇒푓′, 푔 =⇒푔′, and ℎ =⇒ℎ′, we have

(휎 ∘ (휈 ∘ 휇)) ⋅ 훼ℎ,푔,푓 = 훼ℎ′,푔′,푓′ ⋅ ((휎 ∘ 휈) ∘ 휇). Notice that this cannot intuitively be captured by these diagrams as we have not provided a convention to distinguish (ℎ ∘ 푔) ∘ 푓 and ℎ ∘ (푔 ∘ 푓). 훽 훾 • for each pair of 2-morphisms 푓 =⇒푔 and 푔 =⇒ℎ, where 푓, 푔, and ℎ all have domain 푋 and codomain 푌, a vertical 훾⋅훽 composition operation ⋅ given by composition in the Hom-category C(푋, 푌), and denoted 푓 ==⇒ℎ or

푓 훽 푋 푔 푌, 훾 ℎ 푓 – for every 1-morphism 푋 −→푌, an object of the Hom-category C(푋, 푌), we have an identity morphism id푓 푓 ==⇒푓 in C(푋, 푌), which we call the identity 2-morphism11 on 푓; • for every three objects, 푋, 푌, and 푍, a functor ∘∶ C(푋, 푌) × C(푌, 푍) → C(푋, 푍), denoting horizontal composition of 2-morphisms, drawn: 푔∘푓 푓 푔 푋 훾∘훽 푍 = 푋 훽 푌 훾 푍 . 푞∘푝 푝 푞

푓 푔 Furthermore, for coherence, we require that the pentagon and triangle equations hold: for all 푉 −→푊, 푊 −→푋, 푝 푞 푋 −→푌, 푌 −→푍,

훼푞,푝∘푔,푓 (푞 ∘ (푝 ∘ 푔)) ∘ 푓 푞 ∘ ((푝 ∘ 푔) ∘ 푓)

훼푞,푝,푔∘id푓 id푞∘훼푝,푔,푓

((푞 ∘ 푝) ∘ 푔) ∘ 푓 푞 ∘ (푝 ∘ (푔 ∘ 푓))

훼푞∘푝,푔,푓 훼푞,푝,푔∘푓 (푞 ∘ 푝) ∘ (푔 ∘ 푓) and 훼 푔,id푊,푓 (푔 ∘ id푊) ∘ 푓 푔 ∘ (id푊 ∘ 푓)

휌푔∘id푓 id푔∘휆푓 푔 ∘ 푓 commute. In the literature, 푛-cell is a synonym for 푛-morphism, and these diagrams are called pasting diagrams. The definition we have presented is that of a category enriched over Cat, the Cartesian category of categories and functors, for those who are familiar with theory. The intuition for this definition is that objects (0-morphisms) can be composed together in 0 ways, 1-morphisms can be composed together in 1 way (the ordinary composition in traditional 1-category theory), and 2-morphisms can be composed together in 2 different ways — vertically (along objects), and horizontally (along 1-morphisms). However, the unitality and associativity of the composition of 1-morphisms, rather than being on-the-nose, is now witnessed by 2-morphisms in such a way that is coherent. This means that all pasting diagrams consisting of only identity 2-morphisms, components of 훼, 휆, 휌, and their inverses, commutes. That is, for any 1-morphisms 푓 and 푔, any pair of 2-morphisms 푓 ⇒ 푔 built from those 2-morphisms are equal. For example, we have 푋 푋

휆 = 휌 id푋 id푋 푋 푋 푋 푋

푓 11. We will also draw identity 2-morphisms like 푋 푌. 푓

12 which is otherwise fairly non-trivial to prove. Definition 13 (Strict 2-category). A strict 2-category is a weak 2-category where the unitors and associators are identity 2-morphisms. This definition is a direct categorification of Cat, the strict 2-category of categories, functors, and natural transforma- tions. Definition 14 (Cat). The strict 2-category Cat has • small categories for objects; • functors for 1-morphisms; • natural transformations for 2-morphisms; • 1-morphism composition is given composition of functors; • 2-morphisms can be composed vertically and horizontally, given by vertical and horizontal composition of natural transformations respectively. Definition 15 (). Any 2-category C canonically induces a 1-category 푄(C) with • objects given by the objects of C; • morphisms given by the set of 1-morphisms of C quotiented by isomorphism. Composition of 1-morphisms in C is unital and associative up to isomorphism, so composition in 푄(C) will be unital and associative on-the-nose as required. With this, we can recover the traditional 1-categorical version of Cat, with categories as objects and functors as morphisms: 푄(Cat). 훽 훾 훿 휃 Lemma 5 (Interchange). In a 2-category C, given 2-morphisms 푓 =⇒푔, 푔 =⇒ℎ, 푝 =⇒푞, and 푞 =⇒푟, (휃 ⋅ 훿) ∘ (훾 ⋅ 훽) = (휃 ∘ 훾) ⋅ (훿 ∘ 훽). Proof. Let 푓, 푔, and ℎ all be objects of C(푋, 푌), and 푝, 푞, and 푟 all be objects of C(푌, 푍). Then calculate (휃 ⋅ 훿) ∘ (훾 ⋅ 훽) ∘ = { Definition of the C(푋, 푌) × C(푌, 푍) −→ C(푋, 푍) functor } ∘ �휃 ⋅ 훿, 훾 ⋅ 훽� = { Definition of composition in C(푋, 푌) × C(푌, 푍) } ∘ �(휃, 훾) ⋅ (훿, 훽)� = { Functoriality of ∘ } ∘ �휃, 훾� ⋅ ∘ �훿, 훽� ∘ = { Definition of the C(푋, 푌) × C(푌, 푍) −→ C(푋, 푍) functor } (휃 ∘ 훾) ⋅ (훿 ∘ 훽).

In particular, this means that the composite 푓 푝 훽 훿 푋 푔 푌 푞 푍 훾 휃 ℎ 푟 is well-defined. Rather than defining the horizontal composite of 2-morphisms directly, it is often easier to define the whiskering of a 2-morphism and a 1-morphism.

푓 푝 Definition 16 (Whiskering). In a 2-category C, given a 2-morphism 푋 훽 푌, and 1-morphisms 푊 −→푋 and 푔 푞 푌 −→푍, we define the whiskering as its horizontal composition of 훽 with the corresponding identity 2-morphism: 푓 푞 푞 ∘ 훽 ≔ 푋 훽 푌 푍, 푔 푞

푝 푓 훽 ∘ 푝 ≔ 푊 푋 훽 푌. 푝 푔

13 In pasting diagrams, we draw these whiskerings as

푓 푓 푞 푝 푋 훽 푌 푍, and 푊 푋 훽 푌 푔 푔 respectively. 훽 훾 This is sufficient to define horizontal composition for any arbitrary 2-morphisms 푓 =⇒푔 =⇒ℎ as by interchange we can just define:

훾 ∘ 훽 ≔ (idℎ ⋅ 훾) ∘ (훽 ⋅ id푓) = (idℎ ∘ 훽) ⋅ (훾 ∘ id푓).

퐹 Definition 17 (Weak 2-functor/pseudofunctor). Given two 2-categories C and D, a weak 2-functor C −→ D is given by

• for each object 푋 of C, an object 퐹(푋) of D; 퐹 푋,푌 12 • for each Hom-category C(푋, 푌), a functor C(푋, 푌) −−−−→ D(퐹(푋), 퐹(푌)); • for all objects 푋 of C, an invertible 2-morphism

unit푋 id퐹(푋) ===⇒퐹(id푋);

푓 푔 • for all pairs of 1-morphisms 푋 −→푌 and 푌 −→푍 of C, an invertible 2-morphism

compose푓,푔 퐹(푔) ∘ 퐹(푓) ======⇒퐹(푔 ∘ 푓).

For coherence, we require additionally the commutativity of

휌퐹(푓) 휆퐹(푓) 퐹(푓) ∘ id퐹(푋) 퐹(푓) id퐹(푌) ∘ 퐹(푓) 퐹(푓)

퐹(푓)∘unit푋 퐹(휌푓) unit푌∘퐹(푓) 퐹(휆푓)

퐹(푓) ∘ 퐹(id푋) compose 퐹(푓 ∘ id푋) 퐹(id푌) ∘ 퐹(푓) compose 퐹(id푌 ∘ 푓) id푋,푓 푓,id푌 and 훼퐹(ℎ),퐹(푔),퐹(푓) �퐹(ℎ) ∘ 퐹(푔)� ∘ 퐹(푓) 퐹(ℎ) ∘ �퐹(푔) ∘ 퐹(푓)�

compose푔,ℎ∘퐹(푓) 퐹(ℎ)∘compose푓,푔

퐹(ℎ ∘ 푔) ∘ 퐹(푓) 퐹(ℎ) ∘ 퐹(푔 ∘ 푓)

compose푓,ℎ∘푔 compose푔∘푓,ℎ

퐹 �(ℎ ∘ 푔) ∘ 푓� 퐹 �ℎ ∘ (푔 ∘ 푓)� 퐹(훼ℎ,푔,푓)

푓 for all 1-morphisms 푋 −→푌, 푔, and ℎ. We are trying to equip ourselves with enough machinery to describe profunctors in a suitably rich 2-category; however, one can see from the definitions above that the equivalent 2-categorical concept requires a lot more detail to formally define compared to its 1-categorical counterpart. The definition of monoidal 2-category is several pages long, and we will not reproduce it here; in an informal sense, it is essentially the product of lifting the definition of monoidal category into 2-category theory with very similar intuitions to the above, such that coherence makes sure that equations which really ought to hold actually do. We would like to use the notion of compact closed monoidal 2-category, which requires dozens of pages to define. To deal with this complexity, we will reduce our level of rigour, and introduce the diagrammatic calculus of string diagrams as our primary vehicle of exposition, abandoning pasting diagrams for the most part. Coherence is the key to this methodology, and it ensures that the string diagram calculus is well-defined, sound, and complete. The fully-rigorous algebraic definitions of these structures can be found in Michael Stay (2013), for the interested reader.

푓 12. We usually elide the subscript on 퐹, writing 퐹(푓) for 퐹푋,푌(푓) where 푋 −→푌 is a 1-morphism of C.

14 2.3.1. Prof, the compact closed monoidal weak 2-category of categories, profunctors and natural transformations. Many articles (Bénabou 2000; Borceux 1994; Day and Street 1997; Loregian 2015; Michael Stay 2013) make glancing statements that Prof is a (compact closed/symmetric) (monoidal) 2-category, but these are usually short remarks and not formal definitions13. Owing to the versatility of profunctors in the wider sphere of mathematics, many of these presentations differ vastly and are inappropriate for our exposition. While we have precluded ourselves from providing a rigorous definition (by not formally defining (compact closed) monoidal 2-category), we will still give an essentially complete description of Prof suitable for our purposes, with details (e.g. whiskering, horizontal composition of 2-morphisms, , cups and caps, etc.) worked out. Definition 18 (Prof). The weak 2-category Prof has

• small categories for objects; • profunctors for 1-morphisms; • natural transformations for 2-morphisms; • 1-morphism composition is given by composition of profunctors Definition 6; • 2-morphisms vertically compose by standard vertical composition of natural transformations; however, horizontal composition of 2-morphisms in Prof is not horizontal composition of natural transformations; we define it below. Definition 19 (Horizontal composition in Prof). Given natural transformations

퐹 푃 p p C 훽 D and D 훾 E 퐺p 푄p we seek to find a natural transformation 푃⋄퐹 p C 훾∘훽 E. 푄⋄퐺p

훽푑 훾푒 푑 푐 푑 푒 푑 푒 We have components 퐹푐 −−→퐺푐 and 푃푑 −−→푄푑, and we need to construct components 푒 푥 �훾∘훽� 푥 푒 푥 푐 푒 푥 � 푃푥 × 퐹푐 −−−−−→ � 푄푥 × 퐺푐 , where 푐, 푑, and 푒 are objects of C, D, and E respectively. Define 훽푐 to be the natural transformation 퐹(=, 푐) ⇒ 퐺(푐, =) given by fixing the second (covariant) argument of 훽 as 푐; i.e. component-wise: 훽푑 푑 푐 푑 �훽푐� ≔ 퐹푐 −−→퐺푐 , 푑 푒 훽푐 훾 and define 훾푒 similarly From 퐹(=, 푐) =⇒퐺(=, 푐) and 푃(푒, −) =⇒푄(푒, −), construct the natural transformation:

푒 훾 ×훽푐 푃(푒, −) × 퐹(=, 푐) ===⇒푄(푒, −) × 퐺(=, 푐). 푒 Now define �훾 ∘ 훽� with Lemma 2. 푐 While this gives a definition for horizontal composition, it hardly suffices to provide any intuition; here, wedo 푥 푒 푥 푒 so. An element of ∫ 푃푥 × 퐹푐 is an equivalence class of pairs [(푝, 푓)] for some 푥, an object of D, with 푝 ∈ 푃푥 and 푥 ′ 푓 ∈ 퐹푐 . Suppose that 푑 is a concrete object of D witnessing this existential quantification over 푥; that is, we have some 푒 푑′ pair (푝, 푓), with 푝 ∈ 푃푑′ and 푓 ∈ 퐹푐 , which is the representative of the equivalence class [(푝, 푓)]. Now we can map 푒 푑′ 훾 ′ 훽 푑 푒 푐 푑′ 푒 푑′ 푝 �⎯�푞 ∈ 푄푑′ and similarly 푓 �⎯�푔 ∈ 퐺푐 ; this gives us an element (푞, 푔) ∈ 푄푑′ × 퐺푐 . Now, we use the universal cowedge 휇 ′ 푥 푒 푥 푑 corresponding to the coend ∫ 푄푥 × 퐺푐 , whose action is to inject (푞, 푔) into its equivalence class: (푞, 푔) �⎯�[(푞, 푔)]. So the horizontal composite intuitively unwraps an equivalence class, sends each component along the corresponding natural transformation, and then rewraps the result. This also tells us what the whiskering does: a whisker composite is given by a natural transformation, and an identity natural transformation, so the action is only on one component of the equivalence class, depending on which side is whiskered. Definition 20 (Monoidal structure on Prof). Prof has a monoidal ⊗ structure given by

• on objects, C and D, their monoidal product coincides with the of categories (like in Cat): C ⊗ D ≔ C × D,

13. Borceux (1994) is the standard reference, and describes Prof in most detail as a 2-category; however, it makes no mention of monoidal structure. Bénabou (2000) and Day and Street (1997) define the monoidal structure, but make no mention of compact closure.

15 퐹 퐺 퐹⊗퐸 • on 1-morphisms, given two profunctors C ⇸ D and E ⇸ F, we need to construct a profunctor C × E ⇸ D × F; define this with 퐹 ⊗ 퐸 ∶ C × E ⇸ D × F 푑 푓 �(푑, 푓), (푐, 푒)� ⟼ 퐹푐 × 퐺푒 푝 푞 ′ ′ ′ 푟 ′ 푠 ′ 푑′ 푓 푑 푓 �(푑 ←−푑, 푓 ←−푓), (푐 −→푐 , 푒 −→푒 )� ⟼ 퐹푐 × 퐺푒 → 퐹푐′ × 퐺푒′ 푝 푞 (푥, 푦) ↦ �퐹푟 (푥), 퐺푠 (푦)� . 훽 훾 • on 2-morphisms, given two natural transformations 퐹 =⇒퐺 and 푃 =⇒푄, we must find a natural transformation 훽⊗훾 퐹 ⊗ 푃 ==⇒퐺 ⊗ 푄, which is given by components (푐,푒) �훽⊗훾� (푐,푒) (푑,푓) (푐,푒) (퐹 ⊗ 푃)(푑,푓) −−−−−−−−→ (퐺 ⊗ 푄)(푑,푓) .

(푐,푒) 푑 푓 (푐,푒) 푑 푓 (퐹 ⊗ 푃)(푑,푓) = 퐹푐 × 푃푒 and (퐺 ⊗ 푄)(푑,푓) = 퐺푐 × 푄푒 , so define (푐,푒) 푑 푓 �훽 ⊗ 훾� ≔ 훽푐 × 훾푒 , (푑,푓)

• the unit of ⊗ is the terminal category ퟏ, and it is clear that ⊗ is associative and unital up to coherent isomorphism. This monoidal product is essentially ×, with arguments shuffled around when necessary to make everything typecheck — this is not surprising, as the monoidal product of Rel is the Cartesian product in Set; the relationship between Prof and Cat is essentially a categorified version. That Prof is symmetric monoidal follows directly from ×, in that there is an 휎C,D obvious profunctor C × D ⇸ D × C, which we examine next. Definition 21 (Symmetry of ⊗ in Prof).

휎C,D ∶ C × D ⇸ D × C ((푑1, 푐1), (푐2, 푑2)) ⟼ C(푐1, 푐2) × D(푑1, 푑2) 푔 푓 푓 푔 ′ 1 ′ 1 2 ′ 2 ′ ′ ′ ′ ′ �(푑1 ←−−푑1, 푐1 ←−−푐1), (푐2 −−→푐2, 푑2 −−→푑2)� ⟼ C(푐1, 푐2) × D(푑1, 푑2) → C(푐1, 푐2) × D(푑1, 푑2) 푓 푓 ′ ℎ ′ 푖 1 ′ ℎ 2 ′ (푐1 −→푐2, 푑1 −→푑2) ↦ (푐1 −−→푐1 −→푐2 −−→푐2, 푔 푔 1 ′ 푖 2 ′ 푑1 −−→푑1 −→푑2 −−→푑2) and observe that (푥,푦) (푐1,푑1) (푐1,푑1) (푥,푦) (휎D×C ⋄ 휎C×D) = � 휎D×C × 휎C×D (푐2,푑2) (푥,푦) (푐1,푑1) (푥,푦) = � �C(푐1, 푥) × D(푑1, 푦)� × �C(푥, 푐2) × D(푦, 푑2)� 푥 푦 ≅ �� C(푐1, 푥) × C(푥, 푐2)� × �� D(푑1, 푦) × D(푦, 푑2)�

≅ C(푐1, 푐2) × D(푑1, 푑2), and 푐1,푑1 (C(−, =) ⊗ D(−, =)) = C(푐1, 푐2) × D(푑1, 푑2). 푐2,푑2 Definition 22 (Compact closed structure on Prof). Each object C of Prof has a corresponding dual object: Cop. We need to give a witness for the unit and counit of this duality, which we call the cup and cap respectively. 푓 푔 푓 푓 푔 ′ ′ ′ op ′ ′ op If we have 푐1 −→푐1 and 푐2 −→푐2 in C, then we also have 푐1 ←−푐1 in C , and hence have (푐1 ←−푐1, 푐2 −→푐2) in C × C. 푓 푔 ′ ′ op op Therefore, we have (푐1 −→푐1, 푐2 ←−푐2) in (C × C) . op cupC ∶ ퟏ ⇸ C × C ′ ′ �(푐1, 푐2), ∗� ⟼ C(푐2, 푐1) 푓 푔 ′ ′ ′ ′ ��푐1 −→푐1, 푐2 ←−푐2� , id∗� ⟼ C(푐2, 푐1) → C(푐2, 푐1) 푔 푓 ′ ℎ ′ ℎ ′ 푐2 −→푐1 ↦ 푐2 −→푐2 −→푐1 −→푐1 푔 푓 푔 ′ op ′ ′ op Because we have 푐2 ←−푐2 in C , we also have (푐1 −→푐1, 푐2 ←−푐2) in C × C . op capC ∶ C × C ⇸ ퟏ ′ ′ �∗, (푐1, 푐2)� ⟼ C(푐2, 푐1) 푓 푔 ′ ′ ′ ′ �id∗, �(푐1 −→푐1, 푐2 ←−푐2)�� ⟼ C(푐2, 푐1) → C(푐2, 푐1) 푔 푓 ′ ℎ ′ ℎ ′ 푐2 −→푐1 ↦ 푐2 −→푐2 −→푐1 −→푐1

16 To see that the snake equations hold, observe that (∗,푐) �(cap ⊗ C(−, =)) ⋄ (C(−, =) ⊗ cup )� C C (푐′,∗) ≅ { Definition 6 }

(푐 ,푐 ,푐 ) (∗,푐) (푐1,(푐2,푐3)) ∫ 1 2 3 �(cap ⊗ C(−, =))� × �(C(−, =) ⊗ cup )� C C ′ ((푐1,푐2),푐3) (푐 ,∗) ≅ { Definition 20 } ∗ (푐 ,푐 ) (푐1,푐2,푐3) ′ 2 3 ∫ ��capC� × C(푐, 푐3)� × �C(푐1, 푐 ) × �cupC� � (푐1,푐2) ∗ ≅ { Definition 22 } (푐1,푐2,푐3) ′ ∫ (C(푐2, 푐1) × C(푐, 푐3)) × (C(푐1, 푐 ) × C(푐3, 푐2)) ≅ { Proposition 2 } C(푐, 푐′). The other equation is completely similar.

17 3. Characterising traced monoidal categories internal to Prof

In this section, we introduce the definitions of traced monoidal category and diagrammatic calculus simultaneously. Traced categories are often used to give a categorical notion for feedback, or recursion, which is strongly hinted at from their graphical representation. To begin with, our diagrams are simple traditional string diagrams: morphisms are represented by vertices, with wires denoting their inputs and outputs. Ordinary morphism composition is given by stacking morphisms in sequence and connecting their wires, and tensoring is represented by stacking morphisms horizontally in parallel. The expression represented by a diagram is invariant under (planar) isotopy of wires, which we will use extensively as a proof technique in our extended calculi. The only other notable feature is that of loops to denote tracing. This graphical calculus isthe same as the one found in Selinger (2009, sec 5.1), but rotated by 90°.

3.1. Traced monoidal categories

푓 A (right) traced monoidal category C is one in which for every morphism 퐴 ⊗ 푋 −→퐵 ⊗ 푋, there exists a morphism 푋 Tr퐴,퐵 퐴 −−−−→푌 called its trace (along 푋). Tracing is subject to the following conditions14: 푓 ℎ 푔 • for every 퐴 −→퐴′, 퐴′ ⊗ 푋 −→퐵 ⊗ 푋, and 퐵 −→퐵′, 푋 푋 Tr퐴,퐵′(푔 ⊗ id푋 ∘ ℎ ∘ 푓 ⊗ id푋) = 푔 ∘ Tr퐴′,퐵(ℎ) ∘ 푓 (NAT)

푓 푓

ℎ = ℎ ,

푔 푔

푝 ℎ • for every 푋 −→푋′, and 퐴 ⊗ 푋′ −→퐵 ⊗ 푋, 푋′ 푋 Tr퐴,퐵(id퐵 ⊗ 푝 ∘ ℎ) = Tr퐴,퐵(ℎ ∘ id퐴 ⊗ 푝) (SLI)

ℎ = ℎ ,

푓 • for every 퐴 ⊗ 퐼 −→퐵 ⊗ 퐼, 퐼 −1 Tr 퐴,퐵(푓) = 휌퐵 ∘ 푓 ∘ 휌퐴 (VAN-퐼)

푓 = 푓 ,

푓 • for every 퐴 ⊗ 푋 ⊗ 푌 −→퐵 ⊗ 푋 ⊗ 푌, 푋 푌 푋⊗푌 Tr퐴,퐵(Tr퐴⊗푋,퐵⊗푋(푓)) = Tr퐴,퐵 (푓) (VAN-⊗)

푓 = 푓 ,

푔 푓 • for every 퐶 −→퐷 and 퐴 ⊗ 푋 −→퐵 ⊗ 푋, 푋 푋 푔 ⊗ Tr퐴,퐵(푓) = Tr퐶⊗퐴,퐷⊗퐵(푔 ⊗ 푓) (SUP)

푔 푓 = 푔 푓 .

14. These diagrams go top-down, and we use dashed boxes to indicate which part of the diagram is being traced when ambiguous.

18 In the case where C is a symmetric monoidal structure, we also additionally require that

휎푋,푋 • for the symmetry natural isomorphism 푋 ⊗ 푋 −−−−→푋 ⊗ 푋, 푋 Tr푋,푋(휎푋,푋) = id푋 (YANK)

= .

In the case where ⊗ is not strictly associative — that is, (퐴 ⊗ 퐵) ⊗ 퐶 is a distinct but isomorphic object to 퐴 ⊗ (퐵 ⊗ 퐶) — we need to be more careful regarding Equations (VAN-⊗) and (SUP), and instead we have 푓 1) for every (퐴 ⊗ 푋) ⊗ 푌 −→(퐵 ⊗ 푋) ⊗ 푌,

푋 푌 푋⊗푌 −1 Tr푋,푌(Tr퐴⊗푋,퐵⊗푋(푓)) = Tr퐴,퐵 (훼퐵,푋,푌 ∘ 푓 ∘ 훼퐴,푋,푌), (VAN-⊗-weak) 푔 푓 2) for every 퐶 −→퐷 and 퐴 ⊗ 푋 −→퐵 ⊗ 푋,

푋 푋 −1 푔 ⊗ Tr퐴,퐵(푓) = Tr퐶⊗퐴,퐷⊗퐵(훼퐷,퐵,푋 ∘ 푔 ⊗ 푓 ∘ 훼퐶,퐴,푋). (SUP-weak) Our diagrams are unchanged, as the associators are absorbed into the geometry. It is also clear that in a strict setting, the associators degenerate to identity morphisms, and this more general formulation coincides with the previous. In general, we will not assume ⊗ strictness.

3.2. A 2-morphism for tracing

Consider a natural transformation between profunctors

푋 Tr � C(− ⊗ 푋, = ⊗푋) =⇒ C(−, =).

If 퐴 and 퐵 are objects of C, the components of the natural transformation are of the form

푋 Tr퐴,퐵 � C(퐴 ⊗ 푋, 퐵 ⊗ 푋) −−−−→ C(퐴, 퐵),

ℎ which can informally be understood as performing the trace of some morphism 퐴 ⊗ 푋 −→퐵 ⊗ 푋 for some 푋, yielding 푋 Tr퐴,퐵(ℎ) 퐴 −−−−−−→퐵15. 푓 푔 Fix morphisms 퐴 −→퐴′ and 퐵 −→퐵′ of C. This canonically determines a natural transformation

C(푓⊗−,푔⊗=) C(퐴′ ⊗ −, 퐵⊗ =) ======⇒ C(퐴 ⊗ −, 퐵′⊗ =) component-wise by C(푓⊗−,푔⊗=) 푋,푌 C(퐴′ ⊗ 푋, 퐵 ⊗ 푌) −−−−−−−−−−−−−→ C(퐴 ⊗ 푋, 퐵′ ⊗ 푌)

ℎ 푓⊗id푋 ℎ 푔⊗id푌 퐴′ ⊗ 푋 −→퐵 ⊗ 푌 ⟼ 퐴 ⊗ 푋 −−−−−→퐴′ ⊗ 푋 −→퐵 ⊗ 푌 −−−−−→퐵′ ⊗ 푌. We write C(푓 ⊗ 푋, 푔 ⊗ 푌) for C(푓 ⊗ −, 푔⊗ =) . 푋,푌 Lemma 6. C(푓 ⊗ −, 푔⊗ =) is a natural transformation. 푝 푞 Proof. Let 푋 −→푋′ and 푌 −→푌′ be morphisms of C, giving a corresponding morphism of Cop × C:

(푝,푞) (푋′, 푌) −−−→(푋, 푌′). Every morphism of Cop × C is of this form. It suffices to show that

C(퐴′⊗푝,퐵⊗푞) C(퐴′ ⊗ 푋′, 퐵 ⊗ 푌) C(퐴′ ⊗ 푋, 퐵 ⊗ 푌′)

C(푓⊗푋′,푔⊗푌) C(푓⊗푋,푔⊗푌′)

C(퐴 ⊗ 푋′, 퐵′ ⊗ 푌) C(퐴 ⊗ 푋, 퐵′ ⊗ 푌′) C(퐴⊗푝,퐵′⊗푞)

푋 15. Note that this is not quite true, as ℎ ∈ C(퐴 ⊗ 푋, 퐵 ⊗ 푋) which is distinct to the set ∫ C(퐴 ⊗ 푋, 퐵 ⊗ 푋), so the types do not quite match up.

19 commutes. By expanding the definitions, it becomes apparent that both composites are the function (푓⊗푝∘−,=∘푔⊗푞) C(퐴′ ⊗ 푋′, 퐵 ⊗ 푌) −−−−−−−−−−−−→ C(퐴 ⊗ 푋, 퐵′ ⊗ 푌′), ℎ 푓⊗푝 ℎ 푔⊗푞 퐴′ ⊗ 푋′ −→퐵 ⊗ 푌 �⎯⎯⎯⎯⎯⎯⎯⎯� 퐴 ⊗ 푋 −−−→퐴′ ⊗ 푋′ −→퐵 ⊗ 푌 −−−→퐵′ ⊗ 푌′.

The corresponding naturality square for Tr퐴,퐵 is given by

푋 푋 ∫ C(푓⊗푋,푔⊗푋) 푋 ∫ C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) ∫ C(퐴 ⊗ 푋, 퐵′ ⊗ 푋)

(Tr−-nat) Tr퐴′,퐵 Tr퐴,퐵′

C(푓,푔) C(퐴′, 퐵) C(퐴, 퐵′) 푔∘−∘푓 푋 푋 where ∫ C(푓 ⊗ 푋, 푔 ⊗ 푋) is the image of C(푓 ⊗ −, 푔⊗ =) under the coend functor ∫ −(푋, 푋), as per Proposition 1. For the sake of clarity, we now elaborate the universal property of coend for the functor C(퐴′ ⊗ −, 퐵⊗ =). Such a functor is given by C(퐴′ ⊗ −, 퐵⊗ =) ∶ Cop × C ⟶ Set (푋, 푌) ⟼ C(퐴′ ⊗ 푋, 퐵 ⊗ 푌) 푝 푞 (푋′ −→푋, 푌 −→푌′) ⟼ C(퐴′ ⊗ 푋′, 퐵 ⊗ 푌) ⟶ C(퐴′ ⊗ 푋, 퐵 ⊗ 푌′)

푟 id퐴′⊗푝 푟 id퐵⊗푞 퐴′ ⊗ 푋′ −→퐵 ⊗ 푌 ⟼ 퐴′ ⊗ 푋 −−−−−−→퐴′ ⊗ 푋′ −→퐵 ⊗ 푌 −−−−−→퐵 ⊗ 푌′. 퐹 푋 Following the template of Equation (1), for any profunctor C ⇸ C, there exists a universal arrow ∫ C(퐴′ ⊗ 푋, 퐵 ⊗ 푋 푋)⇢ ∫ 퐹(푋, 푋) which uniquely makes the diagram

id ⊗푝∘− ′ ′ 퐵 ′ ′ ′ C(퐴 ⊗ 푋 , 퐵 ⊗ 푋) ′ C(퐴 ⊗ 푋 , 퐵 ⊗ 푋 ) C(퐴 ⊗id푋′,퐵⊗푝) C(퐴′⊗−,퐵⊗=) −∘id ′⊗푝 C ′ 휇 ′ 퐴 (퐴 ⊗푝,퐵⊗id푋) 푋 퐹 휇푋′∘훼(푋′,푋′) 푋 C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) ∫ C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) C(퐴′⊗−,퐵⊗=) 휇푋 푋 �∫ −(푋,푋)�(훼)

푋 ∫ 퐹(푋, 푋)

퐹 휇푋∘훼(푋,푋)

푝 훼 commute for any C-morphism 푋 −→푋′ and natural transformation C(퐴′ ⊗ −, 퐵⊗ =) =⇒퐹. Furthermore, by Proposition 1, 푋 we know that this universal arrow is the image of 훼 under the coend functor ∫ −(푋, 푋), which we denote with 푋 �∫ −(푋, 푋)� (훼). We will make use of two specialisations of this diagram in the following section, by choosing parameters 퐹, 푝, and 훼. ′ First, if we choose 훼 = idC(퐴′⊗−,퐵⊗=), thereby letting 퐹 = C(퐴 ⊗ −, 퐵⊗ =), then the bottom right of this diagram trivialises, leaving id ⊗푝∘− ′ ′ 퐵 ′ ′ ′ C(퐴 ⊗ 푋 , 퐵 ⊗ 푋) ′ C(퐴 ⊗ 푋 , 퐵 ⊗ 푋 ) C(퐴 ⊗id푋′,퐵⊗푝) ′ ′ C(퐴 ⊗−,퐵⊗=) −∘id퐴′⊗푝 C(퐴 ⊗푝,퐵⊗id푋) 휇푋′ (2)

푋 C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) ∫ C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) C(퐴′⊗−,퐵⊗=) 휇푋 ′ which is exactly what it means for 휇C(퐴 ⊗−,퐵⊗=) to be a dinatural transformation (Equation (cow-din)). ′ If we instead choose 푝 = id푋, thereby letting 푋 = 푋 , the top left of this diagram trivialises, leaving

C(퐴′⊗−,퐵⊗=) 휇 푋 C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) 푋 ∫ C(퐴′ ⊗ 푋, 퐵 ⊗ 푋)

푋 훼(푋,푋) �∫ −(푋,푋)�(훼)

푋 ∫ 퐹(푋, 푋) 퐹 퐹(푋, 푋) 휇푋

20 Subsequently, by choosing 퐹 = C(퐴 ⊗ −, 퐵′⊗ =) and defining 훼 = C(푓 ⊗ −, 푔⊗ =), this becomes

C(퐴′⊗−,퐵⊗=) 휇 푋 C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) 푋 ∫ C(퐴′ ⊗ 푋, 퐵 ⊗ 푋)

푋 (3) 푔⊗id푋∘−∘푓⊗id푋 C(푓⊗푋,푔⊗푋) ∫ C(푓⊗푋,푔⊗푋)

푋 C(퐴 ⊗ 푋, 퐵′ ⊗ 푋) ∫ C(퐴 ⊗ 푋, 퐵′ ⊗ 푋) C(퐴⊗−,퐵′⊗=) 휇푋

3.2.1. Sliding and naturality hold automatically. Now, we define:

푋 C(퐴⊗−,퐵⊗=) − Tr퐴,퐵 ≔ Tr퐴,퐵 ∘휇푋 , (Tr=-def)

C(퐴⊗−,퐵⊗=) 휇 푋 with C(퐴 ⊗ −, 퐵⊗ =) ⇒⤑ Δ 푋 given by the universal cowedge of the coend ∫ C(퐴 ⊗ 푋, 퐵 ⊗ 푋). ∫ C(퐴⊗푋,퐵⊗푋) Proposition 5. Equation (NAT) holds automatically.

Proof. Derive:

푋 Tr퐴,퐵′(푔 ⊗ id푋 ∘ ℎ ∘ 푓 ⊗ id푋) − = { Equation (Tr=-def) } C(퐴⊗−,퐵′⊗=) �Tr퐴,퐵′ ∘휇푋 � (푔 ⊗ id푋 ∘ ℎ ∘ 푓 ⊗ id푋)

= { 푔 ⊗ id푋 ∘ ℎ ∘ 푓 ⊗ id푋 = �C(푓 ⊗ 푋, 푔 ⊗ 푋)� (ℎ) } C(퐴⊗−,퐵′⊗=) �Tr퐴,퐵′ ∘휇푋 ∘ C(푓 ⊗ 푋, 푔 ⊗ 푋)� (ℎ) = { Equation (3) } 푋 C(퐴′⊗−,퐵⊗=) �Tr퐴,퐵′ ∘ ∫ C(푓 ⊗ 푋, 푔 ⊗ 푋) ∘ 휇푋 � (ℎ)

= { Equation (Tr−-nat) } C(퐴′⊗−,퐵⊗=) �C(푓, 푔) ∘ Tr퐴′,퐵 ∘휇푋 � (ℎ) − = { Equation (Tr=-def) } 푋 �C(푓, 푔) ∘ Tr퐴′,퐵� (ℎ) 푋 푋 = { C(푓, 푔) �Tr퐴′,퐵(ℎ)� = 푔 ∘ Tr퐴′,퐵(ℎ) ∘ 푓 } 푋 푔 ∘ Tr퐴′,퐵(ℎ) ∘ 푓.

Equation (NAT) is often referred to as ‘naturality of the trace’, and when we write this out in pasting diagrams we see why this is the case:

푔⊗id ∘−∘푓⊗id C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) 푋 푋C(퐴 ⊗ 푋, 퐵′ ⊗ 푋) C(푓⊗푋,푔⊗푋)

푋 푋 Tr퐴′,퐵 Tr퐴,퐵′ C(푓,푔) C(퐴′, 퐵) C(퐴, 퐵′) 푔∘−∘푓

Tr푋 which is exactly what a naturality square for C(− ⊗ 푋, = ⊗푋) ==⇒ C(−, =) would look like — that is, this condition stipulates that for all 푋,

C(−⊗푋,=⊗푋)

Cop × C Set Tr푋 C(−,=) is a natural transformation.

− Proof. As an alternative way to see that this holds, we can expand this diagram using Equation (Tr=-def):

21 푔⊗id ∘−∘푓⊗id C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) 푋 푋 C(퐴 ⊗ 푋, 퐵′ ⊗ 푋) C(푓⊗푋,푔⊗푋)

C(퐴′⊗−,퐵⊗=) C(퐴⊗−,퐵′⊗=) 휇푋 (3) 휇푋

푋 푋 ∫ C(푓⊗푋,푔⊗푋) 푋 ∫ C(퐴′ ⊗ 푋, 퐵 ⊗ 푋) ∫ C(퐴 ⊗ 푋, 퐵′ ⊗ 푋)

Tr ′ Tr ′ 퐴 ,퐵 (Tr−-nat) 퐴,퐵

C(푓,푔) C(퐴′, 퐵) C(퐴, 퐵′) 푔∘−∘푓 which commutes because its inner squares commute.

Proposition 6. Equation (SLI) holds automatically.

Proof. Derive:

푋′ Tr퐴,퐵(id퐵 ⊗ 푝 ∘ ℎ) − = { Equation (Tr=-def) } 푋′ �Tr퐴,퐵 ∘휇 � (id퐵 ⊗ 푝 ∘ ℎ)

= { id퐵 ⊗ 푝 ∘ ℎ = �C(퐴 ⊗ id푋′, 퐵 ⊗ 푝)� (ℎ) } 푋′ �Tr퐴,퐵 ∘휇 ∘ C(퐴 ⊗ id푋′, 퐵 ⊗ 푝)� (ℎ) = { Equation (2) } 푋 �Tr퐴,퐵 ∘휇 ∘ C(퐴 ⊗ 푝, 퐵 ⊗ id푋)� (ℎ)

= { �C(퐴 ⊗ 푝, 퐵 ⊗ id푋)� (ℎ) = ℎ ∘ id퐴 ⊗ 푝 } 푋 �Tr퐴,퐵 ∘휇 � (ℎ ∘ id퐴 ⊗ 푝) − = { Equation (Tr=-def) } 푋 Tr퐴,퐵(ℎ ∘ id퐴 ⊗ 푝).

Equation (SLI) is sometimes called the ‘dinaturality of the trace’; similarly to before, this stipulates a certain dinaturality condition — namely, that for all 퐴 and 퐵,

C(퐴⊗−,퐵⊗=)

Cop × C Set Tr퐴,퐵

ΔC(퐴,퐵) is a dinatural transformation. The dinaturality condition in this case is, following Equation (cow-din),

C(퐴 ⊗ 푋′, 퐵 ⊗ 푋)

−∘id퐴⊗푝 id퐵⊗푝∘−

C(퐴⊗푝,퐵⊗id푋) C(퐴⊗id푋′,퐵⊗푝) C(퐴 ⊗ 푋, 퐵 ⊗ 푋) C(퐴 ⊗ 푋′, 퐵 ⊗ 푋′)

Tr Tr 퐴,퐵푋 퐴,퐵푋′ C(퐴, 퐵)

Proof. By identifying Tr푋 with Tr , we can rewrite this into 퐴,퐵 퐴,퐵푋

22 C(퐴 ⊗ 푋′, 퐵 ⊗ 푋)

−∘id퐴⊗푝 id퐵⊗푝∘−

C(퐴⊗푝,퐵⊗id푋) C(퐴⊗id푋′,퐵⊗푝) C(퐴 ⊗ 푋, 퐵 ⊗ 푋) (2) C(퐴 ⊗ 푋′, 퐵 ⊗ 푋′)

C(퐴⊗−,퐵⊗=) C(퐴⊗−,퐵⊗=) 휇푋 휇푋′ 푋 ∫ C(퐴 ⊗ 푋, 퐵 ⊗ 푋)

Tr퐴,퐵

C(퐴, 퐵) and subsequently verify that it commutes by the dinaturality of 휇C(퐴⊗−,퐵⊗=).

3.3. Presentations of higher algebraic structure and the diagrammatic calculus

Finally we have reached a point where we can begin to develop more exciting string diagrams, and here we introduce the diagrammatic calculus of Prof. In the style of Dunn and Vicary (2016), we will not be very formal about the foundations of the graphical calculus. By this, we mean that a algebraic objects in a 2-category can be informally understood in terms of a presentation given by the following data:

• 0-morphisms (i.e. objects) determine the colours of wires. In our graphical calculus for Prof, objects are categories, and we only really care about 2 of them — C and its dual category Cop — thus, we represent the colours by adding directionality to the wires. Upwards represents a wire of type C, and downwards a wire of type Cop. • 1-morphisms represent 2-dimensional tiles of 푚 inputs, denoted by wires coming in to the tile from its bottom boundary, and 푛 outputs, denoted by wires going up and out. Composition of 1-morphisms is given by tiling: vertical tiling is ordinary composition of 1-morphisms, and horizontal tiling corresponds to tensoring. In Prof, 1-morphisms are profunctors, and we represent the identity profunctor by a tile consisting of a vertical wire with no nodes. • 2-morphisms represent local tile transformations, which allow us to rewrite parts of a composite 1-morphism into another with the same boundaries. Composite 2-morphisms then correspond to a sequence of rewrites in this fashion. In Prof, these are natural transformations, and the identity natural transformation corresponds to the rewrite which does nothing. • Equational structure, which specifies a pair of composite 2-morphisms are equal. In our diagrammatic calculus, this corresponds to an identification between two sequences of rewrites. • In , because we are working in the context of a compact closed monoidal 2-category, some structure is ‘built-in’ to our graphical calculus:

symmetry for all objects 푋 and 푌, we have crossing 1-morphisms:

휎푋,푌 푋 ⊗ 푌 −−−→ 푌 ⊗ 푋 ≔

such that

duality for any object 푋, represented by , an object 푋∗ (the dual of 푋) represented by , we have cup and cap 1-morphisms

cup푋 퐼 −−−−→푋∗ ⊗ 푋 ≔

cap푋 푋 ⊗ 푋∗ −−−−→퐼 ≔

which satisfy duality in the form of snake equations:

≅ , and ≅ . ()

23 With the symmetry, we also define

and derive more snake equations

≅ , and ≅ .

That this duality is coherent is witnessed by the swallowtail equations:

≅ ≅ , and ≅ ≅ . (曆)

More formally, such a presentation gives the generating data for finitely presented weak 2-categories. We can use such a presentation to study structures inside of a 2-category — for instance, ∗-autonomous categories correspond exactly to objects of Prof which can be equipped with a right-adjoint Frobenius pseudomonoid structure (Dunn and Vicary 2016), so we can use a suitable presentation to study ∗-autonomous categories by intuitively identifying a fragment of Prof in which the diagrammatic calculus respects the presentation. For an alternative and more rigorous take, this could be seen as considering the free 2-category generated by the presentation and representations into Prof via monoidal functors and cofibrant replacement. By a result known as the cofibrancy theorem, such functors are canonically determined by their actions on the presentation data, subject to its equational structure. Therefore, we are able to apply coherence results to such a free 2-category and functors out of it, and in particular this implies that the diagrammatic calculus is well-defined and valid. For more details, see Schommer-Pries (2011).

Definition 23 (Pseudomonoid presentation M). The presentation of a pseudomonoid M = ( , , ) is given by

16 • a generating 0-morphism ,

• generating 1-morphisms:

• invertible generating 2-morphisms expressing associativity and unitality respectively:

훼 휆 휌−1 ⇒∼ ⇒∼ ⇒∼ ⇐ ⇐ ⇐ 훼−1 휆−1 휌

16. One should imagine this as a point with innate upwards direction, such that the identity 1-morphism on this generator is given by ‘stretching’ the point into a vertical wire with upwards orientation.

24 17 • identifications specifying coherence : (pentagon and triangle equations)

α

α α

α α

α

ρ λ

A representation of this presentation in Prof is equivalent to a monoid in Prof, which corresponds precisely to the promonoidal categories. Informally, one can think of this as a monoidal category but substituting ‘functor’ for ‘profunctor’ in its definition — in an appropriate sense, profunctors generalise functors thus a promonoidal category can be thought of as a ‘nearly’ monoidal category. To close the gap on ‘nearly’, we need each profunctor to be equivalent to a functor, and this happens exactly when each profunctor is a left adjoint. With respect to our presentation, this means specifying that each generating 1-morphism has right-adjoints, which we freely add. Definition 24 (Right-adjoint pseudomonoid presentation M⊣). The presentation of a right-adjoint pseudomonoid M⊣ is given by the data of a pseudomonoid presentation, extended with the following generators

• additional generating 1-morphisms:

• invertible generating 2-morphisms expressing coassociativity and counitality, and additional (non-invertible) generating 2-morphisms:

휂 휀 ⇒ ⇒

휑 휓 ⇒ ⇒

17. The dashed boxes are used to show which parts are being rewritten for illustratory purposes, and are not a formal part of the diagrammatic calculus.

25 • identifications specifying coherence, and additional equations specifying ⊣ and ⊣ :

φ

η ε ψ

η ε ψ φ

Note that the process of freely adding right adjoints to the generating 1-morphisms in this sense is entirely procedural. Definition 25 (Right-adjoint extension). Given a presentation P, we define P⊣ to be the presentation obtained by freely adding right adjoints for every generating 1-morphism of P. 푓 푓⊣ For each 1-morphism 푋 −→푌, we freely add a right adjoint 푌 −−→푋, along with unit and counit 2-morphisms

푋 푋 푋 푓⊣ 푓 휂 and 휀 푓 푓⊣ 푌 푌 푌, respectively, such that 푋 푋 푋 푋 푓 휂 ⊣ 푓 id푓 푓 = 푓 휀 푓 푌 푌 푌 푌, and 푌 푌 푋 푋 푓⊣ ⊣ ⊣ 휂 푓 id푓 푓 = 휀 푓 푓⊣ 푋 푋 푌 푌.

Note that 푋 and 푌 may be tensor products, which graphically are represented as multiple input and output wires respectively. This notion directly generalises adjunctions between two functors in ordinary (1-)category theory. Graphically, we depict this entire extension by vertically flipping a 1-morphism, inverting the colour of its node, and then reversing the direction of all the wires. Then we add a unit and counit for each pairing of 1-morphism and freely-added right adjoint, along with triangle equations. Another important construction that we will frequently use is adjoint mate 2-morphisms.

26 Definition 26 (Adjoint mate). Suppose that we have 1-morphisms and adjunctions

퐿 ⊣ 푅 , and 퐿′ ⊣ 푅′ , and also a 2-morphism 훽 퐿 =⇒ 퐿′ .

Then we derive its adjoint mate 훽∗ as follows:

푅 푅 훽 ′ ∗ unit counit 훽 ≔ 푅′ ==⇒ 퐿 =⇒ 퐿′ =====⇒ 푅 .

푅′ 푅′

Seeing as traced monoidal categories are a subclass of monoidal categories, it makes sense to ask whether we can describe them as a representation of some presentation in Prof, which we explore in the next section.

3.4. The internal string diagram construction

⊗ A monoidal category is a category C equipped with a functor C × C −→ C — the tensor — subject to the existence of coherent natural isomorphisms for the associator and unitors. Such a functor is equivalent to a profunctor which has a (−)∗ right adjoint in Prof, and this is explicitly given by the Cat −−−→ Prof embedding. That is, the profunctor

⊗∗ C × C ⇸ C. This profunctor is a functor op ⊗∗ ∶ C × (C × C) ⟶ Set (푋, (푌, 푍)) ⟼ C(푋, 푌 ⊗ 푍) 푓 푔 ℎ (푋′ ←−푋, (푌 −→푌′, 푍 −→푍′)) ⟼ C(푋′, 푌 ⊗ 푍) → C(푋, 푌′ ⊗ 푍′) 푝 푓 푝 푔⊗ℎ 푋′ −→푌 ⊗ 푍 ↦ 푋 −→푋′ −→푌 ⊗ 푍 −−−→푌′ ⊗ 푍′. Observe that the sets in the image of this profunctor are all Hom-sets of C, and diagrammatically we can represent the Hom-set C(푋, 푌 ⊗ 푍) as 푋

푌 푍 As a monoidal category, C has its own graphical calculus, where wires represent objects of C and tiles represent morphisms 푓 of C; as such, any C-morphism 푋 −→푌 ⊗ 푍 ∈ C(푋, 푌 ⊗ 푍) should correspond to a tile with one wire labelled 푋 at one boundary, and two wires labelled 푌 and 푍 at the other. Drawing it like so 푋

푌 푍 motivates internal string diagrams. The key idea is that the profunctors in our graphical calculus represent Hom-sets, determined by C-objects at their boundaries, and furthermore we can access the diagrammatic calculus of C by drawing it internal to the diagrammatic representation of the Hom-set after inflating the profunctors into suitable tubes: ⎛ ⎞ ⎜ ⎟ ⎜ 푋 ⎟ 푋 ⎜ 푋 ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ 푓 ∈ ⎟ ⤳ 푓 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎝⎜ 푌 푍 ⎠⎟ 푌 푍 푌 푍

27 We then imagine the tubes of profunctors as a space in the sense of the intuitive embedding into ℝ3, where the C-morphisms inhabit the volume; observe that the diagrammatic calculus of profunctors is drawn bottom-up, while that of C is in the opposite direction: top-down. Next, we proceed to give a more formal description of this construction, which is a minor modification of the same construction given in Bartlett et al. (2015, sec. 4)18. 푍 Let P be a right-adjoint presentation. Given a representation 퐹(P) −→ Cat, where 퐹(P) is the category freely generated by P, for each adjunction between the generating 1-morphisms of P, 퐺 ⊣ 퐺⊣, we have an adjunction in ⊣ ⊣ ∗ Cat: 푍(퐺) ⊣ 푍(퐺 ), and also in Prof: (푍(퐺)) ⊣ �푍(퐺 )� ; but because for all functors 퐹, 퐹∗ ⊣ 퐹 , so we also have an ∗ ∗ ( ) ( )∗ adjunction 푍(퐺) ∗ ⊣ 푍(퐺) in Prof. As adjoints are unique, this induces a canonical isomorphism ∼ 휁∶ �푍(퐺⊣)� → (푍(퐺))∗ . ∗ We can extend 휁 to a natural transformation by letting it be the identity on left-adjoint generators, which gives a new 푍̃ representation 퐹(P) −→ Prof: 퐹(P) 푍 Cat

휁 (−)∗ 푍̃ Prof ̃ 푍 is built to pick out the image of the covariant (−)∗ embedding of 푍(퐺) in Prof for left-adjoint generators 퐺, and the image of the contravariant (−)∗ embedding of 푍(퐺) in Prof where 퐺 ⊣ 퐺⊣ for each right-adjoint generator 퐺⊣; this ∗ is in order to utilise the explicitly computable adjunction 푍(퐺)∗ ⊣ 푍(퐺) in Prof, rather than the adjunction induced directly by embedding 퐺 ⊣ 퐺⊣. One can think of 푍̃ as ‘inflating’ the generating 1-morphisms of a presentation, and for 퐹(M⊣) we define ̃ ̃ ̃ ∗ ̃ ∗ ≔ 푍( ) = 푍( )∗, ≔ 푍( ) = 푍( )∗, ≔ 푍( ) = 푍( ) , ≔ 푍( ) = 푍( ) . This notation extends to any composite 1-morphisms built from these generators, in the sense that in the imageof 푍̃ (which is a weak 2-functor), we decompose into components, inflate, and then recompose in Prof. For example, we have 푍̃ � � ≅ 푍̃ � � ⋄ 푍̃ � �

≅ �푍(̃ ) ⊗ 푍(̃ )� ⋄ �푍(̃ ) ⊗ 푍(̃ )� ≅ ( ⊗ ) ⋄ ( ⊗ ) , which we elect to draw like so:

Following on from this, we must consider how internal morphisms are affected. Consider two such diagrams: 푋 푋

푌 푌 Focusing on the outer tubes, if we label the internal boundary with 푍, then consistent with our definitions, we have that both tubes represent the Hom-set 푍 � C(푋, 푍) × C(푍, 푌) ≅ �� C(푋, 푍) × C(푍, 푌)� / ∼ . 푍∈C As such, the C-morphisms which live in the interior are elements of that set, which are equivalence classes of pairs of morphisms of C(푋, 푍) and C(푍, 푌) for some C-object 푍. Now suppose that 푓 is a morphism 푋 → 푌; then the internal 푓 id푌 id푋 푓 morphism of the left diagram would represent [(푋 −→푌, 푌 −−−→푌)], and the right [(푋 −−−→푋, 푋 −→푌)]; but

푓 id푌 id푋 푓 id푌 id푋 푓 id푌 id푋 푓 (푋 −→푌, 푌 −−−→푌) = (푋 −−−→푋 −→푌, 푌 −−−→푌) ∼ (푋 −−−→푋, 푋 −→푌 −−−→푌) = (푋 −−−→푋, 푋 −→푌),

18. Essentially, Bartlett et al. (2015) gives the Vect-enriched version.

28 푓 id푌 id푋 푓 so [(푋 −→푌, 푌 −−−→푌)] = [(푋 −−−→푋, 푋 −→푌)], and we really do have an identification

푋 푋

푓 ≅

푌 푌 in the internal string diagram calculus. In fact, the congruence 퐸푞푢푎푡푖표푛 (∼) ensures free movement of internal morphisms between interior boundaries is permissible, and we can still utilise the equational structure of the diagrammatic calculus of C internally also. Thus, the interior boundaries can be freely omitted if we so choose; for clarity, we will draw them.

훽 3.4.1. Actions of generating 2-morphisms. For any generating 2-morphism 퐺 =⇒퐺′, as 푍(퐺)̃ and 푍(퐺̃ ′) are Hom-sets, we can interpret 푍(훽)̃ as a function on function spaces, which will map a C-string diagram internal to 푍(퐺)̃ to one internal to 푍(퐺̃ ′). This map is fully determined by 휁:

푋 푍(훽)̃ ̃ 푋 푌 ̃ ′ 푋 푍(퐺)푌 푍(퐺 )푌

휁퐺 ∼ ∼ 휁퐺′

푍(퐺) 푋 푍(퐺′) 푋 ∗푌 푍(훽) 푋 ∗푌 ∗푌 We will illustrate this for the case where 퐺 and 퐺′ are composed of left-adjoint generating 1-morphisms (the ̃ ̃ ′ ′ ′ C other cases are similar), i.e. 푍(퐺) = 푍(퐺)∗ and 푍(퐺 ) = 푍(퐺 )∗. Let 푍(퐺) and 푍(퐺 ) be endofunctors on ; then by Definition 8, 푍(퐺) 푋 = C(푋, 푍(퐺)(푌)) and 푍(퐺′) 푋 = C(푋, 푍(퐺′)(푌)), and the map 푍(훽)̃ is just the same as 푍(훽) 푋 given ∗푌 ∗푌 ∗푌 by Definition 10:

푍(훽) 푋 ∗푌 C(푋, 푍(퐺)(푌)) −−−−−−−−−−→ C(푋, 푍(퐺′)(푌)) 푍(훽) 푓 푓 푌 푋 −→푍(퐺)(푌) �⎯⎯⎯⎯⎯⎯⎯� 푋 −→푍(퐺)(푌) −−−−→푍(퐺′)(푌). This precisely tells us that the generating 2-morphisms of M⊣ act in the following way: for 훼 퐴 퐴

푓 푓 퐴 ̃ 푔 푍(훼)퐵,퐶,퐷 �⎯⎯⎯⎯⎯⎯⎯� ℎ

푔 ℎ

퐵 퐶 퐷 퐵 퐶 퐷 or equivalently ̃ 퐴 푓 푔⊗ℎ 푍(훼)퐵,퐶,퐷 푓 푔⊗ℎ 훼퐵,퐶,퐷 퐴 −→푋 ⊗ 푌 −−−→(퐵 ⊗ 퐶) ⊗ 퐷 �⎯⎯⎯⎯⎯⎯⎯� 퐴 −→푋 ⊗ 푌 −−−→(퐵 ⊗ 퐶) ⊗ 퐷 −−−−−→퐵 ⊗ (퐶 ⊗ 퐷), for 휆 퐴 퐴

퐴 푓 ̃ 푓 푍(휆)퐵 �⎯⎯⎯⎯⎯⎯⎯� 푔 푔 ℎ ℎ

퐵 퐵 or equivalently ̃ 퐴 푓 푔⊗ℎ 푍(휆) 푓 푔⊗ℎ 휆퐵 퐴 −→푋 ⊗ 푌 −−−→퐼 ⊗ 퐵 �⎯⎯⎯⎯⎯⎯⎯�퐵 퐴 −→푋 ⊗ 푌 −−−→퐼 ⊗ 퐵 −−→퐵,

29 for 휌

퐴 퐴

퐴 푓 푍(휌)̃ 푓 퐵 �⎯⎯⎯⎯⎯⎯⎯� 푔 푔 ℎ ℎ

퐵 퐵 or equivalently

̃ 퐴 푓 ℎ⊗푔 푍(휌) 푓 ℎ⊗푔 휌퐵 퐴 −→푋 ⊗ 푌 −−−→퐵 ⊗ 퐼 �⎯⎯⎯⎯⎯⎯⎯�퐵 퐴 −→푋 ⊗ 푌 −−−→퐵 ⊗ 퐼 −−→퐵.

Then, by construction of 휁, the actions of the units and counits obtained from freely adding right adjoints is obtained from Theorem 1: for 휑

푍(휑)̃ �⎯⎯⎯⎯⎯⎯⎯� for 휓

퐴 퐴

퐴 푓 푍(휓)̃ 푓 �⎯⎯⎯⎯⎯⎯⎯�퐵 푔 푔

퐵 퐵 or equivalently

퐴 푓 푔 푍(휓)̃ 푓 푔 (퐴 −→퐼, 퐼 −→퐵) �⎯⎯⎯⎯⎯⎯⎯�퐵 퐴 −→퐼 −→퐵, for 휂

퐴 퐵 퐴 퐵

퐴,퐵 푍(휂)̃ 퐶,퐷 푓 푔 푓 푔 �⎯⎯⎯⎯⎯⎯⎯�

퐶 퐷 퐶 퐷 or equivalently

퐴,퐵 푍(휂)̃ 푓 푔 퐶,퐷 푓⊗푔 (퐴 −→퐶, 퐵 −→퐷) �⎯⎯⎯⎯⎯⎯⎯� 퐴 ⊗ 퐵 −−−→퐶 ⊗ 퐷, for 휀 퐴 퐴

푓 퐴 푍(휀)̃ 푓 �⎯⎯⎯⎯⎯⎯⎯�퐵

푔 푔

퐵 퐵

The actions of 휑 and 휀 are very subtle, in such a way that they do not have nice equational analogues. Using this and Definition 26, we can derive the actions of the right adjoint generating morphisms; unsurprisingly, they are intuitively symmetric to their left adjoints, using precomposition instead of postcomposition:

30 ∗ for 훼−1 퐵 퐶 퐷 퐵 퐶 퐷

푔 ∗ 퐵,퐶,퐷 ℎ 푍(훼̃ −1 ) �⎯⎯⎯⎯⎯⎯⎯�퐴 푔 ℎ 푓 푓

퐴 퐴 or equivalently

퐵,퐶,퐷 −1∗ −1 푔⊗ℎ 푓 푍(훼̃ ) 훼퐵,퐶,퐷 푔⊗ℎ 푓 (퐵 ⊗ 퐶) ⊗ 퐷 −−−→푋 ⊗ 푌 −→퐴 �⎯⎯⎯⎯⎯⎯⎯�퐴 퐵 ⊗ (퐶 ⊗ 퐷) −−−−−→(퐵 ⊗ 퐶) ⊗ 퐷 −−−→푋 ⊗ 푌 −→퐴, ∗ for 휆−1 퐵 퐵

퐵 ℎ −1∗ ℎ 푔 푍(휆̃ ) �⎯⎯⎯⎯⎯⎯⎯�퐴 푔

푓 푓

퐴 퐴 or equivalently

퐵 ̃ −1∗ −1 푔⊗ℎ 푓 푍(휆 ) 휆퐵 푔⊗ℎ 푓 퐼 ⊗ 퐵 −−−→푋 ⊗ 푌 −→퐴 �⎯⎯⎯⎯⎯⎯⎯�퐴 퐵 −−−→퐼 ⊗ 퐵 −−−→푋 ⊗ 푌 −→퐴, ∗ for 휌−1

퐵 퐵

∗ 퐵 ℎ ̃ −1 ℎ 푔 푍(휌 ) �⎯⎯⎯⎯⎯⎯⎯�퐴 푔

푓 푓

퐴 퐴 or equivalently

퐵 ̃ −1∗ −1 ℎ⊗푔 푓 푍(휌 ) 휌퐵 ℎ⊗푔 푓 퐵 ⊗ 퐼 −−−→푋 ⊗ 푌 −→퐴 �⎯⎯⎯⎯⎯⎯⎯�퐴 퐵 −−−→퐵 ⊗ 퐼 −−−→푋 ⊗ 푌 −→퐴.

We refer the reader to Bartlett et al. (2015, sec 4.3) for an alternative and more detailed development of the above.

3.5. Presentation of a traced monoidal category

Definition 27 (Traced presentation T). The presentation of a (right) traced pseudomonoid is given by M⊣, equipped with

19 • an additional generating 2-morphism :

Tr ⇒ (Tr)

19. The cups and caps arise from the compact structure of the representing category; for our purposes, this is Prof, which is a compact closed 2-category.

31 20 • equations specifying the commutativity of

(T-van-퐼) ≅ Tr

∼ ∗ 휌−1 ∘휌

Tr

Tr

∗ 훼−1 ∘훼 ∼

(T-van-⊗) Tr

≅ 휀

20. Strictly speaking, we make use of 휑 and 휓 ‘upside-down’ by utilising the cup-cap duality of Prof, followed by cusp elimination — we choose to elide this detail, simplifying our graphical calculus for clarity because those 2-morphisms have no action on the internal morphisms, and can be considered as an inconsequential isotopy.

32 Tr 휂

(T-sup)

Tr 휂

∼ 훼∗∘훼−1

Notice that the generating 2-morphism Tr is just the diagrammatic representation of the natural transformation from Section 3.2. In particular, for any representation of a 2-morphism of this shape in Prof we can apply the results of Section 3.2.1.

3.5.1. Action of Tr. We define the action of Tr as follows:

푓 푍(̃ Tr) �⎯⎯⎯� 푓

푓 Interpreted as acting on some internal morphism 퐴 ⊗ 푋 −→퐵 ⊗ 푋 ∈ C(퐴 ⊗ 푋, 퐵 ⊗ 푋), this implicitly inserts the 푋 morphism into the coend ∫ C(퐴 ⊗ 푋, 퐵 ⊗ 푋) with its cowedge before performing the tracing:

푋 휇푋 Tr퐴,퐵 C(퐴 ⊗ 푋, 퐵 ⊗ 푋) −−−−−−−−−−→ � C(퐴 ⊗ 푋, 퐵 ⊗ 푋) −−−−−−−−−−→ C(퐴, 퐵)

푋 푓 푓 Tr퐴,퐵(푓) 퐴 ⊗ 푋 −→퐵 ⊗ 푋 �⎯⎯⎯⎯⎯⎯⎯� �퐴 ⊗ 푋 −→퐵 ⊗ 푋� �⎯⎯⎯⎯⎯⎯⎯� 퐴 −−−−−−−→퐵.

Proposition 7. Equation (T-van-퐼) is equivalent to Equation (VAN-퐼).

33 Proof. Using internal string diagrams, observe

퐴 퐴

퐼 푍(휓)̃ 푓 퐼 푓 퐼

퐵 퐵

퐴 ≅ 푍(̃ Tr) 퐴 퐵

푓 ∼ 푓 ∗ 퐴 퐵⊗퐼 푍(휌̃ −1 ) ∘푍(휌)̃ 퐵⊗퐼 퐵

Note that the dashed string, representing the monoidal unit of C, is not a formal part of the string diagram calculus, but rather an informal notational reminder21. Thus the action on the internal morphism from bottom left looping above to bottom right is really just 푓 퐴 ⊗ 퐼 −→퐵 ⊗ 퐼 ∈ C(퐴 ⊗ 퐼, 퐵 ⊗ 퐼)

휇퐼

푓 푋 �퐴 ⊗ 퐼 −→퐵 ⊗ 퐼� ∈ ∫ C(퐴 ⊗ 푋, 퐵 ⊗ 푋)

̃ 퐴 푍(Tr)퐵

퐼 Tr퐴⊗퐼,퐵⊗퐼 퐴 −−−−−−−→퐵(푓) ∈ C(퐴, 퐵), and along the bottom it is 푓 퐴 ⊗ 퐼 −→퐵 ⊗ 퐼 ∈ C(퐴 ⊗ 퐼, 퐵 ⊗ 퐼)

퐵⊗퐼 푍(휌)̃ 퐵

푓 휌퐵 퐴 ⊗ 퐼 −→퐵 ⊗ 퐼 −−→퐵 ∈ C(퐴 ⊗ 퐼, 퐵)

∗ 퐴 푍(휌̃ −1 ) 퐵⊗퐼 −1 휌퐴 푓 휌퐵 퐴 −−−→퐴 ⊗ 퐼 −→퐵 ⊗ 퐼 −−→퐵 ∈ C(퐴, 퐵), so as required, this equality of 2-morphisms is really the assertion that

퐼 −1 Tr퐴⊗퐼,퐵⊗퐼(푓) = 휌퐵 ∘ 푓 ∘ 휌퐴 .

Proposition 8. Equation (T-van-⊗) is equivalent to Equation (VAN-⊗-weak).

21. It could be made formal, but the power of the string diagram calculus lies in the fact that we can ignore it; this is similar to how we freely apply a 2-morphism 훽 upside-down following the orientation of our diagrams, where formally we mean that we apply cup-cap duality, 훽 rightside-up, and then cusp elimination.

34 Proof. Using internal string diagrams, observe

퐴 푋

퐴 푌

̃ 퐴⊗푋 푓 푍(Tr)퐵⊗푋 푓 푋

̃ 퐴 푍(Tr)퐵 퐵

∗ 퐴,푋,푌 ̃ −1 푍(훼 )퐵⊗(푋⊗푌) ∘ ∼ 푓 ̃ (퐵⊗푋)⊗푌 푍(훼)퐵,푋,푌

퐴 ̃ 퐴 푋 푍(Tr)퐵

퐴 퐴

푓 푓 푓 푌 ≅ 푌 푋 푋 ⊗ 푌 ̃ 푌⊗푋 푍(휀)푌⊗푋

퐵 퐵

35 The action along the top is

푓 (퐴 ⊗ 푋) ⊗ 푌 −→(퐵 ⊗ 푋) ⊗ 푌 ∈ C((퐴 ⊗ 푋) ⊗ 푌, (퐵 ⊗ 푋) ⊗ 푌)

휇푌

푓 푌 �(퐴 ⊗ 푋) ⊗ 푌 −→(퐵 ⊗ 푋) ⊗ 푌� ∈ ∫ C((퐴 ⊗ 푋) ⊗ 푌, (퐵 ⊗ 푋) ⊗ 푌)

̃ 퐴⊗푋 푍(Tr)퐵⊗푋

푌 Tr퐴⊗푋,퐵⊗푋(푓) 퐴 ⊗ 푋 −−−−−−−−−−−→퐵 ⊗ 푋 ∈ C(퐴 ⊗ 푋, 퐵 ⊗ 푋)

휇푋

푌 Tr퐴⊗푋,퐵⊗푋(푓) 푋 �퐴 ⊗ 푋 −−−−−−−−−−−→퐵 ⊗ 푋� ∈ ∫ C(퐴 ⊗ 푋, 퐵 ⊗ 푋)

̃ 퐴 푍(Tr)퐵

푋 푌 Tr퐴,퐵�Tr퐴⊗푋,퐵⊗푋(푓)� 퐴 −−−−−−−−−−−−−−−−−→퐵 ∈ C(퐴, 퐵),

and along the bottom is

푓 (퐴 ⊗ 푋) ⊗ 푌 −→(퐵 ⊗ 푋) ⊗ 푌 ∈ C((퐴 ⊗ 푋) ⊗ 푌, (퐵 ⊗ 푋) ⊗ 푌)

(퐵⊗푋)⊗푌 �푍(훼)̃ � 퐵,푋,푌

푓 훼퐵,푋,푌 (퐴 ⊗ 푋) ⊗ 푌 −→(퐵 ⊗ 푋) ⊗ 푌 −−−−−→퐵 ⊗ (푋 ⊗ 푌) ∈ C((퐴 ⊗ 푋) ⊗ 푌, 퐵 ⊗ (푋 ⊗ 푌))

∗ 퐴,푋,푌 �푍(훼̃ −1 )� 퐵⊗(푋⊗푌) −1 훼퐴,푋,푌 푓 훼퐵,푋,푌 퐴 ⊗ (푋 ⊗ 푌) −−−−−→(퐴 ⊗ 푋) ⊗ 푌 −→(퐵 ⊗ 푋) ⊗ 푌 −−−−−→퐵 ⊗ (푋 ⊗ 푌) ∈ C(퐴 ⊗ (푋 ⊗ 푌), 퐵 ⊗ (푋 ⊗ 푌))

휇푋⊗푌

−1 훼퐴,푋,푌 푓 훼퐵,푋,푌 푋⊗푌 �퐴 ⊗ (푋 ⊗ 푌) −−−−−→(퐴 ⊗ 푋) ⊗ 푌 −→(퐵 ⊗ 푋) ⊗ 푌 −−−−−→퐵 ⊗ (푋 ⊗ 푌)� ∈ ∫ C(퐴 ⊗ (푋 ⊗ 푌), 퐵 ⊗ (푋 ⊗ 푌))

̃ 퐴 푍(Tr)퐵

푋⊗푌 −1 Tr퐴,퐵 (훼퐵,푋,푌∘푓∘훼퐴,푋,푌) 퐴 −−−−−−−−−−−−−−−−−−−→퐵 ∈ C(퐴, 퐵),

so again this asserts the same equation as Equation (VAN-⊗-weak).

Proposition 9. Equation (T-sup) is equivalent to Equation (SUP-weak).

36 Proof. Using internal string diagrams, observe

퐶 퐴

푔 푓

퐴 푍(̃ Tr) 퐷 퐵 퐵 퐶,퐴 푍(휂)̃ 퐷,퐵 퐶 퐴

퐶 퐴

푓 푔 푓 푔 푋

퐷 퐵

퐷 퐵

퐶⊗퐴 퐶,퐴⊗푋 푍(̃ Tr) 푍(휂)̃ 퐷⊗퐵 퐷,퐵⊗푋 퐶 퐴

퐶 퐴

푔 푓 ∼ 푔 푓 푋 ∗ 퐶,퐴,푋 푋 ̃ −1 푍(훼 )퐶⊗(퐴⊗푋) ∘ ̃ (퐷⊗퐵)⊗푋 푍(훼)퐷,퐵,푋

퐷 퐵

퐷 퐵

Alternatively, we can observe the composite action; along the top:

푔 푓 (퐶 −→퐷, 퐴 ⊗ 푋 −→퐵 ⊗ 푋) ∈ C(퐶, 퐷) × C(퐴 ⊗ 푋, 퐵 ⊗ 푋)

C(퐶,퐷)×휇푋

푔 푓 푋 (퐶 −→퐷, [퐴 ⊗ 푋 −→퐵 ⊗ 푋]) ∈ C(퐶, 퐷) × ∫ C(퐴 ⊗ 푋, 퐵 ⊗ 푋)

C ̃ 퐴 (퐶,퐷)×푍(Tr)퐵 푋 푔 Tr퐴,퐵 (퐶 −→퐷, 퐴 −−−−→퐵) ∈ C(퐶, 퐷) × C(퐴, 퐵)

퐶,퐴 푍(휂)̃ 퐷,퐵 푋 푔⊗Tr퐴,퐵 퐶 ⊗ 퐴 −−−−−−→퐷 ⊗ 퐵 ∈ C(퐶 ⊗ 퐴, 퐷 ⊗ 퐵),

37 and along the bottom:

푔 푓 (퐶 −→퐷, 퐴 ⊗ 푋 −→퐵 ⊗ 푋) ∈ C(퐶, 퐷) × C(퐴 ⊗ 푋, 퐵 ⊗ 푋)

퐶,퐴⊗푋 푍(휂)̃ 퐷,퐵⊗푋 푔⊗푓 퐶 ⊗ (퐴 ⊗ 푋) −−−→퐷 ⊗ (퐵 ⊗ 푋) ∈ C(퐶 ⊗ (퐴 ⊗ 푋), 퐷 ⊗ (퐵 ⊗ 푋))

̃ (퐷⊗퐵)⊗푋 푍(훼)퐷,퐵,푋

푔⊗푓 훼퐷,퐵,푋 퐶 ⊗ (퐴 ⊗ 푋) −−−→퐷 ⊗ (퐵 ⊗ 푋) −−−−−→(퐷 ⊗ 퐵) ⊗ 푋 ∈ C(퐶 ⊗ (퐴 ⊗ 푋), (퐷 ⊗ 퐵) ⊗ 푋)

퐶,퐴,푋 ̃ −1∗ 푍(훼 )퐶⊗(퐴⊗푋) −1∗ 훼 퐶,퐴,푋 푔⊗푓 훼퐷,퐵,푋 (퐶 ⊗ 퐴) ⊗ 푋 −−−−−−−−→퐶 ⊗ (퐴 ⊗ 푋) −−−→퐷 ⊗ (퐵 ⊗ 푋) −−−−−→(퐷 ⊗ 퐵) ⊗ 푋 ∈ C((퐶 ⊗ 퐴) ⊗ 푋, (퐷 ⊗ 퐵) ⊗ 푋)

휇푋

−1∗ 훼 퐶,퐴,푋 푔⊗푓 훼퐷,퐵,푋 푋 �(퐶 ⊗ 퐴) ⊗ 푋 −−−−−−−−→퐶 ⊗ (퐴 ⊗ 푋) −−−→퐷 ⊗ (퐵 ⊗ 푋) −−−−−→(퐷 ⊗ 퐵) ⊗ 푋� ∈ ∫ C((퐶 ⊗ 퐴) ⊗ 푋, (퐷 ⊗ 퐵) ⊗ 푋)

퐶⊗퐴 Tr퐷⊗퐵

푋 −1∗ Tr퐶⊗퐴,퐷⊗퐵�훼퐷,퐵,푋∘푔⊗푓∘훼 퐶,퐴,푋� 퐶 ⊗ 퐴 −−−−−−−−−−−−−−−−−−−−−−−−−−−−→퐷 ⊗ 퐵 ∈ C(퐶 ⊗ 퐴, 퐷 ⊗ 퐵), which is the same as Equation (SUP-weak) as required. We can also use the tool of internal string diagrams to vastly simplify the results derived in Section 3.2.1; they are merely the assertion that

푓 ℎ ≅ ℎ

푔 and

ℎ ≅ ℎ

푝 hold, which is wholly implied by the freedom of movement of internal morphisms through internal boundaries. Hence, we present the key result of this work. Theorem 2. The presentation T has Prof-representations which correspond exactly to the (right) traced monoidal categories.

38 4. Sketches of internal traced ∗-autonomous categories

In this section, applications of the theory are developed. In particular, we describe how to characterise various types of categories-with-structure in a similar way, with the aim of elucidating their relationships in the setting of Prof.

4.1. ∗-autonomous categories internal to Prof

We now go on to give the presentation of a Frobenius pseudomonoid. Definition 28 (Frobenius pseudomonoid presentation F). The presentation of a Frobenius pseudomonoid F is given by combining the presentation of a pseudomonoid ( , , ) and a pseudocomonoid22 ( , , ), with the additional data amounting to additional invertible generating 2-morphisms expressing the Frobenius law

≅ ≅ (Frob)

Because of coherence for Frobenius pseudomonoids (Dunn and Vicary 2016), we elect to not give a (necessarily lengthy) equational theory for this presentation, and are formally justified in doing so: the only 2-morphisms that can be constructed in F are composites of generating 2-morphisms, which, by coherence, are equal exactly when their source and target 1-morphisms are equal. Next, we go on to recall some useful facts about Frobenius pseudomonoids. The Frobenius relationship is very strong, in the sense that the pseudomonoid (resp. pseudocomonoid) is really the same as the pseudocomonoid (resp. pseudomonoid) with one of its input (resp. output) legs ‘bent around’ appropriately23. Proposition 10.

≅ ≅ ( -bend)

and

≅ ≅ ( -bend)

Proof.

∗ (Frob) 휆−1 휌∗ (Frob) ≅ ≅ ≅ ≅

(Frob) 휆 휌−1 (Frob) ≅ ≅ ≅ ≅

The approach of Dunn and Vicary (ibid.) is to give a presentation equivalent to F, essentially by taking as a primitive generating 1-morphism, and recovering the pseudocomonoid structure from that via Equation ( -bend) when necessary. This approach reduces the amount of coherence data (in terms of number of equations) that needs to be stated, and from a formalist perspective is simpler to work with.

22. Which is defined symmetrically to Definition 23. 23. Here, we use a different kind of bending than that induced by the cup-cap duality. Indeed, we shall see that ‘black cups’ and ‘black caps’ also form a (distinct) duality.

39 It can also be observed that and form the ‘black cup’ and ‘black cap’ of another duality in Prof. Proposition 11 (Frobenius duality). We have a second duality:

≅ ≅ (Frob-)

Proof. Observe the (unique by coherence) composite along either the top or the bottom:

(

휌 -bend) −1 -bend) ≅ ≅ ≅ 휆 ≅ (

( ≅ -bend) ≅ ∗ ≅ ≅ 휌 ∗ −1 -bend) 휆 (

Corollary 2. We have adjunctions

⊣ ⊣

Proof. Every equivalence in a 2-category can be promoted to an adjoint equivalence. In this case, the unit and counit 2-morphisms in question are witnessed precisely by the appropriate 2-isomorphism of Equation (Frob-) in combination with the snake equations from cup-cap duality. This means that every profunctor of Corollary 2 is a part of an adjunction, and thus (/co)representable. From left to right, they respectively (/co)represent the functors − ⊸ ⊥, ⊥ ⟜ −. −⊸= =⟜− Cop × C −−−−→ C is the internal Hom functor, and C × Cop −−−−→ C is its symmetric version (the distinction is important in the case where C is non-symmetric (Barr 1995)), i.e. C(푋, 푌) is represented by both 푋 ⊸ 푌 and 푌 ⟜ 푋, but in the absence of symmetry (with respect to the tensor ⊗ of C) we do not insist that 푋 ⊸ 푌 ≅ 푌 ⟜ 푋. Instead, we make a distinction between left and right exponentials. If in C, we have an adjunction 푋⊗ =⊣ 푋 ⊸= for all objects 푋, the counit of this gives the left evaluation map lev푌 푋 ⊗ (푋 ⊸ 푌) −−−→푌; similarly, if we have = ⊗푋 ⊣=⟜ 푋, then we get a counit which corresponds to right evaluation: rev푌 (푌 ⟜ 푋) ⊗ 푋 −−−−→푌. We describe these situations as left and right closure of C (with respect to ⊗); when C is both left and right closed, it is called biclosed, and when ⊗ is symmetric, all situations coincide. See Barr (ibid.) for more details. We define a ∗-autonomous category without symmetry: that is, a category C which is biclosed with respect to ⊗, such that ⊗ and ⅋ interact in the standard way. For our purposes, we are interested in a different structure than F⊣.

40 Definition 29 (Right-adjoint Frobenius presentation F∗). Beginning with F, freely add right adjoints and for the pseudomonoid and unit respectively:

⊣ , ⊣ .

F∗ is represented in Prof by the ∗-autonomous categories (Dunn and Vicary 2016, sec 2.7). In this setting, the ( ) pseudomonoid gives the representation (i.e. its (−) ∗ embedding) of the ⅋ operation of a ∗-autonomous category C, and its right adjoint gives the corepresentation (i.e. its ((−))∗ embedding). The pseudocomonoid gives the corepresentation of ⊗, and we will explicitly construct a left adjoint ⊣ from the existing data, which necessarily corresponds to the representation of ⊗.

4.1.1. Recovering ⊗.

Definition 30 (⊗∗). Define the composite

≔ ( -def)

Proposition 12. We have an adjunction

Proof. For the unit, observe that

휂 ≅ ≅ ⇒

41 ( -bend) 훼∗ ( -def) ≅ ≅ ≅ ≅

For the counit,

( -def) ( -bend) 훼 휀 (Frob-) ≅ ≅ ≅ ≅ ⇒ ≅

Coherence of the black Frobenius pseudomonoid ensures that the triangle equations hold.

Proposition 13. We have isomorphisms

≅ ≅ ( -spin)

42 ≅ ≅ ( -spin)

Proof. For the first row, the first isomorphism holds by definition; for the second, we can prove that the right-hand-side is also left-adjoint to . Adjoints are unique up to canonical isomorphism, and this induces the isomorphism that we require. For the second row, we simply use the appropriate isomorphism from the first row to rewrite , and then apply Equation (Frob-) at each leg.

Similarly, we define the unit of this derived left-adjoint pseudomonoid. Definition 31. Define

≔ ( -def)

Proposition 14. We have an adjunction ⊣

Proof. For the unit: ↓

휑 휌∗ ↑ ( -def) =⇒ ≅ ≅ ≅

For the counit:

( -def) 휌−1 휓 (Frob-) ≅ ≅ ≅ =⇒ ≅

As before, we could have made a symmetric choice.

43 Proposition 15.

≅ ≅ ( -spin)

≅ ≅ ( -spin)

Proof. Analogous to Proposition 13. It can be easily verified that ( , , ) does indeed form a pseudomonoid.

4.1.2. The exponential bifunctor − ⊸=. Given that

represents the contravariant functor − ⊸ ⊥, and represents ⊥24, it might be reasonable to expect that

represents − ⊸=, the exponential bifunctor, which is contravariant in its first argument and covariant in its second. As −⊸= this is a functor Cop × C −−−−→ C however, its corepresentation necessarily exists, and must be given by the right adjoint of its representation. Computing this right adjoint is nontrivial because the cap has no right adjoint, so we cannot proceed as we usually would by computing the right adjoint piece-wise and then composing the result. Instead, we utilise the following:

(Frob-) ( -bend) ≅ ≅ ≅

We can easily compute the right adjoint of this, as the components

⊥ 24. Really, it’s ⊥ as a categorified global element profunctor 퐼 ⇸ C.

44 are all left adjoints. By taking right adjoints component-wise, we compose them to get

This will be the right adjoint of

which is the corepresentation of − ⊸=. We can do something completely analogous with the right exponential bifunctor =⟜ − also. Table 1 provides a handy reference for the representations and corepresentations of different built-in functors of a ∗-autonomous category developed so far.

= ⊗ = = ⅋ = − ⊸= =⟜ −

⊣ ⊣ ⊣ ⊣

⊣ ⊣ Table 1. Representation-corepresentation adjoint pairs in a ∗-autonomous category.

4.2. Tracing and other extensions

4.2.1. Compact closedness as a presentation. As we develop in Section 3, the representations of T in Prof are the traced monoidal categories. The rest of this work concerns the presentation F∗ + T: the presentation obtained by straightforwardly combining25 F∗ and T. This gives a basis for a diagrammatic theory of traced ∗-autonomous categories, internal to and utilising the diagrammatic calculus of Prof. It is known that traced ∗-autonomous symmetric monoidal categories are compact closed (Hajgató and Hasegawa 2013). Our initial motivation for developing this theory was to produce a simplified proof for this result in our framework, which is also more general in not assuming symmetry. To this aim, we present (left) autonomous26 categories. Definition 32 (Autonomous presentation A). The (left) autonomous presentation is the same as the presentation F∗, with an additional generating 2-morphism

휃−1 ==⇒ such that the composite

휂 훼 휀 휃 ≔ =⇒ =⇒ =⇒

25. Strictly speaking, we mean that the tensor ⊗ is traced: loops in the likeness of Equation (Tr) can be ‘traced out’ when the black pseudocomonoid is above the white pseudomonoid, but not the other way around, for that would be ⅋-tracing. 26. A left autonomous category is one where every object admits left duals, and similarly a right autonomous one is where every object admits right duals. When every object admits both, the category is often described as autonomous, or rigid. In the case that the category is symmetric, the left duals are canonically related to the right duals via symmetry (Trimble 2019), and we say that the category is compact, or compact closed. (Left/right) Autonomous categories are the suitable generalisation of compact closed categories to a non-symmetric setting.

45 is the inverse of 휃−1. Proposition 16. The Prof representations of A are the (left) autonomous categories.

Proof. Bartlett et al. (2015, Proposition 4.8) gives the result in the Vect enriched case, where the pseudomonoid is additionally balanced. Our situation is a straightforward generalisation.

Ultimately, we would like to show that 휃−1 can be constructed as some composite 2-morphism in 퐹∗ + T, and this would serve to prove that traced ∗-autonomous categories are autonomous.

4.2.2. Relationship to linear distributivity. A ∗-autonomous category induces a relationship between ⅋ and ⊗

훿푋,푌,푍 푋 ⊗ (푌 ⅋ 푍) ====⇒(푋 ⊗ 푌) ⅋ 푍 called the (left) linear distributor. Graphically, this is represented by

훿 =⇒ has an adjoint mate27

훿∗ ⇐=

We conjecture that this is defined by the composite

휂 (Frob) 휀 훿 = =⇒ ≅ =⇒ (훿- -Frob)

and furthermore that

↓ ( -bend) 훿∗ ( -bend) 휃 = ≅ =⇒ ≅ ≅ (휃- -Frob) ↑

It is known that compact closed categories can be characterised as ∗-autonomous categories for which the linear distributor is invertible (Hajgató and Hasegawa 2013, sec. 4)28. That is, admitting additional 2-morphisms

훿−1 ==⇒ and also by duality

훿−1∗ ⇐==

27. A good mnemonic to remember this is that the white dot ‘pushes through’ the black dot. 28. Although they describe the right linear distributor, they freely assume symmetry throughout, in which case the left and right linear distributors coincide. We believe that the left linear distributor is the appropriate one here.

46 We suppose that in the case of (left) autonomous case this is witnessed by (휃- -Frob) turning into an isomorphism (as under this assumption 훿 becomes an isomorphism, and thus so does 훿∗), with inverse

∗ ( -bend) 훿−1 ( -bend) 휃−1 = ≅ ≅ ≅ ≅ ↑

It is via this characterisation of (left) autonomous categories that we shall sketch our candidate proof.

4.2.3. Results on tracing.

Conjecture 1. A right ⊗-traced ∗-autonomous category is left ⅋-traced.

Proof idea. We build the required 2-morphism

Tr⅋ ==⇒ (Tr⅋)

out of existing data as follows:

( -spin) 훼 ≅ ≅ ≅

47 ↓ →

(曆) ≅ ≅ ≅ ≅

(曆) (Frob-) ( -bend) ≅ ≅ ≅ ≅

Tr (Frob-) =⇒ ≅

Then it remains to show that this derived trace 2-morphism satisfies the axioms of Definition 27.

Similarly, a left ⊗-traced ∗-autonomous category should be right ⅋-traced. In the previous proof, we used a trick involving the twisted duality and tracing which we would like to use more often. First, we shall define what we mean by ‘twisted duality’.

48 Proposition 17 (Twisted (Frobenius) duality). We have a third duality:

≅ ≅ (Twist-)

Proof. Recall that as Prof is a symmetric monoidal 2-category, we can apply four-dimensional29 isotopy in our graphical calculus:

← ←

(Frob-) (Frob-) ≅ ≅ ≅ ≅

→ →

Also, we have the following. Proposition 18.

≅ ≅ (Twist-R)

where the light and dark grey dots are any combination of white and black dots.

29. Intuitively, three dimensions allow for braiding (strings can go over or under each other), and four dimensions allow for free movement of strings through each other so we don’t need to distinguish over and under braidings.

49 Proof.

(曆) (Frob-) ≅ ≅ ≅ ≅

and similarly

(曆) (Frob-) ≅ ≅ ≅ ≅

This is an instance of the phenomenon that in a compact category (like Prof), the braided trace30 always coincides with the trace arising from the original cup-cap duality irrespective of whichever duality we choose to perform the braided trace around.

30. Here, we mean ‘trace’ in the sense of creating a loop in a string diagram with cups and caps arising from some duality.

50 With these, define the composite 2-morphisms

↑ (Twist-) 휂 ≅ ≅ =⇒

( -bend)

( -bend) (Twist-R) Tr ≅ ≅ =⇒

51 and

(Twist-) 휂 ≅ ≅ =⇒

( -bend)

( -bend) (Twist-R) (Tr⅋) ≅ ≅ ===⇒

Conjecture 2. 2-morphisms ( -bend) and ( -bend) are isomorphisms.

52 Proof idea. For ( -bend), show that the composite

( -bend) ( -bend) ( -bend) ( -spin) ======⇒ ======⇒ ======⇒ ≅ ≅

is equal to the identity 2-morphism on , by computing its action on Hom-sets. This gives a candidate inverse for ( -bend). Another (possibly harder) approach would be to show that

which would induce the required isomorphism

by the uniqueness of adjoints. The obvious counit candidate is given by ( -bend) and (Twist-R) followed by Tr. The second isomorphism would be derived symmetrically. While we have not proven this claim, we can give some intuition for why it should be true. A compact is one in which intuitively the black dots are isomorphic to the white dots, as ⅋ collapses to ⊗. Just as we have Equations ( -bend) and ( -bend) for the black dots, we should be able to derive a similar ‘bending’ property for the white dots. In the autonomous case, where we forgo symmetry of the pseudomonoids and pseudocomonoids, we conjecture that this white bending needs to incorporate a twist (it is clear that when we have symmetry the twist can be removed). Often it is the case that presentations built out of ‘naturally occurring’ structure are coherent31; it would not be surprising if F∗ + T or some mild extension were coherent, and if this is the case then the composite above must be the identity. We want this to be true in order to derive a Frobenius relationship between the white pseudomonoid and white pseudocomonoid, which is otherwise absent: derive

≅ ( -Frob−)

31. Most of the time they are deliberately given the minimal equational structure which makes this so — e.g. the pentagon and triangle equations in the pseudomonoid presentation M.

53 like so

( -bend)∘( -bend) ↓ (Twist-) ≅ ≅ ≅ ↑

This is the key equation of a Frobenius pseudomonoid, and from any structure satisfying this we can derive the extended Frobenius law:

≅ ≅ ( -Frob)

We demonstrate one side:

휆∗ ↓ ( -Frob−) ≅ ≅ ≅ ≅ ↑ ↑

훼∗ ( -Frob−) ↑ ≅ ≅ ≅ ≅

the rest are analogous. The crescendo of this section is to give a candidate inverse linear distributor 훿−1:

휂 ( -Frob) 휀 훿−1 = =⇒ ≅ =⇒ (훿−1- -Frob)

which is tantamount to proving that traced ∗-autonomous categories are (left) autonomous.

54 5. Conclusion

We have given a detailed account of Prof as a compact closed monoidal 2-category, and its diagrammatic calculus, developing a presentation for traced monoidal categories. Following this, we proved that the traditional notion of traced monoidal category coincides with our external characterisation, using the technique of internal string diagrams. We have also analysed external characterisations of the related structures of ∗-autonomous and autonomous (non-symmetric compact), and given a sketch of how one might prove that traced ∗-autonomous non-symmetric monoidal categories are autonomous, strengthening the result of Hajgató and Hasegawa (2013).

5.1. Future work

To say that Section 4 constitutes a proof would be akin to a programmer insisting upon the correctness of their program just because it typechecks. Even if we did have a complete proof, it would be too lengthy to adequately include here. Rather, what we have outlined is a (small) research programme which might yield a full proof — this is work that we fully intend to carry out, and we hope that this sketch only requires verification and at most minor modification. Other lines of future work include extending our theory to incorporate braided and symmetric monoidal categories, and generalising from Prof to an arbitrary compact closed monoidal 2-category. In another direction, we feel strongly that there is plenty of fruitful work to be done by exploiting the technique of internal string diagrams to ‘do category theory’ internal to Prof, in a similar vein to Marsden (2014).

55 References

Awodey, Steve (2010). Category Theory. 2nd ed. Oxford Logic Guides 52. Oxford ; New York: Oxford University Press. 311 pp. isbn: 978-0-19-923718-0. Baez, John C. and James Dolan (Nov. 1995). ‘Higher-Dimensional Algebra and Topological Quantum Theory’. In: Journal of Mathematical Physics 36.11, pp. 6073–6105. issn: 0022-2488, 1089-7658. doi: 10.1063/1.531236. arXiv: q-alg/9503002. url: http://arxiv.org/abs/q-alg/9503002 (visited on 08/31/2019). Baez, John C. and Aaron Lauda (2011). ‘A Prehistory of N-Categorical Physics’. In: pp. 13–128. doi: 10 . 1017 / CBO9780511976971.003. arXiv: 0908.2469 [gr-qc, physics:hep-th]. url: http://arxiv.org/abs/0908.2469 (visited on 08/31/2019). Baez, John C. and Mike Stay (Mar. 2, 2009). ‘Physics, Topology, Logic and Computation: A Rosetta Stone’. In: arXiv: 0903.0340 [quant-ph]. url: http://arxiv.org/abs/0903.0340 (visited on 11/23/2018). Barr, Michael (Mar. 6, 1995). ‘Nonsymmetric �-Autonomous Categories’. In: Theoretical Computer Science 139.1, pp. 115– 130. issn: 0304-3975. doi: 10.1016/0304-3975(94)00089-2. url: http://www.sciencedirect.com/science/article/pii/ 0304397594000892 (visited on 07/19/2019). Bartlett, Bruce et al. (Sept. 22, 2015). ‘Modular Categories as Representations of the 3-Dimensional Bordism 2-Category’. In: arXiv: 1509.06811 [math]. url: http://arxiv.org/abs/1509.06811 (visited on 05/15/2019). Benabou, J. (1963). ‘Categories avec multiplication’. In: Comptes Rendus Hebdomadaires des Séances de l’Académie des Sciences, Paris 256, pp. 1887–1890. issn: 0001-4036. url: https://zbmath.org/?q=an%3A0111.02201 (visited on 08/31/2019). Bénabou, Jean (1967). ‘Introduction to Bicategories’. In: Reports of the Midwest Category Seminar. Ed. by J. Bénabou et al. Lecture Notes in Mathematics. Springer Berlin Heidelberg, pp. 1–77. isbn: 978-3-540-35545-8. — (June 2000). Distributors at Work. Borceux, Francis (1994). Handbook of Categorical Algebra. Encyclopedia of Mathematics and Its Applications v. 50-51, 53 [i.e. 52]. Cambridge [England] ; New York: Cambridge University Press. 3 pp. isbn: 978-0521061193. Day, Brian and Ross Street (July 15, 1997). ‘Monoidal Bicategories and Hopf Algebroids’. In: Advances in Mathematics 129.1, pp. 99–157. issn: 0001-8708. doi: 10.1006/aima.1997.1649. url: http://www.sciencedirect.com/science/article/ pii/S0001870897916492 (visited on 08/19/2019). Dunn, Lawrence and Jamie Vicary (Jan. 20, 2016). ‘Coherence for Frobenius Pseudomonoids and the Geometry of Linear Proofs’. In: arXiv: 1601.05372 [cs]. url: http://arxiv.org/abs/1601.05372 (visited on 01/25/2019). Hajgató, T. and M. Hasegawa (2013). ‘Traced *-Autonomous Categories Are Compact Closed’. In: Theory and Applications of Categories 28, pp. 206–212. Johnson-Freyd, Theo (2009). ”Philosophical” Meaning of the Yoneda Lemma. url: https://mathoverflow.net/questions/ 3184/philosophical-meaning-of-the-yoneda-lemma/3223 (visited on 08/31/2019). Joyal, André and Ross Street (July 1, 1991). ‘The Geometry of Tensor Calculus, I’. In: Advances in Mathematics 88.1, pp. 55–112. issn: 0001-8708. doi: 10.1016/0001-8708(91)90003-P. url: http://www.sciencedirect.com/science/article/ pii/000187089190003P (visited on 08/31/2019). Joyal, André, Ross Street, and Dominic Verity (Apr. 1996). ‘Traced Monoidal Categories’. In: Mathematical Proceedings of the Cambridge Philosophical Society 119.3, pp. 447–468. issn: 1469-8064, 0305-0041. doi: 10.1017/S0305004100074338. url: https://www.cambridge.org/core/journals/mathematical-proceedings-of-the-cambridge-philosophical- society/article/traced-monoidal-categories/2BE85628D269D9FABAB41B6364E117C8 (visited on 09/12/2018). Lane, Saunders Mac (1963). ‘Natural Associativity and Commutativity’. In: Rice University Studies. Leinster, Tom (2014). Basic Category Theory. Cambridge: Cambridge University Press. isbn: 978-1-107-36006-8. doi: 10.1017/CBO9781107360068. url: http://ebooks.cambridge.org/ref/id/CBO9781107360068 (visited on 08/16/2018). Loregian, Fosco (Jan. 11, 2015). ‘This Is the (Co)End, My Only (Co)Friend’. In: arXiv: 1501.02503 [math]. url: http://arxiv.org/abs/1501.02503 (visited on 02/04/2019). Mac Lane, Saunders (1998). Categories for the Working Mathematician. 2nd ed. Graduate Texts in Mathematics 5. New York: Springer. 314 pp. isbn: 978-0-387-98403-2. Marsden, Daniel (Jan. 28, 2014). ‘Category Theory Using String Diagrams’. In: arXiv: 1401.7220 [cs, math]. url: http://arxiv.org/abs/1401.7220 (visited on 05/14/2019). Milewski, Bartosz (2017). Category Theory for Programmers. url: https://bartoszmilewski.com/2014/10/28/category- theory-for-programmers-the-preface/ (visited on 10/01/2017). Schommer-Pries, Christopher J. (Dec. 5, 2011). ‘The Classification of Two-Dimensional Extended Topological Field Theories’. In: arXiv: 1112.1000 [math]. url: http://arxiv.org/abs/1112.1000 (visited on 07/02/2019). Selinger, Peter (Aug. 23, 2009). ‘A Survey of Graphical Languages for Monoidal Categories’. In: doi: 10.1007/978-3-642- 12821-9_4. url: https://arxiv.org/abs/0908.3347 (visited on 12/05/2018). Stay, Michael (Jan. 6, 2013). ‘Compact Closed Bicategories’. In: arXiv: 1301.1053 [math]. url: http://arxiv.org/abs/1301. 1053 (visited on 06/13/2019). Trimble, Todd (2019). Why Is a Braided Left Autonomous Category Also Right Autonomous? url: https://mathoverflow. net/questions/162677/why-is-a-braided-left-autonomous-category-also-right-autonomous/162693 (visited on 08/27/2019). Wood, R. J. (1982). ‘Abstract pro Arrows I’. In: Cahiers de Topologie et Géométrie Différentielle Catégoriques 23.3, pp. 279–290. issn: 1245-530X. url: https://eudml.org/doc/91304 (visited on 08/31/2019).

56