CSE 6363 Fall 2001
Homework 6
Due: November 20, 2001 (midnight)

Version 6.4 of the FOIL inductive logic programming system is stored in the directory code/foil in the class directory on gamma2. For more information about the program, see the MANUAL file in the same directory. FOIL is written in C, and the compiled version is in the file bin/foil6.

For this homework, you will use FOIL to generate the following four logic theories (or their logical equivalent). Generate an appropriate domain (.d) file and run FOIL on each problem. You are encouraged to experiment with the other options. For each problem turn in your domain file, the FOIL output (or outputs if different options are tried), and a discussion of the difference (if any) between the FOIL-induced logic program and the versions below.

  1. ancestor(X,Y) is true when X has ancestor Y. parent(X,Y) is true when X has parent Y.

      ancestor(X,Y) :- parent(X,Y).
      ancestor(X,Y) :- parent(X,Z), ancestor(Z,Y).

  2. append(X,Y,Z) is true when Z is the list resulting from appending list Y to the end of list X. components(X,F,R) is true when F is the first (car) of list X and R is the rest (cdr) of list X. The empty list is represented as [ ].

      append([ ],X,X).
      append(X,Y,Z) :- components(X,F,R), append(R,Y,W), components(Z,F,W).

  3. factorial(X,Y) is true when Y = X!. decrement(X,W) is true when W = X - 1. product(X,Z,Y) is true when Y = X * Z.

      factorial(X,Y) :- decrement(X,W), factorial(W,Z), product(X,Z,Y).

  4. play(Outlook,Temp,Humidity,Windy) is true when the argument values represent a positive example from the file data/golf.data.

      play(Outlook,Temp,Humidity,Windy) :- Outlook = overcast.
      play(Outlook,Temp,Humidity,Windy) :- Outlook = sunny, Humidity <= 75.
      play(Outlook,Temp,Humidity,Windy) :- Outlook = rain, Windy = false.