Narain@Rand-Unix@sri-unix.UUCP (08/19/83)
Thank you very much for your informative replies to the "not" question. Firstly let me state that I have been a long time programmer in Prolog and LOGLISP and greatly support that style of programming. I perfectly agree that if one wants efficiency and also wants to avoid the spurious behavior of "not" one must be careful that the call to "not is" positioned after the calls to the generators. It IS a constraint but one fairly easy to live with and does not diminish the power of Prolog for most practical applications. In fact I did anticipate that that would be the most reasonable solution given our Prolog ( C-Prolog ). One of the most compelling reasons to use Prolog is that it is based upon a well understood theoretical framework. ( I certainly do rely upon it to a considerable extent when developing my Prolog programs ). If there are deviations from it in a practical environment it is only benefitting to all that they be brought to light. I however wish to respond to one more point raised by Richard O'Keefe. "not" with an argument containing a variable is NOT interpreted properly by C-Prolog. Richard says: >> NO!! \+p(X) is a negation, right? And variables on the right >> hand side of the clause arrow are implicitly EXISTENTIALLY >> aren't they? And (not exists X|p(X)) is (forall X|not p(X)) >> quantified, according to the logic texts. So the meaning of >> \+p(X), when X is a variable, is: >> is it true that there is NO substitution >> for X which makes p(X) true? The above reasoning is incorrect. Firstly, variables are implicitly existentially quantified ONLY when they do not appear in the head of the clause. It is easy to verify this. Secondly "not exists X such that p(X)" is quite different from "exists X such that not p(X)". The following example shows how not(p(X)) when X is a variable has the second interpretation and not the first as pointed out. When you type a query: :-p(X). ( which is a clause in which X does not appear on the left hand side ), you are implicitly asking the interpreter "is there an X such that p(X)?" So, when you type: :-not p(X) X is still existentially quantified and so the correct reading is: "is there an X such that not p(X)?" and NOT "is there no X such that p(X)?" which is what the Prolog interpreter assumes anyway. Sanjai Narain Rand Corp.