Negation
Prolog provides the built-in predicate not/1
which
expresses a form of negation. not(G)
is true if
Prolog cannot prove G
as true given the current
knowledge base. When the Prolog interpreter encounters a goal of
the form not(G)
, it tries to prove the goal
G
. If G
can be proved, then
not(G)
will fail, otherwise not(G)
succeeds.
Add a predicate not_parent/2
to the knowledge base of the exercise about family
relationships. not_parent(X,Y)
should be true
if X is not a parent of Y.
Solution
Write down a Prolog clause representing that Harry likes all
magical creatures except for dementors.
Hint
Go on here.