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

Size: px
Start display at page:

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

Transcription

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

2 Plan computation models lambda-notation bound variables conversion rules reductions normal forms numeral systems lambda-definability Barendregt, Henk, The Lambda Calculus. Its Syntax and Semantics, Elsevier, 2nd edition, Barendregt, Henk; Dezani, Mariangiola, Lambda calculi with Types, 2010.

3 Models of computation

4 Computation models [machines] automata theory -- Turing machines [character strings] formal grammars, Thue systems, Post [numbers] Kleene recursive functions theory [terms] Church lambda-calculus, term rewriting systems Applications to logic [cut elimination] 2nd order arithmetic -- Howard, Girard [higher order dependent types] HOL, Isabelle, Coq -- Coquand, Huet

5 Computing with terms (2 + 3) ((2 + 3) + 4) (4 + 5)...

6 Computing with terms (λx. x + 1) (λx.2 x + 2) (λf.f 3)(λx. x + 2) (λx. x + 2) (λf.λx.f (f x))(λx.x + 2)...

7 Computing with terms (λf.λx.f (f x))(λx.x + 2)3...

8 Computation model define a minimum set no instructions, no states, only expressions no arithmetic just a calculus of functions functions applied to functions functions as results interesting?

9 λ-calculus

10 The lambda-calculus Lambda terms M, N, P ::= x, y, z,... (variables) ( λx.m ) (M as function of x) ( M N ) (M applied to N) c, d,... (constants ) Calculations reductions ((λx.m)n) M{x := N}

11 Abbreviations MM 1 M 2 M n for ( ((MM 1 )M 2 ) M n ) (λx 1 x 2 x n. M) for (λx 1.(λx 2. (λx n. M) )) external parentheses and parentheses after a dot may be forgotten Exercice 1 Write following terms in long notation: λx.x, λx.λy.x, λxy.x, λxyz.y, λxyz.zxy, λxyz.z(xy), (λx.λy.x)mn, (λxy.x)mn, (λxy.y)mn, (λxy.y)(mn)

12 Examples (λx.x)n N (λf.f N)(λx.x) (λx.x)n N (λx.xx)(λx.xn) (λx.xn)(λx.xn) (λx.xn)n NN (λx.xx)(λx.xx) (λx.xx)(λx.xx) Y f =(λx.f (xx))(λx.f (xx)) f ((λx.f (xx))(λx.f (xx))) = f (Y f ) f (Y f ) f (f (Y f )) f n (Y f )

13 Recapitulation calculus is more complex than expected looping expressions!! recursion operator seems definable when termination? consistency? computing power?

14 Abstract syntax The syntax of lambda-terms can be abstracted as: M, N, P ::= x, y, z,... (variables) x λx ( λx.m ) (M as function of x) M ( M N ) (M applied to N) M N c, d,... (constants ) c

15 Abstract syntax Example: (λx.(λy.λx.y x)(λz.z x))x y is y λx x λy λz λx

16 Bound variables (λx.(λy.λx.y x)(λz.z x))x y (rightmost x, y are free) Exercice 2 Show binders of bound variables in (λf.(λx.f (xx))(λx.f (xx)))(λx.λy.x) (λf.(λx.f (xx))(λx.f (xx)))(λf xy.x(f y)) (λf.f ((λx.x)3))(λx.λy.x)

17 Bound variables (λy.λx.y)x λx.x incorrect (dynamic binding: Lisp) (λy.λx.y)x λx.x correct (lexical binding: Scheme) Exercice 2bis Why Lisp is consistent?

18 Bound variables (λy.λx.y)x λx.x (λy.λx.y)x = α (λy.λx.y)x λx.x renaming of bound variables names of bound variables are not important standard in many other calculi π/2 0 cos(x)dx = π/2 0 cos(x )dx 9 i=1 a i = 9 j=1 a j λx.x +2 = α λy.y +2 λxy.x + y = α λyx.y + x

19 Bound variables de Bruijn indices is a systematic computer representation of bound variables for each occurence of a bound variable, one counts the number of binders to traverse to reach its binder. Example: (λx.(λy.λx.y x)(λz.z x))x y y is (λ.(λ.λ.1 0)(λ.0 1))x y λx x λy λz λx

20 Substitution x{y := P} = x c{y := P} = c y{y := P} = P (MN){y := P} = M{y := P} N{y := P} (λy.m){y := P} = λy.m (λx.m){y := P} = λx.m{x := x }{y := P} where x = x if y not free in M or x not free in P, otherwise x is the first variable not free in M and P. (we suppose that the set of variables is infinite and enumerable) Free variables var(x) ={x} var(c) = var(mn) = var(m) var(n) var(λx.m) = var(m) {x}

21 Conversion rules λx.m α λx.m{x := x } (x var(m)) (λx.m)n β M{x := N} λx.mx η M (x var(m)) left-hand-side of conversion rule is a redex (reductible expression) α-redex, β-redex, η-redex,... we forget indices when clear from context, often β Reduction step let R be a redex in M. Then one can contrat redex R in M and get N: M R N

