`\+`

A less obvious problem is that, depending again on the rules and facts known to the Prolog interpreter, it may take a very long time to determine that the proposition cannot be proven. In certain cases, it might "take" infinite time.

Because of the problems of negation-as-failure, negation
in Prolog is represented in modern Prolog interpreters using
the symbol `\+`

, which is supposed to be a mnemonic
for *not provable* with the `\`

standing for
*not* and the `+`

for *provable*.
In practice, current Prolog interpreters tend to support the
older operator `not`

as well, as it is present in
lots of older Prolog code, which would break if `not`

were not available.

Examples:

?- \+ (2 = 4). true. ?- not(2 = 4). true.

Arithmetic comparison operators in Prolog each come equipped with a negation which does not have a "negation as failure" problem, because it is always possible to determine, for example, if two numbers are equal, though there may be approximation issues if the comparison is between fractional (floating-point) numbers. So it is probably best to use the arithmetic comparison operators if numeric quantities are being compared. Thus, a better way to do the comparisons shown above would be:

?- 2 =\= 4. true.