Csc 4330/6330, Programming Language Concepts (Summer 2020)
Homework 4 (Due: 14 July (Tuesday); Late Submission: 16 July (Thursday))
sudo handin4330 4 hw4.pdf
- Draw expression trees for the following λ-expressions:
- λx.(x λy.(y x))
- λx.λy.((λx.y x p)(λz.z x))
- Make all parentheses explicit in the following λ-expressions:
- (λp.p z) λq.w λw.w q z p
- λp.p q λp.q p
- For each of the following terms, identify the free variables in each term and
for each bound variable indicate (by drawing an arrow) to the λ to which it is
bound.
- λs.s z λq.s q
- (λs.s z) λq. w λw.w q z s
- Apply β-reductions to the folowing λ expressions as much as possible:
- (λz.z) (λz.z z) (λz.z q)
- (λs.λq.s q q) (λq.q) q
- ((λs.s s) (λq.q)) (λq.q)
- Consider the following definitions for the booleans "true" and "false" and
logical operator "and":
true = λx.λy.x false = λx.λy.y and = λb1.λb2.(b1 b2 false)
Using β-reductions, show that- (and false true) reduces to false
- (and true true) reduces to true