Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math

Topic: PROLOG does SO have NOT() !!
Replies: 3   Last Post: Nov 20, 2012 3:33 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Graham Cooper

Posts: 4,319
Registered: 5/20/10
Re: PROLOG does SO have NOT() !!
Posted: Nov 20, 2012 3:33 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.