29
votes

I've seen some answers here that use it and I don't know what it means or how to use it. I's also hard to look for it via a search engine :)

3
The Prolog Dictionary might prove useful in the future: cse.unsw.edu.au/~billw/prologdict.html - outis
W.r.t. the shape of the operator, in logic "provable" is usually written as a turnstile: |- . So in "not provable" \+ the \ stands for the long vertical bar and the vertical bar in the + stands for a slash doing the negation. - starblue
@starblue That's pretty far off lol. Why couldn't they use |+? Or just ~ or ! like the rest of the world. - Alexander
Just for clarification: ! is an already defined operator that says "discard all choicepoints for this call" called a cut operator. Not provable means the question can't be answered at this time, not that the answer is false. An example would be "Is the inputstream going to send more data?" which can only be determined when there's an external timeout or a termination signal, not from inside the streamreader itself. - G_V
A plus sign going down a slide having fun? - Paulo Moura

3 Answers

31
votes

It's the 'not provable' operator. It succeeds if its argument is not provable (and fails if its argument is provable).

9
votes

It's do with negation. \+ Goal will succeed if Goal cannot be proven.

0
votes

The way I memorize it is through the following logical rule:

  • \+ = 'if unsure or false, assume false'

This is different from standard boolean logic in that if your goal is uncertain instead of outright true or false, it assumes false when it can't prove true. The most obvious example of this is being unable to see whether a stream is still open or not. If you can't prove it is open, it's the same as being closed to the program.

https://en.wikipedia.org/wiki/Negation_as_failure