4.7 Control Predicates
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Control Predicates
          • fail/0
          • false/0
          • true/0
          • repeat/0
          • !/0
          • ,/2
          • ;/2
          • |/2
          • ->/2
          • *->/2
          • \+/1
    • Packages
Availability:built-in
Source[ISO]\+ :Goal
True if Goal cannot be proven, i.e. if the attempt to prove Goal fails in finite time (mnemonic: + refers to provable and the backslash (\) is normally used to indicate negation in Prolog). In contrast to the ISO standard, but compatible with several other Prolog systems, SWI-Prolog implements \+/1 as a control structure. This implies that its argument is compiled as part of the enclosing clause and possible variables in goal positions are translated to call/1. As a result, if such a variable is at runtime bound to a (!/0), the cut is scoped to the call/1 call rather than the enclosing \+/1.

Many Prolog implementations (including SWI-Prolog, see section 4.8) provide the equivalent predicate not/1. The not/1 alternative is deprecated because it is easily read as strong negation (``it is known/provable that not ...” ) rather than the intended weak negation, also known as default negation (``it is not known/provable that ...” ). See also tnot/1, implementing negation using Well Founded Semantics.