A notation for describing computations that focuses. Allows convenient denition and manipulation of

Size: px
Start display at page:

Download "A notation for describing computations that focuses. Allows convenient denition and manipulation of"

Transcription

1 Introduction to -calculus A notation for describing computations that focuses on function denition and application. Allows convenient denition and manipulation of functions as \rst-class" values. Eample: a function that adds 1 to its argument (.( + 1)) Invented b Church in the 1930's to stud computabilit questions, but now primaril of interest in programming language communit. In itself, serves as a basic functional language. Practical FLs = -calculus + \sntactic sugar." Can also serve (in restricted or specialized form) as intermediate language in compilers (esp. for functional languages). ( Meta-notation for denotational semantics.) We will take a pragmatic, rather than theoretical, approach to -calculus. In particular, we will treat the calculus as a sntactic game, and won't worr about models.

2 Snta -calculus is an epression calculus, with the following concrete snta: Built-in constants <variable> Variable names (<ep> <ep>) Function applications (<variable>.<ep>) Function abstractions <ep> := <constant> A <variable> is ordinaril denoted b a lower-case letter, e.g.,,,z,f. We tpicall use upper-case letters (e.g., M,N,P,Q) as metavariables ranging over epressions (e.g., (.M)). Pure -calculus has no constants. We will tpicall etend the -calculus with some set of \built-in" constants and functions (an applied -calculus): 0,1,2,... Integer constants +-*/ Integer operators true,false Boolean constants and,or,not Boolean operators if If-then-else operator pair Pair constructor fst, snd Pair selectors cons, nil List constructors hd, tl List selectors null List empt predicate

3 Eamples: (f a) (+ 3 2).(+ 1) (.(+ 1)) 17..pair (snd ) (fst ) f..pair (f (fst )) (f (snd )).if (null ) 0 (hd ) We often cheat and use several abbreviations in our concrete snta: Function application associates to the left. The bod of a -abstraction etends as far to the right as possible. Drop parentheses where not needed. A sequence of consecutive abstractions can be written with a single. Eample: S z.( z)( z) could have been written with fewer parentheses as z. z( z) Its full form is (.(.(z.(( z)( z)))))

4 Tree representation For epression of an size, it is best to write down the abstract snta tree of the epression to avoid confusion. (This will prove more deepl useful later on.) Eamples: (.(+ 1)) (.(.(z.(( z)( z))))) z z z

