TYPED LAMBDA CALCULUS Volume I: Λ Λa= Λs Henk Barendregt Wil

TYPED LAMBDA CALCULUS Volume I: Λ Λa= Λs Henk Barendregt Wil

TYPED LAMBDA CALCULUS λA λ λ Volume I: =A S → ∩ Henk Barendregt Wil Dekkers Richard Statman Version: August 21, 2006 2 Preface DRAFT. DO NOT DISTRIBUTE. Bla bla. yghbkjhbkn. And we love our women. Nijmegen and Pittsburgh August 21, 2006 Henk Barendregt1,2 Wil Dekkers1 Rick Statman2 1Faculty of Mathematics and Computer Science Catholic University Nijmegen, The Netherlands 2Departments of Mathematics and Computer Science Carnegie Mellon University Pittsburgh, USA 3 4 Overture This book about typed lambda terms comes in two volumes: the present one about lambda terms typed using simple, recursive and intersection types and a planned second volume about higher order, dependent and inductive types. In some sense this book is a sequel to Barendregt [1984]. That book is about untyped lambda calculus. Types give the untyped terms more structure: function applications are allowed only in some cases. In this way one can single out untyped terms having special properties. But there is more to it. The extra structure makes the theory of typed terms quite different from the untyped ones. The emphasis of the book is on syntax. Models are introduced only in so far they give useful information about terms and types or if the theory can be applied to them. The writing of the book has been different from that about the untyped lambda calculus. First of all, since many researchers are working on typed lambda calculus, we were aiming at a moving target. Also there was a wealth of material to work with. For these reasons the book has been written by several authors. Several long-term open problems had been solved during the interval these volumes were written, notably the undecidability of lambda definability in finite models, the undecidability of second order typability, the decidability of the unique maximal theory extending βη-conversion and the fact that the collection of closed terms of not every simple type is finitely generated. (One of the remaining open problems is the decidability of matching at arbitrary types higher than order 4.) The book is not written as an encyclopedic volume: many topics are only partially treated. For example reducibility among types is analized for simple types built up from only one atom. One of the recurring distinctions made in the two volumes is the difference between the implicit typing due to Curry versus the explicit typing due to Church. In the latter case the terms are an enhanced version of the untyped terms, whereas in the Curry theory to some of the untyped terms a collection of types is being assigned. Volume I is mainly about Curry typing, although Part I of it we also treat the for simple types equivalent Church variant in parallel. The applications of the theory are either within the theory itself, in the theory of programming languages, in proof theory, including the technology of fully formalized proofs used for mechanical verification, or in linguistics. Often the applications are given in an exercise with hints. We hope that the volumes will inspire readers to pursue the topic. Contributors Fabio Alessi Part III, except 16.3 § Henk Barendregt All parts, except 5.3, 5.4, 5.5 §§ Marc Bezem 5.3, 5.4, 5.5 §§ Felice Cardone Part II Mario Coppo Part II Wil Dekkers Parts II, III Mariangiola Dezani-Ciancaglini Part III, except 16.3 § Gilles Dowek Chapter 4 Silvia Ghilezan 6.2 § Furio Honsell Part III, except 16.3 § Michael Moortgat 6.4 § Richard Statman Parts I, II Pawe lUrzyczyn 16.3 § 5 6 Contents in short λA Part I Simple Types → 11 1 The systems λ→ ................................ 15 2 Properties.................................... 45 3 Tools....................................... 79 4 UnificationandMatching ...........................139 5 Extensions....................................171 6 Applications...................................233 7 Furtherreading.................................253 λA Part II Recursive Types = 255 8 Basicconcepts .................................259 9 Propertiesofrecursivetypes. 289 10 Propertiesoftermswithtypes . 311 11 Models......................................327 12 Applications...................................357 13 FurtherReading ................................365 λSS Part III Intersection types ∩ 367 14 Anexemplarysystem .............................371 15 The systems λ ...............................381 →∩ 16 Basicproperties.................................397 17 Type Structures and Lambda Structures . 429 18 Models......................................475 19 Applications ..................................505 20 FurtherReadings................................539 Indices 543 Indexofnames ....................................543 Indexofdefinitions.................................. 543 Indexofnotations ..................................543 References 543 Contents I Simple types λ→ 20.8.2006:919 9 1 The systems λ→ 13 1.1 The λ→ systems `ala Curry .......................... 13 1.2 Normalinhabitants............................... 21 1.3 Representingdatatypes . 26 1.4 The λ→ systems `ala Curry, `ala Church and `ala deBruijn. 37 1.5 Exercises .................................... 44 2 Properties 49 2.1 Firstproperties................................. 49 2.2 Proofsofstrongnormalization . 59 2.3 Checkingandfindingtypes . 62 2.4 Findinginhabitants. .. .. .. .. .. .. .. 70 2.5 Exercises .................................... 78 3 Tools 85 3.1 TypedlambdaModels ............................. 85 3.2 LambdaTheoriesandTermModels . 93 3.3 Syntactic and Semantic logical relations . ....... 99 3.4 Typereducibility ................................ 113 3.5 Thefivecanonicalterm-models . 128 3.6 Exercises ....................................143 4 Definability, Unification and Matching 151 4.1 Undecidability of lambda definability . 151 4.2 UndecidabilityofUnification . 162 4.3 Decidabilityofmatchingofrank3 . 167 4.4 Decidabilityofthemaximaltheory . 180 4.5 Exercises ....................................185 5 Extensions 191 5.1 Lambdadelta..................................191 5.2 Surjective pairing 20.8.2006:919 ..........................202 7 8 CONTENTS 5.3 G¨odel’s system : higher-order primitive recursion . 224 T 5.4 Spector’s system :barrecursion. .240 B 5.5 Platek’s system : fixedpointrecursion . .249 Y 5.6 Exercises ....................................252 6 Applications 257 6.1 Functionalprogramming. 257 6.2 Logicandproof-checking. 258 6.3 Prooftheory ..................................266 6.4 Grammars,termsandtypes . 276 7 Further Reading 289 Part I Simple types λ 21.8.2006:951 → 9 11 Lambda calculus is worth studying, because it is a simple formal system that provides a model of computation with a distinctive quality. At first its expressions represent both a program and its data which on their turn evolve by simple rules (β and η-reduction) to instantaneous descriptions of intermediate computational results possibly ending in output. These features, however, are also present in Term Rewriting Systems. Lambda calculus has two extra qualities setting it apart from these other Rewriting Systems. Firstly it is applicative, in that an expression may be applied to another expression, giving them the possibility to act both as function and as argument. Secondly, Lambda Calculus has abstraction built in, meaning that the expressions are closed under explicit definitions. Lambda calculus as model of computation can be introduced in an untyped fashion: arbitrary expressions may be applied to each other. A similarly flat approach to computing was present in the early assembly languages. Later in imperative programming languages types were introduced to keep order among the code. Exactly the same use of types happened even earlier with lambda calculus as model of computation. Types from a very partial specification of what a program does. In this sense types are somewhat comparable to dimensions in physics that provide—on the basis of meaning—an order in the wealth of quantitative notations. There are certain basic dimensions, like g (gram), m (meter) and s (second) and other dimensions can be expressed using these. The systems of simple types considered in Part I are built up from atomic types A using as only operator the constructor of forming function spaces. For example, from → the atoms A = α,β one can form types α β, (α β) α, α (α β) and so on. Two { } → → → → → choices of the set of atoms will be made most often are A = α , α , α ,... , an infinite { 0 1 2 } set of type variables, and A = o , consisting of only one atomic type. Particular atomic { } types that occur in applications are e.g. Bool, Nat, Real. Even for these simple type systems, the ordering effect is quite powerful. As a short anthology of what is going to come in Part I we state the following. For an untyped lambda term one can find the collection of its possible types. Similarly, given a simple type, one can find the collection of its possible inhabitants (in normal form). Equality of terms of a certain type can be reduced to equality of terms in a fixed type. The problem of unification X:A.MX =βη NX ∃ is for complex enough A undecidable. That of pattern matching X:A.MX =βη N ∃ will turn out to be decidable for A simple enough. It is open if this also holds for arbitrary types. The terms of finite type are extended by δ-functions, functionals for primitive and bar recursion. Applications of the theory in computing, proof-checking and linguistics will be discussed. 12 Chapter 1 The systems λ → 1.1. The λ→ systems `ala Curry Types in this part are syntactic objects built from atomic types using the operator . → In order to classify untyped

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    301 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us