The following exercises are based on the language of arithmetic expressions, which is defined in Chapters 3 and 6 of Pierce.

Exercise 12.1

Find a type for the expression

(if (if (iszero (succ 0)) thenfalseelsetrue) then 7 else 42)

and prove that the expression has that type (i.e., show the type derivation).

Exercise 12.2

Suppose we remove the reduction rule

(pred 0) -> 0

from the definition of the arithmetic expression language, without changing any typing rules. Is it still the case that well-typed expressions never get stuck? (Provide a proof or a counterexample.)

Last update: Tuesday, February 29th, 2000mflatt@cs.utah.edu