Reputation: 73
I need to write clauses in prolog that express the following sentence
"Everyone is mortal but john"
here are my clauses:
not(mortal(john)).
mortal(_).
but when I query ?- mortal(john).
it returns true instead false.
What is wrong?
Upvotes: 0
Views: 63
Reputation: 117019
There's nothing wrong with it.
You have two facts:-
not(mortal(john)).
mortal(_).
Running the query ?- mortal(john).
cannot bind against the first fact as it is not structurally the same, but it can bind against the second.
Upvotes: 1