Recursive program schemes : semantics and proof theory
Citation for published version (APA):
Roever, de, W. P. (1974). Recursive program schemes : semantics and proof theory. Stichting Mathematisch
Centrum.
Document status and date:
Published: 01/01/1974
Document Version:
Publisher’s PDF, also known as Version of Record (includes final page, issue and volume numbers)
Please check the document version of this publication:
• A submitted manuscript is the version of the article upon submission and before peer-review. There can be
important differences between the submitted version and the official published version of record. People
interested in the research are advised to contact the author for the final version of the publication, or visit the
DOI to the publisher's website.
• The final author version and the galley proof are versions of the publication after peer review.
• The final published version features the final layout of the paper including the volume, issue and page
numbers.
Link to publication
General rights
Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain
• You may freely distribute the URL identifying the publication in the public portal.
If the publication is distributed under the terms of Article 25fa of the Dutch Copyright Act, indicated by the “Taverne” license above, please follow below link for the End User Agreement:
www.tue.nl/taverne
Take down policy
If you believe that this document breaches copyright please contact us at:
openaccess@tue.nl
providing details and we will investigate your claim.
0
0
...
N
...
•
RECURSIVE PROGRAM SCHEMES:
.
SEMANTICS AND P
'
ROOF THEORY
RECURSIVE PROGRAM SCHEMES: SEMANTICS AND PROOF THEORY
ACADEMISCH PROEFSCHRIFT
TER VERKRIJGING VAN DE GRAAD VAN DOCTOR IN DE WISKUNDE EN NATUURWETENSCHAPPEN
AAN DE VRIJE UNIVERSITEIT TE AMSTERDAM, OP GEZAG VAN DE RECTOR MAGNIFICUS
MR. LA. DIEPENHORST,
HOOGLERAAR IN DE FACULTEIT DER RECHTSGELEERDHEID, IN HET OPENBAAR TE VERDEDIGEN
OP VRIJDAG 17 JANUARI 1975 TE 13.30 UUR IN HET HOOFDGEBOUW DER UNIVERSITEIT,
DE BOELELAAN 1105
DOOR
WILLEM PAUL DE ROEVER JR
GEBOREN TE AMSTERDAMR--···-·· .
·--1
t~·~:
~.JL.
i
lJ
! ..
1 1 .• \.~ '~-~ _,_,__,,. ··-··· ... _" """ .. "". ." . -""" ... 1'
1 \of'../ ("" (',, ".~ [" (1 6'1,(
t
~-·~ 'J ~ J.. ·i 1·~~ , • 1-·--1974I wish to express my gratitude to the Mathematica! Centre for providing the opportunity and the atmosphere which made the research described in this thesis possible.
I am deeply indebted to J.W. de Bakker for his continuous help, advice and criticism. Furthermore, I am grateful to David Park for his interest in my research, and for critically reading this thesis.
The original incentive which led to this work arose out of the lectures of E.W. Dijkstra, C.A.R. Hoare and N. Wirth at the International Summer School on Program Structures and Fundamental Concepts of Programming, organized by F.L. Bauer, H.J. Helms and M. Paul in 1971.
I thank (in alphabetical order) P.C. Baayen, Peter van Emde Boas, Joost Engelfriet, Michael Gordon, Peter Hitchcock, Giles Kahn, Erik Krabbe, Robin Milner, Maurice Nivat, Paul Vitányi and A. van Wijngaarden for their various suggestions, Th. Gunsing and Tobias Baanders for the editing, Astrid Schuyt-Fasen for the Sisyphean labor of typing my arduous manuscript, and D. Zwarst, J. Suiker and J. Schipper for the printing.
The results of my investigations in the field of semantics of programming languages such as reported in this thesis would not have been possible without the pioneer work of J.W. de Bakker, Robin Milner, David Park and Dana Scott.
The language
PL
for first-order recursive program schemes with call-by-value as parameter mechanism is developed, using models for sequentia! and independent parallel computation. The languageMU
for binary relations over cartesian products which has least fixed point operators is formally defined, and the validity of the monotonicity, continuity, and substitu-tivity properties and Scott's induction rule is proved. After specifying an injection betweenPL
andMU,
it is proved that this injection induces a translation; hence the body replacement characterization of the semantics of recursive program schemes results in the same input-output behaviour asthe least fixed point characterization. Then
MU
is axiomatized using a many-sorted generalization of Tarski's axioms for binary relations, Scott's induction rule and fixed point axiom, and new axioms to characterize pro-jection functions, whence, by the translation result, a calculus for first-order recursive program schemes is obtained. Next we define an operator composing relations with predicates, the so-called 11011-operator, relate theproperties of this operator axiomatically to the structure of the relations and predicates composed, and demonstrate the relevance of this operator to correctness proofs of programs in general and proofs involving the call-by-value parameter mechanism in particular. Axiomatic proofs are given of nu-merous properties of recursive program schems, some of which involve differ-ent modular decompositions of a program. Our calculus is then applied to the axiomatic characterization of the natural numbers, lists, linear lists and ordered linear lists, and used to prove many properties relating the head,
tail and append list-manipulation functions to each ether. Finally both an informal and an axiomatic correctness proef is given of the well-known recursive solution of the Towers of Hanoi problem.
Keywords: semantics of programming languages, recursion, call-by-value, least fixed point operators, axiomatization of polyadic binary relation algebras, Scott's induction rule, axiomatic program correctness, axiomatic list processing.
AMS MOS 70 classification: primary 68 A 05, 02 J 10,
secondary 68 J 20, 68 K JO, 02 J 99.
0. SURVEY
0. 1 •
Objeatives
0.2.
Struature of the paper
0.3.
Related work
!. A FRAMEWORK FOR PROGRAM CORRECTNESS l.i.
Introduation
1 • 2.
A fromework for progrom aorreatness
1.3.
The fo!'T11Ulation of speaifia aorreatness properties of
progroms
2. THE PROGRAM SCHEME LANGUAGE PL
2.1.
Definition of
PL2. 2.
The union theorem
3. THE CORRECTNESS LANGUAGE
MU
3.1.
Definition of
MU
3.2.
Validit;y of Saott's induation rule
andthe translation
theorem
3.3.
Rebuttal of Manna
andVuiUemin on aaU-by-value
4. AXIOMATIZATION OF
MU
3 5 9 12 14 18 -24 32 36 434. 1.
Axiomatization of typed binary relations
444.2.
Axiomatization of Boolean relation aonstants
474.3.
Axiomatization of binary relations over aartesian produats
494. 4.
Axiomatization of the
"µ/'
operators
535. APPLICATIONS
5.1.
An equivalenae due to Morris
5.2.
An equivalenae involving nested while statements
5.3.
Wr>ight's regularization of linear proaedures
5.4.
Axiomatization of the natural numbers
5.5.
The primitive reaursion theorem
58 60
61
62 65
6.1.
Lists, Zinear Zists and ordered Zinear Zists
686.2.
Properties of head and taii
756.3.
Correatness of the TOWERS OF HANOI
6. 3. a.
Informa.i part
776.3.b.
An a:x:iomatia aorreatness proof for the TOWERS OF
HANOI
807. ASSESSMENT 86
APPENDIX 1: SOME TOOLS FOR REASONING ABOUT COMPUTATION MODELS 89
APPENDIX 2: PROOFS OF MONOTONICITY, CONTINUITY AND SUBSTITUTIVITY 99
REFERENCES 106
SAMENVATTING 111
0.1.
Obje!.'Jtives
The objectives of the present paper are to provide a self-contained description of:
!. A conceptually attractive framework for studying the foundations of program correctness.
2. An expedient axiomatization of the properties of first-order recursive programs with call-by-value as parameter mechanism.
Ad 1.
In reasoning about programs and their properties one is always con-fronted with the following two aspects:
1.1 A program serves to describe a class of computations on a possibly idealized computer. In consequence, a programmer always
aonaeptuaZizes
its execution. Whether this conceptualization figures on the very con-crete level of bit manipulation or on the very abstract level of an ALGOL 68 machine, it always uses some model of computation as vehicle for the process of understanding a program. (However, the level on which this conceptualization takes place does matter when conside.ring the ease with which one reasons about the outcome of a program: the less the amount of detail necessary to understand the operation of a program, the better the insight as to whether a program serves its purpose.)1.2 If we abstract from this variety in understanding a program, we arri-ve at the relational structure which embodies the mathematical essence of that program:
its properties.
operational
andmathematiaal
semantics. How do these notions relate?First, one has to choose a language, whose operational semantics is defined by some
interpreter.
Then, one decides which properties of the computations defined by this interpreter to investigate. Finally, one gives anindepen-dent
mathematical characterization of these properties.Our choice has been in this paper
a. To introduce an idealized interpreter for a language for
first-order
reCUPsive program sahemes '/JJith aaZZ-by-value as parameter meahanism
(first-order recursive programs manipulate neither labels nor proce-dures as values).
b. To consider the
input-output behaviour
of programs as a property sub-ject to investigation.c. To use Scott's
least fixed point aharaaterization
for the input-output behaviour of recursive procedures in the setting of binary relations and projection functions.However, other choices are very well possible, e.g., BEKIC [!], BLIKLE [3], KARN [32] and MILNER [48] incorporate also the intermediate stages of a computation into their mathematical semantics. *) This does not necessarily imply that then all properties of a computation have been taken into account (whence equivalence becomes equality). For instance, the two sequences (A
1(A2A3)) and ((A1A2)A3) may be considered equivalent, as their
execution amounts to executing the same elementary statements in the same order: first A
1, then A2 and finally A3, although these elementary state-ments are differently grouped together (cf. corollary 2.1).
Ad 2.
Once the appropriate mathematical semantics has been defined, a pro-per framework for
proving
properties of programs is obtained. As the proofs of these properties may be quite cumbersome and lengthy, one might wish to investigate the_possibiiities of computer-assisted proofs. cf. KING [34], MILNER [47] and WEYRAUCH and MILNER [63], One then has toaalaulate
thecorrectness of a program, whence a formal system is needed. Our system is an extension of the one given in DE BAKKER and DE ROEVER [Il] in that we consider binary relations over
aa:t'tesia:n prod:ucts
of domains, i.e., our domains arestructured.
Other formal systems are considered in MILNER [47], which axiomatizes higher order recursive functionals with call-by-name as parameter mech-anism, and SCOTT [57], which contains an axiomatization of the universa! ;\-calculus model called "logical space".
O. 2.
Structure of ûte paper
Chapter 1
Expression of properties of programs as properties of relations. Introduc-tion to the correctness operator 11011 between relational terms and
predi-cates: ~ satisfies X0p iff X terminates for input ~ with output
n
andout-put
n
satisfies p.Chapter 2
Formal definition of
PL,
a language for first-order recursive program schemes with call-by-value as parameter mechanism, which allows for mutual-ly dependent recursive declarations. Rigorous investigation of the input-output behaviouro
of the program schemes ofPL,
consisting of proofs for(1)
o
is ahomomorphism
with respect to the algebraic structure ofPL,
(2) the main theorem, theunion
theorem, usingmonotonicity,
substitu-tivity
and transformation of a computation into a normal form, (3) themodularity
property, using the least fixed point property; the modularity property relates to the modular design of program schemes and is applied to yield a two-line proof for the tree traversal result of section 4.5 of DE BAKKER and DE ROEVER [Il].This chapter is a generalization of chapter 3 of DE BAKKER and MEERTENS [12].
Chapter
JFormal definition of
MU,
a language for binary relations over cartesian products, which has "simultaneous" least fixed point operators. Rigorous investigation of the mathematica! semantics ofMU,
consisting of proofsfor (1) the monotonicity, substitutivity and
aontinuity
properties, (2) the union theorem (3)validity of Saott's induation rule
(4) thetrans-lation
theorem, which relates the input-output behaviouro
of the recur-sive program schemes defîned in chapter 2 to the mathematica! interpreta-tion of certain terms ofMU,
by stating that the body replacement character-ization of the semantics of recursive program schemes results in the same input-output behaviour as the least fixed point characterization. Rebuttal of MANNA and VUILLEMIN [43] on the subject of call-by-value.Chapter 4
Axiomatization of
MU
in four successive stages: (1) a many-sorted version of Tarski's axioms for binary relations; derivation of, amongst others, the fundamental lemmaf-
R;S n T=
R; (R;T n S) n T, (2) axiomatization of boolean relation constants; derivation of the properties of the "0 " oper-ator, (3) axiomatization of projection functions; derivation of another characterization of the converse of a relation, involving the applîcation of the conversion operator to projection functions, but not to the rela-tion itself, (4) axiomatizarela-tion of the least fixed point operatorsµ.,re-i
sulting in a
aalaulus for first-order reaursive prog!'OJTI sahemes üJith
aall-by-value as pal'alTleter meahanism;
derivation of the monotonicity, fixed point, least fîxed point,generalized iteration
and modularity properties; statement of a result onfunationality
of terms.Chapter 5
Application of the calculus for recursive program schemes developed in chapter 4 to the formal derivation of (1) an equivalence due to MORRIS [50], (2) a property involving nested while statements, contained in sec-tion 5.1 of DE BAKKER and DE ROEVER [Il], using
modular deaorrrposition
andsimultaneous
µ-terms, (3) theregularization
oflinear
procedures following WRIGHT [65]. An applied calculus for the natural numbersN
featuring an im-proved axiom system forN
and a deriviation of the characterizing property of theequality
relation between natural numbers. Axiomatic proof of the primitive recursion theorem using structural induction.Chapter 6
ordered Zinea.r Zists.
Linear lists as a special case of ordered linear lists. Proofs for (1) a characterization of termination of and associa-tivity of theaonaatenation
function with ordered linear lists as argu-ments, (2) many properties relating thehead, taiZ
and concatenationfunc-tions with ordered linear lists as arguments to each other, (3) both
in-formaZ
andformat
versions of correctness of theTOüJers of Hanoi
program.Chapter 7
Assessment consisting of (1) a listing of the four main (technical) accom-plishments of this paper, (2) some open problems, the main one being proof or disproof of Park's conjecture of the completeness of our axiomatization of polyadic binary relations, and (3) a brief discussion of the vast discrep-ancy between intuitive insight in the correctness of a program, and under-standing of the artificial reasoning involved in the axiomatic correctness proof of such a program.
0.3.
ReZated work
We discuss the
reZationaZ
approach to the correctness of recursive procedures, confining ourselves to those methods which are based upon the least fixed point characterization of the semantica of these procedures. Within the context of recursive function theory, this characterization was stated and proved originally in KLEENE [35], where it appears as the first recursion theorem.The recursion induction rule for recursive·procedures over arbitrary domains was formulated by McCARTHY [45]; for more references to the pre-1969 state of affairs in this branch of programming theory see DE BAKKER [8].
About 1969 the least fixed point characterization was formulated again in-dependently by BEKIC [IJ, MORRIS [49], PARK [51], and SCOTT and DE BAKKER [59]. MORRIS stated the result within the À-calculus, using Curry's para-doxical combinator Y. PARK formulated his theory (initially) within the second-order predicate calculus, and discovered the fixed point induction rule. SCOTT and DE BAKKER, using a relational framework, discovered that powerful induction rule which now carries Scott's name, and formulated the µ-calculus, a formal system based upon this rule.
BURSTALL formulated in [5] the rule of structural induction, whose main at-traction (according to me) is its informal flavour (see for instance section
6.3.a of the present paper for an informal correctness proof of the Towers of Hanoi and section 3.4.1 of DE ROEVER [16], in which an informal correct-ness proof fora version of Floyd's iterative tree marking algorithm, cf. exercise 2.3.5.7 of KNUTH [36], is given).
MANNA began his impressive series of publications by expressing program correctness within the first-order predicate calculus [39,40].
In 1970 MILNER generalized the µ-calculus to a system dealing with pol~adic
functions [46], and PARK formulated his theory within the context of polyadic relations [52].
In 1971 DE BAKKER devoted his monograph [9] to an investigation of the µ-calculus, proving a completeness result for those recursive procedures which correspond to flow diagrams; MORRIS formulated the truncation
induc-tion rule [50].
DE BAKKER and DE ROEVER [ I l ] crossbred the µ-calculus with Tarki's algebra of relations [61] to yield an axiomatic framework for proving equivalence,
(partial) correstness and termination of first-order recursive program schemes with one variable. The present paper amplifies on the latter in that (1) the restriction to one variable is removed by considering arbitrary subdivisions of a state, and (2) the distinction on the one hand and the connection on the other between opePational and mathematiaal semantics is clarified (MORRIS [49] also studies this topic). Subdivisions of a state are incorporated within the relational framework by considering relations over aa:t'tesian produats of domains; these were introduced in MILNER [46] and PARK [52].
The connection between induation PUles and tel'ITlination proofs is described by HITCHCOCK and PARK in [28] and elaborated in Hitchcock's dissertation [27], which also contains a correctness proof of a tPanslation of recursive programs into flowcharts with stacks and clarifies the notion of represen-tation of (recursive) data structures.
Greatest fixed points, introduced by PARK in [51], are applied in
MAZURKIEWICZ [44] to obtain a mathematical characterization of divergent
computations and may lead to the axiomatization of Hitchcock and Park's results within an extension of our framework.
In DE ROEVER [17] relational calculi are developed for first-order recursive procedures each parameter of which may be either by-value or called-by-name; an unpublished result by the author states that the input-output behaviour of first-order recursive procedures whose parameters are
called-by-name can be expressed within the ordinary framework of polyadic rela-tions such as developed in this thesis, i.e., without any need for special points such as Scott's undefined element [55] or De Roever's basepoint [16].
In a different setting BLIKLE and MAZURKIEWICZ [4] also use an algebra of relations to investigate programs.
The equivalence between the method of inductive assertions and the least fixed point characterization is the subject of DE BAKKER and MEERTENS [12]. In general, the number of inductive assertions required to character-ize a system of mutually dependent recursive procedures turns out to be in-finite; however, in the regular case this number is finite, as is proved in FOKKINGA [22]. The completeness of the method of inductive assertions for general recursive procedures, as opposed to the merely regular ones, is treated in DE BAKKER and MEERTENS [13].
The relation between the least fixed point characterization and various
rUles of computation is studied by MANNA, CADIOU, NESS and VUILLEMIN in a number of papers: MANNA and CADIOU [41], MANNA, NESS and VUILLEMIN [42], MANNA and VUILLEMIN [43], CADIOU [7] and VBILLEMIN [62]. In section 3.3 we demonstrate that MANNA and VUILLEMIN are mistaken in their conclusion that call-by-value does not lead to the computation of least fixed points; DE ROEVER [15,16,17] and DE BAKKER [14] explain the reason why. In [62] VUILLEMIN, furthermore, compares the power of various induction rules.
The distinction between operational and mathematical semantics and the
need for a mathematical semantics bas been convincingly argued in SCOTT [55,56] and SCOTT and STRACHEY [60].
ROSEN [53] studies conditions under which noT'mal foT'ms for computations exist; implicitly, normal forms are used in appendix 1 to derive the "dif-ficult" half of the union theorem.
The works of DIJKSTRA [18,19], HOARE [29,30] and WIRTH [64] relate to the present paper in that we provide a possible axiomatic basis for some techniques of structured programming; e.g., our correctness operator
"o"
is independently described in DIJKSTRA [20].
unified operational and mathematica! semantics within the framework of category theory.
Scott's discovery of À-calculus models [54] gave a powerful impetus to the field of formal semantics of programming languages; for a discussion of the the literature related to and based upon this discovery, see SCOTT [58].
1.
A FRAMEWORK FOR PROGRAM CORRECTNESS
1 • 1 •
Introduation
This report is devoted to a calculus for
:r>eaUPsive
programs written in a simplefirst-ord.er
programming language, i.e. , a language in whichneither procedures nor labels occur as values.
In order to express and prove properties of these programs such as equiva-lence, correctness and termination, one needs a more
aorrrprehensive
language. We shall abstract in that language from the usual meaning of programs(characterized by sequences of computations) by considering only the input-output relationships established by their execution.
Thus we are interested only in the binary relation
d.esaribed
by a program, itsinput-output behavioUP:
the collection of all pairs of an initial state of the memory, for which this program terminates, and its corresponding final state of
the memory.
EXAMPLE 1.1. Let D be a domain of initial states, intermediate states and final states.
a. The
und.efined
statement L: goto L describes theerrrpty
relation n over D. b. Thedummy
statement describes theid.entity
relation E over D.c. Define the composition R
1;R2 of relations R1 and R2 by
{<x,y>
I
3z <x,z> E R1 and <z,y> E R2}.
In order to express the input-output behaviour of the
aonditional
if p 1 -thens
1 else
s
2 one first has to transliterate p: Let D1 be p (true) andn
pair <p,p'> of disjoint subsets of the identity relation defined by: <x,x> E p iff x E D
1, and <x,x> E p' iff x E D2• This way of looking at predicates is attributed to KARP [33]. If Ri is the input-output behav-iour of Si' i
=
1,2, the relation described by the conditional above is p;R1 u p' ;R2•
d. Let 7T. : Dn -+ D be the
projeation fu:nation
of Dn on its i-th component,l.
i 1, ••• ,n, let the
aonverse
R
of a relation R be def ined byR:
{<x,y> <y,x> E R} and let R1, ••• ,Rn be arbitrary relations over D. Consider
R 07T" n n R "7T.., 1' 1 · • · n' n
This relation consists exactly of those pairs <x,<y
1, ••• ,yn>> such that <x,y.> ER. for i
=
l, ... ,n.Thus
(*)terrninates in x iff all its
aom-J. l.
ponents
R.terminate in x.
Observe the analogy with the following: The'Z-evaluation of a list of parameters called-by-value terminates iff the evaluation of all its constituent actual parameters terminates. This suggests the possibility of describing the call-by-value parameter mech-anism relationally, an idea which will be worked out in chapters 2 and 3.
Note that the input-output behaviour of recursive procedures has not been expressed above; this will be done by extending the language for binary relations with least fixed point operators, introduced by SCOTT and
DE BAKKER in [59].
Once the input-output behaviour of a program has been described in rela-tional terms, its correctness properties should be proved within a relation-al framework, e.g., properties of conditionrelation-als such as listed in McCARTHY [45] are proved as properties of p;R
1
u
p';R2•Suitably rich prograunning- and relational languages, called
PL
andMU,
and a precise formulation of the connections between the two by means of atranslation
will be specified in the next section and will justify that the axiomatization ofMU
results in a calculus for recursive programs.The problem which correctness properties of programs can be formulated within
MU
will be discussed in section 1.3 and.is closely related to the expressiveness of this language itself.EXAMPLE 1.2. With Das above, let the
universaZ
relàtion U be defined byU = D x D.
a. R
1
s
R2 and R2s
R1 together expressequaZit;y
of R1 and R2, and will be abbreviated by R1 = R2• If programs
s
1 ands
2 have input-output behav-iour R1 and R2, respectively, then
s
1 ands
2 are calledequivalent
iff RI=
R2.b. E
s
R;R and Es
R;U bath expresstotaZit;y
of R. c. R;Rs
R expressestransitivit;y
of R.d. R;R ~ E expresses that R describes the graph of a function, i.e.,
funa-tionaZit;y
of R.e. R;R n E
=
{<x,y> <x,y> € E and <x,y> E R;R}{ <x,y> x
=
y and 3z[<x,z> € R and <z,y> E R]} {<x,x> 3z[<x,z> E R]}.Hence R;R n E determines that subset of E which consists of all pairs <x,x> such that there exists some z with <x,z> E R: this indicates a correspondence with a predicate expressing the
domain of aonvergenae
of R. Note that R;R n E=
R;U n E.f. Let p
s
E. Then p;U n U;ps
p expresses that p containsone
pair <a,a> only. This can be understood by deriving a contradiction from the assump-tion that bath <a,a> E p and <b,b> E p for different a and b: for that implies that bath <a,b> E p;U and <a,b> E U;p, whence <a,b> E p;U n U;p and therefore <a,b> E p for different a and b, contradicting ps
E. This requirement therefore states the correspondence of p with the character-istic function of an atom. *)The axiomatization of
MU
proceeds in several stages.First a sublanguage for binary relations over cartesian products is axiom-atized by adding the following two axioms to typed versions of Tarski's axioms for binary relations (see [61]):
E
with rr. denoting the projection function of an n-fold cartesian product on
1
its i-th component, i = 1, ••• ,n, and Ethe identity relation over this product.
In the resulting formal system one can derive properties such as R
=
(R;Rn
E);R, obtained from example 1.2.e, and R1;n
1n
R2;u
2=
=
(R1
;R
1 n E);(R2;R
2 n E);(R1;TI
1 n R2
;~2
), obtained by combining examples 1.1.d and 1.2.e.Secondly we axiomatize the least fixed point operators by (!)
Seott's
in-duetion !'Ule
and (2) an axiom stating essentially the fixed point property of terms containing these operators. Both of these were formulated for the first time in [59].The addition of further axioms to the system for
MU
yields variousa:pplied
calculi, used, e.g., for the characterization of a number of spe-cial domains such as: finite domains with a fixed number of elements(axiomatized below), finite domains ([27]), natural numbers (chapter 5) and various kinds of lists (chapter 6).
EXAMPLE 1.3. Following example 1.2.f an atom ais characterized by
a;::: E and a;U n U;a ;::: a.
Now D contains precisely n elements iff E ;::: D x D is the disjoint union of n atoms a
1, ••• ,an' i.e., iff
(1) ai;U n U;ai
s
ai' i=
1, .•.,n,
(2) al u a2 u u a n E,(3) a. n a.
n,
< i < j .::_ n,1 J
-(4) u ;::: U;ai;u, i
=
I, ... ,n.I • 2. A fro.mework for program eorreetness
In the previous section we discussed program correctness as follows: Starting with a scheme T, one considers its input-output behaviour and re-alizes that this is a relation, whence its properties should be expressed and deduced within a relational framework.
The present section presents an outline of the f ormalization of this point of view as contained in chapters 2 and 3.
schemata.
First-order recursive program schemata are abstractions of certain classes of programs. The statements contained in these programs operate upon a state whose components are isolated by
projection fu:nctions;
a new state is obtained by (1) execution of elementary statements, the dummy statement or projection functions (2) calls of previously declared and possiblyrecup-sive
procedures (3) execution of conditional statements (4) the parallel and independent execution of statements s1, ••• ,sn in the
caZZ-by-vaZue
pPoduat
[S , ••• ,S ], a new construct which unifies properties of the1 n
assignment
statement and the call-by-valuepaPameter mechanism
and allows for the expression of both of these concepts, and (5) composition of state-ments by the ";" operator.The definition of the
operationaZ
semantics of these schemata involves an abstraction from the actual processes taking place within a computer by describing amod.eZ
for the computations evoked by execution of a program. This leads to the characterization of the input-output behaviour oropera-tionaZ interipretation
o(T) of a program scheme T.In section 3.1 we define
MU,
a language for binary relations over cartesian products which has least fixed point operators in order to characterize the input-output behaviour of recursive programs.As the binary relations considered are subsets of the cartesian product of one domain or cartesian product of domains and another domain or cartesian product of domains, terms denoting these relations have to be
typed
for the definition of operations.EZementa;py terms
are individual relation constants, boolean relation con-stants, logical relation constants (for the empty, identity, and universa! relationsn,
E, U and projection functions n.) and relation variables.l
Compound teP111B
are constructed by means of the operators ";" (relational or Peirce produ'it), "u" (union), "n" (intersection), 11" '11 (converse) and 11- 11
(complementation) and the least fixed point operators"µ.", which bind
l
for i
=
l, ... ,n, n different relation variables in n-tuples of terms pro-vidednone of these variables occurs in any corrrpZemented subterm,
i.e.,these terms are
syntacticaZZy continuous
in these variables.Terms
ofMU
are elementary or compound terms.The well-formed formulae of
MU
are calledassertions
and are of the formq.
r
'i1' where q. and 'i1 are sets of inclusions between terms.AmathematicaZ
interpretation mofMU
is defined by:(1) providing arbitrary (type-consistent) interpretations for the individ-ual relation constants and relation variables, interpreting pairs <p,p1> of boolean relation constants as pairs <m(p),m(p1)> of disjoint
subsets of identity relations (cf. KARP [33]) and interpreting the logical relation constants as empty, identity and universal relations and projection functions,
(2) interpreting
"·"
'
'
"u"'
"n"'
11...,11'
"-" as usual,(3) interpreting each µ-term µiXl ••• Xn[cr
1, ••• ,crn] as the i-th component of the least fixed point of the functional <cr
1, ••• ,crn> acting on n-tuples of relations.
An assertion <!>
1-
'!' is valid provided for all m the following holds:If the inclusions contained in <!> are satisfied by
m,
then the inclusionscontained in '!' are satisfied by
m.
The precise correspondence between the operational semantics of
PL
and the mathematica! semantics ofMU
is specified by the tPa:risla;tion theorem of chapter 3:After defining an injection :tit. between schemes and terms we prove that :tJt
induces a meaning ppesePVing mapping, i.e., a tPanslation, provided the in-terpretation of the elementary statement constants and predicate symbols specified by
o
"agrees" with the interpretation of the individual relation constants and boolean relation constants specified bym.
If these require-ments are fulfilled the resulting correspondence betweenPL
andMU
isil-lustrated by
T 1--+ :tit. ( T)
1
"'
"'
O(T) m(:tlt.(T)).
Thus we conclude that, in order to prove properties of T, it suffices to prove properties of tr(T), whence axiomatization of
MU
leads toa calculus for first-order recursive program schemata.*)1.3. The fo!'111Ulation of specifia aoPPeatness pPopePties of pPogpams
*)By an abuse of language we suppress any mention of interpretations o
Globally, in order to formulate the correctness of a program one has to state certain criteria which have to be satisfied in a specific
environ-ment. If these criteria depend on input-output behaviour only, one might hope to express them in the present formalism.
Sometimes this condition is not satisfied. Then these criteria concern in-trinsic properties of the computation processes involved. As these are the very features we abstracted from, one cannot expect to formulate them in MU. For instance, when trying to formulate the correctness criteria for the TOWERS OF HANOI program discussed in chapter 6, it turns out that the re-quirement of moving one disc at a time cannot be expressed in our language. Accordingly we restrict ourselves to criteria which can be formulated in
terms of input-output behaviour only. These may be subdivided as follows:
(a) Equivalence of or inclusions between programs.
(b) Termination prov~ded some input condition is satisfied. (c) Correctness in the sense of HOARE [29]:
Given (partial) predicates p a~d q and a relation tr(T) describing (the input-output behaviour of) a program. T
*),
this criterion is expressed byVx,y[p(x) A x tr(T) y + q(y)J
and amounts to
if x satisfies p and T terminates for x with output y, then y satisfies q. *)
These criteria can all be formulated as inclusion between terms:
For (a) this is evident. As to (b): Let p be represented by <p,p'> satis-fying p .S E, p'
.s
E and p n p'=
n,
and tr(T) describe program T, then.._____..,,,.
p .5: tr(T);tr(T)*f
This corresponds with p{T}q in Hoare's notation and with {p}T{q} in Dijkstra's notation (cf. [19]).or, equivalently,
p S: tr(T) ;U
both express (b) (note that p s R;R is equivalent tops R;U).
As to (c): Let pand q be represented by <p,p'> and <q,q1>, then (c) is
ex-pressed by
p;tr(T) s tr(T);q.
It will be clear that the underlying supposition for the expression of these criteria is that we are able to express all the predicates involved indeed. This was not the case in the formalism described by SCOTT and DE BAKKER in [59] in which predicates were only expressible by primitive symbols, no operations on these symbols or other ways of constructing them being avail-able.
Our main device for the construction of new predicates is the
"o"
operator defined by
Vx[(Xop)(x)+--+ 3y[xXy and p(y)]]. *)
Accordingly, if X
=
tr(T) then (tr(T)•p)(x) is true iff T produces for in-put x ~ output y which satisfies p.In the present formalism Xop can be expressed by
Xop X;p;U n E.
In example 1.2 we showed that X;X n E
=
X;U n E=
XoE describes the domain of convergence ofx.
Thus XoE is the least predicate p satisfying X=
p;X. In chapter 4 we obtain the following characterization of X0p:Xop
=
n{q j X;p S q;X}.*)
Therefore Xop is the least predicate q, sometimes called the
weakeet
pre-aondition,
satisfying X;p ;:. q;X.This observation raises the following question: When does
X;p Xop ;X
hold?
We shall prove that
(*)
holds iff X;X ~ E, i.e., X denotes the graph of afunction.
Therefore the translation theorem implies that
one ie aZZowed to retract prediaates
oa~rringin between statements
on input aond:itions provid.ed these statements d.eearibe funations,
i.e., are d.etenrrinistia.
2. THE PROGRAM SCHEME LANGUAGE
PL
2. 1.
Definition of PL
PL
is a language for first-order recursive program schemes using call-by-value as parameter mechanism.A
statement
scheme ofPL
is constructed frombasic symbols
using the se-quencing, conditional, call-by-value product operations and recursion, and contains atype
indication in the form of a superscript <n,~> in order to distinguish between input domain Dn and output domain D~. The call-by-value product [S1, ••• ,Sn] expresses the independent parallel execution of state-ments
s
1, ••• ,Sn' yielding for input x an output <y1, ••• ,yn> composed of the individual outputs of Si, i = 1, ••• ,n, and is used to describe the assign-ment stateassign-ment and the call-by-value parameter mechanism as fellows:
Assignment statement.
An assignment statement x.:= f(x.1, ••• ,x. ) occurring · i i im in an environment x 1, ••• ,xn of variables is expressed by [ TT 1 , " • , TT. i -1 , [ TT. i 1 , " • , TT. im J; S, TT. i+ 1 , ••• , TT ] , n where S denotes f.
Call-by-value parameter mechanism.
A procedure call proc(f1(x1, ••• ,xm), ••• ,fn(x1, ••• ,xm)) with parameters which are
called-by-value is expressed by [S
1, ••• ,Sn];P, were Sk denotes fk' for k = 1, ••• ,n,
and P denotes proc.
A
declaration
scheme ofPL
is a possibly empty collection of pairsP. <== S. which are indexed by some index set J; for each j e: J such a pair
J J
contains a procedure symbol P. and a statement scheme S. of the same type
J J
as P .•
J
A
program
scheme ofPL
is a pair consisting of a declaration and a state-ment scheme.The well-formed formulae of
PL
are calledassertions.
DEFINITION 2.1 (Syntax of
PL)
*)Types.
Let G be the collection {a,a1, •••
,s,s
1 ••• }of possibly subscripted*) Sections 2.1 and 2,2 follow closely section 3 of DE BAKKER and MEERTENS
greek letters. A domain type is (1) an element of
G,
(2) any string (s1 x x sn), where s1, •.• ,sn are domain types.A
type is a pair <n,s> of domain types.Basia symboZs.
The class of basic symbols is the union of the classes of relation and procedure symbols.Retation symbots.
The class of relation symbolsR
is the union of the classes of elementary statement symbols, predicate symbols, constant sjm-bols and variable symsjm-bols.a. The class of
etementaI'!f statement symbots
A
contains for all types <n,s> h b 1 An.s An,st e sym o s ,
1 , . . . .
b. The class of
prediaate symbots B
contains for all n the symbols n,n n,n n,n n,np ,pl ,".,q ,ql , " . .
c. The class of
constant symbots
C
contains the symbols nn,s for all types (nlx .•• xnn)'nl (nlx,.,xnn)'nn<n,s>, En,n for all n and ~
1
, ••• ,~n for all types n1, ••• ,nn·d. The class of
variabte symbots
X,
introduced for purposes of substitution, . f 11 ~ h b 1 xn,s xn,s yn,s zn.s contal.ns or a types <n ,.,,> t e sym o s , 1 , ••• , , ••• , , ••••Proceél:ure symbots.
The class of procedure symbolsP
contains for all types <n,s> the symbols Pn,s,Pi's, ••.Schemes.
a.
Statement schemes.
The class of statement schemes SS (arbitrary elements gn,s,si's, ••. ,vn•s, .•• ,wn's, ..• ) is defined as follows:1. A u C u X u P
~
SS. *) 2. Ifs7•
8,s~·s
Ess
then (s 1;s2)n,s Ess.
**) 3. If 4. I f pn,n EB and s~·s,s~•S Ess
then (p + s1,s2)n,s Ess.
n.<s1x ••• xs ) n.s 1 n,sn si ,.",sn ESS
then [S1, ... ,Sn] n ESS.
*) Hence, a predicate symbol is
no
statement scheme.**) These parentheses will be often deleted, using the following conventions: (1) the outer pair of parentheses is suppressed, (2) right preferent pa-renthesis deletion. E.g., A1;A2 stands for (A1;A2) and A1;A2;A3 stands for A
b.
DeaZar>ation sahemes.
The class of declaration schemesVS
(arbitrary elements D,D1, ••• ) contains all sets {pry.s J <== Sry's}. J with J any index J JE set, and, for each j E J, P. E
P
andJ S. E J
SS,
such that no S. contains Jany X E X.
-c.
Program sahemes.
The class of program schemesPS
(arbitrary elements T,T1, ••• ) contains all pairs <D,S> with DE
VS
and 8 ESS.
If D = ~.<D,8> will be written as S.
Assertions.
Anatomia forrrruZa
is of the form T1 ~ T2 with T1 ,T2 E
PS.
AformuZa
is a set of atomie formulae {Tl,l ~ T2,l}lEL with L any index set. An assertion is of the form <!>
r
'!' with <!> and '!' formulae.Remar>ks.
J, T1 = T2 will be used as abbreviation for T1 ~ T2, T2 ~ T1•
2. Brackets around domain types and type indications of statement schemes will be omitted provided this causes no confusion.
DEFINITION 2.2. (8ubstitution)
Suhstitution operator.
Let S ESS
and J be any nonempty index set such that, for j E J, Rj EX uS[V./R.J. J is defined as J J JE
Pand V. E
SS
are of the same type, thenJ
fellows:
R. for some j E J, then 8[V./R.]. J =V .•
J J J JE J
a. If S
b. I f 8 Rand, for all j E J, R #R., then 8[V./R.]. J =R.
J J J JE c. If S 8 1;82, (p + 8 1
,s
2) or [S 1, ••• ,8n]' then 8[Vj/Rj]jEJ = 8 1[V./R.]. 3 ;82[V./R.]. J' (p + 8 1[V./R.]. 3,82[V./R.]. J) or J J JE J J JE J J JE J J JE [S1[V./R.]. J ' ' ' ' ,8 [V./R.]. 3J, respectively. J J JE n J J JES.
Sis defined as 8[X./P.].3
.
J J JECZosed.
If no X EX
occurs in 8 ESS,
S is called closed.Remar>ks.
1. From now on the substitution operator is used in the following forms: taking for J the index set of some declaration scheme, we (a) restrict ourselves to R. EX,
J tor for substitution with R. E
J
substitution in S is performed
aZosed
statement scheme.for j E J, and (b) reserve the 11~11
opera-P
and Vj = Xj, for j E J. Hence, explicit as in (a). This explains our notion of2. The substitution operator can be generalized to formulae by writing {VI , 1 ~ v2 l}l L[V./X.]. J for {VI l[V./X.J. J , E J J JE , J J JE ~ v2 l[V./X.]. J}l L' , J J JE E restricting ourselves as above.
3. If J
=
{J, ••• ,n}, S[V./X.]. J is written as S[V./X.].1
J JJE J JJ=, ••• ,n or
S(V
1, ••• ,Vn). If J
=
{I} we also use S[V/X].4.
S[V./X.]. J is defined according to the complexity of S. Thereforeprop-J J JE
erties such as the chain rule, S[V./X.].
3[W./X.]. J
=
J J JE J J JE
=
S[V.[W./X.].3/X.]. J can be proved by induction on the complexity of
J J J JE J JE
s.
An
intePpretation
of the schemes ofPL
is determined by an initial interpretationo
0 which extends to anoperationaZ
interpretationo
of pro-gram schemes using models for sequential and independent parallel (to char-acterize the call-by-value product) computation.DEFINITION 2.3. (Initial interpretation). An initial interpretation is a function
o
0, such that
a. For each n E G, o
0(n) is a set denoted by D , and for each compound n domain type (n 1 x ••• x nn)• oo<n1 x ••• x nn) is the cartesian product of oo<n1), ••• ,oo<nn).
b. For An,i; E
A
and xn,i; Ex,
o
(An'I;)0 and
o
0 (Xn'I;) are subsets ofo
0(n) x o0(i;).
c. For pn,n E
B,
o0(pn'n) is a partial predicate with arguments in o0(n).
d. For each projection function symbol the projection function of oo(nl) x coordinate.
nlx ••• xnn,ni nlx,.,xnn,ni • 7Ti ' 0o(7Ti .
>
is••• x o
0(nn) on its i-th constituent
e. For all constants nn,i; and En,n, o
0(nn,i;) and o0(En'n) are the empty subset of o
0(n) x o0(i;) and the identity relation over o0(n),
respec-tively.
The main problem in defining the semantics of a program scheme
opera-tionaZZy
is the fact that the resulting computation cannot be represented serially in any natural fashion: factors s1, ••• ,sn of a product Cs1, ••• ,Sn] first all have to be executed independent of another, before the computa-tion can continue. Therefore the computacomputa-tions involved are described as a parallel and sequentially structured hierarchy of actions, aaorrrputation
mocleZ.
At the first level of such a hierarchy any execution of a factor of a prod~
this output becomes available as a component of the input for the still-to-be-executed part of the original scheme, if present. When all these compo-nents have been computed, the remaining computation at the first level, if present, is initiated on the resulting vector. The same holds, mutatis mutandis, for the relative dependency between computations on any n-th and n+l-st level of this hierarchy, if present.
Provided one has a finite computation, this delegating will end on a cer-tain level. On that level the execution (of a factor of a product on a pre-vious level) does not anymore involve the computation of any product on a state, whence this computation can be characterized by a sequence of, in our model,
atomia
actions of the following forms: (1) computation of a by-some-initial-interpretation-interpreted relation symbol (2) replacing a procedure symbol by its body, without changing the current state and (3)making a choice between two possible continuations of a computation, de-pending on whether a by-some-initial-interpretation-interpreted predicate symbol is ~ or false on the current state.
The extension of an initial interpretation
o
0 to an
operationat
inter-pretation
o
is defined inDEFINITION
2.4.
(Computation model) Relative to an initial interpretationo
0 and a declaration scheme D, a
com-putation model for xSy is pair <x
1s1x2 ••• x S x n n n+ 1,CM> with S. i E SS for
i
=
1, ••• ,n, s1
=
S, x1=
x and xn+l=
y, consisting of a computationse-quence and a set of computation models relative to
o
0 and D, called
asso-aiated
computation models, satisfying the following conditions:a. If si
=
R
or si=
R;V
withREA
u C uX,
<xi,xi+l> E o0
(R) and i=
n or si+! =v.
b. If S.=
P. or S. l. J l.s.
J or Si+ 1=
S j ; V. c. I f Si=(V
1;V
2);V
3 and si+!=
v
3 •then CM contains a computation model for xi
v
1
;v
2 xi+l*)
As described in appendix 1, this definition implies that the set of com-putation models can be structured as an
algebra.
This superposition of structure allows for simple proofs about certain transformations, by in-duction arguments on the complexity of these models, in case these transformations aremorphisms
w.r.t. this structure.d. If Si= (p + v
1,V2) or Si= (p + v1,V2);V3 and o0(p)(xi) is either ~ or false, then xi+l = xi and, if o0(p)(xi) = true then Si+! = v1 or
Si+! = v
1;v3, and, if o0(p)(xi) = false then Si+! = V2 or Si+! = V2;v3 • e. I f Si= cv
1,".,Vk] or si= cv1,".,vkJ;v, xi+l = <y1,".,yk> such that
CM
contains computation models for xiV1y
1
,
for 1 = l, ••• ,k, and i = nor si+! = v.
Remark.
A computation model represents the entire computation of program <D,S> on input x (= x1) resulting in output y (= xn+I' for some n). At each step of its constituent computation sequence, Si is the statement which re-mains to be executed on the current state x .• Clause a describes theexecu-J.
tion of elementary statements, clause b reflects the
aopy ruiy
for proce-dures, clause c describes preference in execution order, clause d describes the conditional and clause e describes the independent execution of state-ments, terminating iff all its constituent statements have terminated. The meaning of "; 11is expressed by clause c and the second part of claus es a, b, d and e, and expresses continuation of a computation with appointed suc-cessor.
Suppose one defines a computation model as a set of computation se-quences such that each "delegated" computation sequence occurs in this set. This leads to undesirable results, as demonstrated by the program scheme T = <P Ç== [P,P];~
1
,P>. Clearly, T definesn.
However the set{xPx[P,PJ;y1<x,x>1rix} is a computationmodel for.xTx in the sense of this definition (P. VAN EMDE BOAS),
DEFINITION 2.5.
Operationai inte:ripretation.
Let T =<D,Sn'~>
be a program scheme ando
0 be an initia! interpretation. Then the operational interpretation of this scheme is the relation o(T) defined as follows: for each <x,y> E o0(n) x )( o
0
(~),- <x,y> E o(T) iff there exists a computation model w.r.t.o
0 and D
for xSy.
Vaiidity.
a. T1 ~ T2
satisfies o
iff-o(T1
~ ~ o(T2) holds. Ifr
1 ~ T2 satisfies allo,
it is calledvaiid.
c. An assertion <!>
r
'!' such that, for allo,
if <!> satisfieso,
then '!'satisfies
o,
is called valid.2.2.
Tlie UYtion theorem
First we mention properties of the operational interpretation
o
suchas o(s
1;s2)
=
o(s1);o(s2), o(p + s1,s2)=
m(p);o(s1) u m(p');o(s2),o([s1, ••• ,Sn])
= o(S
1
);~
n ••• no(Sn);~),
the fixed point propertyO(P.)
=
o(S.) and the monotonicity property. Then the union theorem isJ J
proved as a culmination of these results. Finally we establish the least fixed point property, which is a generalization of McCarthy's induction
rule (cf. [45]), and prove a lemma legitimating the
modular
design ofpro-gram schemes.
LEMMA 2.1.
a.
If
S E AuC
uX
then
o0(s) a o(S).
b. o(Sl;S2) o(S));o(S2).
c. o(p + s1,s2)
=
m(p);o(s1) u m(p');o(s2),with
m(p)and
m(p')d.efined
asfoll()l.J)s:
<x,x> € m(p)iff
oo(p)(x)=
trueand
<x,x> € m(p')iff
oo(p)(x)
=
fals.e....___..
...___..
d. o([s1,".,Sn]) = o(s1);0(7î 1) n ••• n o(Sn);0(7în).
e.
(Fixedpoint property, fpp)
o(Pj)=
o(Sj)'for eaah
j E J.Proof.
By induction on the complexity of the statement schemes concerned.0
Remarks.
!. From the definitions and parts a, b, c and dof lemma 2.1 the validity of standard properties of program schemes, such as the validityof rl ,::: S and E; S = S easily follows. These and similar propertie.s will .
be used without explicit mentioning.
2. As execution of [S1, •.• ,Sn] corresponds to computation of a list of a
actual parameters which are called-by-value, part dof lemma 2.1 implies the relational description of the call-by-value parameter mechanism.
LEMMA 2.2. (Monotonicity).
{VI . ;:;: V2 . }. J
f-
S [VI . /X. ] . J ;:;:,J ,J JE ,J J JE
Proof.
By induction on the complexity of S.S[V2 ./X.]. J'
,J J JE
a. s = xj, then o(S[V1,j/Xj]jEJ) = o(v1,j);:;: o(v2,j) = o(s[v2,j/Xj]jEJ'
b. s E (R u P) - {X.}. J' then o(S[V1 ./X.J. J) = o(S[V2 ./X.J. J) = o(S).
J JE ,J J JE ,J J JE
c. S = s 1;s2, then O((S1;s 2)[v 1,/Xj]jEJ) =
= o(s1Cv1 ./X.]. J;s2Cv
1 ./X.]. J) =(lemma 2.1)
,J J JE ,J J JE
o(s1cv1 ./X.]. J);o(s2cv1 ./X.]. J) c (induction hypothesis)
,J J JE ,J J JE
-o(s1cv2 ./x.J. J);o(s2cv2 ./x.J. J) =(lemma 2.1)
, J J JE ,J J JE
O(Sl[V2 ./X.J. J;S2[V2 ./x.J. J) = o((Sl;S2)[V2 ./X.]. J). ,J J JE ,J J JE
,J J JE
d. S = (p + s
1,s2) or S = [s1, ••• ,Sn]' similar to c.
D
COROLLARY 2.2. (Substitutivity rule).
{V1 • = v2 .}. J
f-
S[VI ./X.]. J = S[V2 ./X.]. J.,J ,J JE ,J J JE ,J J JE
Next we state a technica! result concerning substitution.
LEMMA 2.3. a.
For alosed
s, S[P./X.J. J = s. J J JE ~ {V. c P.}. Jf-
S[P./X.]. J[V./X.]. J c S[V./X.]. J' J - J JE J J JE J J JE - J J JEb.
For arbi tPaT'Jf
S ,~ ~~
c.
For aroi tro.T'!f
S , S[V./X.]. J = S[V./X.]. J'J J JE J J JE
Praof.
Follows from the definitions, properties of substitution andmono-tonicity, by induction on the complexity of S.
D
Informally, if a recursive procedure Pn,Ç terminates for a given ar-gument, this happens after a finite number of "inner calls" of this proce-dure. We may think of these calls as being nested (where a call on a deeper level is invoked by a call on a previous level). By the recursion depth of the original call we mean the depth of this nesting. At the innermost level, calls of Pn,Ç are not executed again, whence they may be replaced by nn,Ç without affecting the computation.
This process of replacement can be generalized to calls of
sirrrulta:neou.sly
is obtained from S by
u:nifo!'fTlly
replacing calls ofP~,ç
at level n by Qn,Ç for j E J with S(O) defined asQs,ç.
We may think ofJo(S(n)) as restrict-ing O(S) to those arguments which durrestrict-ing execution of S cause execution of calls of P. with recursion depth less than n.J
Thus we conclude that
x
o(S)
yiff
3n[x o(S(n)) y],THEOREM 2.1. (Union theorem).
Let
Sbe a alosed statement saheme. Then, for
all operutionaZ intePpretations o,
o(S) U o(S(n)). n=O
In order to prove the union theorem we need some auxiliary definitions characterizing (1) which occurrences of procedure symbols are
exeauted
in a computation model, (2) the relation between occurrences of the same proce-dure symbol in proceeding computations,(3) statement schemes obtained by successive uniform replacement of procedure calls by their bodies and(4) s(n).
DEFINITION 2. 6.
Exeautable oaaurrenae.
A procedure symbol P. occursexeautable
in acompu-J
tation model CM if it occurs in some computation sequence x
1
s
1 x2 ••• ••• xn Sn xn+I contained in CM, such that for some i, 1 s i s n, Si Pj or S. = P. ;S.l. J
To iclentify.
Let CM be a computation model with constituent sequence x1 s1 x2 ••• xn Sn xn+l' Consider an occurrence of Pj in some S, with S occurring in Si. 1 s i s n. This occurrence
direatly iclentifies
the corre-sponding occurrence of Pj in S occurring in Si+I or Sj below, in each of the following cases:(a) {b)
(cl)
Si R;S and Si+I
=
S with R € A u C u X~si Pk;S and si+I
=
Sk;S, k € J,S. {S);v
3 and S occurs as first statement Sj of the associated
com-l. *)