<< >> Up Title Contents

1.5. Exercises

1. Extend the program by adding rules for the following family relationships (add more people if necessary, so that you can check your results):

brother(X, Y) where X is Y's brother
sister(X, Y) where X is Y's sister

son(X, Y) where X is Y's son
daughter(X, Y) where X is Y's daughter

married(X, Y) where X is married to Y

ancestor(X, Y) where X is Y's ancestor


What problems do you encounter? What is the nature of the problems? What solutions (if any) can you suggest. (Reading the literature on Prolog will help.)


<< >> Up Title Contents