
Primitive Direcursion and Difunctorial Semantics of Typed Object Calculus Johan Glimming Doctoral Thesis in Computer Science at Stockholm University, Sweden 2007 The fi rst part of this thesis consists of two research papers and concerns the fi eld of denotational semantics of typed object calculus, i.e., a for- malism for object-based programming. It provides a category-theoretic semantics based on partial maps subject to an algebraic compactness assumption. This semantics interprets types as mixed-variant functors (so-called difunctors) and is therefore termed difunctorial. In addition, we prove computational soundness and adequacy results for typed ob- ject calculus via Plotkin’s FPC, thus providing a class of computatio- nally adequate models for an extended fi rst-order typed object calculus (with recursive objects supporting method update, but not subtyping). Taken together, this provides a mathematical foundation for studying program algebras for object-based programming languages. The second part (which appeared at CALCO 2007, Springer-Ver- lag) deals with recursion principles on datatypes, including the untyped lambda calculus as a special case. Freyd showed that, in certain domain theoretic categories, locally continuous functors have minimal invari- ants, which possess a structure that he termed dialgebra. This gives rise to a category of dialgebras and homomorphisms, where the minimal in- variants are initial, inducing a powerful recursion scheme (direcursion) on a complete partial order. We identify a problem that appears when we translate (co)iterative functions to direcursion, and as a solution to this problem we develop a recursion scheme (primitive direcursion). This immediately gives a number of examples of direcursive functions, improving on the situation in the literature where only a few examples have appeared. By means of a case study, this line of work is connected to object calculus models. Johan Glimming received his BSc (in Computer Sci- ence) from Uppsala University, and his MSc (in Mat- hematics and the Foundations of Computer Science) from University of Oxford. In 2005, he received the title of Licentiate of Philosophy at Stockholm Univer- sity. issn 1653-5723 isbn 978-91-7155-550-2 Department of Numerical Analysis and Computer Science STOCKHOLM UNIVERSITY, SWEDEN TRITA-CSC-A 2007:22 Stockholms Universitet ISSN 1653-5723 Numerisk analys och datalogi (KTH CSC) ISRN-KTH/CSC/A–07/22–SE SE-100 44 Stockholm ISBN 978-91-7155-550-2 SWEDEN Akademisk avhandling som med tillstånd av Stockholms Universitet framlagges¨ till offentlig granskning for¨ avlaggande¨ av doktorsavhandling den 9 januari 2008 kl 14.00 i sal F3, Lindstedtsvagen¨ 26 (infart Valhallavagen¨ /Drottning Kristinas vag),¨ Kungl Tekniska hogskolan,¨ Stockholm. © Johan Glimming, November 22, 2007 Tryck: Universitetsservice US-AB iii Abstract This thesis concerns two closely related lines of research: (i) We contribute to the se- mantics of typed object calculus by giving (a) a denotational semantics using partial maps making use of an algebraic compactness assumption on the ambient category, (b) a no- tion of “wrappers” by which algebraic datatypes can be represented as object types, and (c) proofs of computational soundness and adequacy of typed object calculus via Plotkin’s FPC (with lazy operational semantics), thus making every denotational model of FPC (with these properties) a computationally adequate model also for a first-order typed object cal- culus (with recursive objects supporting method update, but not subtyping). In this way, we give a mathematical foundation for studying program algebras for object-based program- ming languages, since a valid equation in the model is proved to induce operationally con- gruent terms in the language. For (c), we also develop a variation of Abadi and Cardelli’s first-order typed object calculus with recursive object types and sum types (and some other extensions), and prove subject reduction for this calculus. (ii) The second part concerns recursion principles on datatypes including the untyped lambda calculus as a special case. Freyd showed that in certain domain theoretic categories, locally continuous functors have minimal invariants which possess a structure that he termed dialgebra. This gives rise to a category of dialgebras and homomorphisms, where the minimal invariants are initial, in- ducing a powerful recursion scheme (direcursion) on a complete partial order. We identify a problem that appears when (co)iterative functions (on a fixed parameterised datatype) are translated to direcursion (on the same datatype), and as a solution to this problem we present a recursion scheme (primitive direcursion), generalising and symmetrising primi- tive (co)recursion for endofunctors. To this end, we give a uniform technique for translating (co)iterative maps into direcursive maps. This immediately gives a plethora of examples of direcursive functions, improving on the situation in the literature where only a few ex- amples have appeared. Moreover, an ad-hoc solution proposed elsewhere is avoided for the translated maps, while interesting new examples appear (bisimulations, higher-order coalgebra), also in the context of models of typed object calculus. Contents Contents v Acknowledgements . vii 1 Introduction 1 1.1 Aims . 6 1.2 Related Work . 7 1.3 Contributions . 19 1.4 Overview . 20 2 Categories and Domains 23 2.1 Categories . 23 2.2 Limits and Colimits . 40 2.3 Recursion and Corecursion . 49 2.4 Domain Theory . 57 3 Paper I: Difunctorial Semantics 65 1 Introduction . 68 2 Mathematical Preliminaries . 69 3 Object Calculus . 72 4 Difunctorial Semantics . 74 5 Wrapper Classes . 78 6 Conclusion and Further Work . 80 4 Paper II: Computational Soundness and Adequacy 85 1 Introduction . 88 2 Typed Object Calculus with Recursive Objects . 89 3 FPC . 99 4 Translating Object Calculus into FPC . 100 v vi CONTENTS 5 Soundness and Adequacy . 104 6 Conclusion and Further Work . 109 5 Paper III: Primitive Direcursion vs. Parametric (Co)Iteration 113 1 Introduction . 116 2 Mathematical Preliminaries . 117 3 Primitive Direcursion . 123 4 Example: Application to Object Calculus Semantics . 133 5 Conclusion and Further Work . 140 6 Concluding Remarks 145 Bibliography 157 vii Acknowledgements First and foremost, I would like to thank my supervisor Karl Meinke, my depart- ment, and Stockholm University for taking me on as a PhD student and for funding and supporting my research. I am also most grateful to my coauthor Neil Ghani for many enligthening discussions, for his wit and personal qualities and for his friendship. I am equally grateful to Faron Moller, who introduced me to com- puter science research and whose advice and encouragement I value greatly, and to Bjorn¨ Lisper for his support and advice throughout the years. I am also indebted to Viggo Stoltenberg-Hansen for his courses in logic and domain theory in Uppsala, for many helpful discussions and for the interest he has shown in my work. Over the years, I have had the opportunity to visit researchers in different parts of the world. I am grateful for their hospitality, encouragement and openhanded support. The suggestions I have received on those occasions, and the many award- ing discussions, have greatly influenced and improved my work, and sometimes pointed me in new directions. Here I want to particularly mention: Ralph Back, Roland Backhouse, Marcelo Fiore, Andy Gordon, Furio Honsell, Graham Hutton, Patrik Jansson, Achim Jung, Marina Lenisa, Rasmus Møgelberg, Andy Pitts, Gor- don Plotkin, John Power, Horst Reichel, Bernhard Reus, Alex Simpson, Hendrik Tews, Tarmu Uustalu and Varmo Vene. I am also grateful to Mart´ın Abadi, Vi- viana Bono, Luca Cardelli, Benjamin Pierce, Ramesh Viswanathan, among others, for helpful correspondence. It has also been a privilege to get to know many of the people in the Uppsala-Stockholm logic group, researchers at the IT department in Uppsala and the colleagues at KTH/SU. During the work on this thesis, I have received financial support from Lennander’s foundation at Uppsala University, Wallenberg foundations, as well as scholarships from Stockholm University. They are hereby gratefully acknowledged. Last but not least, I am grateful for the support of my friends and family, who are important well beyond this thesis. I am particularly thankful to my sister Ida for proof-reading sections of an earlier version of the text, and to my parents for their unfailing support. And to Pia, thank you for your love. Chapter 1 Introduction This thesis concerns the denotational semantics approach to the semantics of pro- gramming languages. This approach is based on assigning elements in suitable mathematical structures to the various language constructions. To this end, we will be interested in object-based programming languages, a class of program- ming languages based on entities known as objects, which consist of a family of self-referential methods acting on the object. These objects compute in response to method invocation or method update. The former stimulus is similar to function evaluation, but there is no argument or input, as the evaluation is with respect to the present self of the object, which provides a local state for the computations be- ing carried out. Method update makes change possible, and a sequence of method updates and method invocations together give the ability to simulate in particular purely functional programs, so that any partial recursive function can be repre- sented solely by objects. Moreover, the popular
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages188 Page
-
File Size-