Nominal Domain Theory for Concurrency
Total Page:16
File Type:pdf, Size:1020Kb
UCAM-CL-TR-751 Technical Report ISSN 1476-2986 Number 751 Computer Laboratory Nominal domain theory for concurrency David C. Turner July 2009 15 JJ Thomson Avenue Cambridge CB3 0FD United Kingdom phone +44 1223 763500 http://www.cl.cam.ac.uk/ c 2009 David C. Turner This technical report is based on a dissertation submitted December 2008 by the author for the degree of Doctor of Philosophy to the University of Cambridge, Clare College. Technical reports published by the University of Cambridge Computer Laboratory are freely available via the Internet: http://www.cl.cam.ac.uk/techreports/ ISSN 1476-2986 Nominal Domain Theory for Concurrency David C. Turner Abstract Domain theory provides a powerful mathematical framework for describing se- quential computation, but the traditional tools of domain theory are inapplica- ble to concurrent computation. Without a general mathematical framework it is hard to compare developments and approaches from different areas of study, leading to time and effort wasted in rediscovering old ideas in new situations. A possible remedy to this situation is to build a denotational semantics based directly on computation paths, where a process denotes the set of paths that it may follow. This has been shown to be a remarkably powerful idea, but it lacks certain computational features. Notably, it is not possible to express the idea of names and name-generation within this simple path semantics. Nominal set theory is a non-standard mathematical foundation that captures the notion of names in a general way. Building a mathematical development on top of nominal set theory has the effect of incorporating names into its fabric at a low level. Importantly, nominal set theory is sufficiently close to conventional foundations that it is often straightforward to transfer intuitions into the nominal setting. Here the original path-based domain theory for concurrency is developed within nominal set theory, which has the effect of systematically adjoining name- generation to the model. This gives rise to an expressive metalanguage, Nominal HOPLA, which supports a notion of name-generation. Its denotational seman- tics is given entirely in terms of universal constructions on domains. An oper- ational semantics is also presented, and relationships between the denotational and operational descriptions are explored. The generality of this approach to including name generation into a simple se- mantic model indicates that it will be possible to apply the same techniques to more powerful domain theories for concurrency, such as those based on presheaves. Acknowledgments Firstly I would like to wholeheartedly thank my supervisor, Glynn Winskel, for all the ideas, support, encouragement, direction and freedom that he has given me over the course of my research. I hope that my work brings his vision for the future of semantics closer to reality. I would also like to thank the EPSRC for their generous support through their grant “Domain Theory for Concurrency”, number GR/T22049/01, whose principal investigator was Prof. Winskel. Sam Staton’s positive influence on my work cannot be overstated, both for his detailed mathematical support and his equally thorough typographical assis- tance. All errors that remain are entirely my own work. Andrew Pitts must also receive my appreciation for his auspiciously timed sem- inar on nominal set theory at the start of my studies, as well as his enthusiasm for all things nominal, and for his terrible puns: it is fortunate that for this work his support seems to be infinite. I regret not having capitalised more on Jamie Gabbay’s equally infectious zeal for the subject; I hope that he, and all the other participants of CANS, enjoy reading this thesis as much as I have enjoyed producing it. At the Computer Laboratory and at DPMMS I have met many other wonderful people who have helped me along my way. In particular I would like to thank Martin Hyland for pointing me in Glynn’s direction in the first place; Matthew Parkinson for helping me to hammer LATEX into shape and in particular for his macro to produce very wide hats indeed; and the Theory and Semantics Group for all our varied conversations on all manner of topics over tea and beer and games of pool. d Clare College has been a wonderfully supportive — and remarkably patient — home to me for the past decade, and the source of many valuable friendships. My family have played a larger part in this work than perhaps they realise. I would like to thank Mum and Dad and Andy and Di and Howard and all my grandparents for giving me the encouragement, the work ethic and the environment that brought me here. I hope you can make it as far as page 10 and I hope it makes you proud. Finally, to Tess, who is the most wonderful person in the world: without you I would have never got so far, so happily, with so much of my sanity still intact. You made it all worthwhile. This is for you. To all of you, thank you. — Dave Turner, Cambridge, December 2008 Contents 1 Introduction 9 2 Preliminaries 13 2.1 DomainTheory............................ 13 2.1.1 Complete Partial Orders and Continuous Functions . 15 2.1.2 AlgebraicCPOs ....................... 17 2.1.3 Nondeterminism in Domain Theory . 19 2.1.4 A Simple Domain Theory for Concurrency . 20 2.1.5 Domains of Paths . 21 2.2 NominalSets ............................. 23 2.2.1 Finite Automorphisms on Names . 25 2.2.2 The Theory of Nominal Sets . 30 2.2.3 Constructing Nominal Sets . 32 2.2.4 A Category of Nominal Sets . 35 2.2.5 Binding in Nominal Sets . 35 2.2.6 Choice and Nominal Sets . 39 2.3 Conclusion .............................. 42 3 Nominal Domain Theory 43 3.1 NominalPreorders .......................... 44 5 CONTENTS 6 3.1.1 Definitions .......................... 44 3.1.2 The structure of NPre ................... 45 3.2 FMPreorders............................. 46 3.2.1 Fraenkel-Mostowski Set Theory . 46 3.3 Nominal Nondeterministic Domains . 51 3.3.1 Free Join-Completions of Path Orders . 52 3.3.2 Categories of FM-Linear Maps . 53 3.3.3 A relationship between (−)#a and (−)........... 54 d 3.3.4 A relationship between δa and (−)............. 56 d 3.3.5 The Structure of FMLins .................. 59 3.4 Continuity in FM Domain Theory . 63 3.4.1 Name-Binding is not Directed-Join Continuous . 63 3.4.2 FM-Continuity . 65 3.4.3 FM-Isolated Elements . 67 3.4.4 Categories of FM-Continuous Maps . 69 3.4.5 A relationship between (−)#a and! ............ 73 3.4.6 A relationship between δa and!............... 74 3.4.7 Binding and Continuity . 77 3.4.8 The Structure of FMCtss .................. 79 3.5 Conclusion .............................. 85 4 Nominal HOPLA: Syntax and Operational Semantics 86 4.1 Syntax................................. 87 4.1.1 Preliminaries ......................... 87 4.1.2 SyntaxofTypes ....................... 88 4.1.3 Syntax of Environments . 88 4.1.4 SyntaxofTerms ....................... 90 CONTENTS 7 4.1.5 Syntax of Actions . 91 4.1.6 Permutations on Terms and Actions . 91 4.1.7 Substitution.......................... 92 4.2 TypingRules ............................. 92 4.2.1 Typing Rules for Terms . 92 4.2.2 Typing Rules for Actions . 97 4.3 The Substitution Lemma . 103 4.4 Operational Semantics . 107 4.4.1 Properties of the Operational Semantics . 108 5 Nominal HOPLA: Denotational Semantics 110 5.1 Types and Environments . 110 5.1.1 TypesasPathOrders . 111 5.1.2 Environments as Products . 112 5.2 TermsandActions .......................... 113 5.2.1 Higher-Order Processes . 114 5.2.2 Prefixing and Matching . 116 5.2.3 Labelled Processes . 118 5.2.4 Recursion ........................... 120 5.2.5 Nondeterminism . 122 5.2.6 Names and Binding . 123 5.2.7 Structural Rules . 126 5.3 Substitution as Composition . 132 5.4 Soundness and Adequacy . 139 5.4.1 Soundness . 140 5.4.2 A Logical Relation . 143 5.4.3 Adequacy ........................... 146 CONTENTS 8 6 A Universal View 153 6.1 FMPres in Dependent Type Theory . 154 6.1.1 AFibration.......................... 155 6.1.2 Binding in (FMPre∅ ↓ y)..................158 6.2 Adjunctions and Kleisli Categories . 161 6.2.1 Adjoints to Inclusions . 161 6.2.2 Adjunctions in Kleisli Categories . 163 6.3 Binding in FM-Linear Categories . 166 6.3.1 Binding in FMLins,Abstractly .............. 166 6.3.2 Binding in FMLins, Concretely . 168 6.4 Binding in FM-Continuous Categories . 169 6.4.1 Binding in FMCtss,Abstractly . 170 6.4.2 Binding in FMCtss, Concretely . 174 7 Conclusion 176 7.1 Related and Future Work . 176 7.1.1 Full Abstraction . 176 7.1.2 Relationships with New HOPLA . 178 7.1.3 Even-More-Nominal HOPLA . 179 7.1.4 Presheaf Semantics . 180 7.1.5 Nominal Domain Theory . 180 7.2 Summary ...............................182 Chapter 1 Introduction Nygaard and Winskel[20] motivate the study of domain theory as follows. Denotational semantics and domain theory of Scott and Strachey provide a global mathematical setting for sequential computation, and thereby place programming languages in connection with each other; connect with the mathematical worlds of algebra, topology and logic; and inspire programming languages, type disciplines and methods of reasoning. Sequential computations typically receive some input, perform a calculation, and output the result once they have finished. In contrast, computation in the modern world is increasingly performed by interconnected collections of de- vices, each performing parts of computations and interacting with their neigh- bours and with their environment in the course of their calculations. Input may not all be received at once; output may not all be sent simultaneously; and computations do not necessarily even have a well-defined finish. In this world of concurrent, distributed computation there is no global mathematical model that serves to guide developments and unify different approaches and which provides a forum for comparing innovations.