:- table ancestor/2. ancestor(X,Y) :- ancestor(X,Z), parent(Z,Y). ancestor(X,Y) :- parent(X,Y). |
:- table shaves/2. shaves(barber,Person):- person(Person), tnot(shaves(Person,Person)). person(barber). person(mayor).Logically speaking, the meaning of this program should be that the barber shaves the mayor, but the case of the barber is trickier. If we conclude that the barber does not shave himself our meaning does not reflect the first rule in the program. If we conclude that the barber does shave himself, we have reached that conclusion using information beyond what is provided in the program. The well-founded semantics, does not treat shaves(barber,barber) as either true or false, but as undefined. Prolog, of course, would enter an infinite loop. XSB's treatment of negation is discussed further in Chapter 5.