COMS W3261
Computer Science Theory
Homework Assignment #5
November 28, 2012
Due in class 1:10pm, December 5, 2012
Instructions
- This is the last homework assignment!
- You may consult with others but your answers must be written in your own words.
- Problems (1)-(5) are each worth 20 points.
- This assignment may be handed in December 10, 2012 for 50% credit.
Problems
- Here is an ambiguous grammar G for lambda calculus:
- E → λ var . E | E E | ( E ) | var
- Construct an unambiguous grammar equivalent to G.
Have your unambiguous grammar enforce the standard disambiguating conventions
for lambda expressions.
- Show one parse tree in each grammar for the expression
- (λx. λy. x y) λz. z
- Consider the lambda-calculus expression
(λx. (λy. x) x) ((λz. z) (λw. (λv.v) w) ).
- Identify all redexes in this expression.
- Evaluate this expression using normal order evaluation.
- Evaluate this expression using applicative order evaluation.
- Evaluate the lambda expression
(λx.(λy.(x(λx.xy))))y.
Describe all the steps in your evaluation.
- Let G be the lambda abstraction
- Evaluate the lambda expression G G.
- Let add, one, and two be the following lambda expressions:
- add = λm. λn. λf. λx. m f (n f x)
- one = λf.λx.f x
- two = λf.λx.f (f x)
- Evaluate (add one two).
aho@cs.columbia.edu