I have a list of persons
and parent
facts
person(nameA).
person(nameB).
person(nameC).
parent(parentname, children).
I need to write a rule hasnochild(X).
to iterates through all person
that has no child.
This is what I have wrote thus far.
hasnochild(X) :- parent(Z, X).
But it returns all the person's name who has a child. How do I get those who have no child?
Something like the whole list of person
minus off what I have wrote.