4

On the one hand:

$ sicstus
SICStus 4.6.0 (x86_64-linux-glibc2.17): Mon Apr  6 09:23:37 PDT 2020
[...]

| ?- \+ (!,false) ; X = 1.
yes

... on the other hand ...

$ gprolog
GNU Prolog 1.4.5 (64 bits)
[...]

| ?- \+ (!,false) ; X = 1.
true ? ;
X = 1
yes

... also on the other hand:

$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.2.2)
[...]

1 ?- \+ (!,false) ; X = 1.
true ;
X = 1.

Confusing, isn't it? Help please!

repeat
  • 18,496
  • 4
  • 54
  • 166

1 Answers1

6

Just an artifact of the SICStus Prolog top-level. Try e.g.

$ sicstus
SICStus 4.6.0 (x86_64-darwin-17.7.0): Mon Apr  6 18:23:42 CEST 2020
...
| ?- X = 0, \+ (!,false) ; X = 1.
X = 0 ? ;
X = 1 ? ;
no

The \+/1 control construct is opaque to cuts in SICStus Prolog as required by the standard.

Paulo Moura
  • 18,373
  • 3
  • 23
  • 33