15-851 Computation and Deduction
Assignment 4


Please hand in a copy of your code electronically (see for instructions).

Exercise 5.11

Write Elf programs to determine if a Mini-ML expression is free of the recursion operation fix and at the same time linear, i.e. every bound variable occurs exactly once. Since only one branch in a case statement will be taken during evaluation, a bound variable must occur exactly once in each branch in a linear expression.

Note: you do not have to program the test whether a program is affine or relevant as stated in the notes.

Exercise 3.18

Consider a language extension to support lazy evaluation in Mini-ML. For this we introduce a new type constructor # , where #t is the type of suspensions of type t . There should be a new constructor delay e and a destructor let delay u = e1 in e2. The intent is that we substitute an expression for u which need not be a value.

  • Extend typing, value, and evaluation judgements.
  • Define a function force which has type (#a) -> a for a type variable a.
  • Prove that force(delay e) evaluates to v if and only if e evaluates to v according to your operational semantics.
  • Represent the new expression constructors in LF.
  • Represent the new value constructors in LF.
  • Represent the new evaluation rules in LF.
  • Extend the proof of type preservation.
  • Extend the proof of value soundness.
  • Extend the definition of the value soundness judgement and give a representation of the new cases in LF.
  • Another choice of primitives for suspensions are delay e and force e. Compare this to the primitives delay and let delay used above. Do you see any advantages or disadvantages?

[ Home | Schedule | Assignments | Handouts | Software | Overview ]

Frank Pfenning