Negated Subgoals
Rules may include negated subgoals, but in restricted forms:
Ok:
P(X,Y) :- Between(X,Y,Z) & NOT Direct(X,Z)
Bad:
Q(X, Y) :- R(X) & NOT S(Y)
Bad but salvagable:
T(X) :- R(X) & NOT S(X,Y)
We�ll rewrite as:
S�(X) :- S(X,Y)
T(X) :- R(X) & NOT S�(X)
Previous slide
Next slide
Back to first slide
View graphic version