/* Example with a family tree */

father(bob, alice).
father(bob, peter).
mother(carol,peter).
mother(carol,alice).



siblings(A,B) :- father(X,A), father(X,B),
                 mother(Y,A), mother(Y,B), A\=B.


% print all of them as lists:
allsibs :- siblings(A,B), write([A,B]), nl, fail.
allsibsok :- not(allsibs).

% as a list of lists:
allsibslist(L) :-findall([X,Y],siblings(X,Y),L).