I was testing top-level printing, and found a clause
consult and execution bug. Try entering these clauses:
?- [user].
p(X,Y) :- X = f(f(f(X))), Y = f(f(Y)).
p(X,Y) :- X = a(f(X,Y)), Y = b(g(X,Y)).
p(X,Y) :- X = s(s(X,Y),_), Y = s(Y,X).
Querying and Listing in SWI-Prolog gives, it is buggy:
/* SWI-Prolog 9.3.25 */
?- p(X,Y).
X = Y, Y = f(f(Y)) ;
X = a(f(X, Y)) ; /* bug, Y = b(g(X, Y)) missing */
X = s(s(X, Y), _). /* bug, Y = s(Y, X) missing */
?- listing(p/2).
p(A, B) :-
A=f(f(f(A))),
B=f(f(B)).
p(A, B) :-
A=a(f(A, B)),
B=B. /* bug, B = b(g(A, B)) expected */
p(A, B) :-
A=s(s(A, B), _),
B=B. /* bug, B = s(B, A) expected */
Querying and Listing in Trealla Prolog gives, it is buggy:
/* Trealla Prolog 2.78.24 */
?- p(X,Y).
X = f(f(f(_A))), Y = f(f(_B)) /* bug what are _A and _B */
; X = a(f(_A,_B)), Y = b(g(_A,_B)) /* bug what are _A and _B */
; X = s(s(_A,_B),X), Y = s(_B,_A). /* bug what are _A and _B */
?- listing(p/2).
p(A,B) :-
A=f(f(f(A))),B=f(f(B)).
p(A,B) :-
A=a(f(A,B)),B=b(g(A,B)).
p(A,B) :-
A=s(s(A,B),_),B=s(B,A).
Edit 19.07.2025:
Querying and Listing in Dogelog Player gives, it is ok:
/* Dogelog Player 1.3.5 */
?- p(X,Y).
X = f(X), Y = X;
X = a(f(X, Y)), Y = b(g(X, Y));
X = s(s(X, Y), _), Y = s(Y, X).
?- listing(p/2).
p(A, B) :-
A = f(f(f(A))),
B = f(f(B)).
p(A, B) :-
A = a(f(A, B)),
B = b(g(A, B)).
p(A, B) :-
A = s(s(A, B), _),
B = s(B, A).