でない例 – q(X, Y, Z) :- r1(X,Y), X < Z. – q(X, Y, Z) :- r1(X,Y), not r2(X, Y, Z). • Safety な例 – q(X, Y, Z) :- r1(X, Y), r2(Y, Z), X < Z. – q(X, Y, Z) :- r1(X,Y), not r2(X, Y, Z), r3(Y, Z). 8
adjacent(a, d). adjacent(e, f). reachable(X, Y) :- adjacent(X, Y). reachable(X, Y) :- adjacent(X, Z), reachable(Z, Y). ?- reachable(b, d). reachable(b, d). ?- reachable(a, f). a b d f c e