Program Semantics Intensional Logic and Comp ositionality Jeery I Zucker Departmen t of Computer Science Systems McMaster University Ont LS K Canada Hamilton zuckermaccsdcssmcmasterca HingKai Hung Campus Drive USA Snyder NY hungcsbuffaloedu Abstract We apply intensional logic to the semantics of an Algollike programming language asso ciates with expressions their meanings relative to p ossible worlds here This interpreted as machine states These meanings lie in the semantic domains of a higher order typ ed intensional logic The great advantage of this approach is that it preserves comp ositionality of the meaning function even in opaque contexts This approach assignments Janssen and Van Emde Boas has b een applied in three areas blo cks and pro cedures with parameters passed by value and by reference Hung and assignments to p ointers and parameters passed by name Hung and Zuc ker It is shown how this approach gives an elegant semantics which is simple comp ositional and implementation indep endent Intro duction Denotational semantics Comp ositionality Assume within some general framework we have a numb er of syntactic domains and corresp onding semantic domains D with a meaning function D Assume also that the comp ound expressions of the syntax are formed from the atomic expressions set of syntactic operators by a xed The meaning function is said to satisfy the Compositionality Principle if for every such nary syntactic op erator there exists a corresp onding function 1 n n+1 D D D such that for every comp ound expression 1 n 1 n n+1 n+1 1 n 1 n This research was supp orted by the National Science Foundation under grant no DCR by a grant the Science Engineering Research Board of McMaster University and by a grant from the National from Sciences and Engineering Research Council of Canada Typ eset by A ST X M E The Comp ositionality Principle thus says that the meaning of a comp ound expression is a function of the meanings of its parts The idea can b e found in the writings of Frege It is Chapter where it is used in the framework of many carefully discussed in Janssen cit Chapter Janssen gives many arguments for sorted algebras and homomorphisms op accepting this principle usefulness elegance generality comprehensibility p ower value as a heuristic to ol and others Its signicance for the correctness and verication of concurrent systems is discussed in Zwiers tial comp osition Consider a simple Algollike programming language with assignments sequen we dene the meaning S of a program S in this language as a state and conditionals Whether transformer De Bakker or as a predicate transformer forward or backward Dijkstra it is not hard to see that the resulting semantics is compositional and reference ad Consider now however the language extended by procedures with value dress parameters and by blocks For such a language comp ositional semantics is more dif cult to dene De Bakker for example uses syntactic application which is non comp ositional So how can we restore comp ositionality in such a framework The answer is in the use of intensional logic as we will now see Sense and Denotation Frege distinguished b etween two notions of mean ing denotation or reference or extension and sense or intension We illustrate rst that compositionality implies the the application of each with a wellknown example Note which states that substituting one term for another with the principle of substitutivity of equals same meaning in an expression should not alter the meaning of that expression Consider for example the sentence S I see the morning star now which has a denite denotation truth value relative to a particular valuation of the index icals I and now Now the phrases the morning star and the evening star have the same enus so substituting the evening star for the morning star in S denotation the planet V should result in a sentence with the same truth value S I see the evening star now which is the case But now consider the sentence S I b elieve that the morning star is the morning star which is obviously true Now however if we substitute the evening star for say the second o ccurrence of the morning star in S we get a sentence S I b elieve that the morning star is the evening star which may very well b e false The explanation for this apparent violation of the principle of substitutivity of equals is that the context after a verb of attitude expressing a b elief etc is referential ly opaque compared to a referential ly transparent context such as is visible Freges insight was that the meaning of an expression in an opaque context is given not by its denotation but by its sense Now the ent senses since we can easily imagine expressions morning star and evening star have dier a world in which they refer to dierent ob jects and hence dierent meanings in an opaque context Hence S and S do not give a counterexample to the principle of substitutivity of equals To summarize this discussion taking the senses of expressions to b e their meanings in opaque contexts restores the principle of substitutivity of equals and hence comp ositionality Intensional logic In order to reason ab out senses or intensions as opp osed to denotations or extensions we use intensional logic An early axiomatization of intensional logic Carnap gave a semantics in which the sense of an expression was given by Church e gave a more mathematically is a function from states to extensional values Kripk to develop ed semantics in which the sense of an expression is a function from possible worlds extensional values Mon tague gave a comp ositional semantics for a fragment of English including opaque contexts by dening a translation of it into a system of intensional logic Van Emde Boas and Janssen applied Montagues approach to an Janssen imp erative programming language essentially a fragment of Algol Their insight was that for example the left hand certain contexts in such a language can b e viewed as opaque contexts side of an assignment Example Supp ose the lo cations x and y each store the value Compare rst the two assignments x x and x y They b oth have the same eect x y But compare now the two assignments x x and y x They have dierent eects The rst results in x y and the second in x y So substitutivity of equals works in but not in From this we infer that the rhs right hand side of an assignment is referential ly transparent but the lhs left hand side is referential ly opaque as The solution is to dene the the sense of a program variable or identier of typ e N a function from p ossible worlds to numb ers interpreting p ossible worlds as computation states This amounts to taking the sense of an identier as a memory address or location the contents of which dep ends on the state of the computation and its denotation as the current contents Remark In common progam language terminology the lhs of an assignment is said to de ct The assignment causes the reference to note a reference or lo cation and the rhs an obje p ossess the ob ject as its value and the ob ject can then b e accessed through the reference by dereferencing This is quite a dierent concept of reference from the one used in philosophy denotation that we have b een discussing Janssen and Van Emde Boas pro ceeded by translating the programming language into a system of higherorder intensional logic The semantics thus inherited by the programming language turns out to b e comp ositional An overview of this pap er The approach has b een applied for fragments of Algol in three areas Assignments Janssen Van Emde Boas Blo cks and pro cedures with parameters passed by value and by reference Hung Assignments to p ointer identiers parameters passed by name Hung Zucker We will consider each of these three areas in turn in Sections and resp ectively We have In each case as we will see one gets a semantics which is already touched on the rst in x compositional and implementation independent This pap er is intended as a brief survey of these areas details can b e found in the ab ove references and in a forthcoming publication Garrel Pottinger and Bob Tennent for helpful remarks following We thank Peter Grogono the talk on which this pap er is based The formal system I L of intensional logic Syntax We dene a typ ed system IL of intensional logic The types are generated according to the denition j B j j S N 1 2 where N and B are the basic typ es of numbers and booleans or propositions and S is the typ e of states Note that S is a hidden typ e there are no terms of typ e S For each typ e there is a countable set V ar of variables of typ e There are also constants of certain typ es including the constant Typ ed expressions are generated according to the typing rules from these variables and constants by the arithmetical operations of the relations of and on the numb ers the prop ositional connectives and existential quantier the op erations of ^ _ application and lambda abstraction at all typ es and the modal operators intension extension and h i state switcher Definition Reference variables x are variables of typ e S N There is also a countable f of reference constants X of typ e S N The reference variables and constants set Re will represent the numb er references or lo cations ^ Remarks For an expression ie of type the expression gives the sense or intension of ie its values in all states _ For S gives
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages11 Page
-
File Size-