Jean-Louis Krivine LAMBDA-CALCULUS TYPES AND MODELS Translated from french by René Cori To my daughter Contents Introduction5 1 Substitution and beta-conversion7 Simple substitution ..............................8 Alpha-equivalence and substitution ..................... 12 Beta-conversion ................................ 18 Eta-conversion ................................. 24 2 Representation of recursive functions 29 Head normal forms .............................. 29 Representable functions ............................ 31 Fixed point combinators ........................... 34 The second fixed point theorem ....................... 37 3 Intersection type systems 41 System D­ ................................... 41 System D .................................... 50 Typings for normal terms ........................... 54 4 Normalization and standardization 61 Typings for normalizable terms ........................ 61 Strong normalization ............................. 68 ¯I-reduction ................................. 70 The ¸I-calculus ................................ 72 ¯´-reduction ................................. 74 The finite developments theorem ....................... 77 The standardization theorem ......................... 81 5 The Böhm theorem 87 3 4 CONTENTS 6 Combinatory logic 95 Combinatory algebras ............................. 95 Extensionality axioms ............................. 98 Curry’s equations ............................... 101 Translation of ¸-calculus ........................... 105 7 Models of lambda-calculus 111 Functional models ............................... 111 Spaces of continuous increasing functions .................. 116 Spaces of initial segments ........................... 117 Applications .................................. 125 Retractions ................................... 130 Qualitative domains and stable functions .................. 134 8 System F 145 Definition of system F types ......................... 145 Typing rules for system F ........................... 146 The strong normalization theorem ...................... 150 Data types in system F ............................ 153 Positive second order quantifiers ....................... 159 9 Second order functional arithmetic 165 Second order predicate calculus ....................... 165 System FA2 ................................... 172 Realizability .................................. 179 Data types ................................... 182 Programming in FA2 .............................. 185 10 Representable functions in system F 193 Gödel’s -translation ............................. 196 : Undecidability of strong normalization .................... 199 Bibliography 203 INTRODUCTION The lambda-calculus was invented in the early 1930’s, by A. Church, and has been considerably developed since then. This book is an introduction to some aspects of the theory today : pure lambda-calculus, combinatory logic, seman- tics (models) of lambda-calculus, type systems. All these areas will be dealt with, only partially, of course, but in such a way, I think, as to illustrate their interdependence, and the essential unity of the subject. No specific knowledge is required from the reader, but some familiarity with mathematical logic is expected ; in chapter 2, the concept of recursive function is used ; parts of chapters 6 and 7, as well as chapter 9, involve elementary topics in predicate calculus and model theory. For about fifteen years, the typed lambda-calculus has provoked a great deal of interest, because of its close connections with programming languages, and of the link that it establishes between the concept of program and that of in- tuitionistic proof : this is known as the “ Curry-Howard correspondence ”. Af- ter the first type system, which was Curry’s, many others appeared : for ex- ample, de Bruijn’s Automath system, Girard’s system F , Martin-Löf’s theory of intuitionistic types, Coquand-Huet’s theory of constructions, Constable’s Nuprl system... This book will first introduce Coppo and Dezani’s intersection type system. Here it will be called “ system D­ ”, and will be used to prove some fundamen- tal theorems of pure lambda-calculus. It is also connected with denotational semantics : in Engeler and Scott’s models, the interpretation of a term is essen- tially the set of its types. Next, Girard’s system F of second order types will be considered, together with a simple extension, denoted by FA2 (second order functional arithmetic). These types have a very transparent logical structure, and a great expressive power. They allow the Curry-Howard correspondence to be seen clearly, as well as the possibilities, and the difficulties, of using these systems as programming languages. A programming language is a tool for writing a program in machine lan- guage (which is called the object code), in such a way as to keep control, as far as possible, on what will be done during its execution. To do so, the primi- 5 6 Lambda-calculus, types and models tive method would be to write directly, in one column, machine language, and, alongside, comments indicating what the corresponding instructions are sup- posed to do. The result of this is called a “ source program ”. Here, the aim of the “ compilation ”, which transforms the source program into an object code, will be to get rid of the comments. Such a language is said to be primitive, or “ low level ”, because the com- puter does not deal with the comments at all ; they are entirely intended for the programmer. In a higher level language, part of these comments would be checked by the computer, and the remainder left for the programmer ; the “ mechanized ” part of the comments is then called a “ typing ”. A language is considered high level if the type system is rich. In such a case, the aim of the compilation would be, first of all, to check the types, then, as before, to get rid of them, along with the rest of the comments. The typed lambda-calculus can be used as a mathematical model for this situation ; the role of the machine language is played by the pure lambda- calculus. The type systems that are then considered are, in general, much more rich than those of the actual programming languages ; in fact, the types could almost be complete specifications of the programs, while the type checking (compilation) would be a “ program proof ”. These remarks are sufficient to ex- plain the great interest there would be in constructing a programming language based on typed lambda-calculus ; but the problems, theoretical and practical, of such an enterprise are far from being fully resolved. This book is the product of a D.E.A. (postgraduate) course at the University of Paris 7. I would like to thank the students and researchers of the “ Equipe de Logique ” of Paris 7, for their comments and their contributions to the early versions of the manuscript, in particular Marouan Ajlani, René Cori, Jean-Yves Girard and Michel Parigot. Finally, it gives me much pleasure to dedicate this book to my daughter Sonia. Paris, 1990 I want to thank also Darij Grinberg and Robert Solovay, who have corrected errors in the proofs of corollary 1.3 and theorem 7.16. Paris, 2011 Chapter 1 Substitution and beta-conversion The terms of the ¸-calculus (also called ¸-terms) are finite sequences formed with the following symbols : variables x, y,... (the set of variables is assumed to be countable), left and right parenthesis, and the letter ¸. They are obtained by applying, a finite number of times, the following rules : any variable x is a ¸-term ; ² whenever t and u are ¸-terms, then so is (t)u ; ² whenever t is a ¸-term and x is a variable, then ¸x t is a ¸-term. ² The set of all terms of the ¸-calculus will be denoted by L. The term (t)u should be thought of as “ t applied to u ” ; it will also be denoted by tu if there is no ambiguity ; the term (...(((t)u1)u2)...)uk will also be written (t)u1u2 ...uk or tu1u2 ...uk . Thus, for example, (t)uv,(tu)v and tuv denote the same term. By convention, when k 0, (t)u u ...u will denote the term t. Æ 1 2 k The free occurrences of a variable x in a term t are defined, by induction, as follows : if t is the variable x, then the occurrence of x in t is free ; if t (u)v, then the free occurrences of x in t are those of x in u and Æ v ; if t ¸y u, the free occurrences of x in t are those of x in u, except Æ if x y ; in that case, no occurrence of x in t is free. Æ A free variable in t is a variable which has at least one free occurrence in t. A term which has no free variable is called a closed term. A bound variable in t is a variable which occurs in t just after the symbol ¸. 7 8 Lambda-calculus, types and models 1. Simple substitution Let t,t1,...,tk be terms and x1,...,xk distinct variables ; we define the term t t /x ,...,t /x as the result of the replacement of every free occurrence of Ç 1 1 k k È x in t by t (1 i k). The definition is by induction on t, as follows : i i · · if t x (1 i k), then t t /x ,...,t /x t ; Æ i · · Ç 1 1 k k ÈÆ i if t is a variable x ,...,x , then t t /x ,...,t /x t ; 6Æ 1 k Ç 1 1 k k ÈÆ if t (u)v, then Æ t t /x ,...,t /x (u t /x ,...,t /x )v t /x ,...,t /x ; Ç 1 1 k k ÈÆ Ç 1 1 k k È Ç 1 1 k k È if t ¸x u (1 i k), then Æ i · · t t1/x1,...,tk /xk ¸xi u t1/x1,...,ti 1/xi 1,ti 1/xi 1,...,tk /xk ; Ç ÈÆ Ç ¡ ¡ Å Å È if t ¸x u, with x x ,...,x , then Æ 6Æ 1 k t t /x ,...,t /x ¸x u t /x ,...,t /x . Ç 1 1 k k ÈÆ Ç 1 1 k k È Such a substitution will be called a simple one, in order to distinguish it from the substitution defined further on, which needs a change of bound variables. Simple substitution corresponds, in computer science, to the notion of macro- instruction. It is also called substitution with capture of variables. With the notation t t /x ,...,t /x , it is understood that x ,...,x are distinct Ç 1 1 k k È 1 k variables. Moreover, their order does not matter ; in other words : t t /x ,...,t /x t t /x ,...,t /x for any permutation σ of {1,...,k}.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages206 Page
-
File Size-