Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!samsung!munnari.oz.au!lee From: lee@munnari.oz.au (Lee Naish) Newsgroups: comp.lang.prolog Subject: Re: Fun. vs. Logic Message-ID: <2788@munnari.oz.au> Date: 23 Nov 89 09:21:25 GMT References: <11500018@hpldola.HP.COM> <11500019@hpldola.HP.COM> Sender: news@cs.mu.oz.au Reply-To: lee@munmurra.UUCP (Lee Naish) Organization: Comp Sci, University of Melbourne Lines: 35 In article djk@cs.mu.Oz.AU writes: >... Astute readers may have noticed some overlap with my posting - sorry if it bored you, but I couldn't be bothered cancelling my article and rewording it to avoid overlap. Really clever readers would have noticed that David and I contradicted each other: > >] ?- not person(X). > >Your query fails immediately, because X only occurs once. The reason for the disagreement is a useful but unfortunately confusing feature of NU-Prolog, namely implicit quantification. NU-Prolog allows you to write explicit quantifiers as follows: ?- all X not p(X). This query fails, since there is an X such that p(X). It turns out that some code ends up looking like this: all [X1,X2,X3,X4] not p(RelevantVar, X1, X2, X3, X4) which looks much nicer if you allow implicit quantifiers: not p(RelevantVar, _, _, _, _) Variables can be implicitly quantified if they occur only once in a clause (and there is a style checker which warns you if such variables are not prefixed with an underscore). Last time I had anything to do with the implementation, this implicit quantification was not done with queries at the top level of the system. This has changed (I guess I should have known), so X in the original query is treated as universally quantified outside the negation (or existentially inside). lee