11.3.130 (\+)/1 [ISO]


\+ +P

Fails if the goal P has a solution, and succeeds otherwise. Equivalent to:

     P -> fail ; true.


callable, must be nonvar


This is not normally regarded as a built-in predicate, since it is part of the syntax of the language. However, it is like a built-in predicate in that you can say call((\+ P)).

Cuts in P do not make sense, but they are allowed, their scope being the goal P.


Remember that with prefix operators such as this one it is necessary to be careful about spaces if the argument starts with a `('. For example:

     | ?- \+ (P,Q).

is this operator applied to the conjunction of P and Q, but

     | ?- \+(P,Q).

would require a predicate \+ /2 for its solution. The prefix operator can however be written as a functor of one argument; thus

     | ?- \+((P,Q)).

is also correct.


Call errors (see ref-sem-exc).

See Also


Send feedback on this subject.