[mercury-users] Dumb Newbie Question

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Aug 24 19:57:11 AEST 2000


On 24-Aug-2000, Travis C. Porco <porco at stat.Berkeley.EDU> wrote:
> Dear Readers--I have heard it said that Mercury implements a fuller set
> of predicate logic than does Prolog.  I would like if possible to know more
> about this.  Are there examples of interesting logic problems or proofs
> that can be solved with Mercury programs?  

Theoretical treatments of logic programming often use a very simple
formulation of Prolog, namely pure definite horn clause programs:
the body of each clause must be a conjunction of positive literals.

Standard Prolog goes a bit further, allowing explicit disjunction (`;')
and negation (`\+').

Mercury goes a bit further still, supporting explicit quantifiers
(`some [Vars] Goal' and `all [Vars] Goal') and implication (`=>', `<=',
and `<=>').  In Mercury, the body of a clause can be any logic formula,
so long as it is type- and mode-correct.

So in Mercury you can for example write

	:- pred sets_are_equal(set(T)::in, set(T)::in) is semidet.
	sets_are_equal(Set1, Set2) :-
		all [X] (member(X, Set1) <=> member(X, Set2)).

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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