The Tower of Babel

Prolog Database
mother(peggy,george).
mother(alice,margaret).
father(george,alice).
father(bob,mary).
mother(margaret,mary).
mother(sue,bob).

parent(X,Y) :- father(X,Y).
parent(X,Y) :- mother(X,Y).
grandmother(X,Z) :- mother(X,Y),parent(Y,Z).

If we ask the inference engine

?grandmother(G,mary).

we receive the answers
G=sue
and
G=alice
 

NOTES:

  1. There may be several facts or rules that provide information about a single relationship. The listing is considered to be an "OR" list. However the predicates may not be contradictory or repeated.
  2. The Prolog "engine" that works over these facts and rules will assume that they are in a "priority" order and thus when necessary will check the facts and rules out in the order given.

[TOC][Next]

CS1104 Main Page
Last Updated 03/28/2000
© J.A.N. Lee, 2000