CS 6520 Homework 15

Exercise 15.1

Complete a typed lambda calculus implementation by implementing a type checker, staring with tlc-almost.ml. (The evaluator is complete. You need only write a type checker.)

The top of tlc-almost.ml provides details about the language to implement. This variant of the typed lambda calculus provides only numbers as primitive constants, doesn't provide extensions like pairs, and doesn't even provide an addition primitive. You do not need to implement the missing features; the given features are enough to write interesting examples.

Exercise 15.2

Extend your typed lambda calculus implementation with type abstractions, as in Chapter 14 of the course notes.

When you extend the xval datatype, TyLam is a good name for the new constructor.

When you extend the xtype datatype, TyVar and ForAll are good names for the new constructors.

When you extend the xpr datatype, TyApp is a good name for the new constructor.

For your convenience, OCaml is installed on the cs filesystem for x86 Linux at
For other platforms, you can download and install OCaml from

The OCaml reference manual is available in HTML from the OCaml home page.

Hand-in procedure for exercises 15.1 and 15.2: Send a mail message containing your code to mflatt@cs.utah.edu. Your message should encapsulate two files, tlc.ml and tlc-ta.ml.

Mime-encoded enclosures are preferred, but any reasonable encoding/enclosing mechanism is fine, including plain text with a clear separator between the files.

Last update: Tuesday, March 26th, 2002