Advanced Lambda Calculus. Henk Barendregt & Giulio Manzonetto ICIS Faculty of Science Radboud University Nijmegen, The Netherlands

Similar documents
Lambda Calculus with Types. Henk Barendregt ICIS Radboud University Nijmegen The Netherlands

The Lambda-Calculus Reduction System

Advanced Lambda Calculus Lecture 5

Origin in Mathematical Logic

Lambda-Calculus (I) 2nd Asian-Pacific Summer School on Formal Methods Tsinghua University, August 23, 2010

Introduction to λ-calculus

Origin in Mathematical Logic

On the Standardization Theorem for λβη-calculus

Mathematical Logic IV

Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. Radboud University Nijmegen. March 5, 2012

Lecture 2: Self-interpretation in the Lambda-calculus

Lambda Calculus. Andrés Sicard-Ramírez. Semester Universidad EAFIT

Models of computation

Reducibility proofs in λ-calculi with intersection types

Lazy Strong Normalization

COMP6463: λ-calculus

Small families. (at INRIA with Gérard and in the historical λ-calculus) Jean-Jacques Lévy

Lambda Calculus. Week 12 The canonical term models for λ. Henk Barendregt, Freek Wiedijk assisted by Andrew Polonsky

Simply Typed λ-calculus

Programming Language Concepts: Lecture 18

3.2 Equivalence, Evaluation and Reduction Strategies

DEGREES OF EXTENSIONALITY IN THE THEORY OF BÖHM TREES AND SALLÉ S CONJECTURE.

Categories, Proofs and Programs

Functional Programming with Coq. Yuxin Deng East China Normal University

A probabilistic lambda calculus - Some preliminary investigations

Rewriting, Explicit Substitutions and Normalisation

Graph lambda theories

Simply Typed λ-calculus

Komponenten- und Service-orientierte Softwarekonstruktion

Intersection and Singleton Type Assignment Characterizing Finite Böhm-Trees

Combinators & Lambda Calculus

Proofs in classical logic as programs: a generalization of lambda calculus. A. Salibra. Università Ca Foscari Venezia

Lambda Calculus: Models and Theories

A Differential Model Theory for Resource Lambda Calculi - Part II

Graph models for the untyped λ-calculus

CSCI 490 problem set 6

Traditional and Non Traditional lambda calculi

The Lambda Calculus is Algebraic

Bisimulation and coinduction in higher-order languages

Using models to model-check recursive schemes

Logic and Probability Lecture 3: Beyond Boolean Logic

Alonzo Church ( ) Lambda Calculus. λ-calculus : syntax. Grammar for terms : Inductive denition for λ-terms

Church s undecidability result

summer school Logic and Computation Goettingen, July 24-30, 2016

On Upper Bounds on the Church-Rosser Theorem

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521

An Introduction to the Lambda Calculus

Subtyping and Intersection Types Revisited

The Calculus of Inductive Constructions

Justifying Algorithms for βη-conversion

Models of Computation,

Introduction to Type Theory February 2008 Alpha Lernet Summer School Piriapolis, Uruguay. Herman Geuvers Nijmegen & Eindhoven, NL

Semantics with Intersection Types

Equivalent Computers. Lecture 39: Lambda Calculus. Lambda Calculus. What is Calculus? Real Definition. Why?

Constructive approach to relevant and affine term calculi

Relational Graph Models, Taylor Expansion and Extensionality

arxiv: v1 [cs.lo] 23 Mar 2016

Lambda Calculus and Types

Introduction to Type Theory

Introduction to lambda calculus Part 2

Univalent Foundations and Set Theory

Non-Idempotent Typing Operators, beyond the λ-calculus

Realisability methods of proof and semantics with application to expansion

Computation Theory, L 9 116/171

What is a Categorical Model of the Differential and the Resource λ-calculi?

Typage et déduction dans le calcul de

Introduction to lambda calculus Part 6

Local computation of β-reduction A concrete presentation of Game Semantics

Call-by-Value Non-determinism in a Linear Logic Type Discipline

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus

RELATIONAL GRAPH MODELS AT WORK

Consequence Relations and Natural Deduction

Five Basic Concepts of. Axiomatic Rewriting Theory

Alberto Carraro 1, 2 and Antonino Salibra 1

Safety Analysis versus Type Inference

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521

Some Results on Classical Semantics and Polymorphic Types

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

CS522 - Programming Language Semantics

A relational semantics for parallelism and non-determinism in a functional setting

REVISITING CALL-BY-VALUE BÖHM TREES IN LIGHT OF THEIR TAYLOR EXPANSION

Call-by-value non-determinism in a linear logic type discipline

Typed Lambda Calculi. Nikos Tzeveλekos Queen Mary, University of London 1 / 23

Lambda Calculus. Yuxi Fu. 31 May, 2013

Full Abstraction for Resource Calculus with Tests

Sequent Combinators: A Hilbert System for the Lambda Calculus

CSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators.

Elementary Affine Logic and the Call by Value Lambda Calculus

ON THE CHARACTERIZATION OF MODELS OF H : THE SEMANTICAL ASPECT

Introduction to Type Theory

Static Program Analysis

Interpreting the Full λ-calculus in the π-calculus

Beyond First-Order Logic

A characterization of the Taylor expansion of λ-terms

Domain theory and denotational semantics of functional programming

Extensional Models of Untyped Lambda-mu Calculus

Lambda Calculus, Linear Logic and Symbolic Computation

Strong Normalization for Guarded Types

Marginalia to a theorem of Jacopini

Transcription:

