# CSCI 431 Homework 7

time due submission file
9:00 AM Wednesday 1 November, 2006 in class

## The assignment

### Part 1 -- LISP revisited

Write a recursive definition is LISP or Scheme for the Fibonacci function.

• Fib(0) = 1
• Fib(1) = 2
• Fib(n) = Fib(n-1) + Fib(n-2), when n > 1

### Part 2 -- λ-calculus

Write a λ expression that computes Fibonacci. You must use the Y-operator in your solution. You can also use the C-like conditional expression (x ? y : z) and C-like arithmetic and relational operators.

### Part 3 -- Prolog

Assuming that facts relating to parentage are being encode in Prolog with rules involving a predicate parent similar to the following:

• parent(bobbie, jane).
• parent(jessie, joe).

Write rules for determining when two individuals are cousins, that is, have a common ancestor. To make things simpler (and avoid the use of not) you may assume that you are your own cousin and that your parents are your cousins and that your aunts and uncles are your cousins and that your great-great-great-grandfather is your cousin.