Lambda Calculus Flashcards
(44 cards)
What are Lambda Calculus benefits?
- Define computable functions
- Mathematical foundation for functional programming
What is a function?

(T/F) Lambda calculus is a method of representing functions.
True
Lambda calculus provides a set of conversion rules for syntactically transforming functions. Give an example.

Give an example:


Give an example of the following in ML & Scheme:


(T/F)
λ y. * (+ x y) 2
x is bound in this expression
y is free
False
(T/F)
λ x. λ y. * (+ x y) 2
both x and y are bound in this expression.
True
(T/F)
In the pure form of lambda calculus, everything is a fuction.
True
Simple syntax for lambda calculus:

Is this in the abstraction or application form?
(λx. ((* 2) x))
Abstraction
Is this in the abstraction or application form?
((λx. ((* 2) x)) 3)
Application
This is a function defined by a lambda abstraction and given an argument.
What is this special case?
(λx. x)
function of x that returns x, is the identity function since it is the function or
((λx. x) E) = E
for any lambda expression E
(T/F)
In applications, association groupings associate to the right.
False
(f g h) = (f g) h
not f (g h)
In ML:
fun f x :: xs gives error because this is interpreted as (f x) :: xs and it should be f (x::xs).
Which has higher precedence, abstraction or application?
Application has higher precedence than abstraction
λx.A B = λx.(A B)
not (λx.A) B <– This makes B an argument
Express the following nested list expression with parenthesis.
λ x y z . E
(λ x. (λ y . (λ z . E )))
Give names to λ expressions
Example: define f = (λ x . ((+ x) 1))
What is this in ML and Scheme?
Use val keyword in ML
val f = fn x => x+1
f 3
Use define keyword in Scheme
(define f (lambda (x) (+ x 1)))
(f 3)
Reduction rules in lambda expressions:
Apply a set of reduction rules to simplify the expression
4 kinds of reduction rules:
δ (delta)
β (beta)
α (alpha)
η (eta)
Delta Reduction:
Use for the built-in constants
+ 2 3
->δ
5
Read “+ 2 3” reduced to 5 with the delta indicating that reduction used a delta rule
Delta Reduction:
* (+ 1 2)(- 5 1)

Beta Reduction:
Given
((λ x. E1) E2)
Replace all occurrences of bound variable x in the body, E1, with E2.
What is the Beta reduction for the following?
((λ x . * 2 x) 5)

Beta Reduction:
( (λ x. λ y. + x y) 7 ) 8

Issues with Beta reduction:
( λ x. ( (λ x.x) (+ 1 x) ) ) 3

Name clash resolution:
The example again
(λ x. (λ x.x) (+ 1 x)) 3

















