CS 6520 Homework 2

Exercise 2.1

Using Church numerals and the definitions of add and pred developed in Gordon, prove the following equivalence.

Exercise 2.2

Show the reduction ofto 0. Expand Y, but leave other abbreviations intact, reducing applications of abbreviated functions in one step. For example: (sub1 1) -> 0.

Exercise 2.3

Define a lambda calculus encoding for Lisp cons cells, consisting of expressions for the following: Your encoding must satisfy the following equations: Since we consider expressions such as (car null) or (car cons) to be nonsense, your encoding need not equate such expressions with anything in particular.

Exercise 2.4

Using your encoding from the previous exercise, define length, which takes a list of booleans and returns the number of cons cells in the list.

A list of booleans is either null, or (cons b l) where b is true or false and l is a list.

Exercise 2.5

Translate the following functions to the lambda calculus, assuming pre-existing definitions for true, false, if, not, fst, snd, add1, sub1, zero?, Y, and positive integers.


Last update: Monday, January 17th, 2000
mflatt@cs.utah.edu