Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!sri-unix!Narain@Rand-Unix From: Narain@Rand-Unix@sri-unix.UUCP Newsgroups: net.lang.prolog Subject: Problem With "Not" Message-ID: <4230@sri-arpa.UUCP> Date: Mon, 15-Aug-83 19:41:00 EDT Article-I.D.: sri-arpa.4230 Posted: Mon Aug 15 19:41:00 1983 Date-Received: Thu, 18-Aug-83 05:49:48 EDT Lines: 36 In browsing through the Prolog utilities today I came across one that advised using \+ instead of not ( or something ) and noticed the following example: bachelor(X):-not(married(X)),male(X). If we add: married(a). married(b). male(c). then :-bachelor(Y). fails. This is what the example said or implied. But if we rewrite the rule as: bachelor(X):-male(X),not(married(X)). then :-bachelor(Y). succeeds with Y=c. I think this is serious since the order of literals should not affect what the program computes, only its efficiency if at all. The problem arises since at runtime the argument to "not" contains a variable. This changes the meaning of not(X) to: there exists a Y such that not(married(Y)). In which case Y may be bound to any element in the set: Herbrand-Universe for the program - {Y such that married(Y) is derivable} a potentially infinite set. But the call to not(married(Y)) must not fail. No doubt this has been observed before and I would greatly appreciate any comments on how to avoid the problem. -- Sanjai