For example if I have this ancestors, how can I say who is the bastard son or daughter?
ancestor(frank,mary).
ancestor(frank,andrew).
ancestor(frank,jake).
ancestor(joanne,mary).
ancestor(joanne,andrew).
married(frank,joanne).
laws (there are some more code that I am not posting because it is no relevant)
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).