Advanced Lambda Calculus Henk Barendregt & Giulio Manzonetto ICIS Faculty of Science Radboud University Nijmegen, The Netherlands

Form of the course Ordinary lecture Seminar form Exam: working out an exercise or writing a short paper

Topics (sneak preview) Lambda calculus untyped λ Lambda Calculus with Simple types Recursive types Ordered types Intersection types where respectively A A = A, S = S,, S = S,,, λ A freely generated from A λ A = with equations A = A B λ S with inequalities A A B λ S with inequalities and intersections A (A B) B is a set of type atoms is a type algebra is a type structure is an intersection type structure λx.x : A A λx.xx : A, λx.xx : A B, λx.xx : (A (A B)) B. if A = A B if A A B

1.1 Lambda terms and calculus Lambda terms can express: Computations on numbers - on data types Infinite processes Hardware design functional programming languages like Scheme, ML, Haskell, Clean Proofs (certification) computer mathematics

1.2 Untyped lambda terms (1933) Lambda terms var ::= c var term ::= var term term λvar term Lambda calculus (λx.m)n = M[x: = N] M = M M = N N = M M = N & N = L M = L M = N MP = NP M = N PM = PN M = N λx.m = λx.n mathematical axiom logical axiom and rules We write λ M = N if M = N is provable by these axioms and rules.

1.3 Notations Notations for variables and terms x,y,z,,f,g,,f,g,, Φ, Ψ, M,N,L, Abbreviations MN 1 N n ( (MN 1 ) N n ) λx 1 x n.m (λx 1 ( (λx n.m) )) Standard terms: combinators I λx.x K λxy.x S λxyz.xz(yz) ω λx.xx Ω ωω Y λf.(λx.f(xx))(λx.f(xx)) range over V range over Λ

1.4 Reduction Def. A notion of reduction on Λ is a relation R Λ 2 Def. (i) The notion of reduction β is (ii) Write (β-contraction) β = { (λx.m)n,m[x := N] M,N Λ} M β N M,N β (iii) One step β-reduction β is the compatible closure of β, i.e. M β N M β N M β N MP β NP M β N PM β PN M β N λxm β λxn (iv) Many step β-reduction, notation β is the reflexive transitive closure of β, i.e. M β M M β N M β N M β N & N β L M β L

1.5 Reduction graphs Def. The β-reduction graph of an M Λ, notation G β (M), is {N M β N}, β i.e. the set of reducts of M directed by β Exercise. Draw G β (M) for the following terms (i) M WWW, (ii) M UU, (iii) M V V, with W λxy.xyy with U λx.ixx with V λx.i(xx) (iv) M TTx, with T λtxz.z(ttx) You get in a different order a cube, an infinite tower of cubes, an increasing chain of n-dimensional cubes with 0 n <, and an icecream cone with two scoops!

1.6 Normal forms Def. (i) A term M is said to be in β-normal form (β-nf) if for no term N one has M β N (ii) A term M has a β-nf if for some term N in nf M β N. (iii) M is β-weakly normalizing (β-wn) if there is a finite reduction path M β M 1 β M 2 β β M k (1) such that M k is in β-nf. This is equivalent to having a β-nf. (iv) M is β-strongly normalizing (β-sn) if all reduction paths as in (1) terminate in a nf. This states that there are no infinite β-reduction paths starting with M. We often leave out the prefix β- Examples. I, K, S are in nf. KISS has a nf. Ω has no nf. KIΩ is WN but not SN. It has a subterm that has no nf. (λx.(λy.i)(xx))(λx.(λy.i)(xx)) is not SN, even if each subterm is WN.

2.1 Coding & decoding terms For M 1 M n Λ define M 1,,M n λz.zm 1 M n U n i λx 1 x n.x i Then M 1,,M n U n i = M i

2.2. Coding data types (Böhm-Piperno-Guerrini) Let A = A,c,f,g be freely generated data type with c : A f : A A g : A 2 A Here free means that equations like c = g(f(c),c) are never valid. There is a categorical formulation of being free. Def. The elements of A can be represented by λ-terms c λe.eu 3 1e f λxe.eu 3 2xe g λxye.eu 3 3xye. A term like g(f(c),c) is represented by g(f(c),c) g(fc)c

2.3 General recursion Thm. Given A 1.A 2,A 3 Λ there is an F Λ such that Fc = A 1 F (1) F(fx) = A 2 xf (2) F(gxy) = A 3 xyf (3) Proof. Try F = X 0,X 1,X 2, the X to be determined In order to satisfy (1) one should have Fc = X 0,X 1,X 2 c = c X 0,X 1,X 2 = (λe.eu 3 1e) X 0,X 1,X 2 = X 0,X 1,X 2 U 3 1 X 0,X 1,X 2 = X 0 X 0,X 1,X 2 = A 1 F, by choosing X 0 λa.a 1 a. Similarly one can choose X 1, X 2 to satisfy (2), (3).

Encoding λ-terms as λ-terms Consider a data type with constructors var,app,abs Represent these in λ by var, app, abs Def. (Mogensen) x PQ varx app P Q λx.p abs(λx. P ) By the recursion principle we can find an E such that E(varx) x E(appxy) (Ex)(Ey) E(absz) λx.e(zx) Then E x x E PQ E P E Q E λx.p λx.e( P ) Therefore M Λ.E M = M

Applications of coding and E Show that for no P one has Find terms P i such that P(xy) = x P i M 1 M 2 = M i Show that F Λ M Λ.F M = M. See Barendregt [1984]. Show that Y 2 Λ F Λ.F Y 2 F = Y 2 ( F ) I am not sure whether the last two are true!