[net.lang.prolog] Referential Transparency

Pereira%SRI-AI@sri-unix.UUCP (11/04/83)

The argument about the referencial opaqueness of =.. is wrong: 1+2 in
Prolog DOES NOT denote 3 for the very simple reason that function
symbols in Prolog are uninterpreted.  What is NOT referentially
transparent in Prolog is machine arithmetic via "is". "call" is also
referentially opaque, for similar reasons, E.g. "call" and "is" will
succeed or produce an error depending on the evaluation order.  A
simile of referential transparency can be rescued from the mess by
claiming that Prolog is a PARTIAL implementation of Horn clause logic.
However, some people have observed that the Kowalski-van Emden
equation between logical and denotational semantics is less relevant
to Prolog than claimed, because a complete denotational semantics of
Prolog SHOULD deal with termination, errors, etc. Alan Mycroft has
developed an elegant account of termination which does not require a
notion of state, but it looks like such a nice account will not be
possible for the effect of "is" and "call", not to mention other,
nastier, features.

-- Fernando Pereira

PS. I have more to say on this point, but I'll keep it for
    the next time for the sake of brevity.