View source with formatted comments or as raw
    1% Problematic left-recursion example (requires tabling)
    2
    3r(X, Y) :- r(X, Z), p(Z, Y).
    4r(X, Y) :- p(X, Y).
    5% r(a,d) works if goals reversed. Likely r(X, Z) will never succeed with Z = c
    6r(X, Y) :- r(X, Z), q(Z, Y).
    7
    8p(a, b).
    9p(b, c).
   10q(c, d).
   11
   12?- r(a,Y).