
UNIVERSITY OF COPENHAGEN FACULTY OF SCIENCE PhD thesis Robin Kaarsgaard The Logic of Reversible Computing Theory and Practice Academic advisors: Robert Glück (principal), Holger Bock Axelsen, Andrzej Filinski Submitted: December 22, 2017 The Logic of Reversible Computing Theory and Practice Robin Kaarsgaard DIKU, Department of Computer Science, University of Copenhagen December 22, 2017 This thesis has been submitted to the PhD School of the Faculty of Science at the University of Copenhagen. To Sophie iv Abstract Reversible computing is the study of models of computation that exhibit both forward and backward determinism. While reversible computing initially gained interest through its potential to reduce the energy consumption of computing machinery, via a result from physics now known as Landauer’s principle, a number of other applications in computer science have since been proposed, from syntax descriptions to model-based testing, debug- ging, and even robotics. In spite of its numerous current (and potential future) applications, the established foundations for computation and programming, such as Turing machines, λ-calculi, and various categorical models, are largely ill equipped to handle reversible computing, as these often tacitly rely on irreversible operations to function. To set reversible computing on a foundation as solid as the one for conventional computing requires both a significant adaptation of existing techniques and the development of new ones. In this thesis, we investigate reversible computing from a perspective of logic, broadly construed. To complement the operational point of view from which reversible computing is often studied, we offer a denotational account of reversibility in computation based on recent work in category theory. We propose two new techniques, founded in formal logic, for reasoning about reversible logic circuits. Further, we account for the behaviour of fixed points in certain proposed categorical models of reversible computing, and connect these results to the behaviour of recursive functions and data types in established reversible pro- gramming languages. In an application and extension of some of these results, we propose a uniform categorical foundation for a large class of reversible imperative programming languages known as structured reversible flowchart languages. We investigate the role of re- versible effects in reversible functional programming, and show that a wide palette of these may be modelled as arrows (in the sense of Hughes) satisfying certain additional equations. Finally, we propose a brief vision for the future of the reversible functional programming language Rfun. v vi Dansk resumé Reversibel beregning er studiet af beregningsmodeller der er både fremad- og baguddeter- ministiske. På trods af at reversibel beregning oprindeligt fik interesse igennem dets poten- tialle til at reducere beregningsmaskiners energiforbrug, via et resultat fra fysikken der nu kendes som Landauer’s princip, har det senere fundet et antal andre anvendelser i datalo- gien, fra syntaksbeskrivelser til model-baseret testning, fejlfinding i programmel, og endda robotteknologi. På trods af disse talrige nuværende (og potentielle fremtidige) anvendelser er mange grundlæggende modeller for beregning og programmerinbg, såsom Turingmaskiner, λ- kalkyler og visse kategoriske modeller, i høj grad dårligt rustede til at håndtere reversibel beregning, da disse ofte implicit afhænger af irreversible operationer for at virke. At kunne placere reversibel beregning på et lige så solidt grundlag som det for konventionel beregning kræver både betydelige tilpasninger af eksisterende teknikker, og udviklingen af nye. I denne afhandling undersøger vi reversibel beregning fra et (i bred forstand) logisk per- spektiv. Som supplement til det operationelle udgangspunkt der ofte benyttes til at studere reversible beregning giver vi en denotationel redegørelse af reversibilitet i beregning, baseret på nylige resultater fra kategoriteori. Vi fremsætter to nye teknikker, grundlagt i teknikker fra formel logik, til at ræsonnere om reversible logiske kredsløb. Endvidere redegør vi for fikspunkters opførsel i visse foreslåede kategoriske modeller for reversibel beregning, og forbinder denne redegørelse til rekursive funktioner og datatypers opførsel i etablerede re- versible programmeringssprog. Ved brug og udvidelse af nogle af disse resultater foreslår vi et ensartet kategorisk grundlag for en betydelig mængde af imperative reversible program- meringssprog, de såkaldte strukturerede reversible flowchartsprog. Vi undersøger reversible effekters rolle i reversibel funktionsprogrammering, og viser, at en bred palet af disse kan modelleres som pile (i Hughes’ fortolkning) der opfylder visse yderligere ligheder. Endelig fremsætter vi en kortfattet vision for fremtiden for det reversible funktionsprogrammer- ingssprog Rfun. vii viii Contents Abstract iv Dansk resumé vi Preface xi 1 Introduction 1 1.1 Reversibility and invertibility: A semantic perspective ........... 1 1.2 Unifying operational and denotational reversibility ............ 6 1.3 Reversible computing as physical computing ................ 8 1.4 Reversibility and invertibility in programming languages . 10 1.5 Contributions ............................... 12 References 17 A Reversible circuit logic 25 A.1 Ricercar: A language for describing and rewriting reversible circuits . 27 A.2 A classical propositional logic for reasoning about reversible logic circuits . 45 B Foundations of reversible recursion 63 B.1 Join inverse categories and reversible recursion . 65 B.2 Inversion, fixed points, and the art of dual wielding . 85 C Semantics of reversible programming languages 103 C.1 A categorical foundation for structured reversible flowchart languages: Sound- ness and adequacy .............................105 C.2 Reversible effects as inverse arrows . 139 C.3 RFun revisited ...............................159 ix x Preface This manuscript constitutes the author’s PhD thesis, an endeavour that could nothave been completed without the support and encouragement from a tremendous number of people. First of all, I would like to thank my academic advisors Holger Bock Axelsen, Andrzej Filinski, and Robert Glück for their encouragement and sage advice, always ready to discuss a particularly puzzling topic (of which there are many) or to point me in the right direction. I would also like to thank my (current and previous) office mates and other fellow PhD students, with whom I’ve shared many discussions (academic and otherwise), thoughts, and beers. In no particular order: Ulrik Terp Rasmussen, Bjørn “Nillerbjørn” Bugge Grathwohl, Vivek Shah, Oleksandr Shturmov, Danil Annenkov, Abraham Wolk, Martin Dybdal. I’d also like to thank Fritz Henglein for many interesting discussions, for agreeing to chair my thesis committee, and for entrusting me early on with teaching duties in one of my favourite courses here at DIKU, Logic in Computer Science. I would also like to thank Hanna van Lee, who quickly became my partner in crime in teaching this course. I would also like to thank those who have helped me broaden my horizons, and who have showed in interest in my work: Apart from those already mentioned, I’d like to thank Torben Mogensen, Marcos vaz Salles and the rest of the APL group here at DIKU; and Rasmus Møgelberg (who first introduced me to category theory) and Marco Paviotti for great discussions and great coffee. I also owe thanks to Bart Jacobs and the rest of the Nijmegen Quantum Logic Group at Radboud University for hosting me in the spring of 2016: Aleks Kissinger, Fabio Zanasi, Mathys Rennela, Bas Westerbaan, Bram Westerbaan, Kenta Chō, and Sander Uijlen. I would also like to thank Dexter Kozen, Michael Johnson, Robin Cockett, and Tarmo Uustalu for interesting discussions, and for showing interest in my work; and, the latter two, for agreeing to serve on my thesis committee. A special thanks goes to my (non-advisor) collaborators: Chris Heunen, Martti Karvonen, Mathias Soeken, Michael Kirkedal Thomsen. I am also grateful for the support offered byCOST Action IC1405: Reversible computing – extending horizons of computing. Finally, I would like to thank my friends and family for their support during the past three years; and Sophie, for everything. Robin Kaarsgaard Full name: Robin Kaarsgaard Jensen xi “Sometimes I wish I knew how to go crazy. I forget how.” “It’s a lost art,” Hank said. “Maybe there’s an instruction manual on it.” Philip K. Dick, A Scanner Darkly 1 Introduction A famous parable from the Rigveda, familiar to many category theorists due to the truly awesome work of Peter Johnstone [74], is that of the blind men examining an elephant: One man, holding the trunk, says it is like a snake; another man, touching one of the elephant’s legs, says it is like a pillar; a third man, holding the tail, says it is like a rope, etc. Similar sound but incomplete statements can be made of reversible computing: It is about computations that can be undone; it is about computers as physical machines; it is about computation free of information effects [72]; and so on. In this chapter we will give an introduction to central concepts in reversible computing as they will be used later in the thesis. To set the stage for some of these developments, we will also present a new denotational view of reversible computing that highlights com- positionality as a central principle of reversibility, clarify some concepts that are often left underspecified, and connect this to existing views on
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages184 Page
-
File Size-