#StackBounty: #prolog #sicstus-prolog #prolog-coroutining Unexpected behavior of frozen/2

Bounty: 450

I was playing around with the predicates freeze/2 and frozen/2:

?- freeze(X,a=a), frozen(X,Goal).
?- freeze(X,a=a), freeze(Y,b=b), X=Y, frozen(X,Goal).

(version 4.5.1 for x86_64) gave these answers:

| ?- freeze(X,a=a), frozen(X,Goal).
Goal = prolog:freeze(X,user:(a=a)),
prolog:freeze(X,user:(a=a)) ? ;
no
| ?- freeze(X,a=a), freeze(Y,b=b), X=Y, frozen(X,Goal).
Y = X,
Goal = (user:(a=a),prolog:freeze(X,user:(b=b))),
prolog:freeze(X,user:(a=a)),
prolog:freeze(X,user:(b=b)) ? ;
no

Now Goal = prolog:freeze(X,user:(a=a)) I did not expect!

What I did expect were answers like the ones given by version 8.0.3:

?- freeze(X,a=a), frozen(X,Goal).
Goal = user:(a=a),
freeze(X, a=a).
?- freeze(X,a=a), freeze(Y,b=b), X=Y, frozen(X,Goal).
X = Y,
Goal = (user:(a=a), user:(b=b)),
freeze(Y, a=a),
freeze(Y, b=b).

Arguably, both the SICStus answers and the SWI answers are correct…

But is there a deeper reason for the somewhat peculiar answer(s) given by SICStus?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.