Combining Union, Intersection and Dependent Types in an Explicitely Typed Lambda-Calculus Claude Stolze

Total Page:16

File Type:pdf, Size:1020Kb

Combining Union, Intersection and Dependent Types in an Explicitely Typed Lambda-Calculus Claude Stolze Combining union, intersection and dependent types in an explicitely typed lambda-calculus Claude Stolze To cite this version: Claude Stolze. Combining union, intersection and dependent types in an explicitely typed lambda- calculus. Logic [math.LO]. COMUE Université Côte d’Azur (2015 - 2019), 2019. English. NNT : 2019AZUR4104. tel-02406953v2 HAL Id: tel-02406953 https://hal.archives-ouvertes.fr/tel-02406953v2 Submitted on 26 Jun 2020 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Types union, intersection, et dépendants dans le lambda-calcul explicitement typé Claude STOLZE INRIA Sophia-Antipolis Méditerranée Présentée en vue de l’obtention du Devant le jury, composé de : grade de docteur en Informatique de Giuseppe Castagna l’Université Côte d’Azur. Ugo de’Liguoro Silvia Ghilezan Furio Honsell Dirigée par : Luigi Liquori Delia Kesner Bruno Martin Jakob Rehof Soutenue le : 16 décembre 2019 Luigi Liquori Types union, intersection, et dépendants dans le lambda-calcul explicitement typé Jury Président du jury Bruno Martin, Professeur, Université Côte d’Azur Rapporteurs Silvia Ghilezan, Professeur, University of Novi Sad, Serbie Delia Kesner, Professeur, Université de Paris Examinateurs Giuseppe Castagna, Directeur de recherche, CNRS, Université de Paris Ugo de’Liguoro, Professeur, Università degli Studi di Torino, Italie Furio Honsell, Professeur, Università degli Studi di Udine, Italie Jakob Rehof, Professeur, Technische Universität Dortmund, Allemagne Encadrant Luigi Liquori, Directeur de recherche, INRIA Sophia-Antipolis Méditerranée Types union, intersection, et dépendants dans le lambda-calcul explicitement typé Résumé : Le sujet de cette thèse est sur le lambda-calcul décoré avec des types, communément appelé « lambda-calcul typé à la Church ». Nous étudions des versions de ce lambda- calcul muni de types intersections, tels que ceux décrits dans le livre « Lambda-calculus with types » de Barendregt, Dekkers et Statman ; les types unions, qui ont été introduits par Plotkin, MacQueen et Sethi ; et les types dépendants, tels qu’ils ont été décrits par Plotkin, Harper et Honsell lorsqu’ils ont introduit le Logical Framework d’Edinbourgh LF. Les types intersections et unions sont un moyen d’exprimer du polymorphisme ad hoc et sont une alternative au polymorphisme paramétrique de Girard. Les types dépendants ont été introduits pour formaliser la logique intuitionniste avec la correspondance de Curry- Howard. Le système de types obtenu peut être enrichi avec une relation de soutypage décidable. La combinaison de ces trois disciplines de type donne lieu à une famille de calculs qui peuvent être paramétrés et classifiés. Nous appelons le système générique le Delta-calcul. Nous discutons ensuite des décisions de conception qui nous ont amené à la formulation de ces calculs, nous étudions leur métathéorie, et nous présentons divers exemples d’applications avant de présenter une implémentation logicielle du Delta-calcul, avec une description des algorithmes de vérification de type, de raffinement, de soutypage, d’évaluation, ainsi que de l’interface en ligne de commande. Ce travail de recherche peut être vu comme un petit pas franchi dans la direction d’une théorie des types alternative pour définir du polymorphisme dans les langages de programmation et dans les assistants de preuve interactifs. Mots clés : lambda-calcul, théorie des types, correspondance de Curry-Howard. Combining union, intersection and dependent types in an explicitely typed lambda-calculus Abstract: The subject of this thesis is about lambda-calculus decorated with types, usually called “Church-style typed lambda-calculus”. We study this lambda-calculus enhanced with Intersection types, as described by Barendregt, Dekkers and Statman in the book “Lambda-calculus with Types”; Union types, as introduced by Plotkin, MacQueen and Sethi; and Dependent types, as described by Plotkin, Harper and Honsell when they introduced the Edinburgh Logical Framework LF. Intersection and union types are a way to express ad hoc polymorphism and are an alternative to the parametric polymorphism of Girard. Dependent types were introduced as a way to formalize intuitionistic logic using the “proofs-as-lambda-terms / formulae-as-types” Curry-Howard principle. The resulting type system can be enriched with a decidable subtyping relation. Combining these three type disciplines gives rise to a family of calculi that can be parametrized and classified: we call the resulting system the Delta-calculus. We then discuss the design decisions which have led us to the formulation of these calculi, study their metatheory, and provide various examples of applications; and we finally present a software implementation of the Delta- calculus, with a description of the type checker, the refinement algorithm, the subtyping algorithm, the evaluation algorithm and the command-line interface. This work can be understood as a little step toward an alternative type theory to defining polymorphic programming languages and interactive proof assistants. Keywords: lambda-calculus, type theory, Curry-Howard correspondence. ix Remerciements – Acknowledgements Je ne peux commencer cette thèse sans remercier mon directeur, Luigi Liquori, pour tout le soutien et tous les conseils qu’il m’a prodigués au cours de ces trois années de travail ensemble. Merci en particulier pour la confiance que tu m’as accordé. Tu m’as appris l’exigeant métier de chercheur, notamment qu’un article n’a fini d’être écrit que lorsque la deadline est passée, et que les détails mathématiques et l’esthétique ont une importance cruciale dans la science. J’aimerais aussi remercier ma mère pour son soutien à distance de l’autre bout de la France, et qui me réconfortait quand j’avais le mal du pays. Je voudrais remercier Enrico Tassi qui m’a détaillé les entrailles du code de Coq. Et sans oublier mes camarades Siargey, Owen, Sophie, Cécile, Damien, Carsten, Giovanni, et tant d’autres. I would also like to thank my jury for accepting to review my work. I am particularly thankful to Delia Kesner and Silvia Ghilezan, who accepted to be my referees. Many thanks to Bruno Martin, Giuseppe Castagna, Ugo de’Liguoro, Furio Honsell, and Jakob Rehof, for showing interest in my work and for accepting to participate in this jury. x Contents 1 Introduction 1 1.1 Prolegomenon . .1 1.2 Contributions . .3 1.3 Related works . .5 2 A typed calculus with intersection types 9 2.1 Syntax, Reduction and Types . 10 2.1.1 The ∆-calculi . 11 2.1.2 The ∆-chair . 14 2.2 Examples . 15 2.2.1 On synchronization and subject reduction . 18 T 2.3 Metatheory of ∆R ................................ 19 2.3.1 General properties . 19 2.3.2 Synchronous reduction . 25 2.3.3 Strong normalization of the generic ∆-calculus . 29 2.4 Church-style vs. Curry-style λ-calculus . 31 T T 2.4.1 Relation between type assignment systems λ\ and typed systems ∆R 31 2.4.2 Subtyping and explicit coercions . 34 3 Adding union types 39 3.1 Syntax and semantics of ∆BDdL and λ@BDdL .................. 40 3.2 Metatheory of ∆BDdL and λ@BDdL ....................... 43 4 On Mints’ realizability 45 4.1 Presentation of NJ(β) .............................. 46 4.2 Soundness of NJ(β) ............................... 47 4.3 Completeness of NJ(β) ............................. 49 4.3.1 Failure of completeness of NJ(β) without subtyping . 49 4.3.2 Counter-example . 50 5 Subtyping algorithm 51 5.1 The algorithm, shortly explained . 51 5.1.1 Soundness and correctness of the algorithm . 54 5.2 Coq implementation of the theory Ξ ..................... 55 5.2.1 Definition of normal forms . 57 5.2.2 Filters and ideals . 59 xi xii CONTENTS 5.2.3 Induction scheme for filters and ideals . 60 5.2.4 Properties of filters and ideals . 62 5.3 Coq implementation of the subtyping algorithm . 63 5.4 Extracting the subtyping algorithm in OCaml . 69 5.5 The preorder tactic . 70 5.5.1 Denotation . 71 5.5.2 Implementation of the heuristic function . 72 5.5.3 Reification . 74 6 Dependent types 77 6.1 The ∆-framework: LF with proof-functional operators . 80 BDdL 6.2 Relating LF∆ to λ ............................. 84 6.2.1 Typed derivation of Pierce’s example . 85 6.2.2 LF∆ metatheory . 86 6.3 Minimal relevant implications and type inclusion . 89 6.4 Pure Type System presentation of LF∆ .................... 91 6.5 Future Work . 92 7 Implementation of the theorem prover Bull 95 7.1 de Bruijn indices in Bull . 96 7.2 Syntax of terms . 97 7.2.1 Concrete syntax . 98 7.2.2 Implementation of the syntax . 99 7.2.3 Environments . 100 7.2.4 Suspended substitution . 101 7.3 The evaluator of Bull . 102 7.3.1 Reduction rules . 102 7.3.2 Implementation . 102 7.4 The subtyping algorithm of Bull . 104 7.5 The unification algorithm of Bull . 105 7.6 The refinement algorithm of Bull . 105 7.7 The Read-Eval-Print-Loop of Bull . 108 7.8 Future work . 109 8 Examples in Bull 115 8.1 Encodings in LF∆ ................................ 115 8.1.1 Pierce’s code . 116 8.1.2 Hereditary Harrop formulæ . 116 8.1.3 Natural deductions in normal form . 118 8.2 Encodings in LF . 121 List of Figures 1.1 Pierce’s code . .7 2.1 Minimal type theory 6min, axioms and rule schemes (from Figure 13.2 and 13.3 of [12]) . 10 T 2.2 Generic intersection type assignment system λ\ (from Figure 13.8 of [12]) . 10 CD CDS CDV BCD 2.3 Type theories λ\ , λ\ , λ\ , and λ\ .
Recommended publications
  • Lecture Notes on the Lambda Calculus 2.4 Introduction to Β-Reduction
    2.2 Free and bound variables, α-equivalence. 8 2.3 Substitution ............................. 10 Lecture Notes on the Lambda Calculus 2.4 Introduction to β-reduction..................... 12 2.5 Formal definitions of β-reduction and β-equivalence . 13 Peter Selinger 3 Programming in the untyped lambda calculus 14 3.1 Booleans .............................. 14 Department of Mathematics and Statistics 3.2 Naturalnumbers........................... 15 Dalhousie University, Halifax, Canada 3.3 Fixedpointsandrecursivefunctions . 17 3.4 Other data types: pairs, tuples, lists, trees, etc. ....... 20 Abstract This is a set of lecture notes that developed out of courses on the lambda 4 The Church-Rosser Theorem 22 calculus that I taught at the University of Ottawa in 2001 and at Dalhousie 4.1 Extensionality, η-equivalence, and η-reduction. 22 University in 2007 and 2013. Topics covered in these notes include the un- typed lambda calculus, the Church-Rosser theorem, combinatory algebras, 4.2 Statement of the Church-Rosser Theorem, and some consequences 23 the simply-typed lambda calculus, the Curry-Howard isomorphism, weak 4.3 Preliminary remarks on the proof of the Church-Rosser Theorem . 25 and strong normalization, polymorphism, type inference, denotational se- mantics, complete partial orders, and the language PCF. 4.4 ProofoftheChurch-RosserTheorem. 27 4.5 Exercises .............................. 32 Contents 5 Combinatory algebras 34 5.1 Applicativestructures. 34 1 Introduction 1 5.2 Combinatorycompleteness . 35 1.1 Extensionalvs. intensionalviewoffunctions . ... 1 5.3 Combinatoryalgebras. 37 1.2 Thelambdacalculus ........................ 2 5.4 The failure of soundnessforcombinatoryalgebras . .... 38 1.3 Untypedvs.typedlambda-calculi . 3 5.5 Lambdaalgebras .......................... 40 1.4 Lambdacalculusandcomputability . 4 5.6 Extensionalcombinatoryalgebras . 44 1.5 Connectionstocomputerscience .
    [Show full text]
  • Create Union Variables Difference Between Unions and Structures
    Union is a user-defined data type similar to a structure in C programming. How to define a union? We use union keyword to define unions. Here's an example: union car { char name[50]; int price; }; The above code defines a user define data type union car. Create union variables When a union is defined, it creates a user-define type. However, no memory is allocated. To allocate memory for a given union type and work with it, we need to create variables. Here's how we create union variables: union car { char name[50]; int price; } car1, car2, *car3; In both cases, union variables car1, car2, and a union pointer car3 of union car type are created. How to access members of a union? We use . to access normal variables of a union. To access pointer variables, we use ->operator. In the above example, price for car1 can be accessed using car1.price price for car3 can be accessed using car3->price Difference between unions and structures Let's take an example to demonstrate the difference between unions and structures: #include <stdio.h> union unionJob { //defining a union char name[32]; float salary; int workerNo; } uJob; struct structJob { char name[32]; float salary; int workerNo; } sJob; main() { printf("size of union = %d bytes", sizeof(uJob)); printf("\nsize of structure = %d bytes", sizeof(sJob)); } Output size of union = 32 size of structure = 40 Why this difference in size of union and structure variables? The size of structure variable is 40 bytes. It's because: size of name[32] is 32 bytes size of salary is 4 bytes size of workerNo is 4 bytes However, the size of union variable is 32 bytes.
    [Show full text]
  • [Note] C/C++ Compiler Package for RX Family (No.55-58)
    RENESAS TOOL NEWS [Note] R20TS0649EJ0100 Rev.1.00 C/C++ Compiler Package for RX Family (No.55-58) Jan. 16, 2021 Overview When using the CC-RX Compiler package, note the following points. 1. Using rmpab, rmpaw, rmpal or memchr intrinsic functions (No.55) 2. Performing the tail call optimization (No.56) 3. Using the -ip_optimize option (No.57) 4. Using multi-dimensional array (No.58) Note: The number following the note is an identification number for the note. 1. Using rmpab, rmpaw, rmpal or memchr intrinsic functions (No.55) 1.1 Applicable products CC-RX V2.00.00 to V3.02.00 1.2 Details The execution result of a program including the intrinsic function rmpab, rmpaw, rmpal, or the standard library function memchr may not be as intended. 1.3 Conditions This problem may arise if all of the conditions from (1) to (3) are met. (1) One of the following calls is made: (1-1) rmpab or __rmpab is called. (1-2) rmpaw or __rmpaw is called. (1-3) rmpal or __rmpal is called. (1-4) memchr is called. (2) One of (1-1) to (1-3) is met, and neither -optimize=0 nor -noschedule option is specified. (1-4) is met, and both -size and -avoid_cross_boundary_prefetch (Note 1) options are specified. (3) Memory area that overlaps with the memory area (Note2) read by processing (1) is written in a single function. (This includes a case where called function processing is moved into the caller function by inline expansion.) Note 1: This is an option added in V2.07.00.
    [Show full text]
  • Lecture Notes on Types for Part II of the Computer Science Tripos
    Q Lecture Notes on Types for Part II of the Computer Science Tripos Prof. Andrew M. Pitts University of Cambridge Computer Laboratory c 2016 A. M. Pitts Contents Learning Guide i 1 Introduction 1 2 ML Polymorphism 6 2.1 Mini-ML type system . 6 2.2 Examples of type inference, by hand . 14 2.3 Principal type schemes . 16 2.4 A type inference algorithm . 18 3 Polymorphic Reference Types 25 3.1 The problem . 25 3.2 Restoring type soundness . 30 4 Polymorphic Lambda Calculus 33 4.1 From type schemes to polymorphic types . 33 4.2 The Polymorphic Lambda Calculus (PLC) type system . 37 4.3 PLC type inference . 42 4.4 Datatypes in PLC . 43 4.5 Existential types . 50 5 Dependent Types 53 5.1 Dependent functions . 53 5.2 Pure Type Systems . 57 5.3 System Fw .............................................. 63 6 Propositions as Types 67 6.1 Intuitionistic logics . 67 6.2 Curry-Howard correspondence . 69 6.3 Calculus of Constructions, lC ................................... 73 6.4 Inductive types . 76 7 Further Topics 81 References 84 Learning Guide These notes and slides are designed to accompany 12 lectures on type systems for Part II of the Cambridge University Computer Science Tripos. The course builds on the techniques intro- duced in the Part IB course on Semantics of Programming Languages for specifying type systems for programming languages and reasoning about their properties. The emphasis here is on type systems for functional languages and their connection to constructive logic. We pay par- ticular attention to the notion of parametric polymorphism (also known as generics), both because it has proven useful in practice and because its theory is quite subtle.
    [Show full text]
  • Coredx DDS Type System
    CoreDX DDS Type System Designing and Using Data Types with X-Types and IDL 4 2017-01-23 Table of Contents 1Introduction........................................................................................................................1 1.1Overview....................................................................................................................2 2Type Definition..................................................................................................................2 2.1Primitive Types..........................................................................................................3 2.2Collection Types.........................................................................................................4 2.2.1Enumeration Types.............................................................................................4 2.2.1.1C Language Mapping.................................................................................5 2.2.1.2C++ Language Mapping.............................................................................6 2.2.1.3C# Language Mapping...............................................................................6 2.2.1.4Java Language Mapping.............................................................................6 2.2.2BitMask Types....................................................................................................7 2.2.2.1C Language Mapping.................................................................................8 2.2.2.2C++ Language Mapping.............................................................................8
    [Show full text]
  • Julia's Efficient Algorithm for Subtyping Unions and Covariant
    Julia’s Efficient Algorithm for Subtyping Unions and Covariant Tuples Benjamin Chung Northeastern University, Boston, MA, USA [email protected] Francesco Zappa Nardelli Inria of Paris, Paris, France [email protected] Jan Vitek Northeastern University, Boston, MA, USA Czech Technical University in Prague, Czech Republic [email protected] Abstract The Julia programming language supports multiple dispatch and provides a rich type annotation language to specify method applicability. When multiple methods are applicable for a given call, Julia relies on subtyping between method signatures to pick the correct method to invoke. Julia’s subtyping algorithm is surprisingly complex, and determining whether it is correct remains an open question. In this paper, we focus on one piece of this problem: the interaction between union types and covariant tuples. Previous work normalized unions inside tuples to disjunctive normal form. However, this strategy has two drawbacks: complex type signatures induce space explosion, and interference between normalization and other features of Julia’s type system. In this paper, we describe the algorithm that Julia uses to compute subtyping between tuples and unions – an algorithm that is immune to space explosion and plays well with other features of the language. We prove this algorithm correct and complete against a semantic-subtyping denotational model in Coq. 2012 ACM Subject Classification Theory of computation → Type theory Keywords and phrases Type systems, Subtyping, Union types Digital Object Identifier 10.4230/LIPIcs.ECOOP.2019.24 Category Pearl Supplement Material ECOOP 2019 Artifact Evaluation approved artifact available at https://dx.doi.org/10.4230/DARTS.5.2.8 Acknowledgements The authors thank Jiahao Chen for starting us down the path of understanding Julia, and Jeff Bezanson for coming up with Julia’s subtyping algorithm.
    [Show full text]
  • Category Theory and Lambda Calculus
    Category Theory and Lambda Calculus Mario Román García Trabajo Fin de Grado Doble Grado en Ingeniería Informática y Matemáticas Tutores Pedro A. García-Sánchez Manuel Bullejos Lorenzo Facultad de Ciencias E.T.S. Ingenierías Informática y de Telecomunicación Granada, a 18 de junio de 2018 Contents 1 Lambda calculus 13 1.1 Untyped λ-calculus . 13 1.1.1 Untyped λ-calculus . 14 1.1.2 Free and bound variables, substitution . 14 1.1.3 Alpha equivalence . 16 1.1.4 Beta reduction . 16 1.1.5 Eta reduction . 17 1.1.6 Confluence . 17 1.1.7 The Church-Rosser theorem . 18 1.1.8 Normalization . 20 1.1.9 Standardization and evaluation strategies . 21 1.1.10 SKI combinators . 22 1.1.11 Turing completeness . 24 1.2 Simply typed λ-calculus . 24 1.2.1 Simple types . 25 1.2.2 Typing rules for simply typed λ-calculus . 25 1.2.3 Curry-style types . 26 1.2.4 Unification and type inference . 27 1.2.5 Subject reduction and normalization . 29 1.3 The Curry-Howard correspondence . 31 1.3.1 Extending the simply typed λ-calculus . 31 1.3.2 Natural deduction . 32 1.3.3 Propositions as types . 34 1.4 Other type systems . 35 1.4.1 λ-cube..................................... 35 2 Mikrokosmos 38 2.1 Implementation of λ-expressions . 38 2.1.1 The Haskell programming language . 38 2.1.2 De Bruijn indexes . 40 2.1.3 Substitution . 41 2.1.4 De Bruijn-terms and λ-terms . 42 2.1.5 Evaluation .
    [Show full text]
  • Type-Check Python Programs with a Union Type System
    日本ソフトウェア科学会第 37 回大会 (2020 年度) 講演論文集 Type-check Python Programs with a Union Type System Senxi Li Tetsuro Yamazaki Shigeru Chiba We propose that a simple type system and type inference can type most of the Python programs with an empirical study on real-world code. Static typing has been paid great attention in the Python language with its growing popularity. At the same time, what type system should be adopted by a static checker is quite a challenging task because of Python's dynamic nature. To exmine whether a simple type system and type inference can type most of the Python programs, we collected 806 Python repositories on GitHub and present a preliminary evaluation over the results. Our results reveal that most of the real-world Python programs can be typed by an existing, gradual union type system. We discovered that 82.4% of the ex- pressions can be well typed under certain assumptions and conditions. Besides, expressions of a union type are around 3%, which indicates that most of Python programs use simple, literal types. Such preliminary discovery progressively reveals that our proposal is fairly feasible. while the effectiveness of the type system has not 1 Introduction been empirically studied. Other works such as Py- Static typing has been paid great attention in type implement a strong type inferencer instead of the Python language with its growing popularity. enforcing type annotations. At the same time, what type system should be As a dynamically typed language, Python excels adopted by a static checker is quite a challenging at rapid prototyping and its avail of metaprogram- task because of Python's dynamic nature.
    [Show full text]
  • Software II: Principles of Programming Languages
    Software II: Principles of Programming Languages Lecture 6 – Data Types Some Basic Definitions • A data type defines a collection of data objects and a set of predefined operations on those objects • A descriptor is the collection of the attributes of a variable • An object represents an instance of a user- defined (abstract data) type • One design issue for all data types: What operations are defined and how are they specified? Primitive Data Types • Almost all programming languages provide a set of primitive data types • Primitive data types: Those not defined in terms of other data types • Some primitive data types are merely reflections of the hardware • Others require only a little non-hardware support for their implementation The Integer Data Type • Almost always an exact reflection of the hardware so the mapping is trivial • There may be as many as eight different integer types in a language • Java’s signed integer sizes: byte , short , int , long The Floating Point Data Type • Model real numbers, but only as approximations • Languages for scientific use support at least two floating-point types (e.g., float and double ; sometimes more • Usually exactly like the hardware, but not always • IEEE Floating-Point Standard 754 Complex Data Type • Some languages support a complex type, e.g., C99, Fortran, and Python • Each value consists of two floats, the real part and the imaginary part • Literal form real component – (in Fortran: (7, 3) imaginary – (in Python): (7 + 3j) component The Decimal Data Type • For business applications (money)
    [Show full text]
  • 1 Simply-Typed Lambda Calculus
    CS 4110 – Programming Languages and Logics Lecture #18: Simply Typed λ-calculus A type is a collection of computational entities that share some common property. For example, the type int represents all expressions that evaluate to an integer, and the type int ! int represents all functions from integers to integers. The Pascal subrange type [1..100] represents all integers between 1 and 100. You can see types as a static approximation of the dynamic behaviors of terms and programs. Type systems are a lightweight formal method for reasoning about behavior of a program. Uses of type systems include: naming and organizing useful concepts; providing information (to the compiler or programmer) about data manipulated by a program; and ensuring that the run-time behavior of programs meet certain criteria. In this lecture, we’ll consider a type system for the lambda calculus that ensures that values are used correctly; for example, that a program never tries to add an integer to a function. The resulting language (lambda calculus plus the type system) is called the simply-typed lambda calculus (STLC). 1 Simply-typed lambda calculus The syntax of the simply-typed lambda calculus is similar to that of untyped lambda calculus, with the exception of abstractions. Since abstractions define functions tht take an argument, in the simply-typed lambda calculus, we explicitly state what the type of the argument is. That is, in an abstraction λx : τ: e, the τ is the expected type of the argument. The syntax of the simply-typed lambda calculus is as follows. It includes integer literals n, addition e1 + e2, and the unit value ¹º.
    [Show full text]
  • Lambda-Calculus Types and Models
    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
    [Show full text]
  • The Lambda Calculus Bharat Jayaraman Department of Computer Science and Engineering University at Buffalo (SUNY) January 2010
    The Lambda Calculus Bharat Jayaraman Department of Computer Science and Engineering University at Buffalo (SUNY) January 2010 The lambda-calculus is of fundamental importance in the study of programming languages. It was founded by Alonzo Church in the 1930s well before programming languages or even electronic computers were invented. Church's thesis is that the computable functions are precisely those that are definable in the lambda-calculus. This is quite amazing, since the entire syntax of the lambda-calculus can be defined in just one line: T ::= V j λV:T j (TT ) The syntactic category T defines the set of well-formed expressions of the lambda-calculus, also referred to as lambda-terms. The syntactic category V stands for a variable; λV:T is called an abstraction, and (TT ) is called an application. We will examine these terms in more detail a little later, but, at the outset, it is remarkable that the lambda-calculus is capable of defining recursive functions even though there is no provision for writing recursive definitions. Indeed, there is no provision for writing named procedures or functions as we know them in conventional languages. Also absent are other familiar programming constructs such as control and data structures. We will therefore examine how the lambda-calculus can encode such constructs, and thereby gain some insight into the power of this little language. In the field of programming languages, John McCarthy was probably the first to rec- ognize the importance of the lambda-calculus, which inspired him in the 1950s to develop the Lisp programming language.
    [Show full text]