If I have the following knowledge base, how do I add a cut to the parent_of term so that if an X is already determined to be a father, prolog won't attempt to "check" if X is also a mother?
father_of(max,john).
father_of(max,james).
father_of(max,gabe).
mother_of(june,john).
mother_of(june,james).
parent_of(X,Y) :- father_of(X,Y).
parent_of(X,Y) :- mother_of(X,Y).
For example, I want:
parent_of(max,Y) to be: Y=john, Y=james, Y=gabe
parent_of(june,Y) to be: Y=john, Y=james
For the first one, I don't want prolog to even attempt to check if max is a mother_of since it was already determined that he is a father_of.
I've already tried so many combinations including:
parent_of(X,Y) :- father_of(X,Y),!. <-- fixes an X and Y and thus will list only Y=john
parent_of(X,Y) :- !,father_of(X,Y). <-- works for parent_of(max,Y) but not parent_of(jane)
Is this even possible?