Solution to Prolog Problem #1

`sibling(X,Y) <= mother(M,X) and mother(M,Y) and father(F,X) and father(F,Y).`

Prolog Problem #2

It is possible within Prolog to define predicates within predicates, that is, facts within facts, facts within rules. In the following facts the "type" of the second argument in the facts is defined explicitly:

```owns(john, book(hamlet)).
owns(john, book(wutheringheights)).
owns(mary, book(wutheringheights)).
owns(john, book(1984)).
owns(mary, book(sesamestreet)).
owns(mary, book(whiskers)).
owns(john, car(chevrolet)).
owns(mary, car(chevrolet)).
owns(joseph, car(chevrolet)).
owns(john, car(ford)).
```

Write rules that will count (by repeating the YES clause the appropriate number of times) the number of books or cars that a person owns. Use the following left-hand-sides for the rules:

```books(X) <=
cars(Z) <=
```
where X is the name of the owner.

For example, the query

`?books(john).`
would produce the result:
```? books(john).
books(john) YES
books(john) YES
books(john) YES```

Last updated 2002/03/18