Article View: comp.lang.prolog
Article #2835forall/2 and negation as failure
From: reeves
Date: Thu, 22 Oct 1987 08:43
Date: Thu, 22 Oct 1987 08:43
34 lines
1829 bytes
1829 bytes
I'm having a problem reading forall/2 and wondered if anyone could help.
In Sterling and Shapiro p. 270-271, the claim is that
forall(Goal,Condition) is true for all solutions of Goal, Condition is
true. Under this reading not(Goal, not(Condition)) works fine as far as I
can tell.
They claim that
forall(father(X,C),male(C))
is checking _for_ fathers that have all male children. My reading is that
it is checking _that_ all fathers have all male children. Their
implementation returns two solutions for the query: the fathers that have
only male children. In the database, however, there are fathers who do
not have only male children, so (I would think) the query should fail.
Is there a reading for forall/2 for the following implementation (from S&S)?
forall(G,C) :- setof(C,G,Cases), check(Cases).
check([Case|Cases]) :- Case, check(Cases).
check([]).
Alternatively, is there a case where:
forall(G,C) :- not(G, not C).
behaves counterintuitively, due to the use of not as negation-as-failure?
Fanx,
John Reeves
UCLA CS Department, AI Lab UUCP: {ihnp4,ucbvax}!ucla-cs!reeves
3531 Boelter Hall, LA CA 90024 ARPA: reeves@CS.UCLA.EDU
Technical Details
Message-ID:
<8781@shemp.UCLA.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!im4u!ut-sally!husc6!sri-unix!sri-spam!ames!elroy!cit-vax!ucla-cs!reevesShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!im4u!ut-sally!husc6!sri-unix!sri-spam!ames!elroy!cit-vax!ucla-cs!reeves From: reeves@ucla-cs.UUCP Newsgroups: comp.lang.prolog Subject: forall/2 and negation as failure Message-ID: <8781@shemp.UCLA.EDU> Date: Thu, 22-Oct-87 04:43:54 EDT Article-I.D.: shemp.8781 Posted: Thu Oct 22 04:43:54 1987 Date-Received: Sat, 24-Oct-87 21:16:34 EDT Sender: root@CS.UCLA.EDU Reply-To: reeves@CS.UCLA.EDU (John F. Reeves) Organization: UCLA Computer Science Department Lines: 34