1 Amazing fact #3: -calculus is Turing-complete! But the -calculus is too weak, right? No multiple arguments! No numbers or arithmetic! No booleans or.

Slides:



Advertisements
Similar presentations
Repeated Addition Or Adding up.
Advertisements

The lambda calculus David Walker CS 441. the (untyped) lambda calculus a language of functions e ::= x | \x.e | e1 e2 v ::= \x.e there are several different.
INF 212 ANALYSIS OF PROG. LANGS LAMBDA CALCULUS Instructors: Crista Lopes Copyright © Instructors.
Foundations of Programming Languages: Introduction to Lambda Calculus
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed lambda calculus.
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap Overview  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed.
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed lambda calculus.
CS5205: Foundation in Programming Languages Lecture 1 : Overview
1 Formal Semantics. 2 Why formalize? ML is tricky, particularly in corner cases generalizable type variables? polymorphic references? exceptions? Some.
Lesson 4-5 Example Example 1 Find the product of 3 and 7 by using repeated addition. Then write the multiplication fact and its commutative fact.
A Level Computing#BristolMet Session Objectives U2#S9 MUST identify operators and operands SHOULD describe different types of operator COULD Create an.
Functional Languages. Why? Referential Transparency Functions as first class objects Higher level of abstraction Potential for parallel execution.
Chapter 3: Data Types and Operators JavaScript - Introductory.
1 Problem Solving using computers Data.. Representation & storage Representation of Numeric data The Binary System.
CMSC 330: Organization of Programming Languages Lambda Calculus Introduction λ.
CSE1301 Computer Programming Lecture 5: C Primitives 2 Corrections.
CSE S. Tanimoto Lambda Calculus 1 Lambda Calculus What is the simplest functional language that is still Turing complete? Where do functional languages.
Multiplication Facts. 1 x3 3 Think Fast… 2 x4 8.
Operators in Python. Arithmetic operators Some operators in Python will look familiar (+, -, *, /) Others are new to you (%, //, **) All of these do work.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
Lesson 4 Typed Arithmetic Typed Lambda Calculus 1/21/02 Chapters 8, 9, 10.
1 ML fun x -> e e 1 e 2 0, 1, 2,..., +, -,... true, false, if e then e else e patterns datatypes exceptions structures functors let f x = e variables These.
Chapter 2 Number Systems: Decimal, Binary, and Hex.
CSE 230 The -Calculus. Background Developed in 1930’s by Alonzo Church Studied in logic and computer science Test bed for procedural and functional PLs.
Unit 7 Number Systems and Bases Presentation 1Binary and Base 10 Presentation 2Adding Binary Numbers Presentation 3Subtracting Binary Numbers Presentation.
MAT 1000 Mathematics in Today's World Winter 2015.
INM175 Topic 8 1 Module INM175 Discrete Mathematics Topic 8 Algebraic Theories.
-Calculus Kangwon National University 임현승 Programming Languages These slides are based on the slides by Prof. Sungwoo Park at POSTECH.
Lambda Calculus CSE 340 – Principles of Programming Languages Fall 2015 Adam Doupé Arizona State University
Multiplication Facts. 9 6 x 4 = 24 5 x 9 = 45 9 x 6 = 54.
Exponents Exponents mean repeated multiplication 2 3 = 2  2  2 Base Exponent Power.
CMSC 330: Organization of Programming Languages Lambda Calculus and Types.
CSE 5317/4305 L12: Higher-Order Functions1 Functional Languages and Higher-Order Functions Leonidas Fegaras.
PPL CPS. Moed A 2007 Solution (define scale-tree (λ (tree factor) (map (λ (sub-tree) (if (list? sub-tree) (scale-tree sub-tree factor) (* sub-tree.
M M M M 5. Not Listed
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Multiplication Facts. 2x2 4 8x2 16 4x2 8 3x3.
Multiplication Facts Review: x 1 = 1 10 x 8 =
CSE-321 Programming Languages -Calculus (II) POSTECH March 26, 2007 박성우.

1 Announcements Exam 2 graded Rainbow grades: HW1-5, Exam 1-2, Quiz 1-6 Part 1: Problem 1, Problem 2, will go over 2 Part 2: Problem 1, Problem 2 Part.
Multiplication Facts All Facts. 0 x 1 2 x 1 10 x 5.
EVEN NUMBERS EVEN NUMBERS 1 = prime 2 = prime1 3 = prime 4 = 2 x 22 5 = prime 6 = 2 x 33 7 = prime 8 = 2 x 2 x 24 9 = 3 x 3 10 = 2 x 55.
CS5205: Foundations in Programming Languages
CS 550 Programming Languages Jeremy Johnson
Lambda Calculus CSE 340 – Principles of Programming Languages
Multiplication Facts.
Multiplying 2 Digit Factors
More on Lambda Calculus
September 4, 1997 Programming Languages (CS 550) Lecture 6 Summary Operational Semantics of Scheme using Substitution Jeremy R. Johnson TexPoint fonts.
Multiplication Facts.
Lesson 4 Typed Arithmetic Typed Lambda Calculus
Arithmetic Sequences.
Carlos Varela Rennselaer Polytechnic Institute September 6, 2016
Lesson2 Lambda Calculus Basics
Lesson 8 Linear Equations Recursive Routines.
How To Change A Fraction Into A Decimal
Multiplication Facts.
Amazing fact #3: -calculus is Turing-complete!
Notes Over 11.5 Recursive Rules
Carlos Varela Rennselaer Polytechnic Institute September 8, 2017
Functional Programming Concepts
Multiplication Facts.
Functional Programming Concepts
CSE S. Tanimoto Lambda Calculus
Functional Programming Concepts
Amazing fact #3: -calculus is Turing-complete!
Carlos Varela Rennselaer Polytechnic Institute September 8, 2015
Exponent practice.
Carlos Varela Rennselaer Polytechnic Institute September 10, 2019
Presentation transcript:

1 Amazing fact #3: -calculus is Turing-complete! But the -calculus is too weak, right? No multiple arguments! No numbers or arithmetic! No booleans or if! No data structures! No loops or recursion!

2 Multiple arguments: currying Encode multiple arguments via curried functions, just as in regular ML (x 1, x 2 ). e  x 1. ( x 2. e) (  x 1 x 2. e) f(e 1, e 2 )  (f e 1 ) e 2

3 Church numerals Encode natural numbers using stylized lambda terms zero  s. z. z one  s. z. s z two  s. z. s (s z) … n  s. z. s n z A unary encoding using functions No stranger than binary encoding

4 Arithmetic on Church numerals Successor function: take (the encoding of) a number, return (the encoding of) its successor I.e., add an s to the argument's encoding succ  n. s. z. s (n s z) succ zero   s. z. s (zero s z)   * s. z. s z = one succ two   s. z. s (two s z)   * s. z. s (s (s z)) = three

5 Addition To add x and y, apply succ to y x times Key idea: x is a function that, given a function and a base, applies the function to the base x times "a number is as a number does" plus  x. y. x succ y plus two three   * two succ three   * succ (succ three) = five Multiplication is repeated addition, similarly