Assignment 5
Due on Nov 1 before lecture.
Please bring a hardcopy of your solutions to lecture. Or submit a hardcopy
of your solutions to Paul Darga before lecture.
(Note, the original due date was Oct 30. We extended the deadline because
Paul was out of town attending a conference on Friday and could not hold
office hours.)
Problem 1
Consider the language of boolean and arithmetic expressions discussed in
class (Figures 3-1 and 3-2 in the Pierce book). Suppose we add a new
syntactic form:
Suppose we also add new evaluation rules:
-
t1 ---> t1'
-------------------------
double t1 ---> double t1'
-
double 0 ---> 0
-
double (succ nv1) ---> succ (succ (double nv1))
Problem 1a (2 Points)
Extend the typing rules discussed in class (Figures 8-1 and 8-2 in the
Pierce book) to support the new language.
Problem 1b (6 Points)
Using the new typing rules, prove the progress and preservation theorems
(Theorems 8.3.2 and 8.3.3 in the Pierce book) for the new language.
(Note that the Pierce book contains proofs of these theorems for the
original language. You do not have to reproduce these proofs. Just show
the portions of the proofs that are different now.)
Problem 2
Consider the language of boolean and arithmetic expressions discussed in
class (Figures 3-1 and 3-2 in the Pierce book). Suppose we add a new
syntactic form:
Suppose we also add new evaluation rules:
-
t1 ---> t1'
-------------------------
half t1 ---> half t1'
-
half 0 ---> 0
-
half (succ (succ nv1)) ---> succ (half nv1)
Problem 2a (2 Points)
Extend the typing rules discussed in class (Figures 8-1 and 8-2 in the
Pierce book) to support the new language.
Problem 2b (6 Points)
What can you say about well-typed programs in the new language?
Are the progress and preservation theorems (Theorems 8.3.2 and 8.3.3 in the
Pierce book) valid for the new language?
If so, prove the theorems.
If not, then modify the statements of the theorems appropriately and then
prove the theorems.
(Note that the Pierce book contains proofs of these theorems for the
original language. You do not have to reproduce these proofs. Just show
the portions of the proofs that are different now.)