Thread View: comp.lang.functional
4 messages
4 total messages
Started by S. Mantha (Visiting Scientist)
Tue, 18 Dec 1990 19:08
A question on Semantics
Author: S. Mantha (Visiting Scientist)
Date: Tue, 18 Dec 1990 19:08
Date: Tue, 18 Dec 1990 19:08
79 lines
3760 bytes
3760 bytes
This is a question to the semanticists on this newsgroup. What follows is my understanding of the subject (so, it may be all wrong!) In Mathematical Logic, primacy is given to model theory in the following sense. We prove the *soundness* and *completeness* of the axioms and inference rules of the proof theory with respect to the model theory (i.e. notions of validity -- true in all models and so forth). Consider the analogous enterprise in programming language semantics. Here, the idea is to show the *equivalence* between the operational and denotational semantics of a language (the so called full abstraction property). But the direction is reversed. Some kind of a relation (either an equivalence relation or a partial ordering) on program *behaviours* is assumed. The models that we then build are said to be *adequate* and/or *fully abstract*. The burden of *full abstraction* or the stigma of being too *concrete* lies with the models that are constructed to give the denotational semantics. The operational semantics is, in some sense, prior to the denotational semantics. Logic programming is different in this respect. For definite Horn clauses we have the machine independent denotational semantics given by the minimal Herbrand model (let us ignore negation for the moment). The operational semantics is given by SLD-resolution and the usual soundness and completeness results follow. This is in the general tradition of mathematical logic. Why is it not true of other programming languages? Why don't we start with machine independent semantics and then show that the corresponding operational models are sound and complete with respect to them? A colleague responded in the following way: In computing, you can't question the physics. If your machine tells you "it is so" then it is so. You can't argue with that. And thus the notion that our model theory has to be, at least, *adequate* (the terminology itself suggests the inferior status of semantics). A related question: When is a syntax declarative? Note that we talk about the declarative semantics of Horn clauses (cut-free, first order restriction of Prolog). In this case, the terms "denotational" and "declarative" can be used interchangeably. The denotations of the predicates are given by the least Herbrand model and those of the terms by the Herbrand interpretation (term algebra with free constructors). We, however, do not talk of the declarative semantics of C or Pascal, for instance. It is another matter that these languages can be given denotational semantics. I could think of the following: While the denotational semantics of C, Pascal or assembly is completely machine independent, the *construction* of the denotation itself depends heavily on the operational details of some abstract machine -- and is fact little more than the composition of a sequence of state transition functions. In *declarative* languages, on the other hand, the denotation lies on the surface of the syntax and is very easy to comprehend. So, what makes a language declarative? cheers Surya Mantha University of Utah and Xerox, Webster Research Center.
Re: Define "Declarative" (was: A question on Semantics)
Author: Frank Silbermann
Date: Wed, 19 Dec 1990 19:49
Date: Wed, 19 Dec 1990 19:49
89 lines
4479 bytes
4479 bytes
Surya Mantha: <663@rocksanne.WRC.XEROX.COM> mantha.wbst128@xerox.com > When is a syntax declarative? Some will call a language declarative if it has a declarative subset (regardless how weak :-) ). I consider a language declarative if programs can easily (to whom?) be viewed as assertions of fact, alternative to the conventional view that a program is a command. > Note that we talk about the declarative semantics > of Horn clauses (cut-free, first order restriction of Prolog). > In this case, the terms "denotational" and "declarative" > can be used interchangeably. > We, however, do not talk of the declarative semantics > of C or Pascal, for instance. For these languages, there is no clear declarative reading. That's why their denotational semantics are so complicated. With a referentially-transparant functional language (free of side-effects) you can argue that certain expressions denote functions, function arguments, function applications, and so on. One argues that the entire program can be viewed as a mathamatical assertion, and thus that the language is declarative. To be sure, the assertion that such-and-such expression _denotes_ a function is, by definition, a (possibly informal) claim about the language's _denotational_ semantics, and therefore, investigation into the denotational semantics is required to support such claims. Furthermore, until we define the mathamatical domains of discourse, we cannot even begin to speak about functions (which are, by definition, `1-to-1' and `onto' domain mappings). Thus the importance of domain theory. > In Mathematical Logic, primacy is given to model theory > We prove the *soundness* and *completeness* of the axioms > and inference rules of the proof theory wrt the model theory > (i.e. notions of validity -- true in all models and so forth). > For definite Horn clauses we have the machine independent > denotational semantics given by the minimal Herbrand model. > Then, the operational semantics via SLD-resolution > is proposed, and the soundness and completeness results follow. > This is in the general tradition of mathematical logic. > > Consider the analogous enterprise in programming language semantics. > Here, the idea is to show the *equivalence* between the operational > and denotational semantics of a language. > But the direction is reversed. > Some kind of a relation (either an equivalence relation > or a partial ordering) on program *behaviours* is assumed. > The models that we then build are said to be *adequate* > and/or *fully abstract*. The burden of *full abstraction* > or the stigma of being too *concrete* lies with the models > that are constructed to give the denotational semantics. > The operational semantics is, in some sense, > prior to the denotational semantics. > Why is it not the other way around? > Why don't we start with machine independent semantics > and then show that the corresponding operational models > are sound and complete with respect to them? Practical declarative language designs are limited to that which is reasonable for a computer to do, i.e., the operational semantics. Therefore, the operational semantics is thought about first. Once the denotational semantics are understood, however, _I_ believe we should make it normative, at least for the purpose of teaching the language. The theory of logic developed analogously. First came the "operational semantics", as ancient philosophers collected rules of inference. The model-theory was developed much later, as understanding increased. In today's logic programming community, the typical order is: 1) propose a useful extension to Prolog, giving the operational semantics; 2) ignore the model-theoretic implications of the new feature. :-) Frank Silbermann fs@cs.tulane.edu Tulane University New Orleans, Louisianna USA
Re: Define "Declarative" (was: A question on Semantics)
Author: S. Mantha (co-op)
Date: Thu, 20 Dec 1990 20:37
Date: Thu, 20 Dec 1990 20:37
86 lines
4223 bytes
4223 bytes
In article <5492@rex.cs.tulane.edu>, fs@caesar.cs.tulane.edu (Frank
Silbermann) writes:
|>
|>With a referentially-transparant functional language
|>(free of side-effects) you can argue that certain expressions
|>denote functions, function arguments, function applications, and so on.
|>One argues that the entire program can be viewed
|>as a mathamatical assertion, and thus that the language is declarative.
Are you saying -- please correct me if I am wrong -- that referential
transparency (R.T.) is a *necessary* condition for "declarativeness"? I
don't think
that (that R.T. is a necessary condition for declarativeness) is a
correct assertion.
It is too strong a requirement to place upon the language. I agree that it is a
sufficient condition for declarativeness.
Consider intensional sentences such as "I believe that X" or "I know that Y".
Any logic that models such sentences
(and thus any language whose operational semantics mimics the proof theory for
such a logic) violates the property of referential transparency. I
would, however, not
venture to claim that such a language was not declarative. I feel we
need a sharper notion
of what we mean by declarative programming.
As far as functional languages (FL) are concerned, I agree with you
that referential
transparency is a key property. One compromises on the compositionality
of FL by introducing
even such seemingly benign entities as logical variables (consequently
full unification).
While one gets a richer notion of communication--synchronization (with
the logical variables
acting as channels of C and S) than in traditional functional languages
and the ability to
reason with partially instantiated data structures there are several
disadvantages.
Characterizing the behaviour of logical variables semantically is a
problem. In the presence
of "laziness", one has to deal very carefully with unification. The
semantics should not only
be bottom-avoiding, it should also be top(error)-avoiding.
We (Gary Lindstrom and I) have, however, arrived at a somewhat
satisfactory account of
lazy functional languages with logical variables. We use the notion of
Information Systems
(introduced by Scott to give an alternative formulation of domain
theory) to capture the notion
of "constraint solving" inherent in unification. Instead of viewing
programs as plain
mathematical functions, we view them as entities that impose constraints
on the values of
logical variables in a *global* logical store -- a term introduced by
Saraswat in his
thesis. We can show compositionality (modulo the logical store). It
seems plausible that
such a model can be generalized to functional programming with other
kinds of constraint
solving, as in the Constraint Logic Programming model. "Laziness" would
be of real
importance as constraints would not have to be reduced to a normal form
at each step of the
computation.
|>In today's
|>logic programming community, the typical order is:
|>
|> 1) propose a useful extension to Prolog,
|> giving the operational semantics;
|>
|> 2) ignore the model-theoretic implications of the new feature.
|> :-)
I couldn't agree with you more. There is another class of logic programmers
who are exclusively engaged in the enterprise of providing "semantics"
(on an incremental basis) but whose work has little computational content.
The worst are those who palm off EXTRA-LOGICAL features as being
*meta-logical*.
cheers
Surya Mantha
University of Utah and
Xerox, Webster Research Center
Re: Define "Declarative" (was: A question on Semantics)
Author: Frank Silbermann
Date: Fri, 21 Dec 1990 20:13
Date: Fri, 21 Dec 1990 20:13
67 lines
3409 bytes
3409 bytes
>|>With a referentially-transparant functional language >|>(free of side-effects) you can argue that certain expressions >|>denote functions, function arguments, function applications, and so on. >|>One argues that the entire program can be viewed >|>as a mathamatical assertion, and thus that the language is declarative. In article <673@rocksanne.WRC.XEROX.COM> mantha.wbst128@xerox.com writes: >Surya Mantha > Are you saying -- please correct me if I am wrong > -- that referential transparency (R.T.) is a *necessary* > condition for "declarativeness"? Since declarativeness is not a mathematically-precise concept, I'd be a fool to take such a strong stand. Let's just say that the looser the dependence of an expression upon its context -- the more declarative. > Characterizing the behaviour of logical variables semantically > is a problem. It's not a problem for pure Prolog. It is a problem for Prolog with extra-logical features, however. > In the presence of "laziness", one has to deal > very carefully with unification. The semantics > should not only be bottom-avoiding, > it should also be top(error)-avoiding. I am revising for publication a paper by Bharat Jayaraman and myself which combines lazy (outermost reduction, to be precise) higher-order functional programming with 1st-order horn logic via relative set abstraction. Both operational and denotational semantics are based on conventional domain theory, (with a few run-time program transformations thrown in for efficiency). There is no top(error)-value in the language -- though certain operations will be explicitly undefined(bottom). Logical variables are not _explicit_ features of the language, but are introduced as an operational optimization to avoid blind enumeration of certain generator sets. > We (Gary Lindstrom and I) have, however, > arrived at a somewhat satisfactory account of > lazy functional languages with logical variables. > We use the notion of Information Systems > (introduced by Scott to give an alternative formulation > of domain theory) to capture the notion > of "constraint solving" inherent in unification. > Instead of viewing programs as plain mathematical functions, > we view them as entities that impose constraints > on the values of logical variables in a *global* logical store > -- a term introduced by Saraswat in his thesis. > We can show compositionality (modulo the logical store). I'd welcome seeing anything you've written. > The worst (of the logic programmers) are those > who palm off EXTRA-LOGICAL features as being > *meta-logical*. Even if a feature _is_ meta-logical -- doesn't that mean it belongs in a _meta-language_ (e.g. a language-oriented programmable environment)? Frank Silbermann fs@cs.tulane.edu Tulane University New Orleans, Louisianna USA
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads