Amazing fact #3: -calculus is Turing-complete!

Slides:



Advertisements
Similar presentations
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.
Advertisements

INF 212 ANALYSIS OF PROG. LANGS LAMBDA CALCULUS Instructors: Crista Lopes Copyright © Instructors.
Foundations of Programming Languages: Introduction to Lambda Calculus
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.
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.
1 Problem Solving using computers Data.. Representation & storage Representation of Numeric data The Binary System.
CMSC 330: Organization of Programming Languages Lambda Calculus Introduction λ.
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.
Lesson 4 Typed Arithmetic Typed Lambda Calculus 1/21/02 Chapters 8, 9, 10.
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.
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.
1 Other Models of Computation Costas Busch - LSU.
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.
Multiplication Facts. 2x2 4 8x2 16 4x2 8 3x3.
Multiplication Facts Review: x 1 = 1 10 x 8 =
How Does Turing Machine Think? Example Chaoyang Li RULE’S If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT! Let’s.
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.
PLUS.
Functional Programming
Chapter 2: Lambda Calculus
CS5205: Foundations in Programming Languages
Introduction to the λ-Calculus and Functional Programming Languages
CS 550 Programming Languages Jeremy Johnson
Unit – 3 :LAMBDA CALCULUS AND FUNCTIONAL PROGRAMMING
Lecture 6: Lambda Calculus
Lambda Calculus CSE 340 – Principles of Programming Languages
Model Multiplication Name: _______________________________
Multiplication Facts.
Multiplying 2 Digit Factors
Chapter 2: Data Abstraction 2.1 Specifying Data via Interfaces
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.
Lambda Calculus Revisited
Multiplication Facts.
Turing Machines 2nd 2017 Lecture 9.
Geometry of Interaction
CS 320 Principles of Programming Languages
Lesson 4 Typed Arithmetic Typed Lambda Calculus
Model Multiplication Name: _______________________________
Arithmetic Sequences.
Typed Arithmetic Expressions
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
Carlos Varela Rennselaer Polytechnic Institute September 4, 2015
Multiplication Facts.
Notes Over 11.5 Recursive Rules
Carlos Varela Rennselaer Polytechnic Institute September 8, 2017
Class 37: Making Lists, Numbers and Recursion from Glue Alone
Functional Programming Concepts
Multiplication Facts.
Expressions.
Functional Programming Concepts
Chapter 2: Data Abstraction 2.1 Specifying Data via Interfaces
Addition Facts Plus 0,1,2,3,4.
CSE S. Tanimoto Lambda Calculus
Functional Programming Concepts
Key Questions What are the basic arithmetic expressions and how do you use them in Excel?
Amazing fact #3: -calculus is Turing-complete!
Carlos Varela Rennselaer Polytechnic Institute September 8, 2015
Exponent practice.
Addition Facts Plus 0.
Carlos Varela Rennselaer Polytechnic Institute September 10, 2019
Presentation transcript:

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!

Multiple arguments: currying Encode multiple arguments via curried functions, just as in regular ML (x1, x2). e  x1. (x2. e) ( x1 x2. e) f(e1, e2)  (f e1) e2

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. sn z A unary encoding using functions No stranger than binary encoding

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

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