比如我有这个祖先,我怎么能说谁是混蛋儿子或女儿?
ancestor(frank,mary).
ancestor(frank,andrew).
ancestor(frank,jake).
ancestor(joanne,mary).
ancestor(joanne,andrew).
married(frank,joanne).
法律(我没有发布更多代码,因为它不相关)
mother(X,Y) :- ancester(X,Y),gender(X,female).
father(X,Y) :- ancester(X,Y),gender(X,male).
son(X,Y) :- father(Y,X).
sister(X,Y) :- ancester(Z,X),ancester(Z,Y),X\==Y,gender(Y,female).
brother(X,Y) :- ancester(Z,Y),ancester(Z,X), X\==Y,gender(Y,male).
grandfahter(X,Y) :- ancester(X,Z),ancester(Z,Y),gender(X,male).
grandmother(X,Y) :- ancester(X,Z),ancester(Z,Y),gender(X,female).