Article View: comp.lang.prolog
Article #3708Re: The meaning of "declarative"
From: Jamie Andrews
Date: Fri, 14 Oct 1988 17:52
Date: Fri, 14 Oct 1988 17:52
72 lines
3735 bytes
3735 bytes
[ I posted this article before, but I suspect that it didn't get
outside Edinburgh. If it did, please forgive me for reposting. ]
In article <ALF.88Oct2184429@hathor.sics.se> alf@sics.se (Thomas Sj|land) writes:
>Statement 1, (commonly accepted, it seems, although the meaning is unclear):
> "Prolog is a declarative language"
To me, "declarative" just means that you are writing
programs by declaring (or "defining", or "describing")
mathematical structures. I think the term was first used to
draw a distinction between imperative languages and languages
like LISP. So in functional languages, programs describe
functions, and in logic programming, programs describe
relations.
I remember that when I learned LISP, it was very unclear
to me why being declarative made it so superior to conventional
languages. I was left with the impression that my prof. just
thought it was better for some vague aesthetic reasons.
Frankly, I'm still unimpressed by purely functional programming
languages.
>My view: "(declarative programming <-> programming without added intension)"
I'm not sure what you mean by "added intension". Do you mean
implementation considerations that make the program do more or less
than it would seem to from a purely declarative reading?
> My intuition leads me to think of soundness rather than completeness
> when I hear the term "declarative".
But consider the Prolog program
P(x) :- Infinite_loop(x).
P(3).
and the query
P(3).
In the declarative reading of the predicate, it looks like P(3)
holds. But when we run the query, it goes off into an infinite
loop -- thus P(3) effectively does not hold. In this case, the
declarativeness or intuitiveness of the program has just been
misleading. A complete system, or an understandable semantics
with respect to which a system is complete, would eliminate
this problem.
How much of a problem is this? It depends on your point
of view. I think that if a system is just sound, that's good
enough for most purposes; but if it's also complete with respect
to some clean semantics, it's even better because we can also
(supposedly) see when a program is going to terminate, as
opposed to just seeing when it's not going to succeed (the only
thing we can get for sure from a declarative reading when the
system is just sound).
BTW, re. my comment about functional programming: logic
programming uses the language of logic, which is (by definition,
almost) very close to the way we think and deduce information
from assumptions. So logic programming is very useful for
systems with lots of logical dependencies (expert systems,
protocol testers, etc.), and its structure corresponds to a wide
class of problems. Functional programming can make no such
claim -- very few problems seem better thought of in terms of
mathematical functions. The main thing that functional
programming seems to offer over relational is a clear and
deterministic decision procedure.
--Jamie.
jha@lfcs.ed.ac.uk
"I always find mathematics so difficult" -- D.Hilbert
Technical Details
Message-ID:
<849@etive.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!apple!voder!pyramid!octopus!vsi1!altnet!uunet!mcvax!ukc!etive!lfcs!jhaReferences:
<ALF.88Oct2184429@hathor.sics.se> <818@etive.ed.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!apple!voder!pyramid!octopus!vsi1!altnet!uunet!mcvax!ukc!etive!lfcs!jha From: jha@lfcs.ed.ac.uk (Jamie Andrews) Newsgroups: comp.lang.prolog Subject: Re: The meaning of "declarative" Message-ID: <849@etive.ed.ac.uk> Date: 14 Oct 88 17:52:30 GMT References: <ALF.88Oct2184429@hathor.sics.se> <818@etive.ed.ac.uk> Sender: news@etive.ed.ac.uk Reply-To: jha@lfcs.ed.ac.uk (Jamie Andrews) Distribution: comp.lang.prolog Organization: Laboratory for the Foundations of Computer Science, Edinburgh U Lines: 72