Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!ucsd!ames!amdcad!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!etive!aipna!bjr From: bjr@aipna.ed.ac.uk (Brian Ross) Newsgroups: comp.lang.prolog Subject: Re: The meaning of "declarative" Message-ID: <256@aipna.ed.ac.uk> Date: 20 Oct 88 10:43:45 GMT References: <818@etive.ed.ac.uk> <590@dcl-csvax.comp.lancs.ac.uk> <859@etive.ed.ac.uk> Reply-To: bjr@uk.ac.ed.aipna.UUCP (Brian Ross) Organization: Dept. of AI, Edinburgh, UK Lines: 40 In article <859@etive.ed.ac.uk> jha@lfcs.ed.ac.uk (Jamie Andrews) writes: > [...] I was >not asserting that Prolog is "more declarative" than Lisp or >that you can program everything declaratively in Prolog. I was >comparing the logic programming paradigm to the functional >programming paradigm, in general. I was pointing out that the >overall structure of logic programs makes them suitable for >problem domains with lots of logical dependencies, whereas the >overall structure of functional programs makes them suitable >for problem domains involving functions -- seemingly fewer. >Though functions come up naturally quite frequently in programs, >they seldom seem to capture the essence of the whole problem. A discussion of this is in the I.C. report "The Unification of Functional and Logic Languages" by Darlington, Field, and Pull. They argue that logic programs are more descriptively powerful than functional ones due to the existence of logical variables. The fact that logical variables can be both input and output in nature gives logic programs an extra degree of expressiveness (nondeterminism) not possible in conventional functional programs, which are strictly deterministic. This means that higher-level "declarative" program statements are often more naturally expressed in Prolog than, say, Lisp. On the negative side, having lots of complicated logical dependencies in a logic program means that the programmer has to be acutely aware of them. As far as what is meant by "declarative" Prolog programming, I think that if a Prolog clause can be informally interpreted as a logical statement about the problem, be it high-level or low-level, it is declarative. Confusion seems to arise when one considers how high-level a statement it is, ie. whether it can be interpreted as a statement of the program specification. For example, a pure Prolog program which mimics an imperative-style computation might still be declarative, but it likely doesn't share much in common with the natural specification of the problem. Thus many people would say it really isn't declarative -- I would say it is, but it isn't a very high-level declarative description of the problem! Brian Ross "We have all lived in this century. I have not lived in this century." - Senator "Zippy" Quayle