IT training domain theoretic foundations of functional programming streicher 2006 12 04

132 47 0
IT training domain theoretic foundations of functional programming streicher 2006 12 04

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

DOMAIN-THEORETIC FOUNDATIONS OF FUNCTIONAL PROGRAMMING Thomas Streicher DOMAIN-THEORETIC FOUNDATIONS OF FUNCTIONAL PROGRAMMING DOMAIN-THEORETIC FOUNDATIONS OF FUNCTIONAL PROGRAMMING Technical University Darmstadt, Germany 1t» World Scientific NEW ,JERSEY LONDON· SINGAPORE· BEIJING· SHANGHAI· HONG KONG· TAIPEI· CHENNAI Published by World Scientific Publishing Co Pte Ltd Toh Tuck Link, Singapore 596224 USA office: 27 Warren Street, Suite 401-402, Hackensack, NJ 07601 UK office: 57 Shelton Street, Covent Garden, London WC2H 9HE British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library DOMAIN-THEORETIC FOUNDATIONS OF FUNCTIONAL PROGRAMMING Copyright © 2006 by World Scientific Publishing Co Pte Ltd All rights reserved This book, or parts thereof, may not be reproduced in any form or by any means, electronic or mechanical, including photocopying, recording or any information storage and retrieval system now known or to be invented, without written permission from the Publisher For photocopying of material in this volume, please pay a copying fee through the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, USA In this case permission to photocopy is not required from the publisher ISBN 981-270-142-7 Printed in Singapore by World Scientific Printers (S) Pte Ltd dedicated to Dana Scott and Gordon Plotkin who invented domain theory and logical relations Contents Preface ix Introduction PCF and its Operational Semantics 13 The Scott Model of PCF 23 3.1 Basic Domain Theory 3.2 Domain Model of PCF 3.3 LCF - A Logic of Computable Functionals 25 32 34 Computational Adequacy 37 Milner's Context Lemma 43 The Full Abstraction Problem 45 Logical Relations 51 Some Structural Properties of the Da 57 Solutions of Recursive Domain Equations 65 10 Characterisation of Fully Abstract Models vii 77 viii Domain-Theoretic Foundations of Functional Programming 11 Sequential Domains as a Model of PCF 87 12 The Model of PCF in S is Fully Abstract 95 13 Computability in Domains 99 Bibliography 117 Index 119 Preface This little book is the outcome of a course I have given over the last ten years at the Technical University Darmstadt for students of Mathematics and Computer Science The aim of this course is to provide a solid basis for students who want to write their Masters Thesis in the field of Denotational Semantics or want to start a PhD in this field For the latter purpose it has been used successfully also at the Univ of Birmingham (UK) by the students of Martin Escardo Thus I think this booklet serves well the purpose of filling the gap between introductory textbooks like e.g [Winskel 1993] and the many research articles in the area of Denotational Semantics Intentionally I have concentrated on denotational semantics based on Domain Theory and neglected the more recent and flourishing field of Game Semantics (see [Hyland and Ong 2000; Abramsky et.al 2000]) which in a sense is located in between Operational and Denotational Semantics The reason for this choice is that on the one hand Game Semantics is covered well in [McCusker 1998] and on the other hand I find domain based semantics mathematically simpler than competing approaches since its nature is more abstract and less combinatorial Certainly this preference is somewhat subjective but my excuse is that I think one should write books rather about subjects which one knows quite well than about subjects with which one is less familiar We develop our subject by studying the properties of the well known functional kernel language PCF introduced by D Scott in the late 1960ies The scene is set in Chapters and where we introduce the operational and domain semantics of PCF, respectively Subsequently we concentrate on studying the relation between operational and domain semantics employing more and more refined logical relation techniques culminating in the construction of the fully abstract model for PCF in Chapters 11 and ix Computability in Domains 107 and a PCF+ term N denoting terras M; denoting [ej,0] for i=l, ,k |_|F e \{[ei, ,e fe ,n]} Then e = \JFe is denoted by the P C F + term A/i:Nx] -> Nj with (0 t//(±)=0 V(/) = ^ if f(n) = for some n € N I, _L otherwise is definable in P C F + + Proof Let swap be a PCF term of type i—>u with (0 swap(x) = < l, x if x = if x = otherwise Then the P C F + + term A/:t—>t swap(3(Aa;:i swap(/(x)))) denotes V D 108 Domain-Theoretic Foundations of Functional Programming Moreover, we will employ the following extension of ifz and the parallel conditional to arbitrary types a = cri—> —>afc—»t : if M is of type i and N\ and N2 are of type a (relative to some typing context) then we write ifz(M, Ni,N2) as a shorthand for Axi:O-^>O, upCT : t—H—> [N—>£] defined as N /n(«) = { {k € K | k < n} ifu = T otherwise Obviously, each /„ is sequential and computable as it can be implemented e.g by an obvious ML program of type unit—>nat—>unit The sequence (/n)n€N is effective and ascending w.r.t the extensional order but, nevertheless, its limit / = |_l /n as given by JN ifu = T \ K otherwise T h u s , in case of the effective Scott model, i.e higher type computability in the sense of recursion theory, higher types are just a "figure of speech" because they can all be simulated within t—»t, i.e the partial recursive functions (together with all constant functions) Nevertheless, higher types are very convenient from a "stylistic" point of view 112 Domain-Theoretic Foundations of Functional Programming is not sequentially computable since f(u)(n) =T iff neKVu=T and the right hand side obviously requires parallel evaluation Thus, for sequential domains the computable elements are not closed under suprema of effective chains of effective elements However, via realizability one may construct universal models for sequential languages (even with recursive types), see [Rohr 2002].7 But for the stable model of PCF (see [Amadio and Curien 1998]) a notion computability has been successfully developed by A Asperti in [Asperti 1990] This is possible because the sequence (/ n ) n eN considered above is not increasing w.r.t the stable ordering We conclude this chapter with some more recursion theoretic considerations Principal Numberings and the Myhill-Shepherdson Theorem For an effectively given domain we will define a notion of principal numbering of Comp(£>, e) which in a certain sense will be optimal For this purpose recall the Godel numbering W of r.e sets of natural numbers where We = {n e N | {e}(n)|} see e.g [Rogers 1987] Definition 13.15 (principal numbering) Let (D, s) be an effectively given domain A principal numbering of (D, s) is a surjective function £ : N —> Comp(£>,e) such that there exist total recursive functions / and g satisfying the conditions (CI) W)(n) = {k e N I ek Q C(n)} (£2) C(g(n)) = |_|e[Wn] whenever e[Wn] is directed See also John Longley's treatise [Longley 2002] on Sequentially Realizable Functionals where he constructs a universal model for P C F + i f where H is a non-order-extensional but sequential constant of type having a somewhat complicated operational semantics Longley's sequentially realizable functionals are equivalent to the extensional collapse of Curien's Sequential Algorithms (see [Amadio and Curien 1998]) providing a nonextensional model for P C F But notice that this notion of sequentiality is more liberal than the one arising from P C F definability as studied in this book Computability in Domains 113 A computable numbering is a surjective map v : N -» Comp(D,£) for which there exists a total recursive function h with Wh(n) = {k £ N | Sk E K n ) } for all n £ N Obviously, for every computable numbering v of Comp(D, e) there exists a total recursive function t with £o£ = v (namely t = goh) On computable numberings one may consider the following preorder v\ < v-i iff there exists a total recursive h with vT(n, n, k)} g cf the admissible numberings of partial recursive functions as introduced and studied in [Rogers 1987] 114 Domain-Theoretic Foundations of Functional Programming where T is Kleene's T-predicate (see e.g [Rogers 1987]) Obviously, for every n £ N the set £[Wfc(n)] is a chain in D and thus its supremum is Cg(h(n))- Now for all n £ N we have {n}^)^ iflF |_|£[^//i(n)] = d, i.e n

Ngày đăng: 05/11/2019, 14:09

Mục lục

  • Contents

  • Preface

  • 1. Introduction

  • 2. PCF and its Operational Semantics

  • 3. The Scott Model of PCF

    • 3.1 Basic Domain Theory

    • 3.2 Domain Model of PCF

    • 3.3 LCF - A Logic of Computable Functionals

    • 4. Computational Adequacy

    • 5. Milner's Context Lemma

    • 6. The Full Abstraction Problem

    • 7. Logical Relations

    • 8. Some Structural Properties of the Dσ

    • 9. Solutions of Recursive Domain Equations

    • 10. Characterisation of Fully Abstract Models

    • 11. Sequential Domains as a Model of PCF

    • 12. The Model of PCF in S is Fully Abstract

    • 13. Computability in Domains

    • Bibliography

    • Index

Tài liệu cùng người dùng

Tài liệu liên quan