In ISO Prolog unification is defined only for those cases that are NSTO (not subject to occurs-check). The idea behind is to cover those cases of unifications that are mostly u
In SWI-prolog:
unify_sto(X,Y) :- \+ unify_with_occurs_check(X,Y), X = Y, !, writeln('Error: NSTO failure'), fail. unify_sto(X,Y) :- X = Y.
gives the following results:
[debug] ?- unify_sto(X,s(X)). Error: NSTO failure false. [debug] ?- unify_sto(X,a). X = a. [debug] ?- unify_sto(b,a). false.