Introduction to
Logic Programming
What
versus
How
 

Exercise 3.2 - Safety


Say whether each of the following rules is safe.

a. goal(X,Y) :- p(X,Y) & q(Y,X)
b. goal(X,Y) :- p(X,Y) & q(Y,Z)
c. goal(X,Y) :- p(X,X) & q(X,Z)
d. goal(X,Y) :- p(X,Y) & ~q(Y,Z)
e. goal(X,Y) :- p(X,Y) & ~q(Y,X)