Article View: net.lang.prolog
Article #626Re: Standard behavior?
From: Peter Ludemann
Date: Sat, 24 May 1986 05:41
Date: Sat, 24 May 1986 05:41
41 lines
2902 bytes
2902 bytes
In article <980@watdragon.UUCP> rggoebel@watdragon.UUCP (Randy Goebel LPAIG) writes:
>> >Consider the following trivial predicate:
>> >a([]).
>> >a(_).
>> >
>> >Given the query :-a([]). , C-Prolog finds one match and UNSW Prolog finds two.
>> >Which is standard behavior? How do other implementations behave?
>-------------
>Hmmm. The reason for logic programming's existence is to dispense with
>guesses about what behaviour should be. The formulae assert that the
>individual constant named `[]' and everthing else (i.e., `_') is in the
>class named by the predicate `a'. If you believe that the anonymous variable
>is a universially quantified variable, then there are two resolution proofs
>of the query a([]).
>
>Implementors' treatment of `_' can produce non-standard behaviour; non-standard
>means not consistent with the logical interpretation.
I have to disagree, Randy. The query merely asks whether or not
there is a proof of "a([])". Not how many there are. Although by
Prolog's execution order, there are only two ways of generating the
answer, there are of course an _infinite_ number of logical proofs.
There is no point in trying to list them all :-).
Furthermore, if the goal "a([])" is within a predicate (for example,
q(X) :- a([]), b(X).), then a smart implementation would notice that
if "b(X)" fails, there is no need to re-try "a([])". Isn't that what
all the work on intelligent backtracking has been about?
Now, a general philosophical point. Prolog is certainly _not_ logic
programming, although it is a large step in that direction. A true
logic programming language would not have nor need "cut" ("!"),
"var", "nonvar", etc. ("=..", "name", "is" and even "call" are
legitimate because they can be considered as an infinite number of
rules. "var" and "nonvar" can't be described that way). One of the
advantages of logic programming is that it allows us to consider
computations without knowing (precisely) the underlying execution
strategy. Indeed, for "pure" programs, the execution strategy could
change, yet the programs would still execute correctly. Let us
strive to produce true logic programming languages which get over the
minor failings of Prolog.
Technical Details
Message-ID:
<253@ubc-cs.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!seismo!rochester!bullwinkle!uw-beaver!ubc-vision!ubc-cs!ludemannReferences:
<980@watdragon.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!seismo!rochester!bullwinkle!uw-beaver!ubc-vision!ubc-cs!ludemann From: ludemann@ubc-cs.UUCP (Peter Ludemann) Newsgroups: net.lang.prolog Subject: Re: Standard behavior? Message-ID: <253@ubc-cs.UUCP> Date: Sat, 24-May-86 01:41:35 EDT Article-I.D.: ubc-cs.253 Posted: Sat May 24 01:41:35 1986 Date-Received: Mon, 26-May-86 01:43:55 EDT References: <980@watdragon.UUCP> Reply-To: ludemann@ubc-cs.UUCP (Peter Ludemann) Organization: UBC Department of Computer Science, Vancouver, B.C., Canada Lines: 42