15-816 Linear Logic

Assignment 9: Logic Programming in Linear Twelf

This homework consists of two exercises. One is mandatory, the other is optional.

Exercise: 1

Write a linear Twelf program to determine if a purely functional Mini-ML expression, (see course notes [under preparation]) is recursion-free and at the same time

  1. linear (every bound variable occurs exactly once);
  2. affine (every bound variable occurs at most once);
  3. relevant (every bound variable occurs at least 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, may occur at most once in each branch in an affine expression, and must occur at least once in each branch in a relevant expression.

Define your judgments and rules, the representation function into LLF, show adequacy, and program your solution in linear Twelf.

Exercise 2: (extra credit)

Extend your solution from Exercise 1 to full Mini-ML with references. Expressions assigned to reference cells cannot contain free variables for any of the three properties to hold.

[ home | schedule | assignments | languages | handouts | overview | links ]

Carsten Schuermann