CS 565 final exam, Spring 2000.
Q.1: When the algorithm terminates, the desired set of labels will be named R.
First, do a normal flow analysis of the program, assigning a set of
labels L(e) to every expression e.
Next, for all applications (e_1 e_2) that are _not_ in the body of
any lambda, do
R = R \union L(e_1).
Continue iteratively like this with the body of each lambda whose label
is in R. This will terminate because there are finitely many lambdas.
Q.2: {2,3}.
Q.3: e_0 = 5
e_{i+1} = (\lambda x.(\lambda f.((f x); (f e_i))); x)
where e;e' abbreviates (lambda g.e')e
Q.4: See www.cs.purdue.edu/homes/palsberg/draft/tip-palsberg00.ps.gz,
Section 2.1.