22 Reductions M N when M = M 0 M 1 M 2 M n = N (n 0) same with explicit contracted redexes M = M 0 R 1 M 1 R 2 M 2 R n M n = N and with named reductions ρ : M = M 0 R 1 M 1 R 2 M 2 R n M n = N we speak of redex occurences when specifying reduction steps, but it is convenient to confuse redexes and redex occurences when clear from context

23 Lambda theories M = β N when M and N are related by a zigzag of reductions M and N are said interconvertible M N Also M = α N, M = η N, M = β,η N,... Interconvertibility is symmetric, reflexive, transivite closure of reduction relation or with notations of mathematical logic: α M = N, β M = N, η M = N, β + η M = N,... the syntactic equality M = N will often stand for M = α N.

24 Exercice 3 Find terms M such that: M M M = M 0 M 1 M 2 M n = M (M i all distinct) M = β xm M = β λx.m M = β MM M = β MN 1 N 2 N n for all N 1, N 2,... N n Find term Y such that, for any M: YM = β M(YM) Find Y such that, for any M: Y M M(Y M) (difficult) Show there is only one redex R such that R R

25 Normal forms An expression M without redexes is in normal form M If M reduces to a normal form, then M has a normal form M N, N in normal form Exercice 4 which of following terms are in β-normal form? in βη-normal form? λx.x λxy.x λxy.xy λxy.x((λx.y(xx))(λx.y(xx))) λx.x(λxy.x)(λx.x) λxy.x(λxy.x)(λx.yx) λxy.x((λx.xx)(λx.xx))y

26 Exercice 5 Show that if M is in normal form and M N, then M = N Show that: 1- λx.m N implies N = λx.n and M N 2- MN P implies M M, N N and P = M N or M λx.m, N N and M {x := N } P 3- xm 1 M 2 M n N implies M 1 N 1, M 2 N 2,... M n N n and xn 1 N 2 N n = N 4- M{x := N} λy.p implies M λy.m and M {x := N} P or M xm 1 M 2 M n and NM 1 {x := N} M n {x := N} λy.p

27 δ-rules

28 Adding δ-rules: PCF Terms of PCF M, N, P ::= x, y, z,... (variables) λx.m (M function of x) M N (M applied to N) n (integer constant) M N (arithmetic operation, +, *, -, / ) ifz P then M else N (conditionnal) Conversion rules (λx.m)n M{x := N} m n ifz 0 then M else N ifz n+1 then M else N m n M N

29 Examples (bis) (2 + 3) ((2 + 3) + 4) (4 + 5)...

30 Examples (bis) (λx. x + 1) (λx.2 x + 2) (λf.f 3)(λx. x + 2) (λx. x + 2) (λf.λx.f (f x))(λx.x + 2)...

31 Examples (bis) (λf.λx.f (f x))(λx.x + 2)3...

32 Examples Fact(3) Fact = Y (λf.λx. ifz x then 1 else x f (x 1)) Y = λf.(λx.f (xx))(λx.f (xx)) can be written as a single term in: (λ Fact. Fact(3)) ((λy.y (λf.λx. ifz x then 1 else x f (x 1))) (λf.(λx.f (xx))(λx.f (xx))) )

33

34

35

36

37

38

39

40

41

42

43

44

45 λ-definability

46 Computing without δ-rules Numbers will be in unary-code =0 S ( ) with following implementation: 0=True,? 1 = False,0 = False, True,? 2 = False,1 = False, False, True,?... n = False, n 1 = False, False, True,? n

47 Computing without δ-rules Booleans True = λx.λy.x = K False = λx.λy.y Pairs and Projections M, N = λx.xmn π 1 = λx.x True π 2 = λx.x False True MN False MN π 1 M, N π 2 M, N M N M N Non-negative integers... 0=True, True n +1=False, n iszero = π 1 iszero 0 True iszero(n + 1) False

48 Computing without δ-rules... integers Succ = λx.false, x Pred = λx. iszero x 0 π 2

49 Other numeral system also named Church s numerals or n = λf.λx.f (f ( f (x) )) n n = λf. f f f n was n+1 in Church s original monograph

