The sound negation operator. If Goal is not ground, the predicate delays.
?Goal
Callable term or a variable.
Description
This is the sound negation operator. It can be used instead of not/1,
\+/1 or fail_if/1 (the negation as failure operators) when in
coroutining mode. It is known that negation as failure may yield
non-logical results if the Goal contains free variables. To avoid this,
~/1 delays if Goal is not ground. If the free variables are bound later
in the execution, the delayed predicate is woken and executed and may
yield success or failure. While ~/1 always behaves logically, in some
cases it delays where negation as failure or constructive negation would
have immediately (and correctly) failed.
Fail Conditions
Fails if Goal can be satisfied
Resatisfiable
No.
Exceptions
Examples
Success:
~ 3 = 4.
~ 3 = X, (delays ...
X = 4. ... and succeeds with X = 4)
Fail:
~ 3 = 3.
~ 3 = X, (delays ...
X = 3. ... and fails)
~ X = X, (delays ...
X = 3. ... and fails)