[mercury-users] Newbie problem. :)
Peter Schachte
schachte at cs.mu.OZ.AU
Tue Jun 15 15:14:08 AEST 1999
> Given the clause
> :- p(X), q(X).
> "p(X) and q(X) cannot both be true", then
> a disjunction
> ( ... p(T) ... ; ... q(T) ... )
> in a mode where T is ground can be compiled as
> an if-then-else.
But for determinism, you also need to know that
p(X) ; q(X).
I think it would be better to allow declarations something like
:- assertion p(X) <=> \+ q(X).
Since exclusive or would be a lot more natural for this, maybe the
syntax should be
:- assertion p(X) ! q(X).
or maybe even something more specialized:
:- exclusive p(X), q(X).
This generalizes nicely to n goals:
:- exlusive p1(X), ... pn(X).
This means
p1(X) => \+ p2(X), ..., \+ pn(X) and
...
pn(X) => \+ p1(X), ..., \+pn-1(X) and
p1(X) ; ... ; pn(X).
--
Peter Schachte Whatever you can do or dream you can,
mailto:schachte at cs.mu.OZ.AU begin it; Boldness has genius, power and
http://www.cs.mu.oz.au/~schachte/ magic in it.
PGP: finger schachte at 128.250.37.3 -- Goethe
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list