View source with formatted comments or as raw
    1#table p/2.
    2
    3p(a,b).
    4p(b,c) :- not p(b,d).
    5p(b,d) :- not p(b,c).
    6
    7p(X,Y) :-
    8    p(X,Z),
    9    p(Z,Y).
   10
   11
   12?- p(a,X).