[mercury-users] DCG expansion and logical connectives

Ralph Becket rbeck at microsoft.com
Thu Nov 25 00:16:05 AEDT 1999


I've just had a small surprise.

The following clause (signature supplied)

:- pred ground(atom_type(S), varctxt(S), varctxt(S)).
:- mode ground(in, mdi, muo) is semidet.

ground(functor(_Name, _Arity, Args)) -->
        ( all [Arg]
                { list__member(Arg, Args) }
          =>
                ground(Arg)
        ).

led to this error:

atom.m:488: In clause for predicate `atom:ground/4':
atom.m:488:   warning: variable `Arg' has overlapping scopes.
atom.m:491: In clause for predicate `atom:ground/4':
atom.m:491:   error: undefined predicate `=>/4'.

I'm not sure about the first one yet, but the second error has me worried.
As far as I'm concerned, `,' and ';' etc. are syntax for conjunction and
disjunction and `=>' is syntax for implication.  Indeed, the reference
manual states that

Goal1 => Goal2 
   An implication. This is an abbreviation for `not (Goal1, not Goal2)'.

So my question is, is this a bug of omission from the DCG transformation
(I'd say yes) or is there a good reason to eschew implication in DCG
clauses?

As for the first error, I presume the following expansion:

	all [X] p(X) => q(X)				<=>
		all [X] not (p(X), not q(X))		<=>
		not some [X] not(p(X), not q(X))

which leaves my confused as to where the overlapping scopes warning is
coming from.

Cheers,

Ralph
--------------------------------------------------------------------------
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