assignment (1)

Telechargé par anya.naitdjoudi
Final Exam
Foundations of Software
January 22, 2008
Last Name :
First Name :
Section :
Exercise Points Achieved Points
1 10
2 10
3 10
Total 30
Exercise 1 : Types and terms (10 points)
For each of the following types, write down a term in lambda calculus that has that type. You
should give the terms in the untyped lambda calculus, and the given type should be the type
inferred by the Hindley–Milner type inferencer.
AA
(AA)AA
(AB)(BC)AC
(ABC)(BAC)
(AB)(AC)(BCD)AD
2
Exercise 2 : Featherweight Java (10 points)
Consider the Featherweight Java language without casts. Prove the following theorem:
Progress: If tis a well typed term, it is either a value or can take a step.
Proceed by induction on typing derivations.
3
Exercise 3 : Type inference (10 points)
Consider the lambda calculus with Hindley–Milner type inference and let–polymorphism. Adding
mutable cells (references) to this language makes the type inference unsound. Complete the fol-
lowing program so that it is well–typed, and its evaluation leads to a type–error (gets stuck).
Explain why.
l e t v = r e f id in
. . .
(where id is the identity function).
4
1 / 4 100%
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !