From merkosh@planet-interkom.de  Sun Jan  9 23:52:07 2000
Received: from vi-b1.ipcore.viaginterkom.de ([195.182.96.29])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id XAA11601
	for <prolog@swi.psy.uva.nl>; Sun, 9 Jan 2000 23:52:07 +0100 (MET)
Received: from merkosh (d-16-175.ipdial.viaginterkom.de [62.180.175.16])
	by vi-b1.ipcore.viaginterkom.de (8.9.3/8.9.3) with SMTP id XAA27029
	for <prolog@swi.psy.uva.nl>; Sun, 9 Jan 2000 23:46:54 +0100 (MET)
Message-ID: <002601bf5af3$3f944e60$10afb43e@merkosh>
From: "Uwe Mayer" <merkosh@planet-interkom.de>
To: "SWI Prolog Mailing List" <prolog@swi.psy.uva.nl>
Subject: predicate logic & using accumulater
Date: Sun, 9 Jan 2000 23:42:43 +0100
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300

hi there,

i am learning from a book, called "Clause and Effect" by William F.Clocksin.
in worksheet 6 he introduces the use of an accumulator in a procedure,
calculating the length of a list:

1.
length([],0).
length([H|T],N) :- length(T,Nt), N is Nt +1.

2.
length(L,N) :- accumulate(L,0,N).

accumulate([],A,A).
accumulate([H|T],A,N) :- A1 is A +1, accumulate(T,A1,N).

furthermore he states that the second version should be prefered. WHY? for
debugging purposes?



my second question is more theoretical.
in analysis phrases like "for all" and "there exists" (dt. Quantoren) are
used.

my second book states that we are only using first order predicate logic in
prolog. (fine)
and that in first order predicate logic we use these <Quantoren> on
individuals and varriables (fine)
BUT that in second (and higher) predicate logic these <Quantoren> work on
predicate varriables. (not fine)

i have problems immagening such a construction.
first case is clear, f.e.:

define a partial map censor such that the goal censor(X,Y) maps the input
list X of words onto the output list Y of words in which no prohibited words
from prohibit(Z) appears.

prohibit(bother).
prohibit(blast).
prohibit(drat).
prohibit(fiddlestick).

censor([],[]).
censor([X|T],[X|L]) :- not prohibit(X), censor(T,L).
censor([X|T],L) :- prohibit(X), censor(T,L).

the second clause of censor can be described as "censor matches the head of
the input list to the head of the output list, if FOR ALL VALUES of the head
of the input list: prohibit(head of input list) fails and recurse on the
tail of the input list".

this would be quantifying (using <Quantoren>) on varriables.
Can anyone give me an example of quantifying on predicate varriables? Why
are such constructions not possible in prolog? why are they useless?

Th@nx in advance

Uwe Mayer

--
"Nothing can be loved or hated
 unless it is first understood"
              Leonardo da Vinci 1452 - 1519

