Please read Chapters 23, 24 in your textbook.
Prove the type soundness of pure System-F (see Figure 23-1, page 343)
in SASyLF in the same style as previous proofs (canonical forms,
progress, substitution and preservation). Unlike previous weeks, you
are not given very much in the skeleton file. You should start with an earlier proof,
and take out anything not related to pure System F (unit, pairs, sums, fold
etc) and add the new System F specific terms, contexts, values,
evaluation forms and type rules. (Up to now, we had only
one binding context in Gamma, now we will need another binding:
Gamma,X.)
Use the partial solutions to
Exercises 23.5.1 and 23.5.2 to help you write the proof.
The solution to Exercise 23.5.1 mentions a new substitution lemma.
That is given for you in the (fragmentary) skeleton file.
This fragment implies the exists of a judgment
and rules B-VAR, B-ARROW and B-ALL.
The programming questions should be done using the
fullomega type checker, and you should copy in the
church-numeral encoding of pairs and lists from test.f in the
fullomega checker directory.
plus.)
map
using the Church encoding of lists. It should have the same
type as on page 346.
List type defined on page 351 exposes the internal
representation. For example, we couldn't substitute an implementation
using recursive types. The following definition fixes this problem
OOList = lambda X.
{Some R,{state:R, nil:R,
isnil: R->Bool,
cons: X->R->R,
head: R->X,
tail: R->R}};
oonil that has type
ooisnil, oocons, oohead,
ootail so that they have the following types:
oomap to use these primitives
(you may assume fix). Test your program by running
oohead[Bool]
(oomap[Int][Bool] iseven
(oocons[Nat] 1 (oocons[Nat] 2 (oonil[Nat]))))