# Re: [eclipse-clp-users] testing NOT existence

From: Christian Wirth <tyrion_at_...215...>
Date: Wed, 14 Apr 2010 21:57:33 +0200
```I want to test, if not(pred(A)) has could have solution. That would be
the case if A is not bound, or it's bound to A\=1. And after writing
this, i also now how to do this :) ... thx for the cue.

cheers, Christian

Kish Shen schrieb:
> Christian Wirth wrote:
>> i have a conditon NOT(pred(A)) and a fact pred(1). The existenc check
>> \+(\+(not(pred(A))) should succeed, because it's possible that A is
>> not bound to 1, but it fails because A gets bound to 1 by the test.
>> How can i test if a NOT(condition) is solvable ?
>>
>
> Hi Christian,
>
> not/1 and \+/1 behave exactly the same -- I believe \+/1 was added
> because not/1 does not do negation as some people understand it, so
> \+/2 is considered by some to be a better name for the way Prolog (and
> thus ECLiPSe) implements negation. Specifically, negation as failure
> (with closed world assumption).
>
> \+(A) and not(A) succeeds if A fails, and fails if A succeeds.
> Thus \+( \+( not(A))) (which is what you have) has exactly the same
> semantics as \+(A) (and not(A)), except it does more work.
>
> What exact semantics do you want? Note that if you want pred(A) to
> behave like a constraint (i.e. it can delay if it is not immediately
> entailed), then you cannot use the \+(\+(A)) trick, because if A
> delays, A will appear to succeed, and \+(A) will fail.
>
> Cheers,
>
> Kish
>
```
Received on Wed Apr 14 2010 - 19:57:40 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 20 2019 - 09:14:20 CEST