Docsity

CIS 500 - Software Foundations: Homework Assignment 8 - Extensions of Simple Types, Assignments of Computer Science

Toggle sidebar
bg1
CIS 500 — Software Foundations
Homework Assignment 8
Extensions of simple types
Due: Monday, November 6, 2006, by noon
Reminder: You should work all one-star exercises in TAPL as you are reading.
1 Exercise Answer each of the following questions either Yes or No. Additionally, for those whose
answers are No, give a term tthat demonstrates how type safety (either progress or preservation)
breaks if we extend the subtype relation with this pair of types.
1. Is {x:{}} a subtype of {x:Top}?
2. Is {} a subtype of {x:Top}?
3. Is {x:Top} a subtype of {x:Top→Top}?
4. (If the system is extended to include Ref types as described in TAPL Section 15.5) is Ref Top
a subtype of Ref (Ref Top)?
5. Is {x: Top →(Ref Top)} a subtype of {x: (Ref Top) →Top}?
2 Exercise Suppose we extend the calculus with the product type constructor T1×T2described in
TAPL Section 11.6. It is natural to add a subtyping rule
S1<: T1S2<: T2
S1×S2<: T1×T2
(S-ProdDepth)
corresponding to S-RcdDepth for records. Would it be a good idea to add a width subtyping rule
for products
S1×S2<: S2×S1(S-ProdPerm)
as well?
3 Exercise TAPL exercise 15.3.2.
4 Exercise TAPL exercise 15.3.6.
5 Exercise [Required for PhD groups; optional for others.] TAPL exercise 15.5.3.
pf2

Partial preview of the text

Download CIS 500 - Software Foundations: Homework Assignment 8 - Extensions of Simple Types and more Assignments Computer Science in PDF only on Docsity!

CIS 500 — Software Foundations

Homework Assignment 8

Extensions of simple types Due: Monday, November 6, 2006, by noon Reminder: You should work all one-star exercises in TAPL as you are reading.

1 Exercise Answer each of the following questions either Yes or No. Additionally, for those whose answers are No, give a term t that demonstrates how type safety (either progress or preservation) breaks if we extend the subtype relation with this pair of types.

  1. Is {x:{}} a subtype of {x:Top}?
  2. Is {} a subtype of {x:Top}?
  3. Is {x:Top} a subtype of {x:Top→Top}?
  4. (If the system is extended to include Ref types as described in TAPL Section 15.5) is Ref Top a subtype of Ref (Ref Top)?
  5. Is {x: Top → (Ref Top)} a subtype of {x: (Ref Top) → Top}?

2 Exercise Suppose we extend the calculus with the product type constructor T 1 × T 2 described in TAPL Section 11.6. It is natural to add a subtyping rule

S 1 <: T 1 S 2 <: T 2

S 1 × S 2 <: T 1 × T 2 (S-ProdDepth)

corresponding to S-RcdDepth for records. Would it be a good idea to add a width subtyping rule for products

S 1 × S 2 <: S 2 × S 1 (S-ProdPerm)

as well?

3 Exercise TAPL exercise 15.3.2.

4 Exercise TAPL exercise 15.3.6.

5 Exercise [Required for PhD groups; optional for others.] TAPL exercise 15.5.3.

6 Debriefing

  1. Approximately how many hours (per person, on average) did you spend on this assignment?
  2. Would you rate it as easy, moderate, or difficult?
  3. How deeply do you feel you understand the material it covers (0%–100%)?
  4. Any other comments?