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 :)
Asked
Active
Viewed 5.2k times
36
-
6The Prolog Dictionary might prove useful in the future: http://www.cse.unsw.edu.au/~billw/prologdict.html – outis Nov 11 '09 at 00:23
-
3W.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 Nov 11 '09 at 06:44
-
@starblue That's pretty far off lol. Why couldn't they use `|+`? Or just `~` or `!` like the rest of the world. – Alexander Oct 24 '16 at 02:34
-
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 Mar 26 '18 at 12:25
-
A plus sign going down a slide having fun? – Paulo Moura Jun 03 '18 at 18:56
-
http://www.cse.unsw.edu.au/~billw/dictionaries/prolog/negation.html – Tom Charles Zhang Apr 11 '23 at 14:00
3 Answers
37
It's the 'not provable' operator. It succeeds if its argument is not provable (and fails if its argument is provable).

Carl Norum
- 219,201
- 40
- 422
- 469
-
-
2Yes, it's just a detail of your implementation. This link mentions some examples: http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_5.html – Carl Norum Nov 10 '09 at 23:52
-
@JuanjoConti: SWI has both `not/1` and `\+`, but recmmends - based on the documentation - to use `\+`. The `not/1` is - given I understood it correctly - for backwards compatibility. – Willem Van Onsem Aug 04 '17 at 21:03
-
-
@G_V - just checked, looks fine. It's just the wikipedia page for prolog, so easy enough to look up if you need to. – Carl Norum Apr 18 '18 at 18:20
-
@CarlNorum http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_5.html doesn't work for me – G_V Apr 19 '18 at 07:41
-
Oh different link - gotcha. I thought you meant the one in the answer. Anyway, doesn't really matter - just syntax differences between implementations. – Carl Norum Apr 19 '18 at 16:25
10
It's do with negation. \+ Goal
will succeed if Goal
cannot be proven.

Carl Norum
- 219,201
- 40
- 422
- 469

Trevor Tippins
- 2,827
- 14
- 10
-
1
-
-
2"not" is usually some form of (safe) negation, whereas `\+` just means: fail, if the goal is provable *at this point in time* quantifying all variables existentially. – false Jan 31 '15 at 22:22
-
Aaah, so `not` expects a result of `true` or `false`, but `\+` only has to be syntactically correct and gives back `true` if there simply is no way to satisfy the goal at all? Let's say, 'Is my stream at its end yet?' will return true as long as the end hasn't been reached. – G_V Feb 08 '18 at 09:48
0
The way I memorize it is through the following logical rule:
\+
= 'ifunsure
orfalse
, assumefalse
'
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.

G_V
- 2,396
- 29
- 44