50 Other numeral system Lambda-I calculus λx.m (M depends upon x) Church numerals no K = λx.λy.x n = λf.λx.f n (x) n 1 Pairs and projections M, N = λx.xmn π 1 = λp.p(λx.λy. yix) π 2 = λp.p(λx.λy. xiy ni I I = λx.x π 1 m, n π 2 m, n m n

51 Other numeral system... successor and predecessor Succ = λn.λf.λx.nf (f x) Pred = λn. π 3 3 (n φ 1, 1, 1) φ = λt.(λx.λy.λz.succ x, x, y)(π 3 1 t)(π3 2 t)(π3 3 t) where π 3 1, π3 2, π3 3 are the 3 projections on triples φ shift register! FIFO

52 Church numeral system Alonzo Church Stephen Kleene

53

54

55

56 Programming languages

57 Towards programming languages Many δ-rules Adding types never following terms : + =??? 3+λx.x 4(5) 20(λx.x) ifz λx.x then 1 else 3 λf.(λx.f (xx))(λx.f (xx)) λx.xx Adding store and mutable values

58 Functional programming Scheme, SML, Ocaml, Haskell are functional programming languages they manipulate functions and try to reduce the number of memory states F# Haskell SML Ocaml Jocaml ML Ocaml Scheme Lisp Camllight Caml

59 Next class

60 Next class confluency consistency

Models of computation

Models of computation Lambda-Calculus (I) jean-jacques.levy@inria.fr 2nd Asian-Pacific Summer School on Formal ethods Tsinghua University, August 23, 2010 Plan computation models lambda-notation bound variables odels of computation

More information

The Lambda Calculus. Stephen A. Edwards. Fall Columbia University

The Lambda Calculus. Stephen A. Edwards. Fall Columbia University The Lambda Calculus Stephen A. Edwards Columbia University Fall 2014 Lambda Expressions Function application written in prefix form. Add four and five is (+ 4 5) Evaluation: select a redex and evaluate

More information

Origin in Mathematical Logic

Origin in Mathematical Logic Lambda Calculus Origin in Mathematical Logic Foundation of mathematics was very much an issue in the early decades of 20th century. Cantor, Frege, Russel s Paradox, Principia Mathematica, NBG/ZF Origin

More information

The Lambda-Calculus Reduction System

The Lambda-Calculus Reduction System 2 The Lambda-Calculus Reduction System 2.1 Reduction Systems In this section we present basic notions on reduction systems. For a more detailed study see [Klop, 1992, Dershowitz and Jouannaud, 1990]. Definition

More information

Lecture 2. Lambda calculus. Iztok Savnik, FAMNIT. March, 2018.

Lecture 2. Lambda calculus. Iztok Savnik, FAMNIT. March, 2018. Lecture 2 Lambda calculus Iztok Savnik, FAMNIT March, 2018. 1 Literature Henk Barendregt, Erik Barendsen, Introduction to Lambda Calculus, March 2000. Lambda calculus Leibniz had as ideal the following

More information

λ Slide 1 Content Exercises from last time λ-calculus COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification

λ Slide 1 Content Exercises from last time λ-calculus COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Content COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ Slide 1 Intro & motivation, getting started [1] Foundations & Principles Lambda

More information

Origin in Mathematical Logic

Origin in Mathematical Logic Lambda Calculus Origin in Mathematical Logic Foundation of mathematics was very much an issue in the early decades of 20th century. Cantor, Frege, Russel s Paradox, Principia Mathematica, NBG/ZF The Combinatory

More information

Functional Programming with Coq. Yuxin Deng East China Normal University

Functional Programming with Coq. Yuxin Deng East China Normal University Functional Programming with Coq Yuxin Deng East China Normal University http://basics.sjtu.edu.cn/ yuxin/ September 10, 2017 Functional Programming Y. Deng@ECNU 1 Reading materials 1. The Coq proof assistant.

More information

Lecture 3. Lambda calculus. Iztok Savnik, FAMNIT. October, 2015.

Lecture 3. Lambda calculus. Iztok Savnik, FAMNIT. October, 2015. Lecture 3 Lambda calculus Iztok Savnik, FAMNIT October, 2015. 1 Literature Henk Barendregt, Erik Barendsen, Introduction to Lambda Calculus, March 2000. Lambda calculus Leibniz had as ideal the following

More information

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

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007 CSE 230: Winter 2007 Principles of Programming Languages Lecture 12: The λ-calculus Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2 Several evaluation

More information

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

Lambda Calculus. Andrés Sicard-Ramírez. Semester Universidad EAFIT Lambda Calculus Andrés Sicard-Ramírez Universidad EAFIT Semester 2010-2 Bibliography Textbook: Hindley, J. R. and Seldin, J. (2008). Lambda-Calculus and Combinators. An Introduction. Cambridge University

More information

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

summer school Logic and Computation Goettingen, July 24-30, 2016 Università degli Studi di Torino summer school Logic and Computation Goettingen, July 24-30, 2016 A bit of history Alonzo Church (1936) The as formal account of computation. Proof of the undecidability

More information

Introduction to λ-calculus

Introduction to λ-calculus p.1/65 Introduction to λ-calculus Ken-etsu FUJITA fujita@cs.gunma-u.ac.jp http://www.comp.cs.gunma-u.ac.jp/ fujita/ Department of Computer Science Gunma University :Church 32, 36, 40; Curry 34 1. Universal

More information

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus CS 4110 Programming Languages & Logics Lecture 16 Programming in the λ-calculus 30 September 2016 Review: Church Booleans 2 We can encode TRUE, FALSE, and IF, as: TRUE λx. λy. x FALSE λx. λy. y IF λb.

More information

Programming Languages

Programming Languages CSE 230: Winter 2010 Principles of Programming Languages Lecture 10: Programming in λ-calculusc l l Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2

More information

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

Equivalent Computers. Lecture 39: Lambda Calculus. Lambda Calculus. What is Calculus? Real Definition. Why? #,, - Lecture 39: Lambda Calculus Equivalent Computers z z z... term = variable term term (term) λ variable. term λy. M α λv. (M [y α v]) where v does not occur in M. (λx. M)N β M [ x α N ] Turing Machine

More information

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

Advanced Lambda Calculus. Henk Barendregt & Giulio Manzonetto ICIS Faculty of Science Radboud University Nijmegen, The Netherlands 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

More information

TYPED LAMBDA CALCULI. Andrzej S. Murawski University of λeicester.

TYPED LAMBDA CALCULI. Andrzej S. Murawski University of λeicester. TYPED LAMBDA CALCULI Andrzej S. Murawski University of λeicester http://www.cs.le.ac.uk/people/amurawski/mgs2011-tlc.pdf THE COURSE The aim of the course is to provide an introduction to the lambda calculus

More information

COMP6463: λ-calculus

COMP6463: λ-calculus COMP6463: λ-calculus 1. Basics Michael Norrish Michael.Norrish@nicta.com.au Canberra Research Lab., NICTA Semester 2, 2015 Outline Introduction Lambda Calculus Terms Alpha Equivalence Substitution Dynamics

More information

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

Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. Radboud University Nijmegen. March 5, 2012 1 λ Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky Radboud University Nijmegen March 5, 2012 2 reading Femke van Raamsdonk Logical Verification Course Notes Herman Geuvers Introduction to

More information

Traditional and Non Traditional lambda calculi

Traditional and Non Traditional lambda calculi Strategies July 2009 Strategies Syntax Semantics Manipulating Expressions Variables and substitutions Free and bound variables Subterms and substitution Grafting and substitution Ordered list of variables

More information

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

Typed Lambda Calculi. Nikos Tzeveλekos Queen Mary, University of London 1 / 23 Typed Lambda Calculi Nikos Tzeveλekos Queen Mary, University of London 1 / 23 What is the Lambda Calculus A minimal formalism expressing computation with functionals s ::= x λx.s ss All you need is lambda.

More information

Type Systems. Lecture 2 Oct. 27th, 2004 Sebastian Maneth.

Type Systems. Lecture 2 Oct. 27th, 2004 Sebastian Maneth. Type Systems Lecture 2 Oct. 27th, 2004 Sebastian Maneth http://lampwww.epfl.ch/teaching/typesystems/2004 Today 1. What is the Lambda Calculus? 2. Its Syntax and Semantics 3. Church Booleans and Church

More information

Lazy Strong Normalization

Lazy Strong Normalization Lazy Strong Normalization Luca Paolini 1,2 Dipartimento di Informatica Università di Torino (ITALIA) Elaine Pimentel 1,2 Departamento de Matemática Universidade Federal de Minas Gerais (BRASIL) Dipartimento

More information

Models of Computation,

Models of Computation, Models of Computation, 2010 1 The Lambda Calculus A brief history of mathematical notation. Our notation for numbers was introduced in the Western World in the Renaissance (around 1200) by people like

More information

Programming Language Concepts: Lecture 18

Programming Language Concepts: Lecture 18 Programming Language Concepts: Lecture 18 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 18, 30 March 2009 One step reduction

More information

An Introduction to the Lambda Calculus

An Introduction to the Lambda Calculus An Introduction to the Lambda Calculus Mayer Goldberg February 20, 2000 1 Notation and Conventions It is surprising that despite the simplicity of its syntax, the λ-calculus hosts a large body of notation,

More information

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

Small families. (at INRIA with Gérard and in the historical λ-calculus) Jean-Jacques Lévy Small families (at INRIA with Gérard and in the historical λ-calculus) Jean-Jacques Lévy INRIA Rocquencourt and Microsoft Research-INRIA Joint Centre June 22, 2007 caml years coq sixty years is 31,557,600

More information

Typed Arithmetic Expressions

Typed Arithmetic Expressions Typed Arithmetic Expressions CS 550 Programming Languages Jeremy Johnson TAPL Chapters 3 and 5 1 Types and Safety Evaluation rules provide operational semantics for programming languages. The rules provide

More information

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

Alonzo Church ( ) Lambda Calculus. λ-calculus : syntax. Grammar for terms : Inductive denition for λ-terms Alonzo Church (1903-1995) Lambda Calculus 2 λ-calculus : syntax Grammar for terms : t, u ::= x (variable) t u (application) λx.t (abstraction) Notation : Application is left-associative so that t 1 t 2...

More information

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

Intersection and Singleton Type Assignment Characterizing Finite Böhm-Trees Information and Computation 178, 1 11 (2002) doi:101006/inco20022907 Intersection and Singleton Type Assignment Characterizing Finite Böhm-Trees Toshihiko Kurata 1 Department of Mathematics, Tokyo Metropolitan

More information

Charles Wells 1. February 25, 1999

Charles Wells 1. February 25, 1999 NOTES ON THE λ-calculus Charles Wells 1 February 25, 1999 Department of Mathematics Case Western Reserve University 10900 Euclid Ave. Cleveland, OH 44106-7058 USA charles@freude.com http://www.cwru.edu/artsci/math/wells/home.html

More information

Programming Language Concepts: Lecture 16

Programming Language Concepts: Lecture 16 Programming Language Concepts: Lecture 16 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 16, 23 March 2009 λ-calculus:

More information

Simply Typed λ-calculus

Simply Typed λ-calculus Simply Typed λ-calculus Lecture 1 Jeremy Dawson The Australian National University Semester 2, 2017 Jeremy Dawson (ANU) COMP4630,Lecture 1 Semester 2, 2017 1 / 23 A Brief History of Type Theory First developed

More information

Introduction to lambda calculus Part 2

Introduction to lambda calculus Part 2 Introduction to lambda calculus Part 2 Antti-Juhani Kaijanaho 2017-01-24... 1 Untyped lambda calculus 1.1 Syntax... x, y, z Var t, u Term t, u ::= x t u λx t... In this document, I will be using the following

More information

Realisability methods of proof and semantics with application to expansion

Realisability methods of proof and semantics with application to expansion Realisability methods of proof and semantics with application to expansion First Year Examination Supervisors : Professor Fairouz Kamareddine and Doctor Joe B. Wells Student : Vincent Rahli ULTRA group,

More information

Rewriting, Explicit Substitutions and Normalisation

Rewriting, Explicit Substitutions and Normalisation Rewriting, Explicit Substitutions and Normalisation XXXVI Escola de Verão do MAT Universidade de Brasilia Part 1/3 Eduardo Bonelli LIFIA (Fac. de Informática, UNLP, Arg.) and CONICET eduardo@lifia.info.unlp.edu.ar

More information

3.2 Equivalence, Evaluation and Reduction Strategies

3.2 Equivalence, Evaluation and Reduction Strategies 3.2 Equivalence, Evaluation and Reduction Strategies The λ-calculus can be seen as an equational theory. More precisely, we have rules i.e., α and reductions, for proving that two terms are intensionally

More information

Operational Semantics

Operational Semantics Operational Semantics Semantics and applications to verification Xavier Rival École Normale Supérieure Xavier Rival Operational Semantics 1 / 50 Program of this first lecture Operational semantics Mathematical

More information

Introduction to Turing Machines

Introduction to Turing Machines Introduction to Turing Machines Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 12 November 2015 Outline 1 Turing Machines 2 Formal definitions 3 Computability

More information

Notes on the λ-calculus

Notes on the λ-calculus Notes on the λ-calculus J.R.B. Cockett Department of Computer Science, University of Calgary Calgary, T2N 1N4, Alberta, Canada November 30, 2017 1 Introduction The λ-calculus was one of the first descriptions

More information

Simply Typed Lambda-Calculi (II)

Simply Typed Lambda-Calculi (II) THEORY AND PRACTICE OF FUNCTIONAL PROGRAMMING Simply Typed Lambda-Calculi (II) Dr. ZHANG Yu Institute of Software, Chinese Academy of Sciences Fall term, 2011 GUCAS, Beijing Introduction PCF Programming

More information

Constructive approach to relevant and affine term calculi

Constructive approach to relevant and affine term calculi Constructive approach to relevant and affine term calculi Jelena Ivetić, University of Novi Sad, Serbia Silvia Ghilezan,University of Novi Sad, Serbia Pierre Lescanne, University of Lyon, France Silvia

More information

Categories, Proofs and Programs

Categories, Proofs and Programs Categories, Proofs and Programs Samson Abramsky and Nikos Tzevelekos Lecture 4: Curry-Howard Correspondence and Cartesian Closed Categories In A Nutshell Logic Computation 555555555555555555 5 Categories

More information

Type Systems. Today. 1. What is the Lambda Calculus. 1. What is the Lambda Calculus. Lecture 2 Oct. 27th, 2004 Sebastian Maneth

Type Systems. Today. 1. What is the Lambda Calculus. 1. What is the Lambda Calculus. Lecture 2 Oct. 27th, 2004 Sebastian Maneth Today 1. What is the Lambda Calculus? Type Systems 2. Its Syntax and Semantics 3. Church Booleans and Church Numerals 4. Lazy vs. Eager Evaluation (call-by-name vs. call-by-value) Lecture 2 Oct. 27th,

More information

Tutorial on Semantics Part I

Tutorial on Semantics Part I Tutorial on Semantics Part I Basic Concepts Prakash Panangaden 1 1 School of Computer Science McGill University on sabbatical leave at Department of Computer Science Oxford University Fields Institute,

More information

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

Lambda Calculus with Types. Henk Barendregt ICIS Radboud University Nijmegen The Netherlands Lambda Calculus with Types Henk Barendregt ICIS Radboud University Nijmegen The Netherlands New book Cambridge University Press / ASL Perspectives in Logic, 2011 Lambda Calculus with Types (698 pp) Authors:

More information

On the Correctness and Efficiency of the Krivine Machine

On the Correctness and Efficiency of the Krivine Machine On the Correctness and Efficiency of the Krivine Machine Mitchell Wand Northeastern University Daniel P. Friedman Indiana University February 12, 2003 Abstract We provide a short derivation of the Krivine

More information

Minimal logic for computable functionals

Minimal logic for computable functionals Minimal logic for computable functionals Helmut Schwichtenberg Mathematisches Institut der Universität München Contents 1. Partial continuous functionals 2. Total and structure-total functionals 3. Terms;

More information

Programming Languages and Types

Programming Languages and Types Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Where we re going Type Systems... Type systems are one of the most fascinating and powerful aspects of programming

More information

1. Object Calculus. Object calculus is to OO languages what lambda calculus is to functional languages

1. Object Calculus. Object calculus is to OO languages what lambda calculus is to functional languages 1. Object Calculus In this section we will introduce a calculus of objects that gives a simple but powerful mathematical model to study object based languages. Object calculus is to OO languages what lambda

More information

Mathematical Logic IV

Mathematical Logic IV 1 Introduction Mathematical Logic IV The Lambda Calculus; by H.P. Barendregt(1984) Part One: Chapters 1-5 The λ-calculus (a theory denoted λ) is a type free theory about functions as rules, rather that

More information

Sequent Combinators: A Hilbert System for the Lambda Calculus

Sequent Combinators: A Hilbert System for the Lambda Calculus Sequent Combinators: A Hilbert System for the Lambda Calculus Healfdene Goguen Department of Computer Science, University of Edinburgh The King s Buildings, Edinburgh, EH9 3JZ, United Kingdom Fax: (+44)

More information

Lambda Calculus. Yuxi Fu. 31 May, 2013

Lambda Calculus. Yuxi Fu. 31 May, 2013 Lambda Calculus Yuxi Fu 31 May, 2013 Origin in Mathematical Logic Foundation of mathematics was very much an issue in the early decades of 20th century. Cantor, Frege, Russel s Paradox, Principia Mathematica,

More information

The Locally Nameless Representation

The Locally Nameless Representation Noname manuscript No. (will be inserted by the editor) The Locally Nameless Representation Arthur Charguéraud Received: date / Accepted: date Abstract This paper provides an introduction to the locally

More information

The Safe λ-calculus. William Blum. Joint work with C.-H. Luke Ong. Lunch-time meeting, 14 May Oxford University Computing Laboratory

The Safe λ-calculus. William Blum. Joint work with C.-H. Luke Ong. Lunch-time meeting, 14 May Oxford University Computing Laboratory The Safe λ-calculus William Blum Joint work with C.-H. Luke Ong Oxford University Computing Laboratory Lunch-time meeting, 14 May 2007 Overview Safety is originally a syntactic restriction for higher-order

More information

Decidability: Church-Turing Thesis

Decidability: Church-Turing Thesis Decidability: Church-Turing Thesis While there are a countably infinite number of languages that are described by TMs over some alphabet Σ, there are an uncountably infinite number that are not Are there

More information

Beyond First-Order Logic

Beyond First-Order Logic Beyond First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Beyond First-Order Logic MFES 2008/09 1 / 37 FOL

More information

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

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus Course 2D1453, 200607 Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Typing λterms The uptyped λcalculus

More information

About Typed Algebraic Lambda-calculi

About Typed Algebraic Lambda-calculi About Typed Algebraic Lambda-calculi Benoît Valiron INRIA Saclay/LIX Palaiseau, France valiron@lix.polytechnique.fr Abstract Arrighi and Dowek (2008) introduce an untyped lambdacalculus together with a

More information

Sharing in the weak lambda-calculus (2)

Sharing in the weak lambda-calculus (2) Sharing in the weak lambda-calculus (2) Jean-Jacques Lévy INRIA Joint work with Tomasz Blanc and Luc aranget Happy birthday Henk! Happy birthday Henk! Happy birthday Henk! History Sharing in the lambda-calculus

More information

On the Standardization Theorem for λβη-calculus

On the Standardization Theorem for λβη-calculus On the Standardization Theorem for λβη-calculus Ryo Kashima Department of Mathematical and Computing Sciences Tokyo Institute of Technology Ookayama, Meguro, Tokyo 152-8552, Japan. e-mail: kashima@is.titech.ac.jp

More information

Church s undecidability result

Church s undecidability result Church s undecidability result Alan Turing Birth Centennial Talk at IIT Bombay, Mumbai Joachim Breitner April 21, 2011 Welcome, and thank you for the invitation to speak about Church s lambda calculus

More information

Reducibility proofs in λ-calculi with intersection types

Reducibility proofs in λ-calculi with intersection types Reducibility proofs in λ-calculi with intersection types Fairouz Kamareddine, Vincent Rahli, and J. B. Wells ULTRA group, Heriot-Watt University, http://www.macs.hw.ac.uk/ultra/ March 14, 2008 Abstract

More information

Non deterministic classical logic: the λµ ++ -calculus

Non deterministic classical logic: the λµ ++ -calculus Paru dans : Mathematical Logic Quarterly, 48, pp. 357-366, 2002 Non deterministic classical logic: the λµ ++ -calculus Karim NOUR LAMA - Equipe de Logique, Université de Savoie 73376 Le Bourget du Lac

More information

Normalization by Evaluation

Normalization by Evaluation Normalization by Evaluation Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University PhD Seminar in Mathematical Engineering EAFIT University, Medellin, Colombia 9

More information

Combinators & Lambda Calculus

Combinators & Lambda Calculus Combinators & Lambda Calculus Abstracting 1/16 three apples plus two pears = five fruits concrete 3+2 = 5 abstract objects a+b = b+a a (b c) = (a b) c abstract quantities abstract operations a, b[r(a,

More information

arxiv: v1 [cs.lo] 29 May 2014

arxiv: v1 [cs.lo] 29 May 2014 An Introduction to the Clocked Lambda Calculus Jörg Endrullis, Dimitri Hendriks, Jan Willem Klop, and Andrew Polonsky VU University Amsterdam, The Netherlands Abstract We give a brief introduction to the

More information

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications NICTA Advanced Course Theorem Proving Principles, Techniques, Applications λ 1 CONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic, natural

More information

Computation Theory, L 9 116/171

Computation Theory, L 9 116/171 Definition. A partial function f is partial recursive ( f PR) ifitcanbebuiltupinfinitelymanysteps from the basic functions by use of the operations of composition, primitive recursion and minimization.

More information

3. The λ-calculus and Implication

3. The λ-calculus and Implication 3. The λ-calculus and Implication (a) (b) (c) (d) (e) (f) The untyped λ-calculus. The typed λ-calculus. The λ-calculus in Agda. Logic with Implication Implicational Logic in Agda. More on the typed λ-calculus.

More information

Predicate Logic - Undecidability

Predicate Logic - Undecidability CS402, Spring 2016 Undecidable Problems Does the following program halts? (1) N : n, total, x, y, z (2) n GetUserInput() (3) total 3 (4) while true (5) for x 1 to total 2 (6) for y 1 to total x 1 (7) z

More information

The Safe Lambda Calculus

The Safe Lambda Calculus The Safe Lambda Calculus William Blum Linacre College Submitted in partial fulfilment of the requirements for the degree of Doctor of Philosophy Oxford University Computing Laboratory Michaelmas 2008 Abstract

More information

Parallel Reduction in Type Free Lambda-mu- Calculus

Parallel Reduction in Type Free Lambda-mu- Calculus 九州大学学術情報リポジトリ Kyushu University Institutional Repository Parallel Reduction in Type Free Lambda-mu- Calculus Baba, Kensuke Graduate School of Information Science and Electrical Engineering, Kyushu University

More information

Domain theory and denotational semantics of functional programming

Domain theory and denotational semantics of functional programming Domain theory and denotational semantics of functional programming Martín Escardó School of Computer Science, Birmingham University MGS 2007, Nottingham, version of April 20, 2007 17:26 What is denotational

More information

HOAS by example What is a Formal System? A Simply Typed Framework What Does it Mean? Canonical LF References HOAS. Randy Pollack

HOAS by example What is a Formal System? A Simply Typed Framework What Does it Mean? Canonical LF References HOAS. Randy Pollack HOAS Randy Pollack Version of November 2, 2011 Outline 1 HOAS by example 2 What is a Formal System? 3 A Simply Typed Framework 4 What Does it Mean? 5 Canonical LF Judgement Forms and Rules Hereditary Substitution

More information

(2) (15pts) Using Prolog, implement a type-checker for the following small subset of System F:

(2) (15pts) Using Prolog, implement a type-checker for the following small subset of System F: CS 6371 Advanced Programming Languages Sample Spring 2018 Final Exam This sample final exam is LONGER than a real final exam (to give you more practice problems) and has a medium difficulty level. You

More information

Type Inference. For the Simply-Typed Lambda Calculus. Peter Thiemann, Manuel Geffken. Albert-Ludwigs-Universität Freiburg. University of Freiburg

Type Inference. For the Simply-Typed Lambda Calculus. Peter Thiemann, Manuel Geffken. Albert-Ludwigs-Universität Freiburg. University of Freiburg Type Inference For the Simply-Typed Lambda Calculus Albert-Ludwigs-Universität Freiburg Peter Thiemann, Manuel Geffken University of Freiburg 24. Januar 2013 Outline 1 Introduction 2 Applied Lambda Calculus

More information

Denotational semantics

Denotational semantics Denotational semantics Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 4 4 March 2016 Course 4 Denotational semantics Antoine Miné p.

More information

Consistency of a Programming Logic for a Version of PCF Using Domain Theory

Consistency of a Programming Logic for a Version of PCF Using Domain Theory Consistency of a Programming Logic for a Version of PCF Using Domain Theory Andrés Sicard-Ramírez EAFIT University Logic and Computation Seminar EAFIT University 5 April, 3 May 2013 A Core Functional Programming

More information

λ-calculus and types

λ-calculus and types λ-calculus and types Lecture notes Midland Graduate School / APPSEM Spring School 2004 Thorsten Altenkirch School of Computer Science and Information Technology, Nottingham University txa@cs.nott.ac.uk

More information

A Lambda Calculus for Quantum Computation

A Lambda Calculus for Quantum Computation arxiv:quant-ph/0307150v5 3 Apr 004 A Lambda Calculus for Quantum Computation André van Tonder Department of Physics, Brown University Box 1843, Providence, RI 0906 andre@het.brown.edu July 15, 003 Revised

More information

Advanced Lambda Calculus Lecture 5

Advanced Lambda Calculus Lecture 5 Advanced Lambda Calculus Lecture 5 The fathers Alonzo Church (1903-1995) as mathematics student at Princeton University (1922 or 1924) Haskell B. Curry (1900-1982) as BA in mathematics at Harvard (1920)

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines COMP-330 Theory of Computation Fall 2017 -- Prof. Claude Crépeau Lec. 16 : Turing Machines COMP 330 Fall 2017: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic finite

More information

Semantics with Intersection Types

Semantics with Intersection Types Semantics with Intersection Types Steffen van Bakel Department of Computing, Imperial College of Science, Technology and Medicine, 180 Queen s Gate, London SW7 2BZ, U.K., E-mail: svb@doc.ic.ac.uk (Sections

More information

The Greek Alphabet. (a) The Untyped λ-calculus

The Greek Alphabet. (a) The Untyped λ-calculus 3. The λ-calculus and Implication Greek Letters (a) The untyped λ-calculus. (b) The typed λ-calculus. (c) The λ-calculus in Agda. (d) Logic with Implication (e) Implicational Logic in Agda. (f) More on

More information

The λ-calculus and Curry s Paradox Drew McDermott , revised

The λ-calculus and Curry s Paradox Drew McDermott , revised The λ-calculus and Curry s Paradox Drew McDermott drew.mcdermott@yale.edu 2015-09-23, revised 2015-10-24 The λ-calculus was invented by Alonzo Church, building on earlier work by Gottlob Frege and Moses

More information

Lambda calculus L9 103

Lambda calculus L9 103 Lambda calculus L9 103 Notions of computability L9 104 Church (1936): λ-calculus Turing (1936): Turing machines. Turing showed that the two very different approaches determine the same class of computable

More information

3.2 Reduction 29. Truth. The constructor just forms the unit element,. Since there is no destructor, there is no reduction rule.

3.2 Reduction 29. Truth. The constructor just forms the unit element,. Since there is no destructor, there is no reduction rule. 32 Reduction 29 32 Reduction In the preceding section, we have introduced the assignment of proof terms to natural deductions If proofs are programs then we need to explain how proofs are to be executed,

More information

FORMAL SYSTEMS: COMBINATORY LOGIC

FORMAL SYSTEMS: COMBINATORY LOGIC FORMAL SYSTEMS: COMBINATORY LOGIC AND λ-calculus Andrew R. Plummer Department of Linguistics The Ohio State University 30 Sept., 2009 OUTLINE 1 INTRODUCTION 2 APPLICATIVE SYSTEMS 3 USEFUL INFORMATION COMBINATORY

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

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

Call-by-value non-determinism in a linear logic type discipline Call-by-value non-determinism in a linear logic type discipline Alejandro Díaz-Caro? Giulio Manzonetto Université Paris-Ouest & INRIA LIPN, Université Paris 13 Michele Pagani LIPN, Université Paris 13

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages Lecture 03 Theoretical Foundations 1 Domains Semantic model of a data type: semantic domain! Examples: Integer, Natural, Truth-Value Domains D are more than a set of

More information

SHARING IN THE WEAK LAMBDA-CALCULUS REVISITED

SHARING IN THE WEAK LAMBDA-CALCULUS REVISITED SHARING IN THE WEAK LAMBDA-CALCULUS REVISITED TOMASZ BLANC, JEAN-JACQUES LÉVY, AND LUC MARANGET INRIA e-mail address: tomasz.blanc@inria.fr INRIA, Microsoft Research-INRIA Joint Centre e-mail address:

More information

l-calculus and Decidability

l-calculus and Decidability U.U.D.M. Project Report 2017:34 l-calculus and Decidability Erik Larsson Examensarbete i matematik, 15 hp Handledare: Vera Koponen Examinator: Jörgen Östensson Augusti 2017 Department of Mathematics Uppsala

More information

Logic and Probability Lecture 3: Beyond Boolean Logic

Logic and Probability Lecture 3: Beyond Boolean Logic Logic and Probability Lecture 3: Beyond Boolean Logic Wesley Holliday & Thomas Icard UC Berkeley & Stanford August 13, 2014 ESSLLI, Tübingen Wesley Holliday & Thomas Icard: Logic and Probability, Lecture

More information

Lambda-Calculus (cont): Fixpoints, Naming. Lecture 10 CS 565 2/10/08

Lambda-Calculus (cont): Fixpoints, Naming. Lecture 10 CS 565 2/10/08 Lambda-Calculus (cont): Fixpoints, Naming Lecture 10 CS 565 2/10/08 Recursion and Divergence Consider the application: Ω ((λ x. (x x)) (λ x. (x x))) Ω evaluates to itself in one step. It has no normal

More information

Functional Programming with F# Overview and Basic Concepts

Functional Programming with F# Overview and Basic Concepts Functional Programming with F# Overview and Basic Concepts Radu Nicolescu Department of Computer Science University of Auckland 27 Sep 2017 1 / 52 1 Background 2 Overview 3 Type System and Type Inference

More information

The Curry-Howard Isomorphism

The Curry-Howard Isomorphism The Curry-Howard Isomorphism Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) The Curry-Howard Isomorphism MFES 2008/09

More information

Typage et déduction dans le calcul de

Typage et déduction dans le calcul de Typage et déduction dans le calcul de réécriture Benjamin Wack Encadrants : C. Kirchner, L. Liquori Deduction and computation λ-calculus [Church 40] is a simple and powerful computational model Explicit

More information