% From the book % PROLOG PROGRAMMING IN DEPTH % by Michael A. Covington, Donald Nute, and Andre Vellino % (Prentice Hall, 1997). % Copyright 1997 Prentice-Hall, Inc. % For educational use only % File FORALL.PL % Predicate for_all (Chapter 6) % for_all(GoalA,GoalB) % Succeeds if all solutions for GoalA also satisfy GoalB, % and there is at least one solution for both goals. for_all(GoalA,GoalB) :- \+ (call(GoalA), \+ call(GoalB)), % 1 call(GoalA), % 2 !. % 3 % Test knowledge base dog(fido). dog(rover). dog(X) :- bulldog(X). bulldog(bucephalus). animal(X) :- dog(X). animal(felix).