[mercury-users] Re: Question regarding determinism
Peter Schachte
pets at students.cs.mu.OZ.AU
Wed Aug 19 16:27:34 AEST 1998
[I mailed Tom privately about this, thinking it wouldn't be of general
interest. Seeing his reply, I now think it is. I've also Cc'd it to
Mercury Developers, because DJ moved the discussion there.]
On Wed, 19 Aug 1998, Thomas Charles CONWAY wrote:
> > > moddat__add_assumption(Obj, Model, [a(Obj)|Model]) :-
> > > some [] (
> > > list__member(o(Obj, _), Model)
> > > ).
> >
> > I would have expected this to be the right code:
> >
> > moddat__add_assumption(Obj, Model, [a(Obj)|Model]) :-
> > some [X] list__member(o(Obj, X), Model).
>
> That is equivalent to my code except for the singleton variable
> warning for X. Arguably, X isn't singleton since it's mentioned
> in the quantifier and in the goal. Perhaps this is a bug.
Definitely. Variables appearing in quantifier lists have to be considered
for singleton warnings, otherwise you'll get singleton warnings for my code,
which shouldn't give a warning, and not for code like
some [X] foo(1,Y)
which should give a warning.
But I'm still confused. Why isn't `some [] X' always the same as just `X'?
Come to think of it, aren't variables supposed to be quantified in their
closest enclosing scope? In this case, the closest enclosing scope for the
anonymous variable is the list__member goal, so I wouldn't think the
explicit quantification would be necessary. Why is it?
-Peter Schachte | 640K should be enough for anyone!
mailto:pets at cs.mu.OZ.AU | -- Bill Gates, 1981
http://www.cs.mu.oz.au/~pets/ |
PGP: finger pets at 128.250.37.3 |
More information about the developers
mailing list