Domain Theory Corrected and Expanded Version Samson Abramsky1 and Achim Jung2
Total Page:16
File Type:pdf, Size:1020Kb
Domain Theory Corrected and expanded version Samson Abramsky1 and Achim Jung2 This text is based on the chapter Domain Theory in the Handbook for Logic in Computer Science, volume 3, edited by S. Abramsky, Dov M. Gabbay, and T. S. E. Maibaum, published by Clarendon Press, Oxford in 1994. While the numbering of all theorems and definitions has been kept the same, we have included comments and corrections which we have received over the years. For ease of reading, small typo- graphical errors have simply been corrected. Where we felt the original text gave a misleading impression, we have included additional explanations, clearly marked as such. If you wish to refer to this text, then please cite the published original version where possible, or otherwise this on-line version which we try to keep available from the page http://www.cs.bham.ac.uk/∼axj/papers.html We will be grateful to receive further comments or suggestions. Please send them to [email protected] So far, we have received comments and/or corrections from Francesco Consentino, Joseph D. Darcy, Mohamed El-Zawawy, Weng Kin Ho, Klaus Keimel, Olaf Klinke, Xuhui Li, Homeira Pajoohesh, Dieter Spreen, and Dominic van der Zypen. 1Computing Laboratory, University of Oxford, Wolfson Building, Parks Road, Oxford, OX1 3QD, Eng- land. 2School of Computer Science, University of Birmingham, Edgbaston, Birmingham, B15 2TT, England. Contents 1 Introduction and Overview 5 1.1 Origins ................................. 5 1.2 Ourapproach .............................. 7 1.3 Overview ................................ 7 2 Domains individually 10 2.1 Convergence .............................. 10 2.1.1 Posetsandpreorders .. .... .... ... .... .... 10 2.1.2 Notation from order theory . 11 2.1.3 Monotonefunctions ...................... 13 2.1.4 Directedsets .......................... 13 2.1.5 Directed-complete partial orders . 14 2.1.6 Continuous functions . 15 2.2 Approximation ............................. 17 2.2.1 Theorderofapproximation . 18 2.2.2 Basesindcpo’s......................... 18 2.2.3 Continuous and algebraic domains . 19 2.2.4 Comments on possible variations . 22 2.2.5 Usefulproperties ........................ 24 2.2.6 Basesasobjects......................... 25 2.3 Topology ................................ 29 2.3.1 The Scott-topology on a dcpo . 29 2.3.2 The Scott-topology on domains . 30 3 Domains collectively 34 3.1 Comparingdomains........................... 34 3.1.1 Retractions . 34 3.1.2 Idempotents........................... 35 3.1.3 Adjunctions........................... 36 3.1.4 Projections and sub-domains . 39 3.1.5 Closures and quotient domains . 40 3.2 Finitary constructions . 41 3.2.1 Cartesianproduct........................ 42 3.2.2 Functionspace ......................... 43 3.2.3 Coalescedsum ......................... 44 3.2.4 Smashproductandstrictfunctionspace . 45 3.2.5 Lifting ............................. 45 3.2.6 Summary............................ 45 3.3 Infinitary constructions . 46 3.3.1 Limits and colimits . 46 3.3.2 The limit-colimit coincidence . 47 3.3.3 Bilimits of domains . 51 2 4 Cartesian closed categories of domains 54 4.1 Local uniqueness: Lattice-like domains . 55 4.2 Finite choice: Compact domains . 57 4.2.1 Bifinite domains . 57 4.2.2 FS-domains........................... 60 4.2.3 Coherence ........................... 61 4.3 Thehierarchyofcategoriesofdomains. 63 4.3.1 Domains with least element . 63 4.3.2 Domains without least element . 65 5 Recursive domain equations 68 5.1 Examples ................................ 68 5.1.1 Genuineequations ....................... 68 5.1.2 Recursive definitions . 68 5.1.3 Datatypes............................ 69 5.2 Construction of solutions . 70 5.2.1 Continuousfunctors ...................... 70 5.2.2 Local continuity . 71 5.2.3 Parameterized equations . 73 5.3 Canonicity................................ 74 5.3.1 Invariance and minimality . 74 5.3.2 Initiality and finality . 76 5.3.3 Mixedvariance......................... 77 5.4 Analysis of solutions . 79 5.4.1 Structural induction on terms . 79 5.4.2 Admissible relations . 80 5.4.3 Induction with admissible relations . 81 5.4.4 Co-induction with admissible relations . 82 6 Equational theories 85 6.1 Generaltechniques ........................... 85 6.1.1 Freedcpo-algebras ... .... .... ... .... .... 85 6.1.2 Freecontinuousdomain-algebras . 87 6.1.3 Least elements and strict algebras . 92 6.2 Powerdomains.............................. 93 6.2.1 The convex or Plotkin powerdomain . 93 6.2.2 One-sidedpowerdomains. 96 6.2.3 Topological representation theorems . 97 6.2.4 Hyperspaces and probabilistic powerdomains . 103 7 Domains and logic 106 7.1 Stone duality . 106 7.1.1 Approximation and distributivity . 106 7.1.2 From spaces to lattices . 109 7.1.3 From lattices to topological spaces . 110 7.1.4 The basic adjunction . 111 3 7.2 Someequivalences ........................... 112 7.2.1 Sober spaces and spatial lattices . 112 7.2.2 Propertiesofsoberspaces . 114 7.2.3 Locally compact spaces and continuous lattices . 116 7.2.4 Coherence ........................... 117 7.2.5 Compact-opensetsandspectralspaces . 117 7.2.6 Domains ............................ 119 7.2.7 Summary ............................ 121 7.3 Thelogicalviewpoint.......................... 121 7.3.1 Working with lattices of compact-open subsets . 121 7.3.2 Constructions: The general technique . 126 7.3.3 The function space construction . 130 7.3.4 The Plotkin powerlocale . 132 7.3.5 Recursive domain equations . 136 7.3.6 Languages for types, properties, and points . 137 8 Further directions 145 8.1 Further topics in “Classical Domain Theory” . 145 8.1.1 Effectivelygivendomains . 145 8.1.2 UniversalDomains . 145 8.1.3 Domain-theoretic semantics of polymorphism . 146 8.1.4 InformationSystems . 146 8.2 Stability and Sequentiality . 147 8.3 Reformulations of Domain Theory . 147 8.3.1 Predomains and partial functions . 148 8.3.2 ComputationalMonads. 148 8.3.3 LinearTypes .......................... 149 8.4 Axiomatic Domain Theory . 150 8.5 SyntheticDomainTheory. 151 9 Guide to the literature 152 References 153 Index 165 4 1 Introduction and Overview 1.1 Origins Let us begin with the problems which gave rise to Domain Theory: 1. Least fixpoints as meanings of recursive definitions. Recursive definitions of procedures, data structures and other computational entities abound in program- ming languages. Indeed, recursion is the basic effective mechanism for describ- ing infinite computational behaviour in finite terms. Given a recursive definition: X = ...X... (1) How can we give a non-circular account of its meaning? Suppose we are work- ing inside some mathematical structure D. We want to find an element d ∈ D such that substituting d for x in (1) yields a valid equation. The right-hand-side of (1) can be read as a function of X, semantically as f : D → D. We can now see that we are asking for an element d ∈ D such that d = f(d)—that is, for a fixpoint of f. Moreover, we want a uniform canonical method for constructing such fixpoints for arbitrary structures D and functions f : D → D within our framework. Elementary considerations show that the usual categories of math- ematical structures either fail to meet this requirement at all (sets, topological spaces) or meet it in a trivial fashion (groups, vector spaces). 2. Recursive domain equations. Apart from recursive definitions of computa- tional objects, programming languages also abound, explicitly or implicitly, in recursive definitions of datatypes. The classical example is the type-free λ- calculus [Bar84]. To give a mathematical semantics for the λ-calculus is to find a mathematical structure D such that terms of the λ-calculus can be interpreted as elements of D in such a way that application in the calculus is interpreted by function application. Now consider the self-application term λx.xx. By the usual condition for type-compatibility of a function with its argument, we see that if the second occurrence of x in xx has type D, and the whole term xx has type D, then the first occurrence must have, or be construable as having, type [D −→ D]. Thus we are led to the requirement that we have [D −→ D] =∼ D. If we view [. −→ .] as a functor F : Cop × C → C over a suitable category C of mathematical structures, then we are looking for a fixpoint D =∼ F (D, D). Thus recursive datatypes again lead to a requirement for fixpoints, but now lifted to the functorial level. Again we want such fixpoints to exist uniformly and canonically. This second requirement is even further beyond the realms of ordinary mathemati- cal experience than the first. Collectively, they call for a novel mathematical theory to serve as a foundation for the semantics of programming languages. 5 A first step towards Domain Theory is the familiar result that every monotone function on a complete lattice, or more generally on a directed-complete partial or- der with least element, has a least fixpoint. (For an account of the history of this result, see [LNS82].) Some early uses of this result in the context of formal lan- guage theory were [Ard60, GR62]. It had also found applications in recursion theory [Kle52, Pla64]. Its application to the semantics of first-order recursion equations and flowcharts was already well-established among Computer Scientists by the end of the 1960’s [dBS69, Bek69, Bek71, Par69]. But Domain Theory proper, at least as we un- derstand the term, began in 1969, and was unambiguously the creation of one man, Dana Scott [Sco69, Sco70, Sco71, Sco72, Sco93]. In particular, the following key insights can be identified in his work: 1. Domains as types. The fact that suitable categories of domains are cartesian closed, and hence give rise to models of typed λ-calculi. More generally, that domains give mathematical meaning to a broad class of data-structuring mecha- nisms. 2. Recursive types. Scott’s key construction was a solution to the “domain equa- tion” D =∼ [D −→ D] thus giving the first mathematical model of the type-free λ-calculus. This led to a general theory of solutions of recursive domain equations. In conjunction with (1), this showed that domains form a suitable universe for the semantics of programming languages.