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)
safe
unsafe
b.
goal(X,Y) :- p(X,Y) & q(Y,Z)
safe
unsafe
c.
goal(X,Y) :- p(X,X) & q(X,Z)
safe
unsafe
d.
goal(X,Y) :- p(X,Y) & ~q(Y,Z)
safe
unsafe
e.
goal(X,Y) :- p(X,Y) & ~q(Y,X)
safe
unsafe