Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!nntp.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!uwm.edu!rutgers!utcsri!newsflash.concordia.ca!CC.UMontreal.CA!IRO.UMontreal.CA!tarau
From: tarau@IRO.UMontreal.CA (Paul Tarau)
Subject: Re: Arity to Binprolog
Message-ID: <D8uo7G.Dnr@IRO.UMontreal.CA>
Sender: news@IRO.UMontreal.CA
Organization: Universite de Moncton, Canada
References: <3phl9n$ota@khyber.ncc.up.pt>
Date: Sat, 20 May 1995 00:04:27 GMT
Lines: 71

In article <3phl9n$ota@khyber.ncc.up.pt> deec45@tom.fe.up.pt (Filipe Silva) writes:
>In Arity Prolog I have Something like this:
>
>go:-begin(X),assert(piece(X)),.....
>
>later I have
>
>	oc:- (...)
>	    not(piece(X)),...
>
>//////////
>
>when i take this to binprolog (Dos version)
>
>it say something like this when compile
>
>piece/1 not found left unlinked 

BinProlog warns about some statically not visible calls.
Use a reasonably high `quietness' switch like bp -q2 to get
rid of this behavior.

>
>and when i try to 
>
>?-go.
>
>it say      error (...)  ground not(piece(....
>-


Use unsound negation, \+ instead of not/1. \+ is fairly
portable to major commercial Prologs. Denoting \+ "not" 
is Arity specific and in general considered a poor choice as it
let you believe that unprovability is classical negation.

To make this more interesting to innocent people on the net
(please send in the future questions directly to
binprolog@info.umoncton.ca :-)) I will note that actually
BinProlog will warn you about not(piece(X)) only
because not(piece(X)) succeeds in this context.
Further instantiation of X has the ability to reverse
this conclusion,  so you are warned about it. 

Should have peace(X) failed as in the following code:

go:-begin(X),assert(piece(X)),oc.

begin(foo(_)).

lucky(13).

oc:-not(piece(bar(X))),lucky(X).

BinProlog will be happy with your non-ground use of not/1
as further instantiation of X does not matter in this case.

Strong arguments against/for this choice are welcome.

The actual implementation of not/1 in BinProlog is as follows:

not(X):- \+ X,!.
not(X):-ground(X),!,fail.
not(X):-user_error('should be ground',not(X))->fail;abort.

That's about half as draconian as sound negation in other
Prologs :-). Suspending until X becomes ground is another
widely used implementation.

Paul Tarau

