
Programming Languages (COP 4020) [Fall 2008]
Assignment IV
Objectives
1. To practice proving the soundness of programming languages by proving Progress
and Preservation Theorems for a new language.
2. To demonstrate an understanding of the semantics of references in strongly typed
languages by implementing a type checker and interpreter for a simple language
with references.
3. To gain experience with recursively defined data types and exceptions in ML.
Due Date for Language-theory Portion: Wednesday, December 3, 2008, at 6:05pm.
Due Date for Programming Portion: Friday, December 5, 2008, at 11:59pm.
Machine Details
Complete the programming portion of this assignment on the following CSEE network
computers: c4labpc11, c4labpc12, ..., c4labpc29. These machines are physically located
in the Center 4 lab (ENB 220). Do not use any server machines like grad, babbage,
sunblast, etc. You can connect to the C4 machines from home using SSH. (Example:
Host name: c4labpc11.csee.usf.edu Login ID and Password: <your login id and
password>) You are responsible for ensuring that your programs compile and execute
properly on these machines.
Assignment Description
1. [5 points]
Recall language L from Assignment III:
expressions e ::= x | n | e1+e2 | let val x = e1 in e2 end | if e1 then e2 else e3 | T | F | B
(a) Provide rules for L’s static and dynamic semantics.
(b) State a Canonical Forms Lemma for L. You do not need to prove the lemma.
(c) State and prove Progress and Preservation Theorems for L.
For this problem, you may assume without proof that all the standard programming-
language lemmas besides Progress and Preservation (e.g., the Inversion and Substitution
Lemmas) hold for L. You may also assume that all auxiliary programming-language
definitions (e.g., of values and capture-avoiding substitution) already exist. As usual, you
may assume that all expressions are implicitly alpha-converted, so you never have to
consider contexts (Γ) containing more than one entry for the same variable. Finally, in
part (c), and in all proofs for this class, you need not prove cases where the logic would
be identical to an existing proof case. For example, if your proof has cases T-T, T-F, and
T-B, but all three cases have identical proof logic, then you could simply prove case T-T
and then write something like, “Cases T-F and T-B are analogous to case T-T.”
Extra Credit
For an extra 25% credit on this assignment, prove that the Substitution Lemma holds for
language L.
1