Date: Nov 20, 2012 3:33 PM
Author: Graham Cooper
Subject: Re: PROLOG does SO have NOT() !!
On Nov 20, 11:52 pm, Frederick Williams
<freddywilli...@btinternet.com> wrote:
> Graham Cooper wrote:
>
> > Exactly the same way we use not().
>
> > Failure to return a result can be programmed for ANY PREDICATE
>
> > *WITH A FINITE DOMAIN*
>
> > [...]
>
> > You can PROGRAM the predicate NOT(...)
>
> > for any predicate with a FINITE SET OF ARGUMENT VALUES!
>
> Is this "negation as failure"?
>
It's Negation as OTHER.
You can hand program Negation in prolog code for any predicate with a
finite domain.
refundable(CUST) :- taxtype( CUST, personal )
refundable(CUST) :- taxtype( CUST, business )
refundable(CUST) :- taxtype( CUST, company )
not(refundable(CUST)) :- taxtype(CUST, other)
if( refundable(C) , processreturn(C) ).
This works for BOOLEAN ARG predicates like if, or, and, iff, xor,
nand, nor, ..
nand(X) :- not(X).
even if you nest them.
?- or( if(1,0) , if(1,X) )
X = 1
Herc