## Homework 1

1.  Prove lemma 2 from lecture 1 (slide 14) formally.  For every expression e there is that most one value v such that e -->* v.

2.  State the substitution lemma for the simply-typed lambda calculus.  How do we prove it?  Give the proof for the lambda and application cases.

3.  Prove the progress and preservation lemmas for the simply-typed lambda calculus formally.

4.  (Harder) Extend the proof of termination of the simply-typed lambda calculus to deal with booleans and pairs.  The syntax follows.

(types) t ::= ... | bool | <t1,t2>

(terms) e ::= ... | true | false | if e1 then e2 else e3 | <e1,e2> | e.1 | e.2

a)  State the dynamic and static semantics for these constructs.  Before going on to the next parts of this problem, check your work against what Harper has done in chapter 6 and chapter 7 for booleans.  Check with a friend (or me) for pairs.

b)  State the logical relation for the two new types.

c)  Prove lemma 5 (slide 13, lecture 2) for the two new types.

d) Prove lemma 7 (slide 16, lecture 2).

5.  (Extra credit or an alternative to all previous questions) Show how to add first-class continuations to the lambda calculus.  Prove that the lambda calculus remains strongly normalizing or give a counterexample.