>>15
I believe prolog is strict in general, although I'm not sure how this is specified with backtracking and all. I know there are a few parallelizing prolog compilers. But in that example the ; means disjunction, so as soon as the true is satisfied, I think it would not evaluate the infinite_loop. But I'm not sure where this is outlined in a standard. And the prolog operators don't seem to be invertible by default, but you could define invertible ones.
sum(X,Y,Z) :- nonvar(X), nonvar(Y), Z is X + Y;
nonvar(Z), nonvar(Y), X is Z - Y;
nonvar(Z), nonvar(X), Y is Z - X.
That's an interesting point about the floating point numbers. It would keep the image/preimage calculation from being totally consistent. I don't know if invertible arithmetic is really supported by prolog at that level.