Abstract Data Types and Algebraic Semantics of Programming Languages
Abstract Data Types and Algebraic Semantics of Programming Languages
C. PAIR
Centre de Recherche en Informatique de Nancy, 54037 Nancy Cedex, France
Communicated by M. Nivat
Received March 1980
Revised (Sctdber 1980
1. Introduction
cornpi! repr
I I
l.,-------_,M,
sem
Fig. 1.
repr
I
imp/
f
i
D;i-- --se;,--&
expr
Fig. 2.
sa sem’
_---__-
Ls ‘Ds = Ts *MS
I t
I I I
imp1 I I repr
I I
I
I -1
LTf---- DTcTr ------+&
expr sem’
Fig. 3.
This choice, also proposed by [Zl] and [5], presents several advantages:
- from a pragmatic point of view, the data stralcture processed by the. language
has to be described, and an abstract data type is a tool for that description;
- from a more theoretical point of view, the semantics of an abstract type (sem’
mapping) can be canonically described; a possible choice is ‘initial a&bra seman-
tics’, where MS and A& are the initial algebras of the source and target types; but
it is not the only possible choice and it can be criticized: other algebras can be
chosen for MS and A&.
- sem’ is a morphism from the term algebra Ts &resp. TT) into the algebra MS
(resp. MT)); repr and imp2 are also morphisms: in particular, this means that imp1
is completely defined by the images of the source type operations, these images
verifykg the source axioms; for initial algebra semantics, morphisms sem’, imp1
and repr are unique and the diagram commutes.
This leads to define the semantics of a programming language by:
- an algebraic abstract data type;
- a syntactical abstraction mapping (which can, for example, be defined as a
morphism on syntactical trees).
Ahstract & ta types and algebraic stwan tics 3
Using an algebraic abstract data type for defining semantics has also been done,
and its advantages justified, by [29] and [6]. In fact, several semantics are thus
defined, according to the choice of the algebra of meanings: a possible choice is
the initial algebra; another one would be a terminal algebra. This kind of definition
of the semantics can be called algebraic since it uses algebras and morphisms, but
also in a sense close of [22], for the meaning of a program is then a set of terms,
i.e. trees, equivalent for some congruence: with each phrase Js associated, by
syntactical abstraction, a term of the type, and therefore its class for a congruence,
for example generated by the axioms of the type if the chosen semantics is that of
initial algebra. Thus, the presence of axioms prevents of having to consider infinite
trees like [l] or [22]. The study of models of abstract types by algebraic methods
[24,5] avoids any recourse to fixpoint theory [26]. Kere we do not build an ‘algebraic
denotational semantics’, Le. a formalization of denotational semantics by an abstract
type [20]; the abstraLiion will start from the language itself and not from a
denotational semantics: we think that this approach leads to simpler descriptions.
The aim of the paper is to make this semantics precise; it describes the class of
abstract types adapted to deterministic algorithmic languages, in particular without
parallelism. Indeed, with all these languages correspond similar types; this can
make the implementation definitions easier and permits to study them in general.
This class of abstract types will be defined in Section 3, after being introduced by
simple examples, but avoiding fixing too much the considered language which is
of no much importance. The treatment of more complex constructs will be presented
afterwards (Sections 4, 5 and 6) to show that the method is general and can be
favourably compared to others for simplicity. In the Appendix a complete example,
relatively simple but containing some of the difficulties present in programming
languages, is treated. In Section 7 are established general results on the considered
class of abstract types: in particular, are proved the consistency of the type and
the existence of models, necessary to actually define a semantics; more precisely,
these models extend given mcdels of the primitive types (integers, booleans, . . .)
on which the built type relies. These results will allow us to come back to compilation
(Section 8).
[lo] gives another presentation, using abstracl types only for the instantaneous
aspects of semantics, the dynamic aspects being presented at another level, less
formal, by transformations between abstract types. It is an intermediate point of
view between that presented here and a previous formalization of data structures
by equational formal systems [23], applied by [S] to the semantics of programming
languages.
In fact, eval wilI be a ‘generic’ operation, i.e. an operation with a multiple functional-
ity;. for example, it has also the functionality S xBool+ of. It is an ‘external
operation’, connecting the sorts of expressions and states to the primitive sorts.
Abstract data types arzd algebraic semantics 5
apply : S :cStm + S.
2.2. Axioms
eval(s,mul(el,e2)) = mul(eval(s,el),eval(s,e2)).
Such an axiom will be also written for add and, more generally, for every operation
h having a corresponding operation A on values.
For example,
eval(s,nzul(nb(3),nb(4))) = mul(eval(s,nb(3)),eval(s,nb(4)))
= mu4f(nb(eval(s,3)},nb(eval(s,4)))
= mul(nb(J),nb(4))
with
nb: Text-, Int, 3: + Text, 4: + Text.
We have to introduce a value sort Text associated with the tixpression sort Tert.
Similarly will be introduced Ident associated with Ident, and id: Text+Ident. Thus,
we make a complete distinction between ‘syntactic’ sorts for tne phrases of the
language and ‘semantic’ sorts for their values. It is however possible to interpret
two such sorts, e.g. Text and Text, or Ident and fdent, by the same set; in othler
cases, it is more advisable to distinguish between these interpretations, interpreting
for example Ideat as a set of locations while Ident Is considered as a set of simple
or subscripted variables.
The case of the operation val is different: its evaluation actual!y depends on the
state. To co.mpute eval(s,val(i)), we first compute eual(s,i) in the sort Ident; then,
we use an axiom :
eval(s,val(i)) = eval(s,vul(eval(s,i))).
vaf:Ii#ent+ Int;
sub-val:IdentxInt+Stm.
Then, we can write the axiom:
ap;+(k,assign(i,e)) = apply(s,sub-val(eval(s,i),eval(s,e))).
appty(s,nothirtg)= s,
ap,ply(s,conc(stml),stm2)) = apply(apply(s,stml),stm2).
making manifest the syntax hidden operations. The mapp& sa has an argument
which is a phrase, or more precisely a syntactic tree; it is recursively defined from
the grammar, For example:
sa@T+ I := E] = assign(saLI],sa[EI),
sairE+ E + P” = plus(sa[E],sa[Pl),
sa:[P--,Ij = 0a l(sa[@,
sa[I + a] = id(a).
This last equation is valid only if the language does not contain go to statements
(Section 5 1.
sa[call p] = call(id(p))
with
call:Ident+Stm
apply(ss,call(q))= apply(s,eval(s,porn(q))).
The operation poss plays, for procedure identifiers, the role of val for integer
identifiers. A value is assigned to a procedure identifier by a declaration:
sa[proc p = b] = dcl(id(p),sa[bj’),
dcl:IdentxStm+Stm
applyL~,dcl(q,m))= apply(s,sub-poss(eval(s,q),m)),
eval(conc(s,sub-poss(r,m)),poss(r’)) = if eq(r,r’) then m &e eval(s,poss(r’)).
sub-poss is a new constructor of the sort Stm, playing for pow the same role L-IS
sub-val for val.
pass(i) is an expression; the corresponding values are statements. We have to
introduce an expression sort Stm associated with the sort Stm of statements as
value sort:
For each language are given some value sorts, and aalong them necessarily ltlool
and Text (other examples are Int, Ident).
’ poss is an abbreviation for ‘possesses’. The reader could see there an influence of Algol 68 [28].
This influence is real and it could be considered that in some respect the proposed semantics is a
formalization of that of [28], See also [8] which presents similar ideas in another way.
8
These sorts have operations (e.g., &IS, mul, ub, dd); in particular two operations
eq: YVXv-, Boo&
It is also a value sort, which can correspond to an expression sort Stm. Stm is
generated by operations of three classes:
(a) for every modif’ta.ble operation f; Vl x x Vu -, V, the operation
l l l
sub-f: Vl x +XnXV+Stm.
l l
app!y : SXStm -, S;
thds, a state is given by a term
app/y(. . . apply(apply(init, m I), mz). . . , mJ
where ml, m2, . . . , m, are statements; thus, it can also be viewed as a computation.
Abstract data types and algebraic semantics
eval:Sx V-a V
for every pair of an expression sort V and the corresponding value sort V.
3. s’. Axioms
Examples :
apply(s,assign(i,e)) = apply(s,sub-~~aI(eval(s,i),eval(s,e))),
apply(s,nothing) = s,
4. Applicafian fs procedures
We introduce (cf. Section 2.4) associated sorts Mproc and Idproc for procedure
bdentlfiers, amd associated operations M”P:Ew-+ Idproc and idp: Text -+ Idproc. As
we have seen in Section 2.4, an expression set Sfm is associated with Stm. San has
modifiable operations
poss ::Idproc + Stm and poss : Idproc -, Stm.
des:IdentxC+L,
sali] = des(id(i),cc)
incall: + C,
newcall: S XIdproc + C.
The axiom for call given in Section 4.1 hasI then to be ck;lnged into:
appM,caMW= apply(apply(apply(s,
sub-cc(newcall(s,eval(s,q)))),
eval(s,pass(q))),
sub-cc(eval(s,cc))).
Finally, we can express the rules relative 1:oscopes by two axioms for des. The
second one uses an operation:
scope(i) is the identifier of the smallest procedure containing the declaration of the
identifier i.
eq(des(i,c),des(j,c))
= eq(i,j),
’ ’ = eq(i,j) and not eq(scope(i),q).
eq(des(i,newcall(s,q)),des(j,eval(s,cc)~~
A >wayof introducing scope is to put, tiy the syntactical abstraction, with each
identifier the identifier of the procedure where it is declared; therefore sa is not
12 C. Pair
exactly a homomorphism dealing with the syntactic tree of the program, but rather
with a tree de:corated by attributes [ 171. However it is also possible to express this
decoration in rrhetype itself.
I ,et us note Ithat the domain of definition of des could be precised by a precondition
[131 taking in,to account the scoping rules (see [lo] for the use of preconditions).
4.3. Param&rs
Let us now suppose that a procedure has one parameter, called by value. We
need an opera.tion to access this parameter from the procedure idewtifier (supposing
all procedure :identifiers of a program different):
Then, we hzlvleb to express that, at a procedure call,, the formal p:arameter takes the
value of th c;!61;:tualparameter:
slrb-val(des(vp(q),nc),eval(s,u))
sub-cc(nc),
eval(s,poss(q,I),
sub-cc(evak(s,ccj))
where q 2%eual(s,q) and nc = newcall(s, q).
For pari;meters called by reference, we introduce a sort Idpar, the sort Ll of the
corresponciing locations (!ocations of locations), and operations:
- de~p:fdp~r XC+ Ll similar to des,
- vak Ll+.k, modifiable, similar to val and giving the location of the corresponding
actual parameter.
Then, for a procedure having two plarameters, the first called by value and the
second b;y reference:
rp :Idproc -, Idpar,
sa,fcallp(e, v)] = ca U2(idp(p),sr;#ej’,sa[vJ),
sub-cc(eval(s,cc)))
For a language with go to’s, the definition of sa[Sl;S2] given in Sec:tior,l 2.3 as
conc(sa[Sl],sa[S2]) is no longer valid. We modify it into
apply(s,goto(l)) = apply(s,sub-next:‘eval(s,l))).
Moreover, before executing a labelled statement, it is necessary to ‘reset’ nlext to seq :
sali: Sn = lab(idl(i),sa[Sj’),
ap@ycs,lab(l,m)) = apph(s,conc(sub-next(seq),m)).
14 C Pair
in(assign(j,c),Q = false,
048
(gow(i11,/)= false,
ifi(lab(ll,s),l) ==eq[ll,l) or in(s,l),
in(cong(sl,s2),1) = in(sl,l,, 02 in(s2J).
Intuitive&, cortg(sl,s2) executes the statements sl, s2 while the value of next is
~1 Or in t2; con,ul(sl,s2) or cong2(sl,s2) is interpreted like cong(sl,s2) but the
execution’begins in sd or in ~2, respectively. This it;expressed by two axioms:
Up to now, we have considered that an expression did not cause any modification
on the state, i.e. the language has no side effect. Side effects can be caused by
functions ant:1we have not considered functions :ither.
Side elects lead to consider that an cxpressiou can caus’e a modification of state
and therefore to give also to apply the profile
sxv+s
for every expression sort K
Abstract data types and algebraic semantics 15
Moreover, the axioms given for eual in Section 3.3 have to be changed. For
example:
eval(s,h(ul,u;?)) = h(eval(s,uI),eval(apply(s,ul),u2))
apply(s,assignO,e~~= apply(s,sub-vaI(eval(s,i),eval(apply(s,i),e)).
For functions, it can be considered that they give a result in a fixed location
represented by a modifiable 0-ary operation res. Let us suppose that the execution
of a function is terminated by that of a return statement indicating the expression
the value of which is returned:
sa[return e] = ret(sa[e]),
Moreover, for 21function call with an integer argument and an integer result:
the other objects, especially the constructs of the language. This remark leads to
give a hierarchical definition of the abstract type associated with the language. It
reCies on a primitive type, formed with certain value sorts, like Irtt, Bool, Text (but
not C, RI which can be called auxiliary sorts): among the primitive sorts are to be
found those sorts the interpretation of which is imposed; in this sense, ldtwt can
be undifferently considered as a primitive sort or an auxiliary sort.
MorecPver, the terms of sort S are in the form
Some terms of s(lsrt S express computations: those where the second argument of
apply is always a sub-f(vl, . . . , vn,v). Computations are generated by init and
‘hidden’ operations subst-f defined by:
sub-f: VI x 8 l
xV,xV+Stm.
l
(e) Interpretation level vu11 type): here, terms of sort S are unrestricted. For
every operation g; L1 X ’ XL, + Stm is introduced one, and only one, axiom of
l l
VQ make the hypothesis that the term 4(s) contains s. Moreover the operation
if &en eke .-Boo1xStm x&m + Stm is intr educed with the axioms:
* It is also possible not to introduce apply and s&f at this level, but in place sub.+f, see blefore.
18 C. Pair
axiom
(91 evall(init,f(Et,. . . , tJ) = t
where t is a term of data structure level. We say that the auxiliary sorts are suficiently
complete (re~g. consistent) if the type of data structure level is sufficiently complete
(req. consistent) relatively to the primitive type; indeed, the verification of these
properties only use auxiliary and primitive operations.
T,hwaam 1: If the type is initiully completed, for every computation s and every
expressiw e of the norma! type, there exists a term v where eval does not occur, such
that ej3al(s9e)= 0.
Proof;: Let us choose for the terms evaZ(s,e) a rrtJetherian order, i.e. wnere every
descending chain is finite:
Cossequermce: If the type is, Ctially completed and if the auxiliary sorts are
sufficiently complete, then thc,inarrlal type is sufficiently complete relatively to the
primitive type.
Proof: From Theorem 1, the normal type is sufficiently complete relatively to the
type of data structure level, which In turn it<sufficiently complete relatively to the
primitive type.
For the type studied in Section 4, auxiliary sorts are not sufficiently complete;
preconditions should be added, ensuring that axioms are sufficient to compute
eq(des{i,c,?,des(j,c’)) (see Section 4.2) in all useful cases.
Theorem 2: If the auxiliary sortsare consistent, tne normal type is consistent relatively
to :he primitive ty,pe (and therefore relativeiy to hoi).
Let us orient from left to right the axioms (l), (2), (33, (4) of Section 3.5, the
other axioms remaining in both directions. We will show the confluence of the
obtained rewriting system (see [14] for conditions of confluence). There exists no
superposition between the left-hand sides of oriented rules, therefore no critical
pair. Moreover these rules are compatible with the congruence generated by the
unoriented axioms (i.e., denoting = this congruence and + the direct rewriting, if
t+ f’ and t= tl, there exists ti such that ?I+ t: and t’=t;); indeed, operations
generating expressions occur in no unoriented axiom. It results that in the quotient
of the algebra of terms by this congruence, the rewriting system is confluent,, and
it is therefore also confluent for the terms themselves.
Consistency results from confluence: if t = t’ is a theorem, t and t’ can be rewritten
into the same term t”. For terms of data structure level, these rewritings cannot
use the axioms on evul. Therefore t= t” and t”= t’ are theorems at data structure
level, and thus t = t’ is too.
The theorem remains true for an initially completed type: the added axioms (9)
are also oriented from left to right and there is still no superposition.
For the example of Section 4, the consistency of auxiliary sorts is easily proved
by proving confluence of the rewriting system obtained when orienting the axioms
on auxiliary operations (Section 4.2).
The consistency of the full type relatively to thle normal type, therefore to the
primitive type, can be proved in the same way.
Proposition I: If the auxiliary sorts are consistent, the rewriting system obtained by
orienting from left to right the axioms introduced at interpretation level and leaving
unctriented the other axioms, is confluent.
Proof: The oriented axioms are: for every operation g generating statements, one,
and only one, rule
and axioms on if then else ; to ensure compatibility with the congruence = generated
by the unorient ed axioms, we replace the rules on if then else by
This does not change the rewriting relation. Then, there exists no superposition
for left-hand sides provided that the normal type is consistent: this is true from .
the hypotheses (Theorem 2). Confluence results like in Theorem 2.
20 CT Pair
Tkearem 3: ?ke full type is consistent if (and only if) the auxiliary sorts are consistent.
But here the type is not sufficiently complete in the general case. If it is, every
statement has a normal form and this means that every progr2= terminates.
As the type is not in general sufficiently complete, the question arises if, when
a model is given for the primitive type {integers, booleans, . . .) it can be extended
into a model of the full type. This question is studkd in [24] and [S]: the considered
models interprete operations as partial functions; we say that a term t is reducible
if th&ereexists a term p of the primitive type such that t =p is a theorem; each
model of the primitive type can be extended into a model of the full type, supposed
consistent, if eliery suf_Jtcrrmof primitive sort in a reducible term is also reducible.
Theorem 4: If the au:;iliary sorts are consistentanJ suficiently complete, each model
of the primitivr type can be extended into a model of the full type.
Pr~olk ‘Let us ?*jeginb;jr adding a;ioms to get initial completeness (Section 7.2): we
have seen that the type remains consistent. From the consequence of Theorem 1,
if a tlerm of primitive sort is not reducible, it is not normal. Let t be a term of
primitive scat containing a nonreducible term t’ of primitive sort. WC will show
that every axiom transforms t into a term containing a nonreducible term of primitive
sort:; tkrefore, t is nonreducible. It is obvious if the transformation bears on a
teim c!isjoint OCt’ or on a subterm of t’. If it bears on a term containing t’, it is
necessarily induced by an axiorn of the interpretation level, since t’ is not normal.
As a statement contains no term of primitiv~z sort, the axiom is necessarily
appW,g(ul, . - , iJ,r.
u '= t-$(s) where t’ is a subterm of s; therefore t’ is a su’bterm
of MA
7.4. Computd!qtion
part of a state
In the sequcr:l,we study states, i.e. terms of sort S, without variable. To simplify
notztions, we denote here apply by an infixed dot: a state s is then written
init.ml. 9 . 9 .m,;
denoted by +*, and the direct rewriting of which it is the reflexo-transitive closure
by +.
The unoriented rewriting rules do not possess the same property. To extend it,
we consider the congruence = generated by the axioms of the normal type. Since
these axioms =never equal states, it is obvious that the states congruent to
init.ml. l .m, a,ie the init.mi. 9 .mi where micm! (1 &sp). Therefore, if s=s’,
l l l l
Proof: < is the product of two reflexive and transitive relations = and 40: ‘is a
factor of’. Moreover these two relations commute: indeed, s is a factor of a state
congruent to s’ ifi s is congruent to a factor of s’. Therefore the product is re#lexive,
transitive (since C 2 = =(p=(p = = ‘p 2 = =cp = C) and compatible with = (since <= =
,_ < ==-2 V =sp=<).
Proof: We still know the first part. Moreover, if s-, s’, then camp(s) cconzp(s’)
by Proposition 2 if the rewriting rule is i rule of the interpretation level, and
comp(s)=comp(s’) otherwise: in both cases, camp(s) <comp(st). Then, the second
part results of the transitivity of <.
Tkorem 5: For a consistent type, the (classes for = of t’he) computation parts of
Abstract data types md algebraic semantics 23
the terms of every class of the congruence generated by the axioms are totallyordered
by <. Only three kinds of terms can exist:
(1) those admittin%a nok?malform s,,(comp(sJ identical to sn and maximal in its
class );
(2) those leading to an infinite computation! (the comp(s,) of the class are not
bounded );
(3) those admitting a blocked form conq~(s,) (comp(s,) distinct from sm and
maximal in its class).
8. Application to compilation
82 Translation of states
Let US study the implementation of siates in the three cases of Theorem 5. The
implementation of s is denoted by S.
24 C. Pair
minating program; this is true if a term wi;h a blocked form is not transiated into
a term with a normal form.
(e) that a term init.sa[pj’ having a blocked form is translated into a term having
a blocked form, and even that these blocked forms correspond by the translation.
The simplest case where these last two conditions are satisfied is when no term
init.sa[p] has a blocked form.
We call a term semi-normal if all its subterms of another sort than S are normal.
If s is normal, s.sa[pJ is normal.
Theorem 7: If
(1) every state sm, where s and m are terms of data structurelevel, can bl.? rewritten
into a semi-normal term d.ml. .m, (q 2 I) where ml is some sub-f(u,v) or a strict
l l l
subterm of m9
(12) the type is initiallycompleted,
then a semi-normal state cannot admit a blocked form.
Si = COmp(.Si).m.pr. ’ ’ l lPP
where m, ~1,. . . , pp are statements; comp(si) and m are normal; after eliminating
eval by Theorem I, hypothese 1 can be used to rewrite comp(si).m into a semi-
normal term:
For the example in the Appendix, the axioms on the operations generating Stm
directly show that hypothese 1 is satisfied, but for three of them:
- s.cond(b,mt,mz) =if eval(s,b) then ml else m2: if preconditions or axioms are
added so that auxiliary sorts become sufficiently complete, from consequence of
Theorem 1 and from the fact that the primitive type is sufficiently complete relatively
to BOO& eval(s,b) = true or eval(s,b) =fulse is a theorem: therefore hypothese 1
is sath;fied in this case;
- snothing =s and the axiom for while, leading to a blocked form for
init.while(true,nothing).
If the definition is changed by removing nothing and replacing the axiom for
while by
9. Conclusion
We have shown how an algebraic abstract data type can be associated with a
progranmisag language to describe its slemantics, and we have seen how the principal
aspects of deterministic algorithmic languages could be presented in this frame.
Tine extension to parallelism remains to ?Wstudied. Moreover, preconditions must
be introduced, particularly to deal with errors.
The abstract type takes together into account the phrases of the language and
elements allowing to express their meaning, like states, eval,, apply; this is different
from denotational semantics [26] or from [1] where the syntactic and semantic
levels are distinguished, connected by an interpretation function. Grouping together
these two levels is specially interesting for procedures, for the value possessed by
a procedure is a phrase of the language. Moreover a proof on semantics can be
expressed in this formai frame if it relies only on the axioms and not on a particular
semantics (i.e. algebra) of the abstract type. These advantages go beyond the
application to compilation: every proof, every automatic transformation, can find
an advantage in a unified formal frame, using only simple notions and not compli-
cated ma:.hematical objects.
Let us remark that, if the type can be relatively complex, the descriptions of
phrases by their syntactical abstraction are ,more simple (level b of the hierarchical
construction of Section 7.1, the other lelCelsbeing used only to write axioms).
For compilation, the given meGod, both systematic and practical, divides its
complexity and allows to prove correction. Verification of axioms can be done
following the hierarchical construction of the type. If, obviously, nothing general
can be said for the implementatiion of primitive or auxiliary sorts, a general study
seems possible for the implementation of the sub-f, leading to a correction algorithm.
The problem of compiler correction (Section 8) can also be connected to the
chosen abstract type semantics. Initial algebra semantics ensures commutativity of
the diagram of Fig. 3 (Section I) but ,does not guarantee total correctness of the
compi!er, for it expresses nothing on nontermination. Other semantics can be
considered [6], defining stronger congruences on terms: we have spoken of models
extending a given model of &e primitive type (Theorem 4 and [24,5]); for them,
states WiMut normal form are ah considered as equivalent; moreover, choosing
among them a terminal model comes back to conside?: as equivalent the expressions
always evaluated (by eval) into the same value, the states where the expressions
Abstract data types and algebraic semantics 27
have the same value (by e~al), the statements having the same effect (by crpply ):
cf. denotational semantics. It is also possible to consider as equivalent, among the
states without normal form, only those leading to the same infinite computations:
cf. continuous initial algebra s [II Thus, commutativity of the diagram can corres-
pond to one idea, or another, of ‘compiler correctness.
Table A.1
-
Cirammar Operations
Recapitulation of sorts:
Yrimitise sorts: Text, Boo& Int
Auxiliary sorts: Ident, Idpmc, Idpar, C (calls)p L (integer locations), Ll (location lacations)
?Expression sorts: associated to the preceding sorts, and Stm associated with Stm
Stm and S
Abstract data types and algebraic semantics 29
s.conc(m~,m~) =s,mI.m2
s.nothing = s
scope(id(i,q)) = q
a preprocessor binds with each identifier the identifier of the
procedure where it is deLlared, thus suppressing synonymies
(procedure identifiers are supposed to be distinct).
eq(W,p), Wi,qB = aMeqfi,ii,~q(pd~
eq(WW, i&(q))= e&w)
R: formal parameter called by reference
eq(desp(i,newcall(s,q)),desp(j, ~a!(s,cc))) = and(eq(i, j), riot(eq(scopep(i),q)))
~COP~POQW= 4
eq(rPtP), rPW = &P,d
V: formal parameter called by value
+q(Wp), &$I = eq(P,q), eqc’up&),W 4)) = false
s.dc!(q,m) = ssub-poss(eva!(s,q,Jg m)
s.ra!!(q,u,!) = s.sub~~val(des(vp()~nc),eva!(s,u))
sub-valp(de.sp(rp~q),rLz,,eva!(s,!))
.sub-cc(nc)
.eva!~s,poss(q))
.sub-cc(eva!(s,cc))
where q = eva!(s,q) and nc = newcall(s,q)
30 C Pair
f I] J.A. Gogwen, J.W. Thatcher, E.G. Wagner and J.B. Wright, Initial algebra semantics and continuous
algebra, J. ACM 24 (1977) 68-95.
[2] J,A ~Goguen, J.W. Thatcher and E.G. Wagner, An initial algebra approach to the specification,
implementation and correctness of abstract data types, in: R. Yeh, Ed., Current Trends in Progrum-
ming Methodology 4 (Prentice-Hail, Eng!2wood Cliffs, NJ, 1978) 80-149.
[3] J.W. Thatcher, E.G. Wagner and J.B. Wright, More on advice on structuring compilers and proving
them correct, Proc. 6th Colloquium on Automata, Languages and Programming, Graz (1979).
[4f A.V. Aho and J.D. Ulimann, Princip!esof CompilerDesign (Addison-Wesley, Reading, MA, 1977).
[S) M. Broy, C. Pair and M. Wirsing, A systematic study of models of abstract data types, 81-R-42,
Centre de ‘Recherche en Informatiquc de Nancy (1981), to appear.
[4] M. Broy and M. Wirsing, Programming languages as abstract data types, Proc. 5th Colloquium Lt~s
Arbres en Afggbre et en Programmati.gn,Lilie (1980).
171 P. Deschamp, Production de compS!ateurs 5 partir d’une de:scription sCmanoique des iangages: ie
systeme Perluette, These, lnstitut National Poiytechnique, Nancy (1980).
183 J.P. Finance, Une formalisation de la s&antique des iangages de programmation, RAIRD
Lnformatique Thiorique 10(1976), No. 8,3-32 et No. 10,521.
[93 MC. Gaudel, A formal approach to translator specification, in: B. Gilchrist, Ed., Information
Processing 77 (North-Holland, Amsterdam, 1977).
[lOI M.C. Gaudel, G&&ration et preuve de compilateurs basees sur une sQmantique formeiie des
langages de programmation, Thbse, Institut National Polytechnique, Na.ncy (1980).
[l !j J.V. Guttag, E. Horowitz and D.R.. Musser, Abstract data types and software validation, Repc,rt
ISI/RR-76-49, University of Southern California (1976).
[12’J J.V. Guttag and J.H. Horning, The algebraic specification of abstract data types, Actu Informat.
l@(1978) 27-52.
[ 13) J.V. Guttag, Notes on type abstraction, Proc. Speci,ficationof Reliable Software Conference, Bostw
(1979) 36-46.
1141 G. Huet, Confluent reductions: abstract properties and applications to term rewriting sy:ttems,
18th IEEE Symposium on Foundations of Computer Science (1977) 30-45.
[lS J S. Igarashi, Semantics of Aigol-like statements, in: E. Engeier, Ed., Semantics of Algorithmk
Languages, Lecture Notes in Mathematics 1881(Springer, Berlin, 1972) 117-188.
[I43 N.D. Jones and D.A. Schmidt, Compiler generation from denotational semantics, Cqmpur,~
Sciences Department, University of Aarhus (1980).
1171 D. Knuth, Semantiai of tBntext-free languages, Math. Systems Theory 2 (1968) 127-145.
f18) J. McCarthy, A basis for a mathematical theory of computation, in: P. Braffort and D. Hirschberg,
Eds., Computer Programming and Formal Systems (North-Holland, Amsterdam, 1963) 33-704.
[lS] F.L. Morris, Advice on structuring compilers and proving their correctness, Proc. ACMSymposium
on Principles of Programming Languages (1973) 144- 152.
1201 P. D. Mosses, Mathcmaticai semantics and compiler generation, Ph.D. Thesis, Oxford (1975).
[21] P. D. Mosses, A constructive approach to compiler correctness, Aarhus University (1979).
123; B. Courceiie and M. Nivat, Algebraic families of interpretations, 17th Symposium on Foundations
of Computer Science, Houston f 1976).
[231 C. Pair, Furmaiization of the notions of data, information and information structure, in: J.W.
Klimbie and K.L. Koffemana, Eds., Data MurmagementSystems (North-Holland, Amsterdam,
1974) 149-168.
WI C. Pair, Sum*ies mod&s des types abstraits alg&briques, Skminaire LITP et 80-P-052, Centre de
Recherche en Informatique de Nancy (1980).
WI C Pair, Appkation of abstract data types to the definition 49f the semantics of programming
languages, Conference on Formalization of Programming Concepts, Peniscola (1981) and Centre
de Recherche en Informatique de Nancy 81-P-025.
1261 D. Scott and C. Strachey, Toward a mathematical semantics for computer languages, Proc.
Symposium Computers and Rutomatu, Poliytechnic Institute of Brooklyn (1971), 19-46.
E271 R. Tennent, The denotatioahai semantics of programming languages, Comm. ACM 19 (19’76)
437-453.
Ahstract data typesund algebraic semantics 31
[28] A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck and C.H.A. Koster, Report on the algorithmic
I(anguage ALGOL 68, M.R. 101, Mathematisch Centrum, Amsterdam {1969).
[29] 1M.Wand, First-order identities as a defining language, T.R. 29, Computer Science Department,
Indiana University (1979).