5 More on Functions -abstractions are fundamentall the same thing as fn epressions in ML; e.g.,.+ 1 corresponds to fn => + 1. Thus we can view -calculus epressions as a subset of ML epressions. (Of course, we haven't said anthing et about how epressions are supposed to behave computationall.) Notice that all -calculus functions are written in pre notation and take eactl one argument. What do we do about functions that naturall require more than one, such as addition? Recall that when we wrote (+ 3 4) this was reall an abbreviation for ((+ 3) 4). That is, + is a function that takes a single integer argument and returns a new function whose eect is to add to its argument! This trick is called curring after the logician Haskell Curr, who made etensive use of it. Alternativel, we could dene the built-in + function to take a single pair of integers as argument. (But the built-in pair constructor will still need to take its arguments in curried form.) This is the approach taken in ML.

6 Reductions We evaluate a -calculus epression b repeatedl selecting a reducible (sub-)epression (rede) and reducing it, according to a reduction rule. Pure -calculus has the -rule, which describes how to appl a -abstraction to an argument. Informall: the result of appling a -abstraction to an argument is an instance of the bod of the abstraction in which (free) occurrences of the formal parameter in the bod are replaced with (copies of) the argument. Each applied -calculus also has -rules describing how to reduce epressions involving the built-in functions and constants. Eamples: * 2 3! 6 (.+ 1) 4! + 4 1! 5 (.+ ) 5! + 5 5! 10 (.3) 5! 3

7 (.(.- )) 4 5! (.- 4) 5! - 5 4! 1-4 5! - 4 5! - 5 4! 1 (f.f 3)(.+ 1)! (.+ 1) 3! + 3 1! 4 f f 3 + 1! + 1 3! + 3 1! 4

8 Bound and Free Variables In an abstraction.m, we sa the binds the variable in the bod M, meaning that is just a placeholder for a value that will be lled in when the abstraction is applied. An occurrence of a variable in an epression is bound if there is an enclosing abstraction that binds it; otherwise it is free. Note that these denitions are relative to a particular occurrence and a particular epression. Eample.+ ((.+ z) 7) + + z 7 Here and occur bound in the overall epression, but z occurs free.

9 Eample + ((.+ 1) 4) Here the rst occurrence of is free but the second is bound. If M is an epression we write: F V (M) set of free variables in M BV (M) set of bound variables in M An epression M such that F V (M) = ; is said to be closed.

10 -reduction, more carefull If the same name appears in several -bindings, we want to use idea of nested scopes from block-structured languages. I.e., when doing -reduction, we should onl substitute for free occurrences of the formal parameter variable. Eample (.(.- (- 1)) 3 ) 9! (.- (- 1)) 3 9! - (- 3 1) 9! ! !!

11 The following is wrong! (.(.- (- 1)) 3 ) 9 6! (.- (- 9 1)) 3 9! - (- 9 1) 9! ! !!

12 Variable Capture Our revised denition of -reduction still isn't adequate; here's another name-clash problem. f f Naive substitution leads to but this is obviousl wrong: the right-hand, originall free in the epression, has been \captured" b the. We must conclude that a -reduction of (.M)N is onl valid if F V (N) do not clash with an formal parameters in M. We will see several was to cope with this problem.

13 -Conversion and -Conversion We can avoid name-clash problems b uniforml changing the names of bound variables where necessar. Intuitivel, changing names is justiable because the are onl formal parameters. Formall, we call such name changes -conversion. Eample (. + 1) $ (. + 1) Of course, the new name must not appear free in the bod of the abstraction. (. + ) 6$ (. + ) In general, we'd like to dene two epressions as interconvertible if the \mean the same thing" (intuitivel). To do this, we must dene two other forms of conversion relation. -conversion is the smmetric closure of -reduction (the inverse operation is -abstraction). Eample $ (.+ 1) 4

14 Substitution We can avoid all name-clash problems and give simple denitions of both - and -conversion via a careful denition of capture-avoiding substitution. We write [M/] N for the substitution of M for in N. (Other similar notations are also in common use, e.g., N [M/].) [M/] c = c [M/] = M [M/] = ( 6= ) [M/] (Y Z) = ([M/] Y)([M/] Z) [M/].Y =.Y [M/].Z =.[M/]Z ( 62 F V (Z) or 62 F V (M)) [M/].Z = w.[m/]([w/]z) (w 62 F V (Z) [F V (M)) Then we can dene.z $.[/]Z ( 62 F V (Z)) (.M) N $ [N/]M

15 de Bruijn Notation Another wa to solve name clash problems is to do awa with names altogether! In the tree for a closed epression, ever variable occurrence names a variable bound at some -binding on the path between the occurrence node and the root. We can uniquel identif a variable b counting the number of -bindings that intervene between its mention and its dening binding. Eample..+ (* )..+ 1 (* 0 0) * * 0 It is now fairl straightforward to dene -reduction in terms of this representation. (Since there are no names, we don't need -conversion!)

16 -Reduction and -Conversion Consider these two epressions:.+ 1 (+ 1) The \mean the same thing" in the sense that the behave the same wa when applied to an argument (i.e., the add 1 to it). This is the concept of functional etensionalit. To formalize this, we add an -reduction rule: (.F )! F provided 62 F V (F). -reduction tends to simplif an epression, but its inverse, -epansion can also be useful. Their combination is called -conversion, written $. The -rules cannot be deduced from the -rules. We will generall appeal to the -rules to justif program transformations, rather than to perform computation.

17 Reduction Order To evaluate a -epression, we keep performing reductions as long as a rede eists. An epression containing no redees is said to be in normal form. But an epression ma contain more than one rede, so evaluation ma proceed b dierent routes. Eample: (.(.+ ) 3) 2 can be reduced in two was: !! ! + 2! + 2 Fortunatel, both reduction orders lead to the same result in this eample. Will this alwas happen? 3! 5 3! 5

18 Non-terminating reductions Not ever epression has a normal form at all. Consider (D D), where D.. The evaluation of this epression never terminates because (D D)! (D D)! In other words, evaluation enters an innite loop. Such a computation is said to diverge. For some epressions, one reduction sequence ma terminate while another does not. Eample: (.3)(D D) If we perform the application of (.3) to (D D) rst, we immediatel get 3 and stop. But if we keep tring to evaluate the argument (D D) rst, we keep getting (D D) again. So choice of reduction order can aect whether we get an answer!

19 Church-Rosser Theorem It turns out that all reduction sequences that terminate will give the same result, at least for the pure -calculus. Thus, if an epression has an normal form, that normal form is unique. This happ result is a consequence of the Church- Rosser Theorem: If E 1 $ E 2 then 9 E, such that E 1! E and E 2! E. (An sstem (not necessaril related to the -calculus) for which this theorem is true is said to be \Church- Rosser.") Corollar Suppose now that E 0! E 1 and E 0! E 2 and that both E 1 and E 2 are in normal form. Then, since E 1 $ E 2, C-R sas 9 E such that E 1! E and E 2! E. But since E 1 and E 2 are alread both in normal form, this can onl mean that E 1 = E = E 2. (If we are using names, the normal form is unique \up to -conversion".) The Church-Rosser theorem for -calculus is surprisingl dicult to prove. (It isn't necessaril true for applied -calculi, but this is not a problem in practice.)

20 Specifing Reduction Order No reduction sequence can give us a wrong answer, but some sequences might fail to terminate even when a normal form eists. To dene reduction orders, we need to characterize rede positions in an epression. An outermost rede of an epression is one that is not contained within an other rede (i.e., within either the argument or the function bod). An innermost rede of an epression is one that contains no other rede. The leftmost outermost rede is the outermost rede whose (for a -rede) or function constant (for a -rede) is furthest to the left (in the string or tree representation). Leftmost innermost is de- ned similarl. Two important reduction strategies are: applicative order, which sas to alwas reduce the leftmost innermost rede rst; normal order, which sas to alwas reduce the leftmost outermost rede rst.

21 Normalization Theorem The normal order reduction strateg alwas leads to a normal form, if one eists. Applicative order, which corresponds to the idea of evaluating a function's arguments before invoking the function, does not have this propert. Eample revisited: (.3)(D D) 3 z z z Here the rede is the (onl) outermost one and the rede is the (onl) innermost one. Normalorder reduction sas to do the reduction rst, so (D D) is never evaluated. Applicative order reduction sas to evaluate (D D) repeatedl. Intuitivel, normal order evaluation wins over applicative order here because the function.3 doesn't use its argument, so there's no point in tring to evaluate it (fruitlessl). A function that uses its argument is said to be strict in that argument; e.g.,.3 is not strict in, but. is.

22 Eager or Laz? The applicative order strateg corresponds to callb-value, as used in most imperative languages. In FL's this is usuall called eager evaluation. The normal order strateg corresponds to call-bname (as found in Algol-60). Although the normal order strateg appears better (it computes something useful more often) it is signicantl less ecient to implement. Intuitivel, this is because if the argument is a complicated epression, call-b-name must transmit the entire epression including the values of its free variables, whereas call-b-value needs onl to transmit the value of the epression, which ma be much simpler. There's another obvious problem with call-b-name: if an argument is needed, it ma be needed at several points in the bod, and hence get reduced several times. Practical implementations avoid this problem b sharing the result of evaluating the argument at all points where it is used. This combination of call-b-name with sharing is called callb-need or (loosel) laz evaluation. (To model sharing, we need to change our tree representation of -epressions to a graph.) Well-known laz functional languages include Miranda and Haskell; eager functional languages include the (pure subsets of) Scheme and ML.

23 Weak Head Normal Form In real programming languages, we don't epect the bod of a function to be evaluated (even in part) before the function has been called, i.e., before the formal parameters have been assigned values. (If it happens, we tend to think of it as an optimization, as with a loop invariant.) But either of our strategies, as dened so far, ma do such reductions. An applicative order eample: (.+ (+ 2 3) ) 8 The leftmost innermost rede is (+ 2 3), so this will be -reduced to 5 before the top-level reduction occurs. To avoid this behavior, most functional languages implementations \don't evaluate under a." Technicall, we stop evaluating when we reach weak head normal form (WHNF). A consequence of this implementation approach is that we never have name clash problems, since we never reduce an epression containing free variables (assuming we started with a closed epression).

24 Recursion Suppose we wish to dene a recursive function, such as the factorial function: FAC = (n.if (= n 0) 1 (* n (FAC (- n 1)))) This denition is fault: it relies on a abilit to name a -epression (FAC) and refer to that name from within the epression itself. The problem is that -abstractions are anonmous. (We've named -epressions before, but onl as an abbreviation mechanism which could be easil \unfolded.") The onl names a -abstraction can refer to are those of its arguments (or the arguments to enclosing abstractions). So the trick is to rewrite the recursive function so that it takes itself as an etra argument! We do this b -abstraction: FAC $ n.(: : :FAC: : :) becomes FAC $ f.(n.(: : :f: : :)) FAC We can rewrite this as: FAC $ H FAC where H f.(n.(: : :f: : :)) Note that H is a perfectl ordinar -abstraction that does not involve recursion.

25 Fied Points The factorial function FAC is a solution to the equation FAC $ H FAC i.e., it is a function FAC such that the result of appling H to FAC is just FAC. We sa that FAC is a ed point of the function H. It is eas to nd ed points for some functions. For eample the function.* has both 0 and 1 as ed points. In general, a function ma have 0, 1, some, or innitel man ed points. It's not so eas to see what a ed point of H should look like, but for a moment let's just assume the eistence of a function Y that takes an function as argument and returns a ed point of that function as result. That is, for an function F, F (Y F) $ Y F Then, in particular, we have H (Y H) $ Y H, so FAC Y H is a solution to our equation for for the factorial function that doesn't involve recursion!

26 Eample With our denitions FAC Y H H f.n.if (= n 0) 1 (* n (f (- n 1))) we can now compute, e.g., factorial(1): FAC 1 = Y H 1 $ H (Y H) 1 = (f.n.if (= n 0) 1 (* n (f (- n 1)))) (Y H) 1! (n.if (= n 0) 1 (* n (Y H (- n 1)))) 1! if (= 1 0) 1 (* 1 (Y H (- 1 1)))! * 1 (Y H 0) $ * 1 (H (Y H) 0) = * 1 ((f.n.if (= n 0) 1 (* n (f (- n 1)))) (Y H) 0)! * 1 ((n.if (= n 0) 1 (* n (Y H (- n 1)))) 0)! * 1 (if (= 0 0) 1 (* n (Y H (- 0 1))))! * 1 1! 1

27 Dening Y We have seen that recursion can be epressed wholl in terms of a ed-point combinator Y. But how do we dene Y? We could build it into our applied -calculus as a special function with a suitable -rule. In fact, this is more or less what we will do in practice. Amazingl, it is also possible to dene Y as an ordinar epression in the pure -calculus! Here is one denition: Y h.(.h ( ))(.h ( )) Let's check it out: Y H = (.h.(.h ( ))(.h ( ))) H $ (.H ( ))(.H ( )) $ H ((. H ( ))(. H ( ))) $ H ((.h.(.h ( ))(.h ( ))) H) = H (Y H) Note the similarit between this denition of Y and the looping epression (D D). In fact, this version of Y doesn't work with call-b-value evaluation because it goes into an innite loop! Fortunatel, there are man was to write Y; here's one that does work with call-b-value: Y f.(.f(. ))(.f (. ))

28 Pure Fun In principle, we can do without built-in constants and -rules altogether b encoding useful tpes and operators directl in the pure -calculus. In general, this means using -abstractions to represent values. For eample, to model booleans we need a wa of representing true and false, functions correspondig to and, or, etc., and an equivalent of if that selects one of two epressions based on the value of the boolean. Here's how: true.. false.. if f...f and.. false : : : Eample if true 0 1 = (f...f ) true 0 1! (..true ) 0 1! (.true 0 ) 1! true 0 1 = (..) 0 1! (.0) 1! 0

29 Church Numerals 0 f.. 1 f..f 2 f..f(f ) : : : n n times z } { f.. f(f : : : (f ): : :) succ n.f..f(n f ) iszero n.n(.false) true : : : Eample succ 2 = (n.f..f(n f )) 2! f..f(2 f ) = f..f((f..f(f )) f )! f..f((.f(f )) )! f..f(f(f )) = 3

30 Data Constructors pair..f.f fst p.p(..) snd p.p(..) Eample pair 1 2 = (..f.f ) 1 2! f.f 1 2 so fst (pair 1 2) = (p.p(..))(f.f 1 2)! (f.f 1 2)(..)! (..) 1 2! 1 Note that pairs and booleans are encoded in essentiall the same wa!

Lambda Calculus.

Lambda Calculus. Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky, S. Tanimoto, Stephen A. Edwards) Benjamin Pierce Types and Programming Languages http://www.cs.cornell.edu/courses/cs3110/2008fa/recitations/rec26.html

More information

Models of Computation The University of Birmingham. Volker Sorge March 10, Handout 10

Models of Computation The University of Birmingham. Volker Sorge March 10, Handout 10 06-05934 Models of Computation The Universit of Birmingham Spring Semester 2008 School of Computer Science Volker Sorge March 10, 2008 Handout 10 Summar of this handout: Histor Mathematical Notation Prefi

More information

Building up a language SICP Variations on a Scheme. Meval. The Core Evaluator. Eval. Apply. 2. syntax procedures. 1.

Building up a language SICP Variations on a Scheme. Meval. The Core Evaluator. Eval. Apply. 2. syntax procedures. 1. 6.001 SICP Variations on a Scheme Scheme Evaluator A Grand Tour Techniques for language design: Interpretation: eval/appl Semantics vs. snta Sntactic transformations Building up a language... 3. 1. eval/appl

More information

Untyped Lambda Calculus

Untyped 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 information

Optional: Building a processor from scratch

Optional: Building a processor from scratch Optional: Building a processor from scratch In this assignment we are going build a computer processor from the ground up, starting with transistors, and ending with a small but powerful processor. The

More information

Introduction to the λ-calculus

Introduction 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 information

Formal Systems and their Applications

Formal 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 information

CMSC 336: Type Systems for Programming Languages Lecture 4: Programming in the Lambda Calculus Acar & Ahmed 22 January 2008.

CMSC 336: Type Systems for Programming Languages Lecture 4: Programming in the Lambda Calculus Acar & Ahmed 22 January 2008. CMSC 336: Type Systems for Programming Languages Lecture 4: Programming in the Lambda Calculus Acar & Ahmed 22 January 2008 Contents 1 Announcements 1 2 Solution to the Eercise 1 3 Introduction 1 4 Multiple

More information

y = f(x) x (x, f(x)) f(x) g(x) = f(x) + 2 (x, g(x)) 0 (0, 1) 1 3 (0, 3) 2 (2, 3) 3 5 (2, 5) 4 (4, 3) 3 5 (4, 5) 5 (5, 5) 5 7 (5, 7)

y = f(x) x (x, f(x)) f(x) g(x) = f(x) + 2 (x, g(x)) 0 (0, 1) 1 3 (0, 3) 2 (2, 3) 3 5 (2, 5) 4 (4, 3) 3 5 (4, 5) 5 (5, 5) 5 7 (5, 7) 0 Relations and Functions.7 Transformations In this section, we stud how the graphs of functions change, or transform, when certain specialized modifications are made to their formulas. The transformations

More information

20 Calculus and Structures

20 Calculus and Structures 0 Calculus and Structures CHAPTER FUNCTIONS Calculus and Structures Copright LESSON FUNCTIONS. FUNCTIONS A function f is a relationship between an input and an output and a set of instructions as to how

More information

Lambda Calculus and Type Inference

Lambda 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/ October 13, 2004 Lambda Calculus and Type

More information

Chapter Goals: Evaluate limits. Evaluate one-sided limits. Understand the concepts of continuity and differentiability and their relationship.

Chapter Goals: Evaluate limits. Evaluate one-sided limits. Understand the concepts of continuity and differentiability and their relationship. MA123, Chapter 3: The idea of its (pp. 47-67) Date: Chapter Goals: Evaluate its. Evaluate one-sided its. Understand the concepts of continuit and differentiabilit and their relationship. Assignments: Assignment

More information

Formal Semantics. Aspects to formalize. Lambda calculus. Approach

Formal 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 information

Untyped Lambda Calculus

Untyped 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 information

Functional Languages. Hwansoo Han

Functional Languages. Hwansoo Han Functional Languages Hwansoo Han Historical Origins Imperative and functional models Alan Turing, Alonzo Church, Stephen Kleene, Emil Post, etc. ~1930s Different formalizations of the notion of an algorithm

More information

Topic 2 Transformations of Functions

Topic 2 Transformations of Functions Week Topic Transformations of Functions Week Topic Transformations of Functions This topic can be a little trick, especiall when one problem has several transformations. We re going to work through each

More information

Lambda Calculus. Concepts in Programming Languages Recitation 6:

Lambda Calculus. Concepts in Programming Languages Recitation 6: Concepts in Programming Languages Recitation 6: Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky, S. Tanimoto ) Reference: Types and Programming

More information

Functional Programming

Functional 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 information

Introduction to the Lambda Calculus

Introduction 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 information

Type Systems Winter Semester 2006

Type 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 information

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology Intermediate Algebra Gregg Waterman Oregon Institute of Technolog c 2017 Gregg Waterman This work is licensed under the Creative Commons Attribution 4.0 International license. The essence of the license

More information

CIS 500 Software Foundations Fall September 25

CIS 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 information

CSE 505: Concepts of Programming Languages

CSE 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 information

CITS3211 FUNCTIONAL PROGRAMMING

CITS3211 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 information

CMPUT 325 : Lambda Calculus Basics. Lambda Calculus. Dr. B. Price and Dr. R. Greiner. 13th October 2004

CMPUT 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 information

Chapter 5: The Untyped Lambda Calculus

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 information

COMP 1130 Lambda Calculus. based on slides by Jeff Foster, U Maryland

COMP 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 information

4/19/2018. Chapter 11 :: Functional Languages

4/19/2018. Chapter 11 :: Functional Languages Chapter 11 :: Functional Languages Programming Language Pragmatics Michael L. Scott Historical Origins The imperative and functional models grew out of work undertaken by Alan Turing, Alonzo Church, Stephen

More information

6.001 Notes: Section 6.1

6.001 Notes: Section 6.1 6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of

More information

Case study: leical analysis Leical analysis converts u sequences of characters u into u sequences of tokens u tokens are also called words or leemes F

Case study: leical analysis Leical analysis converts u sequences of characters u into u sequences of tokens u tokens are also called words or leemes F Lecture 5 0 Case study: leical analysis Leical analysis converts u sequences of characters u into u sequences of tokens u tokens are also called words or leemes For us, a token will be one of: u a number

More information

Lecture 5: The Untyped λ-calculus

Lecture 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 information

Chapter 5: The Untyped Lambda Calculus

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 information

λ calculus Function application Untyped λ-calculus - Basic Idea Terms, Variables, Syntax β reduction Advanced Formal Methods

λ 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 information

To figure this out we need a more precise understanding of how ML works

To figure this out we need a more precise understanding of how ML works Announcements: What are the following numbers: 74/2/70/17 (2:30,2:30,3:35,7:30) PS2 due Thursday 9/20 11:59PM Guest lecture on Tuesday 9/25 o No RDZ office hours next Friday, I am on travel A brief comment

More information

Transformations of Functions. 1. Shifting, reflecting, and stretching graphs Symmetry of functions and equations

Transformations of Functions. 1. Shifting, reflecting, and stretching graphs Symmetry of functions and equations Chapter Transformations of Functions TOPICS.5.. Shifting, reflecting, and stretching graphs Smmetr of functions and equations TOPIC Horizontal Shifting/ Translation Horizontal Shifting/ Translation Shifting,

More information

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

CS 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 information

VU Semantik von Programmiersprachen

VU 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 information

Programming Language Pragmatics

Programming Language Pragmatics Chapter 10 :: Functional Languages Programming Language Pragmatics Michael L. Scott Historical Origins The imperative and functional models grew out of work undertaken Alan Turing, Alonzo Church, Stephen

More information

0 COORDINATE GEOMETRY

0 COORDINATE GEOMETRY 0 COORDINATE GEOMETRY Coordinate Geometr 0-1 Equations of Lines 0- Parallel and Perpendicular Lines 0- Intersecting Lines 0- Midpoints, Distance Formula, Segment Lengths 0- Equations of Circles 0-6 Problem

More information

CMSC 425: Lecture 10 Basics of Skeletal Animation and Kinematics

CMSC 425: Lecture 10 Basics of Skeletal Animation and Kinematics : Lecture Basics of Skeletal Animation and Kinematics Reading: Chapt of Gregor, Game Engine Architecture. The material on kinematics is a simplification of similar concepts developed in the field of robotics,

More information

Lambda Calculus and Type Inference

Lambda 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 information

2.2 Absolute Value Functions

2.2 Absolute Value Functions . Absolute Value Functions 7. Absolute Value Functions There are a few was to describe what is meant b the absolute value of a real number. You ma have been taught that is the distance from the real number

More information

Chapter 11 :: Functional Languages

Chapter 11 :: Functional Languages Chapter 11 :: Functional Languages Programming Language Pragmatics Michael L. Scott Copyright 2016 Elsevier 1 Chapter11_Functional_Languages_4e - Tue November 21, 2017 Historical Origins The imperative

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages. Lambda calculus

Harvard 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 information

Figure 1: The evaluation window. ab a b \a.b (\.y)((\.)(\.)) Epressions with nested abstractions such as \.(\y.(\.w)) can be abbreviated as \y.w. v al

Figure 1: The evaluation window. ab a b \a.b (\.y)((\.)(\.)) Epressions with nested abstractions such as \.(\y.(\.w)) can be abbreviated as \y.w. v al v: An Interactive -Calculus Tool Doug Zongker CSE 505, Autumn 1996 December 11, 1996 \Computers are better than humans at doing these things." { Gary Leavens, CSE 505 lecture 1 Introduction The -calculus

More information

What are the rules of elementary algebra

What are the rules of elementary algebra What are the rules of elementar algebra James Davenport & Chris Sangwin Universities of Bath & Birmingham 7 Jul 2010 Setting A relativel traditional mathematics course, at, sa first-ear undergraduate level.

More information

CITS3211 FUNCTIONAL PROGRAMMING. 10. Programming in the pure λ calculus

CITS3211 FUNCTIONAL PROGRAMMING. 10. Programming in the pure λ calculus CITS3211 FUNCTIONAL PROGRAMMING 10. Programming in the pure λ calculus Summary: This lecture demonstates the power of the pure λ calculus by showing that there are λ expressions that can be used to emulate

More information

Using Characteristics of a Quadratic Function to Describe Its Graph. The graphs of quadratic functions can be described using key characteristics:

Using Characteristics of a Quadratic Function to Describe Its Graph. The graphs of quadratic functions can be described using key characteristics: Chapter Summar Ke Terms standard form of a quadratic function (.1) factored form of a quadratic function (.1) verte form of a quadratic function (.1) concavit of a parabola (.1) reference points (.) transformation

More information

(Refer Slide Time: 4:00)

(Refer Slide Time: 4:00) Principles of Programming Languages Dr. S. Arun Kumar Department of Computer Science & Engineering Indian Institute of Technology, Delhi Lecture - 38 Meanings Let us look at abstracts namely functional

More information

9/23/2014. Why study? Lambda calculus. Church Rosser theorem Completeness of Lambda Calculus: Turing Complete

9/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 information

From the λ-calculus to Functional Programming Drew McDermott Posted

From the λ-calculus to Functional Programming Drew McDermott Posted From the λ-calculus to Functional Programming Drew McDermott drew.mcdermott@yale.edu 2015-09-28 Posted 2015-10-24 The λ-calculus was intended from its inception as a model of computation. It was used by

More information

6.001 Notes: Section 4.1

6.001 Notes: Section 4.1 6.001 Notes: Section 4.1 Slide 4.1.1 In this lecture, we are going to take a careful look at the kinds of procedures we can build. We will first go back to look very carefully at the substitution model,

More information

Functional Programming. Big Picture. Design of Programming Languages

Functional Programming. Big Picture. Design of Programming Languages Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics

More information

Lambda Calculus. CS 550 Programming Languages Jeremy Johnson

Lambda 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 information

Calculus I (part 1): Limits and Continuity (by Evan Dummit, 2016, v. 2.01)

Calculus I (part 1): Limits and Continuity (by Evan Dummit, 2016, v. 2.01) Calculus I (part ): Limits and Continuity (by Evan Dummit, 206, v. 2.0) Contents Limits and Continuity. Limits (Informally)...............................................2 Limits and the Limit Laws..........................................

More information

triangles leaves a smaller spiral polgon. Repeating this process covers S with at most dt=e lights. Generaliing the polgon shown in Fig. 1 establishes

triangles leaves a smaller spiral polgon. Repeating this process covers S with at most dt=e lights. Generaliing the polgon shown in Fig. 1 establishes Verte -Lights for Monotone Mountains Joseph O'Rourke Abstract It is established that dt=e = dn=e?1 verte -lights suce to cover a monotone mountain polgon of t = n? triangles. A monotone mountain is a monotone

More information

5. Introduction to the Lambda Calculus. Oscar Nierstrasz

5. 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 information

11/6/17. Outline. FP Foundations, Scheme. Imperative Languages. Functional Programming. Mathematical Foundations. Mathematical Foundations

11/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 information

Implicit differentiation

Implicit differentiation Roberto s Notes on Differential Calculus Chapter 4: Basic differentiation rules Section 5 Implicit differentiation What ou need to know alread: Basic rules of differentiation, including the chain rule.

More information

Functional Languages. CSE 307 Principles of Programming Languages Stony Brook University

Functional Languages. CSE 307 Principles of Programming Languages Stony Brook University Functional Languages CSE 307 Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 1 Historical Origins 2 The imperative and functional models grew out of work

More information

Introduction to Homogeneous Transformations & Robot Kinematics

Introduction to Homogeneous Transformations & Robot Kinematics Introduction to Homogeneous Transformations & Robot Kinematics Jennifer Ka Rowan Universit Computer Science Department. Drawing Dimensional Frames in 2 Dimensions We will be working in -D coordinates,

More information

Section 2.2: Absolute Value Functions, from College Algebra: Corrected Edition by Carl Stitz, Ph.D. and Jeff Zeager, Ph.D. is available under a

Section 2.2: Absolute Value Functions, from College Algebra: Corrected Edition by Carl Stitz, Ph.D. and Jeff Zeager, Ph.D. is available under a Section.: Absolute Value Functions, from College Algebra: Corrected Edition b Carl Stitz, Ph.D. and Jeff Zeager, Ph.D. is available under a Creative Commons Attribution-NonCommercial-ShareAlike.0 license.

More information

Computer Science 203 Programming Languages Fall Lecture 10. Bindings, Procedures, Functions, Functional Programming, and the Lambda Calculus

Computer 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 information

The Untyped Lambda Calculus

The 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 information

Lambda Calculus. Lecture 4 CS /26/10

Lambda 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 information

What does my program mean?

What does my program mean? September 16, 2015 L02-1 What does my program mean? Armando Solar Lezama Computer Science and Artificial Intelligence Laboratory M.I.T. Adapted from Arvind 2010. Used with permission. September 16, 2015

More information

The Untyped Lambda Calculus

The 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 information

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER 2012 2013 MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS Time allowed TWO hours Candidates may complete the front

More information

Introduction to the Lambda Calculus. Chris Lomont

Introduction 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 information

Lecture 16 Notes AVL Trees

Lecture 16 Notes AVL Trees Lecture 16 Notes AVL Trees 15-122: Principles of Imperative Computation (Fall 2015) Frank Pfenning 1 Introduction Binar search trees are an ecellent data structure to implement associative arras, maps,

More information

The Lambda Calculus. 27 September. Fall Software Foundations CIS 500. The lambda-calculus. Announcements

The 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 information

Formal Semantics. Prof. Clarkson Fall Today s music: Down to Earth by Peter Gabriel from the WALL-E soundtrack

Formal Semantics. Prof. Clarkson Fall Today s music: Down to Earth by Peter Gabriel from the WALL-E soundtrack Formal Semantics Prof. Clarkson Fall 2015 Today s music: Down to Earth by Peter Gabriel from the WALL-E soundtrack Review Previously in 3110: simple interpreter for expression language: abstract syntax

More information

Last class. CS Principles of Programming Languages. Introduction. Outline

Last 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 information

Lambda calculus. Wouter Swierstra and Alejandro Serrano. Advanced functional programming - Lecture 6

Lambda calculus. Wouter Swierstra and Alejandro Serrano. Advanced functional programming - Lecture 6 Lambda calculus Advanced functional programming - Lecture 6 Wouter Swierstra and Alejandro Serrano 1 Today Lambda calculus the foundation of functional programming What makes lambda calculus such a universal

More information

Functional Languages and Higher-Order Functions

Functional 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 information

1-1. Functions. Lesson 1-1. What You ll Learn. Active Vocabulary. Scan Lesson 1-1. Write two things that you already know about functions.

1-1. Functions. Lesson 1-1. What You ll Learn. Active Vocabulary. Scan Lesson 1-1. Write two things that you already know about functions. 1-1 Functions What You ll Learn Scan Lesson 1- Write two things that ou alread know about functions. Lesson 1-1 Active Vocabular New Vocabular Write the definition net to each term. domain dependent variable

More information

Functional Programming and λ Calculus. Amey Karkare Dept of CSE, IIT Kanpur

Functional 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 information

CS 11 Haskell track: lecture 1

CS 11 Haskell track: lecture 1 CS 11 Haskell track: lecture 1 This week: Introduction/motivation/pep talk Basics of Haskell Prerequisite Knowledge of basic functional programming e.g. Scheme, Ocaml, Erlang CS 1, CS 4 "permission of

More information

Tail Recursion: Factorial. Begin at the beginning. How does it execute? Tail recursion. Tail recursive factorial. Tail recursive factorial

Tail Recursion: Factorial. Begin at the beginning. How does it execute? Tail recursion. Tail recursive factorial. Tail recursive factorial Begin at the beginning Epressions (Synta) Compile-time Static Eec-time Dynamic Types Values (Semantics) 1. Programmer enters epression 2. ML checks if epression is well-typed Using a precise set of rules,

More information

Software Paradigms (Lesson 4) Functional Programming Paradigm

Software Paradigms (Lesson 4) Functional Programming Paradigm Software Paradigms (Lesson 4) Functional Programming Paradigm Table of Contents 1 Introduction... 2 2 Evaluation of Functions... 3 3 Compositional (Construct) Operators... 4 4 Some Implementation Issues...

More information

COMP80 Lambda Calculus Programming Languages Slides Courtesy of Prof. Sam Guyer Tufts University Computer Science History Big ideas Examples:

COMP80 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 information

Elixir, functional programming and the Lambda calculus.

Elixir, 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 information

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING, THE UNIVERSITY OF NEW MEXICO ECE-238L: Computer Logic Design Fall 2013.

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING, THE UNIVERSITY OF NEW MEXICO ECE-238L: Computer Logic Design Fall 2013. ECE-8L: Computer Logic Design Fall Notes - Chapter BINARY NUMBER CONVERSIONS DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-b-digit representation of a positive integer number (powers

More information

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy 06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 6: Polymorphic Type Systems 1. Polymorphic

More information

Introduction to lambda calculus Part 3

Introduction to lambda calculus Part 3 Introduction to lambda calculus Part 3 Antti-Juhani Kaijanaho 2017-01-27... 1 Untyped lambda calculus... 2 Typed lambda calculi In an untyped lambda calculus extended with integers, it is required that

More information

.Math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in .

.Math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in  . 0.1 More on innity.math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in email. 0.1.1 If you haven't read 1.3, do so now! In notes#1

More information

CS152: Programming Languages. Lecture 7 Lambda Calculus. Dan Grossman Spring 2011

CS152: 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 information

12.4 The Ellipse. Standard Form of an Ellipse Centered at (0, 0) (0, b) (0, -b) center

12.4 The Ellipse. Standard Form of an Ellipse Centered at (0, 0) (0, b) (0, -b) center . The Ellipse The net one of our conic sections we would like to discuss is the ellipse. We will start b looking at the ellipse centered at the origin and then move it awa from the origin. Standard Form

More information

Whereweare. 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. 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 information

Implicit Differentiation - the basics

Implicit Differentiation - the basics x x 6 Implicit Differentiation - the basics Implicit differentiation is the name for the method of differentiation that we use when we have not explicitl solved for in terms of x (that means we did not

More information

Fundamentals and lambda calculus

Fundamentals 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 information

CMSC 330: Organization of Programming Languages

CMSC 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 information

Introduction to Lambda Calculus. Lecture 5 CS 565 1/24/08

Introduction 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 information

CMSC 330: Organization of Programming Languages. Operational Semantics

CMSC 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 information

Fundamental Concepts. Chapter 1

Fundamental Concepts. Chapter 1 Chapter 1 Fundamental Concepts This book is about the mathematical foundations of programming, with a special attention on computing with infinite objects. How can mathematics help in programming? There

More information

Roberto s Notes on Integral Calculus Chapter 3: Basics of differential equations Section 6. Euler s method. for approximate solutions of IVP s

Roberto s Notes on Integral Calculus Chapter 3: Basics of differential equations Section 6. Euler s method. for approximate solutions of IVP s Roberto s Notes on Integral Calculus Chapter 3: Basics of differential equations Section 6 Euler s method for approximate solutions of IVP s What ou need to know alread: What an initial value problem is.

More information

Programming Languages Lecture 15: Recursive Types & Subtyping

Programming Languages Lecture 15: Recursive Types & Subtyping CSE 230: Winter 2008 Principles of Programming Languages Lecture 15: Recursive Types & Subtyping Ranjit Jhala UC San Diego News? Formalize first-order type systems Simple types (integers and booleans)

More information

Expressions that talk about themselves. Maarten Fokkinga, University of Twente, dept. INF, Version of May 6, 1994

Expressions that talk about themselves. Maarten Fokkinga, University of Twente, dept. INF, Version of May 6, 1994 Expressions that talk about themselves Maarten Fokkinga, University of Twente, dept. INF, fokkinga@cs.utwente.nl Version of May 6, 1994 Introduction Self-reference occurs frequently in theoretical investigations

More information

Lambda Calculus as a Programming Language

Lambda Calculus as a Programming Language Cristian Giumale / Lecture Notes 1 Lambda Calculus as a Programming Language The Lambda calculus can be considered as the machine code of a particular computer. Call it the Lambda machine. As in conventional

More information

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen COP4020 Programming Languages Functional Programming Prof. Robert van Engelen Overview What is functional programming? Historical origins of functional programming Functional programming today Concepts

More information