The Way of the Dagger
Total Page:16
File Type:pdf, Size:1020Kb
The Way of the Dagger Martti Karvonen I V N E R U S E I T H Y T O H F G E R D I N B U Doctor of Philosophy Laboratory for Foundations of Computer Science School of Informatics University of Edinburgh 2018 (Graduation date: July 2019) Abstract A dagger category is a category equipped with a functorial way of reversing morph- isms, i.e. a contravariant involutive identity-on-objects endofunctor. Dagger categor- ies with additional structure have been studied under different names in categorical quantum mechanics, algebraic field theory and homological algebra, amongst others. In this thesis we study the dagger in its own right and show how basic category theory adapts to dagger categories. We develop a notion of a dagger limit that we show is suitable in the following ways: it subsumes special cases known from the literature; dagger limits are unique up to unitary isomorphism; a wide class of dagger limits can be built from a small selection of them; dagger limits of a fixed shape can be phrased as dagger adjoints to a diagonal functor; dagger limits can be built from ordinary limits in the presence of polar decomposition; dagger limits commute with dagger colimits in many cases. Using cofree dagger categories, the theory of dagger limits can be leveraged to provide an enrichment-free understanding of limit-colimit coincidences in ordinary category theory. We formalize the concept of an ambilimit, and show that it captures known cases. As a special case, we show how to define biproducts up to isomorphism in an arbitrary category without assuming any enrichment. Moreover, the limit-colimit coincidence from domain theory can be generalized to the unenriched setting and we show that, under suitable assumptions, a wide class of endofunctors has canonical fixed points. The theory of monads on dagger categories works best when all structure respects the dagger: the monad and adjunctions should preserve the dagger, and the monad and its algebras should satisfy the so-called Frobenius law. Then any monad resolves as an adjunction, with extremal solutions given by the categories of Kleisli and Frobenius- Eilenberg-Moore algebras, which again have a dagger. We use dagger categories to study reversible computing. Specifically, we model re- versible effects by adapting Hughes’ arrows to dagger arrows and inverse arrows. This captures several fundamental reversible effects, including serialization and mutable store computations. Whereas arrows are monoids in the category of profunctors, dag- ger arrows are involutive monoids in the category of profunctors, and inverse arrows satisfy certain additional properties. These semantics inform the design of functional reversible programs supporting side-effects. iii Lay Summary This thesis is primarily about the mathematics of so-called dagger categories. For now, think of a category as a collection of systems A;B;C;::: and processes between them. Processes can be done after each other, and for any system A there should be a trivial process idA that amounts to doing nothing. In a dagger category there is an additional piece of structure – any process f : A ! B has a counterpart process f † : B ! A going in the opposite direction. One might think of f † as some kind of a reversal of the process f , and this motivates the rules this reversal is supposed to obey, namely • reversing the trivial process of any system A results in the trivial process, i.e. † idA = idA • reversing a process twice results in the original process, i.e. f †† = f • if one reverses the process “g after f ”, one might as well have reversed each process individually and done them after each other in the opposite order. More succinctly, (g ◦ f )† = f † ◦ g† Any mathematical structure obeying these rules is a dagger category. For a concrete example, let us consider the alphabet. Letters can be written after one another, resulting in strings such as “asdf” and “cat”. Strings can be composed by writing them one after the other, so “world” composed after “hello” becomes ‘helloworld”. The empty string is a neutral element with respect to composition, i.e. appending or prepending it to a string doesn’t change the string in question. What makes this into a dagger category is the fact that strings can be reversed. Reversing the empty string results in an empty string. Reversing a string twice results in the original string. Reversing a composite string is the same thing as composing the reversals in the opposite order. Hence the rules above are indeed obeyed by strings of letters. Dagger categories arise independently both in physics and computation, and also at their intersection in quantum computing. However, so far a systematic study of dagger categories has been missing, and this thesis fills the gap. There are various mathem- atical questions and notions people study in the context of ordinary categories, such as (co)limits, which consider well-behaved ways of building new systems from old ones, or monads and arrows, which can be used to enlarge the collection of processes available. This thesis shows how to understand such topics in the context of dagger categories. iv Acknowledgements First and foremost I need to thank my first supervisor Chris Heunen for his guid- ance throughout the years. Besides helping in choosing a topic, nudging me in the right direction when I got stuck, giving advice on literature to read and advising with numerous smaller issues that come about in academic life, he has helped me to grow into a researcher who can hopefully make all these decisions alone. Without him you would be reading an empty thesis1. I must also thank my second supervisor Tom Leinster. His intuition, whether per- taining to topics described in this thesis or to mathematics in general, has not only been helpful but also a delight to observe. I hope that I have been able to absorb even a fraction of his way of thinking. I am very thankful for my examiners Peter Selinger and David Jordan. The time they invested into reading this thesis with care resulted in insightful comments and feedback that has greatly improved this thesis. I wish to thank Gordon Plotkin for very helpful comments during my yearly re- views and on an earlier draft. It is truly a pleasure to see how a computer scientist thinks about category theory. Similarly, I must thank Robin Kaarsgaard not only for his helpful comments but also for the work we have done together – hopefully this was only a start. To the extent that the thesis falls under theoretical computer science, it is because of Gordon and Robin. I am indebted for Jamie Vicary both for coining the name “way of the dagger” to describe the general philosophy when working with dagger categories, and for letting me use it as a title. More widely, I am thankful for the whole community centred around the conference Quantum Physics and Logic – it is a great research community to be a part of, and a great source of friends and collaborators. Before moving to friends and family, I wish to thank various organizations that have helped me. I wish to thank the Osk. Huttunen foundation for financially sup- porting me during my PhD. The money that Vais¨ al¨ a¨ foundation kindly let me use as a travel grant was very useful for letting me become a part of an international scientific community and I learned a lot on the way. COST Action IC1405 made possible a trip to Copenhagen, without which this thesis would be shorter. My host institute LFCS was not only a great academic community, but also helped me with a funding gap at the start and some travel money during the later years. 1A variant of [144] v Life in Edinburgh would have been much duller without Toms, Kima and their friends. Climbing with Orfeas has provided me with a much needed counterbalance to research. My summer breaks in Finland were mostly timed so that I could visit KKT, so I have to thank everyone involved for that particular getaway and the support therein. I must also thank Tuomo, Sakari and IHRA more generally for their sustained friendship. I am grateful for Pentti, Pirjo and Pekka, not only for the usual things loving fam- ilies provide, but also for being crucial for my intellectual development during my formative years and supportive once I got interested in mathematics. All of my sib- lings, half or otherwise, have been crucial to me growing up to be the person I am. There is no way words can express the gratitude I have for Esma, so I will not even try. vi Declaration I declare that this thesis was composed by myself, that the work contained herein is my own except where explicitly stated otherwise in the text, and that this work has not been submitted for any other degree or professional qualification except as specified. (Martti Karvonen) vii Contents 1 Introduction 1 1.1 Why dagger categories . .1 1.2 Historical Background . .2 1.3 Outline, results and content available elsewhere . .5 1.4 Prerequisites . .6 1.5 On notation . .7 2 Background 9 2.1 Dagger categories . .9 2.2 Graphical calculus . 16 3 Equivalences and adjunctions 21 3.1 Dagger equivalences . 21 3.2 Dagger adjunctions . 25 4 Limits 29 4.1 Introduction . 29 4.2 Dagger limits . 30 4.3 Uniqueness up to unitary isomorphism . 37 4.4 Completeness . 43 4.5 Global dagger limits . 50 4.6 Dagger adjoint functors . 53 4.7 Polar decomposition . 55 4.8 Commutativity of limits and colimits . 64 5 Ordinary limit-colimit coincidences via dagger limits 73 5.1 Ambilimits .