Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!news2.near.net!MathWorks.Com!yeshua.marcam.com!usc!elroy.jpl.nasa.gov!decwrl!amd!amdahl!netcomsv!ix.netcom.com!netcom.com!ludemann
From: ludemann@netcom.com (Peter Ludemann)
Subject: Re: prolog syntax
Message-ID: <ludemannCwyCxA.6p6@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <1994Sep28.221859.21888@wmichgw> <36fa8s$6m9@hobbes.cc.uga.edu>
Date: Fri, 30 Sep 1994 17:07:52 GMT
Lines: 21

In article <36fa8s$6m9@hobbes.cc.uga.edu>,
Michael Covington <mcovingt@ai.uga.edu> wrote:
>Usman A. Mangla (31mangla@wmich.edu) wrote:
>: This may be a stupid question, but if you define a fact, it becomes true.
>: How can you make it false.
>
>You can't.  Prolog implements a subset of logic that does not support
>negative facts.

Prolog also implements the "closed world" version of negation; if something
is stated as true, it's assumed to be false.  So, if you use retract/1
to remove a fact (there are lots of caveats with this, such as the predicate
must be dynamic), you'll in effect make it false.  If you're careful, you
can also use cut and fail:
	fact(x) :- !, fail.
will make "fact(x)" false (but this method only works if fact/1 is called
with the argument sufficiently instantiated; if you really want to use this
technique, I suggest using a Prolog that has a better implementation of
negation, such as NU-Prolog or Life).
-- 
Peter Ludemann                      ludemann@netcom.com
