Prev Next Up Home Keys Figs Search New

Prolog Standard Opinions

Appeared in Volume 6/3, August 1993

Keywords: standard.

dave@quintus.com
David Bowen
4th May 1993

At its last meeting, WG17 (the committee working to produce an ISO standard for Prolog) reaffirmed what I think are two of its poorest decisions:

1) To call the negation-by-failure predicate (or control construct) fail_if/1, rather than '\+'/1.

2) To call the type test predicate for floating point numbers real/1.

At the next meeting (in August) there may be one last chance to get these changed, but it will be hard to get WG17 to even discuss these issues again since they were discussed so recently. If anyone feels strongly about these issues (either way) and sends me an email, I will collect the input and summarize it both for the net and for WG17.

To summarize the arguments:

(1) For fail_if/1: This name is easier to read and remember since it is made up of English words rather than symbols.

For '\+'/1: This is in widespread use, and WG17's stated aim is to consolidate existing use, not invent a new language. '\+' is pronounced "not provable", and it can be understood as the logical "provable" sign with a diagonal line across it, tilted over:

fail_if does not aid readability. For example, the clause:
p(X) :- \+ q(X).

is read as "p of X is true if q of X is not provable". Whereas
p(X) :- fail_if(q(X)).

would be read as "p of X is true if fail if of q of X is true", which is nonsense as English. If we want it to be read as "p of X is true if q of X fails" then we should call the predicate fails/1.

There is a danger that a novice could misread the clause as "p of X fails if q of X is true". This is an incorrect reading, since there may be other clauses for p.

(2) For real/1: Prolog is a high-level language based on logic, and therefore it is just an implementational inconvenience that the most practical way to represent real numbers is as floating point numbers.

For float/1: It is misleading to pretend that we are handling real numbers when basic axioms such as the associativity of addition and multiplication do not hold.

Also, we make an important distinction between floating point numbers and integers. The goals float(3) and integer(3.0) should both fail. But surely both 3 and 3.0 are representations of the same real number. So it would be surprising that real(3) fails and real(3.0) succeeds.

Please send your opinions on these issues to dave.bowen@quintus.com.

Prev Next Up Home Keys Figs Search New