Lambda Calculus. Adrian Groza. Department of Computer Science Technical University of Cluj-Napoca
|
|
- Pamela Blake
- 5 years ago
- Views:
Transcription
1 Lambda Calculus Adrian Groza Department of Computer Science Technical University of Cluj-Napoca
2 Outline 1 λ-calculus 2 Operational Semantics Syntax Conversions Normal Form 3 Lambda Calculus as a Functional Language Aritmethic Operations Boolean Expressions Tuples 4 Food for Tought
3 What is Computable? Computation is usually modelled as a mapping from inputs to outputs, carried out by a formal machine or program, which processes its input in a sequence of steps. An effectively computable function is one that can be computed in a finite amount of time using finite resources.
4 Computation Models Turing Machine (Turing, 1936) modifies the content of the memory and of an input tape whose movement is controllable corresponds to imperative languages where the state of the computation process is represented and explicitly processed Lambda Calculus (Church, 1932) works on unary functions relies on function application the substitution in the function body of the formal parameter with the effective parameter processing without state ( ) ( ) Church-Turing thesis If an algorithm (a procedure that terminates) exists then there is an equivalent Turing Machine or applicable λ-function for that algorithm.
5 Lambda Calculus 1 universal: any computable function can be expressed and evaluated using this formalism 2 to directly express higher-order functions 3 to study evaluation orders, termination, uniqueness of answers 4 to serve as a kernel language for functional languages 5 the smallest universal programming language of the world
6 Outline 1 λ-calculus 2 Operational Semantics Syntax Conversions Normal Form 3 Lambda Calculus as a Functional Language Aritmethic Operations Boolean Expressions Tuples 4 Food for Tought
7 Syntax Syntax E = x λx. E E 1 E 2 x - variable λx.e - functional abstraction (x - bound variable, E - body) E 1 E 2 - function application (E 1 function, E 2 argument) <expression> := <name> <function> <application> <function> := λ <name>.<expression> <application> := <expression><expression> Examples: x λ-expression reduced to a variable λx.x is a function taking an argument x, and returning x (identity fun) λx. λy.x function which selects the first value from a pair of values f x is a function f applied to an argument x (same as f(x)) (λx.x) y applying the function λx.x on the argument y
8 Syntax Examples (λx. x x) (λy. y) = (λy. y) (λx.(x + 5)) 3 = 3+5 = 8 ((λx.(λy.x + y)) 3) 5 = (λy.3 + y)) 5 = 3+5=8 (λf.λx.f(f x))(λy.y+1) = λx.(λy.y+1)((λy.y+1) x) = λx.(λy.y+1)(x+1) = λx.x+1+1
9 Syntax Parsing Lambda Expressions 1 Lambda extends as far as possible to the right λf.x y λ f.(x y) λx.e1 E2 E3 λ x.(e1 E2 E3) λx.x λz.x z x λx.(x λz.(x z x)) 2 Application is left-associative x y z (x y) z 3 Parantheses are needed for (λx.e1 E2) E3 where E3 is an argument to the function λx.e1 E2, not part of the body of the function 4 Multiple lambdas may be suppressed λ f g. x λ f. λ g. x
10 Syntax Functions with Many Arguments We can t yet write functions with many arguments - for example, two arguments: λ(x,y).e Solution: take the arguments, one at a time λx.λy.e A function that takes x and returns another function that takes y and returns e (λx.λy.e) a b (λy.e[a/x]) b e[a/x][b/y] This is called Currying Can represent any number of arguments
11 Syntax Free and Bound Variables In function λx.t, the variable x is bound; t is the body of the function A variable which is not bound is free. Examples: (λx. x y) (λx. x)(λy. y x ) (λz. (λx. (y x))) Observations: x is bound, y is free x is bound in the first expression, x is independen x is bound, y is free Name of bound var does not matter: λx.(3+x) = λy.(3+y) Name of free var does matter: λx.(x+y) λx.(x+z) Same identifier can occur free and bound in the same expression: (λx.xy)(λy.y)
12 Conversions α-conversion Conversion = rule for transforming a λ-expression into a another one with the same meaning. α-conversion: renaming bound variables (λx.t) α (λy.t[y/x]) Example (λx.ax) α (λy.ay) (λx.(x(λy.(yx)))) α (λz.(z(λy.(yz))))[z/x] (λx.x(λx.ax))b α (λy.y(λx.ax))b[y/x]
13 Conversions β-conversion β-conversion: applying abstractions to arguments ((λx.t)u) β (t[u/x]) Example ((λx.((fx)x)(ga) β ((f (ga))(ga)) ((λz.(za)(λx.x) β (λx.x)a β a ((λx.λy.y)a)b) β ((λy.y))b (λy.y)b β b β-conversion represents the computational engine of the lambda calculus.
14 Conversions η-conversion η-conversion: eliminates redundant lambda-expressions (λx.fx)y η fy Every time when x is not free in f, we can write: (λ x. f x ) = f Example (λ b. y b) y (λ z. (λ x. x y) z) λ x. x y
15 Conversions Applying Conversions Conversions 1 (λx.t) α (λy.t[y/x]) 2 ((λx.t)u) β (t[u/x]) 3 (λx.fx)y η fy (λ x y. x y) (λ x. x y) (λ a b. a b) NB: left assoc α (λ x z. x z) (λ x. x y) (λ a b. a b) α-conversion [z/x] β (λ z. (λ x. x y) z) (λ a b. a b) β-reduction [(λ x. x y)/x] η (λ x. x y) (λ a b. a b) η-reduction (λ z. f z )= f β (λ a b. a b) y β-reduction [(λ a b. a b)/x] β (λ b. y b) β-reduction [(y/a] η y η-reduction(λ z. f z)= f
16 Conversions Nested expressions Syntax simplification: (λx 1. (λx 2....(λx n. t)...)) (λx 1 x 2...x n. t) (λx y.y x) y b (λx y.y x) y b (λx. (λy. y x)) y b α (λx. (λz. z x)) y b β (λz. z y) b β b y (λx. (λy. y x)) y b β (λy. y y) b β b b Don t accidentally bind a free variable!
17 Normal Form Normal Form A λ-expression is said to be in the normal form if no further reduction steps could be applied to it. Example (λ x. a x)((λ y. b y) c) α (λ z. a z)((λ y. b y) c) β a ((λ y. b y) c) a (b c) Not all expressions have a normal form (λ x. x x) (λ x. x x) β (x x)[(λ x. x x)/x] (λ x. x x) (λ x. x x)... the program never ends.
18 Normal Form Church-Rosser Thesis Thesis Two sequences of reductions applied to a λ-expressions will always result in equivalent normal forms. Thus the normal form does not depend on the order the reductions are performed. (λ x. a x)((λ y. b y) c) α (λ z. a z)((λ y. b y) c) β a ((λ y. b y) c) a (b c) (λ x. a x)((λ y. b y) c) β (λx. a x)(b c) β a (b c)
19 Normal Form Call by name and call by value in λ-calculus Call by name (λ y. a) ((λ x. x x) (λ x. x x)) β a argument is not evaluated and it is substitued in the body of the function. Call by value (λ y. a) ((λ x. x x) (λ x. x x)) β (λ y. a) ((λ x. x x) (λ x. x x)) This type of substitution always finds the normal form, provided that such a form actually exists. (\x -> \y -> x) 1 (5/0) = 1
20 Outline 1 λ-calculus 2 Operational Semantics Syntax Conversions Normal Form 3 Lambda Calculus as a Functional Language Aritmethic Operations Boolean Expressions Tuples 4 Food for Tought
21 Aritmethic Operations λ-calculus Expressivity In the lambda calculus we can only define new functions. How can we program with only functions? Idea Encode the behavior of values and not their structure. Introducing variables let x = e1 in e2 (λx.e1) e2
22 Aritmethic Operations Aritmethic Can we represent numbers in λ-calculus? Numbers will be defined as... functions: 0 := λsz.z 1 := λsz.s(z) 2 := λsz.s(s(z))... Definition A natural number is a function that given an operation s and a starting value z, applies s a number of times to z.
23 Aritmethic Operations Successor Function Our first interesting function... S λwyx.y(wyx) S 0 λw y x. y(wyx) (λsz. z) β λy x. y ((λsz. z) y x) β λy x. y ((λz. z) x) β λy x. y (x) α λs x. s(x) 1
24 Aritmethic Operations Summing numbers Our second interesting function... PLUS λ mnfx. nf (mfx) PLUS 1 2 (λ mnfx.nf (mfx))1 2 ββ λ fx.2f (1fx) λ fx.2f ((λ fx.f (x)) fx) η λ fx.2f (f (x)) λ fx.(λ fx.f (f (x)))f (f (x)) λ fx.f (f (f (x))) α 3
25 Boolean Expressions Boolean Expressions What is true? True is something that used as the first parameter of if makes the result of if to be its second parameter if T M N M if λ p. λthen.λelse. p then else if λp. (λ c. (λ a. pca))) λpca. pca A boolean is a function that given two choices selects one of them T λx. (λy. x) λx y. x F λx. (λy. y) λx y. y if T M N λp c a. p c a (λx y. x) M N β (λc a. (λx y. x) c a) M N β (λa. (λx y. x) a) M N β (λx y. x) M N β (λy. M) N β M
26 Boolean Expressions Logical Operators And, Or, Not and λx (λy if x y F) λxy. x y F or λx (λy if x T y) λxy. x T y not λx. x F T and T F (λx y. x y F) T F β (λy. T y F) F β T F F β (λx y. x) F F β (λy. F) F β F 1 (λx.t) α (λy.t[y/x]) 2 ((λx.t)u) β (t[u/x]) 3 (λx.fx)y η fy
27 Boolean Expressions Logical Operators And, Or, Not and λx (λy if x y F)... λxy. x y F or λx (λy if x T y) λxy. x T y not λx. x F T 1 (λx.t) α (λy.t[y/x]) 2 ((λx.t)u) β (t[u/x]) 3 (λx.fx)y η fy and T F (λx y. x y F) T F β (λy. T y F) F β T F F β (λx y. x) F F β (λy. F) F β F not T (λ b. b F T ) (λ x y. x ) β (λ x y. x) F T β F
28 Boolean Expressions Testing if a number is zero Another interesting function... Z λx.xf F Z 0 λx.xf F 0 0F F (λs z. z) F F F T
29 Boolean Expressions Testing if a number is zero Z 0 λx.xf F 0 0F F (λs z. z) F F F T Z 1 λx.xf F 1 1F F (λsz.s(z))f F F( )F (λxy.y)( )F F Z λx.xf F
30 Tuples Defining pairs PAIR λxyf.fxy FIRST λ p. p T SECOND λ p. p F First (Pair (a b)) (λp.p T) (PAIR a b) (PAIR a b) T (λxyf.fxy a b) T (λf. f a b) T T a b a
31 Tuples Recursion A self-regenerating function... Y λy.(λx.y(xx))(λx.y(xx)) YR λy.(λx.y(xx))(λx.y(xx))r (λx.r(xx))(λx.r(xx)) R((λx.R(xx))(λx.R(xx))) R(YR) When Y is applied on an arbitrary function R, R will call itself on (YR). Subsequent equivalent forms appear when R gets expanded according to its definition. It is R s responsibility to break the recursive loop at some moment by providing a condition for stopping.
32 Tuples Recursion - Example fact = λ f. λ n.if n = 0 then 1 else n * (f (n-1)) (Y fact) 1 = (fact (Y fact)) 1 if 1 = 0 then 1 else 1 * ((Y fact) 0) 1 * ((Y fact) 0) 1 * (fact (Y fact) 0) 1 * (if 0 = 0 then 1 else 0 * ((Y fact) (-1)) 1 * 1 1
33 Outline 1 λ-calculus 2 Operational Semantics Syntax Conversions Normal Form 3 Lambda Calculus as a Functional Language Aritmethic Operations Boolean Expressions Tuples 4 Food for Tought
34 Readings 1 Mandatory reading: Chapter 8: pages Optional reading: A Tutorial Introduction to the Lambda Calculus, Raul Rojas, FU Berlin, Germany, WS-97/98
Chapter 5: The Untyped Lambda Calculus
Chapter 5: The Untyped Lambda Calculus What is lambda calculus for? Basics: syntax and operational semantics Programming in the Lambda Calculus Formalities (formal definitions) What is Lambda calculus
More informationINF 212 ANALYSIS OF PROG. LANGS LAMBDA CALCULUS. Instructors: Crista Lopes Copyright Instructors.
INF 212 ANALYSIS OF PROG. LANGS LAMBDA CALCULUS Instructors: Crista Lopes Copyright Instructors. History Formal mathematical system Simplest programming language Intended for studying functions, recursion
More informationlambda calculus History 11/28/13 Jianguo Lu A formal system designed to inves:gate func:on defini:on, func:on applica:on, and recursion.
lambda calculus Jianguo Lu 1 History Lambda calculus A formal system designed to inves:gate func:on defini:on, func:on applica:on, and recursion. Introduced by Alonzo Church in 1930s. The calculus can
More informationFundamentals and lambda calculus
Fundamentals and lambda calculus Again: JavaScript functions JavaScript functions are first-class Syntax is a bit ugly/terse when you want to use functions as values; recall block scoping: (function ()
More information5. Introduction to the Lambda Calculus. Oscar Nierstrasz
5. Introduction to the Lambda Calculus Oscar Nierstrasz Roadmap > What is Computability? Church s Thesis > Lambda Calculus operational semantics > The Church-Rosser Property > Modelling basic programming
More informationCMSC 330: Organization of Programming Languages. Lambda Calculus
CMSC 330: Organization of Programming Languages Lambda Calculus 1 Turing Completeness Turing machines are the most powerful description of computation possible They define the Turing-computable functions
More informationConstraint-based Analysis. Harry Xu CS 253/INF 212 Spring 2013
Constraint-based Analysis Harry Xu CS 253/INF 212 Spring 2013 Acknowledgements Many slides in this file were taken from Prof. Crista Lope s slides on functional programming as well as slides provided by
More informationA Tutorial Introduction to the Lambda Calculus
A Tutorial Introduction to the Lambda Calculus Raúl Rojas FU Berlin, WS-97/98 Abstract This paper is a short and painless introduction to the λ calculus. Originally developed in order to study some mathematical
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 Summer 2017 1 100 years ago Albert Einstein proposed special theory of relativity in 1905 In the paper On the Electrodynamics of
More informationCMSC 330: Organization of Programming Languages. Lambda Calculus
CMSC 330: Organization of Programming Languages Lambda Calculus 1 100 years ago Albert Einstein proposed special theory of relativity in 1905 In the paper On the Electrodynamics of Moving Bodies 2 Prioritätsstreit,
More informationType Systems Winter Semester 2006
Type Systems Winter Semester 2006 Week 4 November 8 November 15, 2006 - version 1.1 The Lambda Calculus The lambda-calculus If our previous language of arithmetic expressions was the simplest nontrivial
More informationCOMP 1130 Lambda Calculus. based on slides by Jeff Foster, U Maryland
COMP 1130 Lambda Calculus based on slides by Jeff Foster, U Maryland Motivation Commonly-used programming languages are large and complex ANSI C99 standard: 538 pages ANSI C++ standard: 714 pages Java
More informationLecture 5: The Untyped λ-calculus
Lecture 5: The Untyped λ-calculus Syntax and basic examples Polyvios Pratikakis Computer Science Department, University of Crete Type Systems and Static Analysis Pratikakis (CSD) Untyped λ-calculus I CS49040,
More informationActivity. CSCI 334: Principles of Programming Languages. Lecture 4: Fundamentals II. What is computable? What is computable?
Activity CSCI 334: Principles of Programming Languages Lecture 4: Fundamentals II Write a function firsts that, when given a list of cons cells, returns a list of the left element of each cons. ( (a. b)
More informationFundamentals and lambda calculus. Deian Stefan (adopted from my & Edward Yang s CSE242 slides)
Fundamentals and lambda calculus Deian Stefan (adopted from my & Edward Yang s CSE242 slides) Logistics Assignments: Programming assignment 1 is out Homework 1 will be released tomorrow night Podcasting:
More informationIntroduction to Lambda Calculus. Lecture 5 CS 565 1/24/08
Introduction to Lambda Calculus Lecture 5 CS 565 1/24/08 Lambda Calculus So far, we ve explored some simple but non-interesting languages language of arithmetic expressions IMP (arithmetic + while loops)
More informationLambda Calculus. Lecture 4 CS /26/10
Lambda Calculus Lecture 4 CS 565 10/26/10 Pure (Untyped) Lambda Calculus The only value is a function Variables denote functions Functions always take functions as arguments Functions always return functions
More informationProgramming Language Features. CMSC 330: Organization of Programming Languages. Turing Completeness. Turing Machine.
CMSC 330: Organization of Programming Languages Lambda Calculus Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying or tuples
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 1 Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying
More informationCMPUT 325 : Lambda Calculus Basics. Lambda Calculus. Dr. B. Price and Dr. R. Greiner. 13th October 2004
CMPUT 325 : Lambda Calculus Basics Dr. B. Price and Dr. R. Greiner 13th October 2004 Dr. B. Price and Dr. R. Greiner CMPUT 325 : Lambda Calculus Basics 1 Lambda Calculus Lambda calculus serves as a formal
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 1 Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Use currying
More informationPure (Untyped) λ-calculus. Andrey Kruglyak, 2010
Pure (Untyped) λ-calculus Andrey Kruglyak, 2010 1 Pure (untyped) λ-calculus An example of a simple formal language Invented by Alonzo Church (1936) Used as a core language (a calculus capturing the essential
More informationIntroduction to Lambda Calculus. Lecture 7 CS /08/09
Introduction to Lambda Calculus Lecture 7 CS 565 02/08/09 Lambda Calculus So far, we ve explored some simple but non-interesting languages language of arithmetic expressions IMP (arithmetic + while loops)
More informationλ calculus Function application Untyped λ-calculus - Basic Idea Terms, Variables, Syntax β reduction Advanced Formal Methods
Course 2D1453, 2006-07 Advanced Formal Methods Lecture 2: Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Alonzo Church, 1903-1995 Church-Turing thesis First
More informationLambda Calculus. Lambda Calculus
Lambda Calculus Formalism to describe semantics of operations in functional PLs Variables are free or bound Function definition vs function abstraction Substitution rules for evaluating functions Normal
More informationPure Lambda Calculus. Lecture 17
Pure Lambda Calculus Lecture 17 Lambda Calculus Lambda Calculus (λ-calculus) is a functional notation introduced by Alonzo Church in the early 1930s to formalize the notion of computability. Pure λ-calculus
More informationIntroduction to the Lambda Calculus
Introduction to the Lambda Calculus Overview: What is Computability? Church s Thesis The Lambda Calculus Scope and lexical address The Church-Rosser Property Recursion References: Daniel P. Friedman et
More informationCIS 500 Software Foundations Fall September 25
CIS 500 Software Foundations Fall 2006 September 25 The Lambda Calculus The lambda-calculus If our previous language of arithmetic expressions was the simplest nontrivial programming language, then the
More informationLambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu,
Lambda Calculus Type Systems, Lectures 3 Jevgeni Kabanov Tartu, 13.02.2006 PREVIOUSLY ON TYPE SYSTEMS Arithmetical expressions and Booleans Evaluation semantics Normal forms & Values Getting stuck Safety
More informationA Quick Overview. CAS 701 Class Presentation 18 November Department of Computing & Software McMaster University. Church s Lambda Calculus
A Quick Overview CAS 701 Class Presentation 18 November 2008 Lambda Department of Computing & Software McMaster University 1.1 Outline 1 2 3 Lambda 4 5 6 7 Type Problem Lambda 1.2 Lambda calculus is a
More informationConcepts of programming languages
Concepts of programming languages Lecture 5 Wouter Swierstra 1 Announcements Submit your project proposal to me by email on Friday; The presentation schedule in now online Exercise session after the lecture.
More informationLambda Calculus alpha-renaming, beta reduction, applicative and normal evaluation orders, Church-Rosser theorem, combinators
Lambda Calculus alpha-renaming, beta reduction, applicative and normal evaluation orders, Church-Rosser theorem, combinators Carlos Varela Rennselaer Polytechnic Institute February 11, 2010 C. Varela 1
More informationIntroductory Example
CSc 520 Principles of Programming Languages 21: Lambda Calculus Introduction Christian Collberg Department of Computer Science University of Arizona collberg@cs.arizona.edu Copyright c 2005 Christian Collberg
More informationOne of a number of approaches to a mathematical challenge at the time (1930): Constructibility
λ Calculus Church s λ Calculus: Brief History One of a number of approaches to a mathematical challenge at the time (1930): Constructibility (What does it mean for an object, e.g. a natural number, to
More information9/23/2014. Why study? Lambda calculus. Church Rosser theorem Completeness of Lambda Calculus: Turing Complete
Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati Why study? Lambda calculus Syntax Evaluation Relationship to programming languages Church Rosser theorem Completeness of Lambda Calculus: Turing
More informationThe Untyped Lambda Calculus
CS738: Advanced Compiler Optimizations The Untyped Lambda Calculus Amey Karkare karkare@cse.iitk.ac.in http://www.cse.iitk.ac.in/~karkare/cs738 Department of CSE, IIT Kanpur Reference Book Types and Programming
More informationRecursive Definitions, Fixed Points and the Combinator
Recursive Definitions, Fixed Points and the Combinator Dr. Greg Lavender Department of Computer Sciences University of Texas at Austin Recursive Self-Reference Recursive self-reference occurs regularly
More informationFormal Semantics. Aspects to formalize. Lambda calculus. Approach
Formal Semantics Aspects to formalize Why formalize? some language features are tricky, e.g. generalizable type variables, nested functions some features have subtle interactions, e.g. polymorphism and
More informationComputer Science 203 Programming Languages Fall Lecture 10. Bindings, Procedures, Functions, Functional Programming, and the Lambda Calculus
1 Computer Science 203 Programming Languages Fall 2004 Lecture 10 Bindings, Procedures, Functions, Functional Programming, and the Lambda Calculus Plan Informal discussion of procedures and bindings Introduction
More information11/6/17. Outline. FP Foundations, Scheme. Imperative Languages. Functional Programming. Mathematical Foundations. Mathematical Foundations
Outline FP Foundations, Scheme In Text: Chapter 15 Mathematical foundations Functional programming λ-calculus LISP Scheme 2 Imperative Languages We have been discussing imperative languages C/C++, Java,
More information1 Scope, Bound and Free Occurrences, Closed Terms
CS 6110 S18 Lecture 2 The λ-calculus Last time we introduced the λ-calculus, a mathematical system for studying the interaction of functional abstraction and functional application. We discussed the syntax
More informationCITS3211 FUNCTIONAL PROGRAMMING
CITS3211 FUNCTIONAL PROGRAMMING 9. The λ calculus Summary: This lecture introduces the λ calculus. The λ calculus is the theoretical model underlying the semantics and implementation of functional programming
More informationIntroduction to the λ-calculus
Announcements Prelim #2 issues: o Problem 5 grading guide out shortly o Problem 3 (hashing) issues Will be on final! Friday RDZ office hours are 11-12 not 1:30-2:30 1 Introduction to the λ-calculus Today
More informationPart I. Historical Origins
Introduction to the λ-calculus Part I CS 209 - Functional Programming Dr. Greg Lavender Department of Computer Science Stanford University Historical Origins Foundations of Mathematics (1879-1936) Paradoxes
More informationCSE 505: Concepts of Programming Languages
CSE 505: Concepts of Programming Languages Dan Grossman Fall 2003 Lecture 6 Lambda Calculus Dan Grossman CSE505 Fall 2003, Lecture 6 1 Where we are Done: Modeling mutation and local control-flow Proving
More informationdynamically typed dynamically scoped
Reference Dynamically Typed Programming Languages Part 1: The Untyped λ-calculus Jim Royer CIS 352 April 19, 2018 Practical Foundations for Programming Languages, 2/e, Part VI: Dynamic Types, by Robert
More informationThe Lambda Calculus. 27 September. Fall Software Foundations CIS 500. The lambda-calculus. Announcements
CIS 500 Software Foundations Fall 2004 27 September IS 500, 27 September 1 The Lambda Calculus IS 500, 27 September 3 Announcements Homework 1 is graded. Pick it up from Cheryl Hickey (Levine 502). We
More informationElixir, functional programming and the Lambda calculus.
Elixir, functional programming and the Lambda calculus. Programming II - Elixir Version Johan Montelius Spring Term 2018 Introduction In this tutorial you re going to explore lambda calculus and how it
More informationLast class. CS Principles of Programming Languages. Introduction. Outline
Last class CS6848 - Principles of Programming Languages Principles of Programming Languages V. Krishna Nandivada IIT Madras Interpreters A Environment B Cells C Closures D Recursive environments E Interpreting
More informationThe Untyped Lambda Calculus
Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationHarvard School of Engineering and Applied Sciences CS 152: Programming Languages. Lambda calculus
Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Tuesday, February 19, 2013 The lambda calculus (or λ-calculus) was introduced by Alonzo Church and Stephen Cole Kleene in
More informationIntroduction to the Lambda Calculus. Chris Lomont
Introduction to the Lambda Calculus Chris Lomont 2010 2011 2012 www.lomont.org Leibniz (1646-1716) Create a universal language in which all possible problems can be stated Find a decision method to solve
More informationCS152: Programming Languages. Lecture 7 Lambda Calculus. Dan Grossman Spring 2011
CS152: Programming Languages Lecture 7 Lambda Calculus Dan Grossman Spring 2011 Where we are Done: Syntax, semantics, and equivalence For a language with little more than loops and global variables Now:
More informationDenotational Semantics; Lambda Calculus Basics Section and Practice Problems Week 4: Tue Feb 13 Fri Feb 16, 2018
Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Denotational Semantics; Lambda Calculus Basics Week 4: Tue Feb 13 Fri Feb 16, 2018 1 Denotational Semantics (a) Give the
More informationCMSC330. Objects, Functional Programming, and lambda calculus
CMSC330 Objects, Functional Programming, and lambda calculus 1 OOP vs. FP Object-oriented programming (OOP) Computation as interactions between objects Objects encapsulate mutable data (state) Accessed
More informationLambda Calculus. Variables and Functions. cs3723 1
Lambda Calculus Variables and Functions cs3723 1 Lambda Calculus Mathematical system for functions Computation with functions Captures essence of variable binding Function parameters and substitution Can
More informationVU Semantik von Programmiersprachen
VU Semantik von Programmiersprachen Agata Ciabattoni Institute für Computersprachen, Theory and Logic group (agata@logic.at) (A gentle) Introduction to λ calculus p. 1 Why shoud I studyλcalculus? p. 2
More informationCSC173 Lambda Calculus Lambda Calculus Evaluation (10 min) Evaluate this expression (β-reduce with normal-order evaluation):
CSC173 Lambda Calculus 014 Please write your name on the bluebook. You may use two sides of handwritten notes. There are 90 possible points and 75 is a perfect score. Stay cool and please write neatly.
More informationThe Untyped Lambda Calculus
Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus Encodings CMSC 330 Spring 2017 1 Review A lambda calculus expression is defined as e ::= x variable λx.e abstraction (fun def) e e application
More informationLambda Calculus-2. Church Rosser Property
Lambda Calculus-2 Church-Rosser theorem Supports referential transparency of function application Says if it exists, normal form of a term is UNIQUE 1 Church Rosser Property Fundamental result of λ-calculus:
More information301AA - Advanced Programming
301AA - Advanced Programming Lecturer: Andrea Corradini andrea@di.unipi.it h;p://pages.di.unipi.it/corradini/ Course pages: h;p://pages.di.unipi.it/corradini/dida@ca/ap-18/ AP-2018-18: Lambda Calculus,
More informationCourse Notes Equational Programming: Lambda Calculus. Femke van Raamsdonk
Course Notes Equational Programming: Lambda Calculus Femke van Raamsdonk November 8, 2018 2 Contents 1 Introduction 5 2 Terms and Reduction 7 2.1 Lambda terms............................ 7 2.2 Beta reduction............................
More informationAdvanced Topics in Programming Languages Lecture 3 - Models of Computation
Advanced Topics in Programming Languages Lecture 3 - Models of Computation Andrey Leshenko Maxim Borin 16/11/2017 1 Lambda Calculus At the beginning of the last century, several attempts were made to theoretically
More informationLambda Calculus and Extensions as Foundation of Functional Programming
Lambda Calculus and Extensions as Foundation of Functional Programming David Sabel and Manfred Schmidt-Schauß 29. September 2015 Lehrerbildungsforum Informatik Last update: 30. September 2015 Overview
More informationLecture 9: More Lambda Calculus / Types
Lecture 9: More Lambda Calculus / Types CSC 131 Spring, 2019 Kim Bruce Pure Lambda Calculus Terms of pure lambda calculus - M ::= v (M M) λv. M - Impure versions add constants, but not necessary! - Turing-complete
More information- M ::= v (M M) λv. M - Impure versions add constants, but not necessary! - Turing-complete. - true = λ u. λ v. u. - false = λ u. λ v.
Pure Lambda Calculus Lecture 9: More Lambda Calculus / Types CSC 131 Spring, 2019 Kim Bruce Terms of pure lambda calculus - M ::= v (M M) λv. M - Impure versions add constants, but not necessary! - Turing-complete
More informationChapter 5: The Untyped Lambda Calculus
Chapter 5: The Untyped Lambda Calculus What is lambda calculus for? Basics: syntax and operational semantics Programming in the Lambda Calculus Formalities (formal definitions) What is Lambda calculus
More informationFunctional Programming
Functional Programming COMS W4115 Prof. Stephen A. Edwards Spring 2003 Columbia University Department of Computer Science Original version by Prof. Simon Parsons Functional vs. Imperative Imperative programming
More informationMore Lambda Calculus and Intro to Type Systems
More Lambda Calculus and Intro to Type Systems Plan Heavy Class Participation Thus, wake up! Lambda Calculus How is it related to real life? Encodings Fixed points Type Systems Overview Static, Dyamic
More informationAn Introduction to the Lambda Calculus
Department of Computer Science Australian National University COMP3610 Principles of Programming Languages An Introduction to the Lambda Calculus Clem Baker-Finch August 13, 2013 Contents 1 Motivation
More informationCSCI.4430/6969 Programming Languages Lecture Notes
CSCI.4430/6969 Programming Languages Lecture Notes August 28, 2006 1 Brief History of Programming Languages Ada Augusta, the Countess of Lovelace, the daughter of the poet Lord Byron, is attributed as
More informationUntyped Lambda Calculus
Advanced Topics in Programming Languages Untyped Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky, S. Tanimoto ) Reference: Types and Programming
More informationCS 4110 Programming Languages & Logics. Lecture 17 Programming in the λ-calculus
CS 4110 Programming Languages & Logics Lecture 17 Programming in the λ-calculus 10 October 2014 Announcements 2 Foster Office Hours 11-12 Enjoy fall break! Review: Church Booleans 3 We can encode TRUE,
More informationFunctional Programming and λ Calculus. Amey Karkare Dept of CSE, IIT Kanpur
Functional Programming and λ Calculus Amey Karkare Dept of CSE, IIT Kanpur 0 Software Development Challenges Growing size and complexity of modern computer programs Complicated architectures Massively
More informationFormal Systems and their Applications
Formal Systems and their Applications Dave Clarke (Dave.Clarke@cs.kuleuven.be) Acknowledgment: these slides are based in part on slides from Benjamin Pierce and Frank Piessens 1 Course Overview Introduction
More informationFall 2013 Midterm Exam 10/22/13. This is a closed-book, closed-notes exam. Problem Points Score. Various definitions are provided in the exam.
Programming Languages Fall 2013 Midterm Exam 10/22/13 Time Limit: 100 Minutes Name (Print): Graduate Center I.D. This is a closed-book, closed-notes exam. Various definitions are provided in the exam.
More informationWhereweare. CS-XXX: Graduate Programming Languages. Lecture 7 Lambda Calculus. Adding data structures. Data + Code. What about functions
Whereweare CS-XXX: Graduate Programming Languages Lecture 7 Lambda Calculus Done: Syntax, semantics, and equivalence For a language with little more than loops and global variables Now: Didn t IMP leave
More informationLambda Calculus. CS 550 Programming Languages Jeremy Johnson
Lambda Calculus CS 550 Programming Languages Jeremy Johnson 1 Lambda Calculus The semantics of a pure functional programming language can be mathematically described by a substitution process that mimics
More informationUntyped Lambda Calculus
Concepts in Programming Languages Recitation 5: Untyped Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky, S. Tanimoto ) Reference: Types and
More informationCS 6110 S14 Lecture 1 Introduction 24 January 2014
CS 6110 S14 Lecture 1 Introduction 24 January 2014 1 Introduction What is a program? Is it just something that tells the computer what to do? Yes, but there is much more to it than that. The basic expressions
More informationProgramming Languages. Programming with λ-calculus. Lecture 11: Type Systems. Special Hour to discuss HW? if-then-else int
CSE 230: Winter 2010 Principles of Programming Languages Lecture 11: Type Systems News New HW up soon Special Hour to discuss HW? Ranjit Jhala UC San Diego Programming with λ-calculus Encode: bool if-then-else
More informationCS522 - Programming Language Semantics
1 CS522 - Programming Language Semantics Lambda Calculus and Combinatory Logic Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign 2 In this part of the course we discuss
More informationLecture #3: Lambda Calculus. Last modified: Sat Mar 25 04:05: CS198: Extra Lecture #3 1
Lecture #3: Lambda Calculus Last modified: Sat Mar 25 04:05:39 2017 CS198: Extra Lecture #3 1 Simplifying Python Python is full of features. Most are there to make programming concise and clear. Some are
More informationCIS 500 Software Foundations Midterm I
CIS 500 Software Foundations Midterm I October 11, 2006 Name: Student ID: Email: Status: Section: registered for the course not registered: sitting in to improve a previous grade not registered: just taking
More informationLexicografie computationala Feb., 2012
Lexicografie computationala Feb., 2012 Anca Dinu University of Bucharest Introduction When we construct meaning representations systematically, we integrate information from two different sources: 1. The
More informationCOMP80 Lambda Calculus Programming Languages Slides Courtesy of Prof. Sam Guyer Tufts University Computer Science History Big ideas Examples:
COMP80 Programming Languages Slides Courtesy of Prof. Sam Guyer Lambda Calculus Formal system with three parts Notation for functions Proof system for equations Calculation rules called reduction Idea:
More informationMore Lambda Calculus and Intro to Type Systems
#1 More Lambda Calculus and Intro to Type Systems #2 Plan Heavy Class Participation Thus, wake up! (not actually kidding) Lambda Calculus How is it related to real life? Encodings Fixed points Type Systems
More informationLambda Calculus and Type Inference
Lambda Calculus and Type Inference Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ August 17, 2007 Lambda Calculus and Type
More informationFunctions as data. Massimo Merro. 9 November Massimo Merro The Lambda language 1 / 21
Functions as data Massimo Merro 9 November 2011 Massimo Merro The Lambda language 1 / 21 The core of sequential programming languages In the mid 1960s, Peter Landin observed that a complex programming
More informationFunctional Languages and Higher-Order Functions
Functional Languages and Higher-Order Functions Leonidas Fegaras CSE 5317/4305 L12: Higher-Order Functions 1 First-Class Functions Values of some type are first-class if They can be assigned to local variables
More informationT λx (λy. x) F λx (λ y. y)) if λp (λc (λa. (pc)a)
Class 40: Alternate Computing Models cs20 Fall 2009 University of Virginia David Evans Reminders To qualify for a presentation your team must send me an email containing the URL of your site (with some
More informationCMSC 330, Fall 2018 Midterm 2
CMSC 330, Fall 2018 Midterm 2 Name Teaching Assistant Kameron Aaron Danny Chris Michael P. Justin Cameron B. Derek Kyle Hasan Shriraj Cameron M. Alex Michael S. Pei-Jo Instructions Do not start this exam
More informationλ-calculus Lecture 1 Venanzio Capretta MGS Nottingham
λ-calculus Lecture 1 Venanzio Capretta MGS 2018 - Nottingham Table of contents 1. History of λ-calculus 2. Definition of λ-calculus 3. Data Structures 1 History of λ-calculus Hilbert s Program David Hilbert
More informationOverview. A normal-order language. Strictness. Recursion. Infinite data structures. Direct denotational semantics. Transition semantics
Overview A normal-order language Strictness Recursion Infinite data structures Direct denotational semantics Transition semantics Lazy (call-by-need) evaluation and its semantics A Normal-Order Language
More informationThe Untyped Lambda Calculus
Resources: The slides of this lecture were derived from x = 1 [Järvi], with permission of the original author, by copy & let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationCMSC 330: Organization of Programming Languages. Operational Semantics
CMSC 330: Organization of Programming Languages Operational Semantics Notes about Project 4, Parts 1 & 2 Still due today (7/2) Will not be graded until 7/11 (along with Part 3) You are strongly encouraged
More informationNote regarding Projects... Every team will need to do a different project (within a section)
Today Basic Evaluation (HW 6) Programming Paradigms Continue Evaluation Next Time (HW 7) Assignments HW5 due HW 6 out (due next Tuesday) HW 7 out (due Tuesday after Spring break) Note regarding Projects...
More informationAdvanced Seminar Softwareengineering - Denotational semantics
Advanced Seminar Softwareengineering - Denotational semantics Klemens Muthmann Tutor Steffen Zschaler 1. INTRODUCTION This text gives some basic knowledge about denotational semantics. It is intended as
More information3.1 λ-calculus: Syntax
3 The Lambda Calculus The Lambda calculus, or λ-calculus, is a model of computation based on the idea that algorithms can be seen as mathematical functions mapping inputs to outputs. It was introduced
More information