this is my first time using Prolog, and I was wondering if anyone could give me some advice on my logic:
male(jerry).
male(stuart).
male(warren).
male(peter).
female(kather).
female(maryalice).
female(ann).
brother(jerry,stuart).
brother(jerry,kather).
brother(peter, warren).
sister(ann, maryalice).
sister(kather,jerry).
parent_of(warren,jerry).
parent_of(maryalice,jerry).
This is part of a homework assignment, and we are only allowed to use the above facts. In order to know that warren and mary alice are also parents of stuart and kather, some rules need to be implemented. What I've done is:
parent_of(X,Y) :- brother(Z,Y), parent_of(X,Z).
parent_of(X,Y) :- brother(Y,Z), parent_of(X,Z).
parent_of(X,Y) :- sister(Z,Y), parent_of(X,Z).
parent_of(X,Y) :- sister(Y,Z), parent_of(X,Z).
Querying parent_of(X,Y) in prolog using the above rules and facts have set me on an infinite loop with recursive values of X=warren, Y=stuart and X=maryalice, Y=stuart.
Any advice would be greatly appreciated. Thank You!