[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: How to use not in gprolog?

**From**: |
ED-DBALI AbdelAli |

**Subject**: |
Re: How to use not in gprolog? |

**Date**: |
Tue, 30 Oct 2001 14:26:27 -0500 |

Carfield Yim a écrit :
>* *
>* Hi, I need to find the negation of a clause, e.g.:*
>* *
>* e.g: if Z is a member of list T and Y is not a member of T, member(Z,T) *
>* should return true and member(Y,T) should return false.*
>* I would like to get the negation of this clause, i.e.: not(member(Z,T))*
>* return false and not(member(Y,T)) return true. But it doesn't work. So I*
>* try member(X,T)\=true. and once(member(X,T))\=true. But both don't work.*
>* *
>* So I would like to ask how to get the negation of a clause?*
Try the negation by failure (\+) (also called "not provable". see 6.18.2
in the manual):
\+ member(Y,T) will succed if Y is not member of T.
Hope this help.
Ali.