The Parametric Lambda Calculus
The Parametric Lambda Calculus
An EATCS Series
Editors: W. Brauer G. Rozenberg A. Salomaa
On behalf of the European Association
for Theoretical Computer Science (EATCS)
The Parametric
lambda Calculus
A Metamodel for Computation
Springer
Authors Series Editors
Prof. Simona Ronchi Delia Rocca Prof. Dr. Wilfried Brauer
Universita di Torino Institut rur Informatik der TUM
Dipartimento di Informatica Boltzmannstr. 3, 85748 Garching, Germany
corso Svizzera 185 Brauer@informatik.tu-muenchen.de
10149 Torino, Italy
ronchi@di.unito.it Prof. Dr. Grzegorz Rozenberg
www.di.unito.iU-ronchi Leiden Institute of Advanced Computer Science
University of Leiden
Dr. Luca Paolini Niels Bohrweg 1,2333 CA Leiden, The Netherlands
Universita di Torino rozenber@liacs.nl
Dipartimento di Informatica
corso Svizzera 185 Prof. Dr. Arto Salomaa
10149 Torino, Italy Turku Centre for Computer Science
paolini@di.unito.it Lemminkiiisenkatu 14 A, 20520 Turku, Finland
www.di.unito.it/-paolini asalomaa@utu.fi
This work is subject to copyright. AlI rights are reserved, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broad-
casting, reproduction on microfilm or in any other way, and storage in data banks. Duplication of this
publication or parts thereof is permitted only under the provisions of the German Copyright Law of
September 9, 1965, in its current version, and permission for use must always be obtained from
Springet-Verlag Berlin Heidelberg GmbH .
Violations are liable for prosecution under the German Copyright Law.
springeronline.com
© Springer-Verlag Berlin Heidelberg 2004
Originally published by Springet:-Verlag Berlin Heidelberg New York in 2004
Softcover reprint of the hardcover 1st edition 2004
The use of general descriptive names, trademarks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the relevant protective laws and
therefore free for general use.
Cover Design: KiinkelLopka, Heidelberg
1)1pesetting: Camera-ready by the authors
Printed on acid-free paper 45/3142/GF - 5432 1 O
To Corrado Băhm, fram which Simona and -
by transitivity - Luca leamed the pleasure
of research and the interest in A-calculus
Preface
The A-calculus was invented by Church in the 1930s with the purpose of sup-
plying a logical foundation for logic and mathematics [25]. Its use by Kleene
as a coding for computable functions makes it the first programming lan-
guage, in an abstract sense, exactly as the Thring machine can be considered
the first computer machine [57]. The A-calculus has quite a simple syntax
(with just three formation rules for terms) and a simple operational seman-
tics (with just one operation, substitution), and so it is a very basic setting
for studying computation properties.
The first contact between A-calculus and real programming languages was
in the years 1956-1960, when McCarthy developed the LISP programming
language, inspired from A-calculus, which is the first "functional" program-
ming language, Le., where functions are first-dass citizens [66]. But the use
of A-calculus as an abstract paradigm for programming languages started
later as the work of three important scientists: Strachey, Landin and B6hm.
Strachey used the A-notation as a descriptive tool to represent functional
features in programming when he posed the basis for a formal semantics of
programming languages [92]. Landin formalized the idea that the semantics
of a programming language can be given by translating it into a simpler
language that is easier to understand. He identified such a target language
in A-calculus and experimented with this idea by giving a complete transla-
tion of ALGOL60 into A-calculus [64]. Moreover, he dedared in [65] that a
programming language is nothing more than A-calculus plus some "syntactic
sugar". B6hm was the first to use A-calculus as an effective programming
language, defining, with W. Gross, the CUCH language, which is a mixture
of A-calculus and the Curry combinators language, and showing how to rep-
resent in it the most common data structures [19].
But, until the end of the 1960s, A-calculus suffered from the lack of a for-
mal semantics. In fact, while it was possible to codify in it aH the computable
functions, the meaning of a generic A-term not related to this coding was un-
dear. The attempt to interpret A-terms as set-theoretic functions failed, since
it would have been necessary to interpret it into a set D isomorphic to the
set offunctions from D to D, which is impossible since the two spaces always
have different cardinality. Scott [88, 89] solved the problem by interpreting
A-calculus in a lattice isomorphic to the space of its continuous functions,
VIII Preface
Acknowledgement. Both authors would like to thank alI the people of the
"lambda-group" at the Dipartimento di Informatica of the Universita di
Torino for their support and collaboration. Moreover they are grateful to
Roger Hindley and Elaine Pimentel for pointing out some inaccuracies. Luca
Paolini thanks Pino Rosolini for the useful and interesting discussions about
the topics of this book. Simona Ronchi DelIa Rocca did the final revision of
the book during a sabbatical period. Some friends offered her hospitality and
a stimulating scientific environment: Betti Venneri, Gigi Liquori, Rocco De
Nicola, Pierre Lescanne and Philippe De Groote. To alI of them she wants to
X Preface
express her gratitude. Last but not least, both the authors thank the pub-
lisher lngeborg Mayer, whose patient assistance made possible the publication
of this book.
Part I. Syntax
Syntax
1. The Parametric A-Calculus
A calculus is a language equipped with some reduction rules. AlI the calculi
we consider in this book share the same language, which is the language of A-
calculus, while they differ each other in their reduction rules. In order to treat
them in an uniform way we define a parametric calculus, the A.d-calculus,
which gives rise to different calculi by different instantiations of the parameter
.d. In Part 1 we study the syntactical properties of the A.d-calculus, and in
particular those of its two most important instances, the calI-by-name and
the calI-by-value A-calculi. The A.d-calculus has been introduced first in [85]
and further studied in [74]. We use the terminology of [9].
• x E Var implies x E A,
• MEA and x E Var implies (),.x.M) EA (abstract ion) ,
• MEA and NEA implies (M N) EA (application).
),.-terms will be ranged over by Latin capital letters. Sets of ),.-terms will be
denoted by Greek capital letters.
• M==N,
• M == Ax.M' and N is a subterm of M',
• M == PQ and N is a subterm either of P or of Q.
The symbol "A" plays the role of binder for variables, as formalized in the
next definition.
Definition 1.1. 7. The statement "M is free for x in N" is defined by induc-
tion on N as follows:
• M is free for x in x;
• M is free for x in y;
• lf M is free for x both in P and Q then M is free for x in PQ;
1.1 The Language of A- Terms 5
Let liNII = Ilxll; both M[Ndxl, 000' Nn/xn] and M[N /X] are abbreviations
for the simultaneous replacement of Xi by Ni in every M j (O :S i :S Ilxll = n,
O :S j :S IIMII)o
Thus we can also safely extend the notat ion N[M/x] to the case where M
is not free for x in No In this case N[M/x] denotes the result of replacing
x by M in a term N' =" N such that M is free for x in N'o Clearly such
an N' always exists and the notation is well posed o So (AXoU(XY))[xy/u] is
a-equivalent to the term AZoXY(ZY)o
An alternative way of denoting a simultaneous replacement is by explicitly
using the notion of substitutiono A substitution is a function from variables
to termso If s is a substitution and FV(M) = {Xl,ooo,Xn}, s(M) denotes
M[s(xd/Xl' 000' s(xn)/xn]o
(iii) Let C[.] be a context and M be a term. Then C[M] denotes the term
obtained by replacing by M every occurrence of [.] in C[.].
We will use the same abbreviation notation for contexts that we used for
terms.
Note that filling a hole in a context is not a substitution; in fact, free variables
in M can become bound in C[M]. For example, filling the hole of Ax.[.] with
the free variable x results in the term Ax.x.
We will present some A-calculi, alI based on the language A, defined in the
previous section, each one characterized by different reduction rules.
The A.1-calculus is the language A equipped with a set .1 ~ A of input
values, satisfying some closure conditions. InformalIy, input values represent
partialIy evaluated terms that can be pas sed as parameters. CalI-by-name and
calI-by-value parameter passing can be seen as the two most radical choices;
parameters are not evaluated in the former policy, while in the latter they
are evaluated until an output result is reached.
Most of the known variants of A-calculus can be obtained from this para-
metric calculus by instantiating .1 in a suitable way. The set .1 of input values
and the reduction ----+ Ll induced by it are defined in Definition 1.2.1.
(Ax.M)N is called a .1-redex (or simply redex), and M[N/x] is called its
.1-contractum (or simply contmctum).
1.2 The AL1-Calculus 7
(ii) ----+:1 and =.c. are respectively the reflexive and transitive closure of----+.c.
and the symmetric, reflexive and transitive closure of ----+ .c..
(iii) A set .1 ~ A is said set of input values when the following conditions are
satisfied:
• Var ~ .1 (Var-closure) ;
• P, Q E .1 implies P[Q/x] E .1, for each x E Var (substitution closure);
• M E .1 and M ----+.c. N imply N E .1 (reduction closure).
(iv) A term is in L1-normal form (L1-nf) if it has not L1-redexes and it has a
L1-normal form, ar it is L1-normalizing if it reduces ta a L1-normal form;
the set of L1-nf is denoted by L1-NF.
(v) A term is L1-strongly normalizing if it is L1-normalizing, and moreover
there is not an infinite L1-reduction sequence starting fram it.
The closure conditions on the set of input values need some comment.
Since, as already said, input values represent partially evaluated terms, it is
natural to ask that this partial evaluation is preserved by reduction, which
is the rule on which the evaluat ion process is based. The substitution closure
comes naturally from the fact that variables always belong to the set of input
values.
In this book the symbol .1 will denote a generic set of input values. We
will omit the prefix .1 in cases where it is clear from the context.
Example 1.2.2. Let I, K, 0, D be the terms defined in the Example 1.1.2, and
let M, N be input values. Then I M ----+.c. M, so I has the behaviour of the
identity function, KMN ----+:1 M, OMN ----+:1 N, DM ----+.c. MM. If D E .1
then DD ----+:1 DD.
Now some possible sets of input values will be defined.
Definition 1.2.3. (i) r = Var U {Ax.M I MEA}.
(ii) AI is the language obtained fram the grammar generating A, given in
Definition 1.1.1, by modifying the formation rule for abstraction in the
following way:
(.>..x.M) EAl if and only if MEA and x E Var and x occurs in M.
The next property shows that there exists some set of input values, al-
though not all sets of terms are sets of input values.
Property 1.2.4. (i) A is a set of input values.
(ii) r is a set of input values.
(iii) AI is a set of input values.
(iv) A-NF is not a set of input values.
(v) Var U A-NFo is a set of input values.
(vi) Y = Var U {Ax.P I x E FV(P)} is not a set of input values.
8 1. The Parametric >'-Calculus
Praof The first case is obvious. In cases 2,3, and 5, it is easy to check that the
closure properties of Definition 1.2.1 are satisfied. A-NF is not closed under
substitution. It is easy to see that Y is closed under substitution, but it is not
closed under reduction. In fact, Ax.KIx E Y, while Ax.KIx - t y Ax.I <ţ Y. D
The choice ..1 = A gives rise to the classical call-by-name A-calculus [25],
while ..1 = r gives rise to a pure version (Le. without constants) of the
call-by-value A-calculus, first defined by Plotkin [78J.
The fact that VarUA-NFo is a correct set ofinput values was first noticed
in [39J.
(n,m ~ O),
where Mi E A are the arguments of M (1 :::; i :::; m) and ( is the head
of M. Here ( is either a variable (head variable) or an application of the
shape (AZ.P)Q, which can be either a redex (head redex) or not (head block),
depending on the fact that Q belongs or not to the set ..1.
Proof Assume by absurdum that a term M has two different normal forms
MI and M 2 • Then, by the confluence theorem, there is a term N such that
both MI and M 2 Ll-reduce to N, against the hypothesis that both are normal
~~. D
It is natural to ask if the closure conditions on input values, given in
Definition 1.2.1, are necessary in order to assure the confluence of the calculus.
It can be observed that they are not strictly necessary, but a weaker version
of them is needed.
1.2 The )'Ll-Calculus 9
Let P E ,,1 be such that, for every Q t= P such that P ---+~ Q, Q rţ ,,1.
Thus (>..x.M)P reduces both to M[P/x] and to (>..x.M)Q, which do not have
a common reduct, since the last term will be never a redex. Thus the weaker
version of reduction closure that is necessary is the following: M E ,,1 and
M ---+~ N imply that there is P E ,,1 such that N ---+~ P.
On the other hand, let N,P E ,,1 but for all Q such that N[P/x]---+~ Q,
Q rţ ,,1. Thus (>..x.(>..y.M)N)P reduces both to (>..y.M[P/x])N[P/x] and to
(M[N/y]) [P/x], which do not have a common reduct. Thus the weaker vers ion
of the substitution closure that is necessary is the following: P, Q E ,,1 implies
there is R E ,,1 such that P[Q/x] ---+~ R.
Assume M ---+~ N, and assume that there is more than one L1-reduction
sequence from M to N. The standardization theorem says that, in case the set
of input values enjoys a particular property, there is a "standard" reduction
sequence from M to N, reducing the redexes in a given order.
Let us introduce formally the notion of standard reduction sequence.
Definition 1.2.7. (i) A symbol >.. in a term M is active if and only if it is
the first symbol of a L1-redex of M.
(ii) The L1-sequentialization (M)O of a term M is a function fram A to A
defined as follows:
• (xMI ... Mm)O = x (MI) ° ... (Mm)O;
• ((>..x.P)QMI ... Mm)O = (>..x.P)O(Q)O(MI)° ... (Mm)O, if Q E ,,1;
• ((>"x.P)QMI ... Mm)O = (Q)O(>..x.P)O(MI)o ... (Mm)O, ifQ rţ ,,1;
• (>..x.P)O = >..x.(P)o.
(iii) The degree of a redex R in M is the numbers of>.. 's that both are active
in M and occur on the lefi of (R)O in (M)o.
(iv) The principal redex of M, if it exists, is the redex of M with minimum
degree. The principal reduction M ---+~ N denotes that N is obtained
fram M by reducing the principal redex of M. M oreover, ---+:f is the
reflexive and transitive closure of ---+~.
(v) A sequence M == Po ---+ Ll P I ---+ Ll ... ---+ Ll Pn ---+ Ll N is standard if and
only if the degree of the redex contracted in Pi is less than 01' equal to the
degree of the redex contracted in Pi+I, for every i < n.
We denote by M ---+:d N a standard reduction sequence from M to N.
It is important to notice that the degree of a redex can change during the
reduction; in particular, the redex of minimum degree always has degree zero.
Moreover, note that the reduction sequences of length O and 1 are always
standard. It is easy to check that, for every M, the A-sequentialization is
(M)O == M; thus in this case the redex of degree O is always the leftmost one.
Example 1.2.8. (i) Let ,,1 = A, and let M == (>..x.x(KI)) (II). Thus M has
degree O, KI has degree 1 and II has degree 2 (in the term M). The
following reduction sequence is standard:
(>"x.x(KI))(II) ---+A (II)(KI) ---+A I(KI) ---+A I(>..y.I).
10 1. The Parametric A-Calculus
(ii) Let M be as before, and let Ll = r. Thus II has degree O, and KI has
degree 1. Note that now M is no more a redex. The following reduction
sequence is standard:
(>.x.x(KI))(II) - r (>.x.x(KI))I - r I(KI) - r I(>.y.I) - r >.y.I.
(iii) Let M be as before, and let Ll = Var U A-NFo. Thus K 1 has degree O
and II has degree 1. Aiso in this case M is not a redex. The following
reduction sequence is standard:
(>,x.x(KI))(II) -L1 (>.x.x(KI))I -L1 (>.x.x(>.y.I))I.
The notion of a standard set of input values, which is given in Definition
1.2.9 is key for having the standardizat ion property.
The next property shows that some sets of input values are standard,
while some are not standard.
Properly 1.2.11. (i) A and r are standard.
(ii) Var U Ll-NFo is standard, for every Ll.
(iii) AI is not standard.
Proof (i) A is trivially standard. Let us consider r; we will prove that, if
M fţ. r, and M - r N through a not principal reduction, then N fţ. r.
M fţ. r implies that M has one of the following shapes:
1. yM1 ... M m (m > 1).
2. (>.x.M1)M2... M m (m ~ 2) and either (>.x.MdM2 is a redex or it is
a head block.
Case 1 is trivial, since M can never be reduced to a term in r.
In case 2, if M 2 E r then the principal redex is (>.x.MdM2, while if
M 2 fţ. r then if M 2 fţ. r-NF the principal redex is in M 2; if M 2 E r-NF
then the principal redex is in some M j (j :s; 3). So the reduction of a not
principal redex cannot produce a term belonging to r.
(ii) VarU Ll-NFo is standard since not principal reductions preserve the pres-
ence of the redex of minimum degree.
(iii) Consider the term, M == >.x.x(DD)((>.z.I)I). Clearly M fţ. AI and the
principal redex of M is DD. So M-AI >.x.x(DD)I E AI and in this
reduction the reduced redex is not principal, while for every sequence of
-Z reductions; M - Z M fţ. AI. D
1.2 The >.Ll-Calculus 11
It is easy to see that the substitut ion closure on input values, given in
Definition 1.2.1, is necessary in order to assure the standardizat ion property.
In fact, let M, N E Ll and M[N/x] ti. Ll. The following non-standard
reduction sequence (Ax.IM)N ---+Ll (Ax.M)N ---+Ll M[N/x] does not have a
standard counterpart, in fact I(M[N/x]) f+Ll M[N/x].
P'rOof. By Corollary 1.2.6 and by the definit ion of the standard set of input
values. D
Example 1.2.14. (i) Let Ll = A. The term KI(DD) has A-normal form 1. In
fact, the principal A-reduction sequence is K I(DD) ---+ A (Ay.I)(DD) ---+ A
1, while the A-reduction sequence choosing at every step the rightmost
A-redex never stops. Notice that, if we choose Ll = r,
KI(DD) has not
r-normal form.
(ii) The term II(II(II)) is A-strongly normalizing and r-strongly normal-
izing, while K I(DD) is neither A-strongly normalizing nor r-strongly
normalizing.
(iii) Let Ll = Var U A- NFo. Thus 1 (K (xx)) is the Ll- normal form of term
I(II)(K(xx) ).
Remark 1.2.15. The first notion of standardizat ion was given, for the AA-
cakulus, by Curry and Feys [34, 35]. With respect to their notion, if M ---+Â N
then there is a standard reduction sequence from M to N, but this re-
duct ion sequence is not necessarily unique. For instance, Ax.x(II)(II) ---+ A
Ax.xI(II) ---+ A Ax.xII and Ax.x(II)(II) ---+ A Ax.x(II)I ---+ A Ax.xII are both
standard reduction sequences. Klop [58] introduced a notion of strong stan-
dardization, according to which, if M ---+Â N, then there is a unique strongly
standard reduction sequence from M to N, and he designed an algorithm
for transforming a re duct ion sequence into a strongly standard one. Accord-
ing to his notion, in the example before only the first reduction sequence is
12 1. The Parametric >'-Calculus
A notion that will play an important role in what follows is that one of
solvability.
C[M] =4 I.
Example 1.2.17. (i) Consider the two sets of input values A and r. In
both calculi, the term I is solvable, while DD is unsolvable. Ax.x(DD)
is an example of a term that is A-solvable and r-unsolvable. In fact,
(Ax.x(DD))O -Â I, while there is no term P such that P(DD) -rI,
since DD ~ r and DD -r DD.
(ii) Let cI> be the set ofinput values VarUA-NFo. Then I(Ax.I(xx)) E cI>-NF
is a cI>-unsolvable term.
1.2 The >.Ll-Calculus 13
We will see that in all the calculi we will study in the following, the
property of solvability is not preserved by either substitut ion or by head
contexts. As an example in the AA-calculus xD is A-solvable, but xD[D/x]
is not A-solvable.
14 1. The Parametric A-Calculus
The next property, whose proof is obvious, states that, for every term M,
there is a unique term N such that !vI '----* Ll N.
Proof. By induction on M.
• If M == x, then N == x and [M]Ll == X.
• If M == AX.P then N == AX.Q, for some Q such that P =}Ll Q. By induction
Q =}Ll [P]Ll, and so N =}Ll Ax,[P]Ll == [M]Ll.
• If M == Pi P2 and it is not a Ll-redex, then N == Qi Q2 for some Qi and Q2
such that Pi =} Ll Qi and P2 =} Ll Q2. 80, by induction, Qi =} Ll [Pi]Ll and
Q2 =}Ll [P2]Ll, which implies N =}Ll [Pi ]Ll[P2]Ll == [M]Ll'
• If M == (Ax.H)P2 is a redex (i.e. P2 E Ll) then either N == (Ax.QdQ2 or
N == Qi [Q2/ x], for some Qi such that Pi =} Ll Qi (1 :S i :S 2). By induction,
Qi =}Ll [Pi]Ll (1 :S i :S 2). Note that [P21Ll E Ll by Lemma 1.2.21.(ii). In
both cases, N =}Ll [Pil d[P21Ll/xl == [M1Ll, in the former case simply by
induction, and in the latter both by induction and by Lemma 1.2.22. O
~~ ~ ~~ ~ ~~
;. ...
Ll ţ [MIlLl~'"
ţ
.1 .1
~~ ~Ll
.1*
~~ ~Ll ~Ll
.1*
ţ :
.1
.1
~~ ~Ll
NI > '" ţ ... ;. ... >N2
.1 .1 .1 .1
Lemma 1.2.26. Let P, Q be two sequences of terms such that IIPII = IIQlli
moreover, let Pi E Ll and Pi =}~ Qi for all i:::; IIPII.
(i) lf M =}~ N then M[P/x] =}~ N[Q/x].
(ii) lf M =}Ll N then M =}~ N.
Proof. Parts (i) and (ii) can be proved by mutual induction on M.
(i) By Lemma 1.2.22, M[P / x] =} Ll N[Q / X], hence it suffices to show that
M[P/X] -+~ N[Q/x].
Let M == >'YI ...Yh.(MI ... Mm (h, m E N), where either ( is a variable or
( == (>.z.T)U.
If h > O, then the proof follows by induction.
Let h = O, thus N == ~NI ... Nm such that ( =}~ ~ and Mi =}~ Ni; fur-
thermore, let MI == MdP/x] and NI == NdQ/x] (1:::; i:::; m).
The proof is organized according to the possible shapes of (.
(M{ ... M;" -+~ (N{M~ ... M;" -+~ ..... -+~ (N{ ... N;".
1.2. (== Xj E x (1 :::; j :::; l), so ~[Q/x] == Qj. But Pj =}~ Qj means
that there is a standard sequence Pj == Sa -+ Ll ..... -+ Ll Sn == Qj
(n E N). Two cases can arise.
1.2.1. Vi :S n, Si 1= >'z.S'. Then the following reduction sequence
Note that SoM{ ... M:r, == M[P/x] and SnN{ ... N:r, == N[Q/x],
so (J" followed by T is the desired standard reduction sequence.
1.2.2. There is a minimum k :S n such that Sk == >'z.S'.
By induction on (ii), MI =}~ NI. Therefore, by induction
MI [P/x] =}~ NdQ/X] , where MI[P/X] -+~ NdQ/X] is
MI[P/x] == Ro -+Ll ..... -+Ll Rp == NI [Q/X] (p E N). There
are two subcases:
18 1. The Parametric .A-Calculus
a' : M[P/X] == SoRoM~ ... M:n, ~.d ..... ~.d SkRoM~ ... M:n,
~.d ..... ~.d SkRpM~ ... M:n,
~.d Sk+lRpM~ ... M:n, ~.d ..... ~.d SnRpM~ ... M:n,
a": M[P/X] == SoRoM~ ... M:n, ~.d ..... ~.d SkRoM~ ... M:n,
~.d ..... ~.d SkRqM~ ... M:n, ~.d Sk+lRqM~ ... M:n,
~.d ..... ~.d SnRqM~ ... M:n, ~.d ..... ~.d SnRpM~ ... M:n,
2.2. Let N == '1'[U /z]N1 ... N m . So, there is a minimum q ::::; p such
that Rq E .1; let ţJ, be the standard reduction sequence:
M[P/X] == (>.z.T')RoMi···M:n ~L1 ..... ~L1 (>.z.T')RqMi···M:r,
~L1 T'[Rq/z]Mi···M:r,.
T =?~ '1', by induction on (ii). Furthermore, since Rq =?~ U", it
follows by induction that T[P/x][Rq/z] =?~ '1'[Q/x][U"/z].
Let T[P/x][Rq/z] == To ~L1 ..... ~L1 Tt == '1'[Q/X] [U"/z] be the
corresponding standard reduction sequence. Two subcases can
arise:
2.2.1. 'Vi ::::; t, Ti -ţ. >'z.8'. The desired standard reduction se-
quence is ţJ, followed by:
T'[Rp/z]Mi···M:r, == T[P/x][Rp/z]Mi···M:r, ~L1 T1Mi···M:r,
~L1 ..... ~L1 TtMi···M:r, ~~ ..... ~~ TtNi···N:r, == [Q/X]
2.2.2. Let k ::::; t be the minimum index such that T k == >'y.T~.
The construction of the standard reduction sequence depends
on the fact that M 2 may or may not become an input value,
but, in every case, it can be easily built as in the previous
cases.
(ii) The cases M == x and M == >.z.M' are easy.
1. Let M == PQ =?L1 P'Q' == N, P =?L1 P' and Q =?L1 Q'.
By induction, there are standard sequences P == Po ~ L1 ... ~ L1 Pp ==
P' and Q == Qo ~L1 ... ~L1 Qq == Q'.
If 'Vi::::; P Pi -ţ. >'z.P[, then M ~~ N is PoQo ~~ PpQo ~~ PpQq.
Otherwise, let k be the minimum index such that Pk == >'z.P~.
- If 'Vj ::::; q Qj ti. .1, then M ~~ N is
PoQo ~L1 ..... ~L1 PkQo ~~ PkQq ~L1 Pk+lQq ~L1 ..... ~L1 PpQq.
- If there is a minimum h such that Qh E ,1, the standard sequence
is PoQo ~~ PkQo ~~ PkQh ~L1 Pk+lQh ~~ PpQh ~~ PpQq.
2. Let M == (>,x.P)Q =?L1 P'[Q'/x] == N where P =?L1 P', Q =?L1 Q'
and Q E .1. Hence P =?~ P' and Q =?~ Q' follow by induction, so
P[Q/x] =?~ P'[Q' Ix]' by induction on (i). Thus, the desired stan-
dard re duct ion sequence is (>'x.P)Q ~ L1 P[Q/x] ~~ P'[Q' Ix]. D
Note that if.1 is standard and Ris the principal redex of M and M ----~ N,
then R is the principal redex of N.
Praof. Note that if P --+L1 P' then P =}L1 P'. So M --+~ N implies M =}L1
N n =} L1 N. So, by repeatedly applying Lemma 1.2.28 and
NI =} L1 ... =} L1
Lemma 1.2.30 we reach the proof. D
Now we are able to prove the standardization theorem.
Proof. Obvious. D
In the last section of this book, we will see that in order to use a >'..1-
calculus for computing, we need to work inside theories that are both consis-
tent and input consistent .
..1-theories can be classified according to their behaviour with respect to
the ..1-solvable terms.
Proof. Let C[.] be the context separat ing M and N, Le. C[M] =.:l x and
C[N] =.:l Y for two different variables x and y. Since =7 is a congruence,
M =7 N implies C[M] =7 C[N], and so, since T is closed under =.:l,
x =7 y. But this implies >.xy.x =7 >.xy.y, Le. K =7 O. But, since =7 is a
congruence, this implies K M N =7 OM N for alI terms M, N. In particular,
if M, N E L1 then M =7 N by L1-reduction. D
Clearly =.:l does not satisfy (EXT). In fact, (EXT) holds for =.:l only ifit
is restricted to terms that reduce to an abstraction: indeed, xy =.:l (>.z.xz)y,
but x i=-.:l >.z.xz.
The least extensional extension of =.:l is induced by the TJ-reduction rule,
defined as folIows:
By the definit ion of ---+ A, in the AA-calculus the head of a term is either a
variable or a redex. If the head of M is a variable then M is in A -head normal
form (A-hnf), namely M is of the shape AXl ... Xn.zMl ... Mm (n, m E N).
M has a A-head normal form if it reduces to a term in A-hnf. A-HNF denotes
the set of all A-head normal forms.
It is easy to see that M is in A-normal form (A-nf) if and only if both its
head is a variable and its arguments are in A-normal form too. 80 the set of
terms having A-hnf strictly includes the set of terms having A-nf. Consider,
for example, the term Ax.x(DD); it is in A-hnf, but it does not have A-nf.
An example of a term having neither A-hnf nor A-nf is DD.
A term is in A-lazy head normal form (A-Ihnf) if and only it is either an
abstraction or a head normal form. A term has a A-lazy head normal form if
and only if it reduces to a lazy head normal form. A-LHNF denotes the set of
all A-Iazy head normal forms. Clearly Ax.DD is a A-Ihnf, but it has neither
A-hnf nor A-nf. In the literature, a A-Iazy head normal form is called weak-
head normal form. We changed this terminology to stress the fact that to
reach a A-Iazy head normal form it is not necessary to reduce the A-redexes
that do not occur under the scope of a A-abstraction. Both A-head normal
forms and A-Iazy head normal forms are important classes of terms from the
computational point of view.
Property 2.1.2. Let M be A-solvable. Then there are unique n,m E N such
that M -7Â N and N in A-hnf, imply that the A-order and the A-degree of
N are respectively n and m.
Proof. By contraposition, let M have two A-head normal forms with different
A-order and A-degree, i.e. M -7Â P I == >'xI.··xn.xMI· .. M m and M -7Â P2 ==
>.xI ... xp-xNI ... N q , where n =f. p and/or m =f. q. By the confluence theorem,
it must be a term Q such that both P I -7 Â Q and P2 -7 Â Q. But this is
impossible, since the only redexes can occur in Mi or in N j (1 :::; i :::; m,
1 :::; j :::; q), and their reduction cannot change any of n, m,p, q. O
Proof. The proof is identical to the proof of Property 1.3.6, just putting
~=A. O
Proof. (i) By contraposition assume that M[N/y] has A-hnf. We will prove
that this implies that M has A-hnf too. The proof is given by induction
on the length p of standard A-reduction sequence from M[N /y] to its
A-hnf. The cases p = 0,1 are trivial. Let p > 1 and M == >.x.(>.z.P)QM,
otherwise M is already in A-hnf, and let R == >.x.P[Q/z]M. Then
28 2. The Call-by-Name .A-Calculus
where P' == P[Njy]' Q' == Q[Njy] and M' == M[Njy]. Thus R[Njy]
has A-hnf in less than p steps, so by induction R has A-hnf, and by the
Church Rosser theorem M has A-hnf too.
(ii) We as sume that (>.x.M)N has A-hnf and we prove that this implies that
M has A-hnf too. The proof is given by induction on the length p of a
standard A-reduction sequence from (>.x.M)N to its A-hnf. The cases
p = 0,1 are trivial. Let p > 1 and M == )..fj.(>.z.P)QM. If 111711 + Ilxll ~
liNII then the proof folIows from part (i) of this property and from the
confluence property of the A-reduction. Otherwise 3N1 such that IINIII =
111711 + Ilxll, N == N1N 2 and IIN2 11 > 1. In this case, it must be
(=?) If M does not have A-hnf, then by Property 2.1.9, for alI head contexts
C[.], C[M] does not have A-hnf; in particular, C[M] cannot be reduced
to 1. •
The rules of the system are defined by induction on the fact that M, N are
A-normal forms that are 1]-different.
Property 2.1.11. Let M and N be A-nf's such that M =l-A1) N. Then there is
a sequence c of natural numbers such that M etc N.
Proof. Easy. o
Some terms will be used extensively in the rest of this section, in particular
Bn == AXI",Xn+I.Xn+IXI",Xn
an == AXI",Xn+I.Xn+1
U~ == AXI ... Xi,Xn (i :S n, nE N).
The separability algorithm is presented in Fig. 2.1 (pag. 32). For the
sake of simplicity, we assume that aU bound and free variables have different
names.
The foUowing lemma proves a property on which both the termination
and the correctness proofs of the algorithm are based. In fact, rule (A7) of
the algorithm is based on it.
Lemma 2.1.15.
Let M, NE A-NF, r ::::: max{args(M), args(N)} and C;[.] == (Ax.[.])B T •
30 2. The Call-by-Name >'-Calculus
where:
0 5 [.) == ()..X3Y. [.) ) ()..XI X2. X)()..XI X2X3·Y)
O2[.) == ()..X3Y. [.) X2 X3) ()..XIX2.X) ()..XI X2X3·Y)
0 6 [.) == ()..X3Y.(()..U. [.) )UiX2X3)) ()..XI X2.X)()..XI X2X3·Y)
0 7 [.) == ()..X3Y.(()..U.()..X. [.) )B 2IUi)Uix2x3)) ()..XI X2. X)()..XIX2 X3·Y)
0[.) == ()..X3Y.(()..U.()..X. [.) xyu)B2IUi)Uix2x3)) ()..XI X2. X)()..XI X2X3·Y)·
2.1 The Syntax of AA-Calculus 31
So
C[M] == ()..x3y.()..u.()..x.Mxyu)B2 IU.})U.}x2x3) ) ()..XIX2. X)()..XIX2 X3·Y) -+:1
()..X3Y' ()..u.M B 2yuIU.} )U.}X2 X3)) ()..XIX2. X)()..XIX2 X3·Y) --*Â
()..X3Y' (M B 2yU.} IU.}x2 x3)) ()..XIX2.X) ()..XIX2 X3·Y) --*Â
()..xyu.x( u(x(yy))( vv)))B2()..XIX2X3·Y)U.} IU.}X2()..XIX2. X) --*Â
B 2(U.} (B 2 ()..XIX2X3'Y) ()..XIX2X3.Y)))( vv) )IU.} X2 ()..XIX2. X) --*Â
u.} (U.} (B 2 ()..XIX2X3.Y) ()..XIX2X3 .Y)))( vv))I X2 ()..XIX2. X) --*Â
U.} (B 2()..XIX2X3.Y)()..XIX2X3'Y))) (vv )X2 ()..XIX2. X) --*Â
B 2 ()..XIX2 X3.Y) ()..XIX2 X3·Y) )X2 ()..XIX2. X) --* Â
()..XIX2. X) ()..XIX2 X3.Y) ()..XIX2 X3.y) )X2 --* Â X,
C[N] == ()..X3Y' ()..u.()..x.N xyu)B 2lUi) u.} X2X3) ) ()..XIX2, X)()..XIX2 X3·Y) --*Â
()..X3Y· ()..u.N B 2yuIUi)U.}x2 x3)) ()..XIX2.X) ()..XIX2 X3·Y) --*Â
()..X3Y· (N B 2yU.} IU.}x2 x 3)) ()..XIX2.X) ()..XI X2X3·Y) --*Â
()..xyu.x( u(yy)( vv)))B2()..XIX2X3'Y)U.} IU.}X2()..XIX2. X) --*Â
B2 (U.} «)..XIX2X3.Y)()..XIX2X3.Y))( vv)) IU.}X2()..XIX2 .x) --*Â
Ui (Ui «)..XI X2X3·Y) ()..XIX2 X3.y))( vv)) 1X2 ()..XIX2. X) --*Â
Ui «)..XIX2 X3·Y) ()..XIX2 X3·Y)) (vv )X2 ()..XIX2. X) --* Â
()..XIX2 X3·Y)()..XI X2X3·Y)X2()..XIX2.X) --*Â y.
Now we will prove that the algorithm is correct and complete.
Lemma 2.1.17 (Termination).
II M,N E A-NF and M Ţ.c N then M,N ~A C[.].
Proof. By induction on c.
Let c = E. Let us consider first the case when M and N have no initial
abstractions. If they have different head variables, then axiom (A5) must be
applied, otherwise either axiom (A3) or axiom (A4), and then the algorithm
stops. If they have initial abstractions, then either rule (Al) or (A2) must be
applied, and the previous situat ion is reached.
If c -=f=. E, either rule (A6) or (A7) must be used, and then the result follows,
in the first case by induction, in the second one by induction and Lemma
2.1.15. O
The rules of the system proving statements M, N ~A C[.], are the following:
n<m
-------------------(,13)
XM1 ... M m , xN1 ... N n ~A ('\x.[.])Om 1 ..... 1 Kxf)
'-v-'
rn-n-2
m<n
- - - - - - - - - - - - - - - - - (,14)
xM1 ... Mm,xN1 ... N n ~A ('\x.[.])On 1 ..... 1 Kf)x
'-v-'
n-m-2
---------------------(,15)
xM1 ... M m, yN1 ... N n ~A ('\xy.[.])('\Xl ... Xm.X)('\Xl ... Xn.f))
(Al) By induction C[xMI ... Mmxp+1 ... Xq] '-'Â x and C[yNI ... Nn] '-'Â i); so
C[(..\xI ... xp-xMI ... Mm)XI ... Xq] '-'Â C[xMI ... Mmxp+I ... Xq] '-'Â X
C[(..\xI ... xq.yNI ... Nn)XI ... Xq]'-'Â C[yNI ... Nn] '-'Â i).
(A2) Similar to (Al).
(A3) Clearly
(..\x.xMI ... Mm)om 1 ......... 1 Kxi)'-'Â
'--v---"
m-n-2
T-m
T-m
T-m D
The more usual programming languages are such that parameters must be
evaluated in order to be supplied to a function, and moreover the body of
a function is evaluated only when parameters are supplied. The first policy
is the so called call-by-value parameter passing, and the second policy is
called lazy-evaluation. In order to mimic this kind of computation with the
parametric ALl-calculus, it is necessary that Ll be a proper subset of A, and
moreover it contain alI the abstract ion terms.
80 we choose Ll = r, where r = VarU{.Ax.M I MEA} was proved to be
a set of input values in Property 1.2.4. The Ar-calculus coincides with the
APv-calculus, first introduced by Plotkin in [78].
A term of the Ar-calculus is always of the shape: AXl ... Xn.(Ml ... Mm, where
the head ( is either a variable or a r-redex or a head block (see pag. 8).
A term is in r-normal form (r-nf) if it is of the shape AXl ... Xn.(Ml ... Mm,
where Mi is in r-normal form (1 SiS m) and (is either a variable or a head
block (AX.P)Q, where both P and Q are in r-normal form. r-NF denotes
the set of alI r-normal forms.
Example 3.1.1. Both xID and (AX.XI)(yz)w are terms in r-normal form.
DD is a term without r-normal form.
Let us notice that, in the previous definit ion , lf/ is not asked to be a set
of input values. Moreover, the definit ion of lf/C-reduction, in point (i), does
not agree with Definition 1.2.1. In fact, the reduction is defined by closing
the reduction rule only under application, while in the standard case the
closure is under abstract ion too. This allows us to formalize the notion of
lazy reduction, where no reduction can be made under the scope of a A-
abstraction.
Potentially r-valuable terms will be characterized by the lazy reduction
induced by the following subset of A.
Example 3.1.5. >.x.DD E E, xy(>.x.II) E E, I(xy) (j. E. Note that the last
term is in r -normal form, while the first two are not.
We will show that terms having Ee-normal forms are aH and only the
potentiaHy r-valuable terms.
Property 3.1.6. Let MEA.
A term M has Ee-normal form if and only if M -+:se P for some P E E.
Proof. It is easy to see that M E E if and only if M is a Ee-normal form. o
Note that E is not a set of input values. In fact, it is easy to see that the con-
textual reduction --"s would not be confiuent. Let P == (>.x.(>.yz.z)(xD))D.
Clearly P --"s P1 == (>.yz.z)(DD) and P --"s P2 == (>.xz.z)D, but there does
s
not exist a P3 E A such that P 1 --" P3 and P2 --" S P3 .
Thanks to its "lazy" definition, the --"se reduction enjoys aH the good
properties we expect.
Theorem 3.1.1. The --"se reduction enjoys both the conftuence and the
standardization properties.
Proof. The proof is in Sect. 3.1.1. o
Moreover, --"se and --"r reductions commute as proved by Property 3.1.8.
Property 3.1.8. Let M --"se P and M --"r Q. Then there is N such that
both Q --"se N and P --"r
N.
Proof. M --"se P implies M is of the shape (M, where (is either a variable,
or a r-redex, or a head block. Let M == (>.x.R)(zS)M, since the variable's
case is simpler. The proof is given by cases.
1. Let R --" r R'. It is easy to see that the following diagram commutes:
lse lse
R[zSjx]M r ) R'[zSjx]M
2. Let S == Sl ... Sj ",Sm and let Sj --" r Sj (1 :S j :S m). S' will denote
the sequence Sl ... Sj",Sm' It is easy to see that the following diagram
commutes:
(>.x.R)(zS)M ~ (>.x.R)(zS')M
lse lse
R[zSjx]M ; ) R[zS' jx]M
when a number ~ O of r-reductions is needed in order to deal with the
copies of zS generated by the Ee-reduction.
38 3. The Call-by-Value A-Calculus
(>..x.R)(zS)M ~ (>..x.R)(zS)M'
lEl lEl
R[zSjx]M r ) R[zS' jx]M'
4. The cases when the SI! and r-reductions are made in disjoint subterms
of either S or Mare immediate.
5. The cases when the SI! and r-reductions are made in the same subterm
of either S or M can be treated in a similar way as the previous ones.
6. Let M == (>..x.R)SM, where SEr. Then either P == Q, or one of the
previous cases applies. o
The ----'t5c-reduction allows a complete characterization of the potentially
r-valuable terms.
Mf, .. , M~" for some n E N, such that P[Q'/x]M ---tEl' AX1.Mf, MI ---tEl'
AXi+1.MI+1 (1:::; i :::; n') and M~ == xP{ ... p:r" , for some m'.
Let M~ == P[Q'/x]M. Since M ---tEl' Mâ, the proof is given.
({:::) By induction on n. If n = 1, then M ---tEl' xM1 ... M m , and so M is
r -solvable. In alI other cases the proof folIows easily by induction. O
Differently from the calI-by-name case, in the Ar-calculus the notion of
r-nf is not semanticalIy meaningful; in fact, we have seen that a term in r-nf
can be not potentialIy valuable, and so is r-unsolvable. Moreover, consider
the two terms (Az.D)(yI)D and (Az.D)(yK)D: they are r-normal forms, and
they are #r, but they are both r-unsolvable of r-order o. We will see that
alI the r-unsolvable terms of r-order O can be consistently equated.
Nevertheless, A-normal forms maintain a semantic importance also in this
calculus, as the next theorem shows. Note that a A-normal form is a particular
case of a Ee-normal form.
Proof. The proof is identical to the proof of Property 1.3.6, just putting
Ll = r. O
The notion of fixed point can be easily extended in the call-by-value setting, in
the sense that N is a calI-by-value fixed point of M if and only if MN =r N.
The confluence property for the reduction -+ El follows directly from the fact
that it enjoys the diamond property, as proved in the next lemma.
Proof We will prove only the most difficult case, Le. M == (>..x.P)MI ... M m ,
by induction on M.
• If N o == (>"X.P)MI ... M~ ... Mm such that Mk -+El M~, for some k, and
NI == (>"X.P)MI ... M~ ... Mm such that Mh -+El M~, for some k =1= h, then
Q == (>"X.P)MI ... M~ ... M~ ... Mm.
• Let No == (>"X.P)MI ... M~ ... Mm and NI == (>..x.P)MI ... M;: ... Mm such that
M~ =ţ. M;:, M k -+El M~ and M k -+El M;:, for some k. By induction
on Mk there is Q' such that M~ -+El Q' and M;: -+El Q', thus Q
(>..x.P)MI ... Q' ... M m.
• Let MI E E, so both (>"x.P) and MI are Ei-normal forms. Let N o
P[Mtfx]M2... M m and NI == (>"X.P)MI ... M~ ... Mm such that Mk -+El M~,
for some k. Clearly, Q == P[MtfxlM2 ... M~ ... Mm. O
k o
Corollary 3.1.26. lf Po P I ---+a P2 and k ;:::: 1, then there are Pi EA
---+a
Proof. Trivial. o
Proof. (i) ris a standard set of input values and M -'>r NEr imply that
there is N' E r such that M -'>f N' E r; moreover, since M is closed
there is M' such that M -'>~ MI -'>~ M 2 ••• -'>~ M r -'>~ >..z.M' -'>~*
N' E r, where Mi is not an abstractioil, for alI i (1 ::; i ::; r).
Then M -'>Ti >..z.M' by definit ion of principal reduction. Clearly M -'>ri
>..z.M' E r implies M -'>Sl >..z.M' E E, so the proof folIows by Lemma
3.1.31.(iii).
(ii) Let (M) = k and let p be the number of steps of the standard reduction
sequence M -'>A N. The proof is given by induction on the pair (k,p),
ordered according to the lexicographical order.
The cases where either (M) = O or p = O are trivial. M == xMI . . .M m is
not possible, since M E AO by hypothesis. Let M == (>..x.Mo)MI ... M m ,
h' = (MI) and h" = (Mo[MI/x]M2 ••• M m ), thus k = 1 + h' + h".
3.1 The Syntax of the >.r-Calculus 45
The Lemma 3.1.35 proves that if a term has Ee-normal form then it is
potentially r-valuable.
Lemma 3.1.35. Let MEA, FV(M) <;;; {Xl," .,xn }.
M ~:kR N E E implies that 3h E N such that Vr ~ h, 3Mr Er
M[or /XI, ... , or /X n ] ~} Mr,
N[or /Xl, ... , or /X n ] ~} Mr,
Proof. Let Pr be the substitution such that Pr(Y) = or, for alI y E Var and
r ~ O; so Pr(M) = M[or /XI, ... , or /x n ].
The proof will be given by induction on (M).
• Let (M) = O, so M is an abstract ion and the proof is trivial.
• Let (M) ~ 1. If M == xMI ... M m (m E N) then by induction, Vi ~ m there
are hi E N such that Vr ~ max{ m, h l , ... , hm }, Pr(Mi ) ~} Mi E r and
the proof is immediate.
Otherwise, let M == (>-.z.P)QM I ... M m (m E N); M has Ee-normal form
implies that there is R E E such that Q ~:kR R. Hence (Q) < (M) and
this implies by induction, that there is ho E N such that Vr ~ h o 3Qr E r,
Pr(Q)~} Qr and Pr(R) ~T' Qr. Clearly P[R/z]MI ... M m ~:kR N too.
By Property 3.1.33.(iii) (P[R/z]M I ... M m ) ~ (P[Q/z]M t ... M m ) < (M)
then, by induction, there is h l E N such that Vr ~ h l 3Pr E r satisfying
Pr(P[R/z]MI ... M m ) ~} pr and Pr(N) ~} pr.
Vr ~ max{ho, ht}, 3Qr E AO Pr(R)~} Qr implies, by the confluence
theorem,
Lemma 3.1.36. lf M has r-head normal form and FV(M) = {XI, ... ,xn}
then :3s E N, "ir ;:: s, :3k E N such that (AXl ... Xn .M) ~ _ Ok. r
r
Proof. Let Pr (where rEN) be the substitution such that Pr(Y) = or, for
each Y E Var. The proof is done by induction on the minimum number q of
steps necessary to prove that M "" N, for some N in r-head normal form.
If M is an abstraction, the proof follows directly by induction. Let M ==
xMl ... M m , where Mi have Ei-normal forms (1 :::; i :::; m). By Lemma 3.1.35,
-r
:3s i E N such that "ir ;:: Si, MdO r IxI, ... , or IXn] Mi E r (1 :::; i :::; m).
Let r;:: max{m,n,sl, ... ,Sm}j thus for some k E N,
( AXl···Xn·M)or
~-r
or * orM1··· AIm~-r
or or * or-mor or * Ok
~-r'
r r-n r-n
If r - m ;:: r - n then n ;:: m and k = (r - m) - (r - n) = n - mj otherwise
r-m < r-n and or-m ~ -r ~, thus r-n- (r-m) = m-n
r-n r-n-(r-m)
and k = r - (m - n - 1) = r + 1 + n - m.
Let M == (Ax.P)QMl ... M m (m ;:: 1). By definit ion Q -Si R E E and
M "" P[Rlx]Ml ... M m , which has r-head normal form. Q -Si R E E
implies that :3ho E N such that "ir ;:: ho, :3Qr E r, Pr(Q) -r
Qr and
Pr(R) -r Qr, by Lemma 3.1.35. By induction :3h E N such that "ir ;:: h,
(AXl ... Xn.P[Rlx]Ml ... Mm)~ -rOk, for some k E N.
r
Let r;:: max{ho,h}, so for some vE N,
(AXl ... Xn.M)~ -r (Pr(AX'P)Pr(Q)Pr(MI)"'Pr(Mm))~
r r-n
r-n
- r (Pr(P[Qr IX])Pr(MI) ... Pr(Mm )) or .. .or
'"-v--'
-r Ov.
r-n
r
too. D
Note that r :::; k + 1, otherwise C[M] -+} >'Xk+l ... Xr.S' =f.r 1. The proof is
given for induction on (C[M])e by taking into account an possible shapes of
the term M .
• M == >,xn+l ... xr.xjMl ... Mm. If m = O then the proof is trivial by putting
N == M, so let m 2 1. There are 2 cases.
1. If r ::; k then
Hence (C[U]) < (C[M]) , and by induction, we can state U "" T and
C[U]-} 1, for some T in r-head normal form.
Let N be Ti so C[N] - } 1 and
M == AXnH ... Xr.(>\z.P)QM1 ... Mm "" AXnH ... Xr.P[R/z]M1 ... Mm "" T.
r
(.ţ:;) By Lemma 3.1.37.
•
3.1.3 Proof of r-Separability Theorem
The notions of args, nfA and ':::'c are defined respectively in Definitions
2.1.12. 2.1.14 and 2.1.10.
50 3. The Call-by-Value A-Calculus
Lemma 3.1.39. Let M E A-NF, FV(M) = {Xl, ... ,Xn} and r 2: args(M).
IfVj::; n, Qj = AXI ... Xr.Qj and Qj E r then
Lemma 3.1.40 proves an important result on which the inductive rule (r7)
of the algorithm is based. The relation 'te was defined in Definition 2.1.10.
Example 3.1.41. Let us consider the same terms as in Example 2.1.16, i.e.
let M == AXYU.X(u(x(yy))(vv)) and N == AXYU.X(u(yy)(vv)).
Clearly args(M) = args(N) = 2, so let r = 2. The derivat ion proving the
statement M,N ~r C[.] is the following:
C 5 [.] ==
C2 [.] ==
C6['] ==
The rules of the system proving statements M, N ~r C[.), are the following:
n<m
----------------------------------------------------(r3)
XMI ... Mm,xNI ... N ~r (AX.[.))Or+n Br ..... BT(AXI ... xm-n.fi)y ..... f)
n
'"-v--' '-v-'
r+n-m m-n
m<n
----------------------------------------------------(r4)
XMI ... Mm,xNI ... Nn ~r (AX. [.))Or+m ~;.l[)AxI ... Xn-m.f})~
r+m-n n-m
X=/=y
-------------------------------------------------------(r5)
xMI ... Mm,yNI" .Nn ~r (AXy.[.))(AXI ... Xr+m.fi)(AXI ... Xr+n.f})~
T
h? 1. If k = O then TR1 ... Rh == ZP1 ... Pm, so the proof is similar to the
previous case.
Let k ? 1, let D'[.] be [.]Rk+1 ... Rh and b' denote a substitution such
that b'(uj) = Rj (1 :S j :S k), while b'(y) = b(y) for alI other variables.
Hence, b'(D'[T]) -t} >..xr_m ... xr.Qz by case k = O; the proof folIows,
since b(D[zPl ... Pm]) -t} b'(D'[T]).
o
In the next lemma, X, fi are the pair of fresh variables considered by the
algorithm.
Proof Let e denote a substitution such that e(x) = x, e(fI) = fi, while
Vz E Var - {x, fi}, e(z) = ar.
We will prove that e(C[M]) -t} X and e(C[N]) -t} fi;
moreover, let T E A-NF, let args(T) :S r, let D[.] == (>"Ul",Uk.[.])Rl ... Rh be a
context (k :S h) such that either Rj = B r or Rj = U[ or Rj = X~ s (where
1 :S j :S h, t :S r, U E Var and S ~ Var) and let x, fi (j. FV(D[T]) , s~:
• if nfA(D[T]) == M then e(C[D[T]]) -t} x,
• if nfA(D[TJ) == N then e(C[D[T]]) -t} fi.
The proofis given by induction on the derivat ion proving M,N =?tr C[.].
(FI) Let C;[.] == (>..Xl"'Xp.[.])X;t,{x,y} ... X;p,{x,y} and
e(C[D[T*ll) == e(C*[D*[T*ll) ~} x.
The proof for the term on the right is similar.
(r2) Similar to (rl).
(r3) Let n < m and let xMl ... Mm,xNl ... N n ~r C[.] where
We will prove that, ifT E A-NF, args(T) ::; r, D[.] == (>.Ul ... Uk.[.])Rl ... R h
is a context (h, k E N), where
On the other hand, we will prove that, if TE A-NF, args(T) ::; r, D[.] ==
(>'Ul",Uk.[.])Rl ... Rh is a context (h, k E N), where
-'r y.
m~n
r+l
We will prove that, if TE A-NF, args(T) :::; r, D[.] == (AUl ... ud.])Rl ... Rh
is a context (h, k E N), where
On the other hand, we will prove that, if T E A-NF, args(T) :::; r, and
D[.] == (AUl ... ud.])Rl ... Rh is a context (h, k E N) where
Rj E {B r , U;, X~,s It E N /\ u E Var /\ S ~ Var} (l:::;j:::;h),
x, Y tţ FV(D[T]) and nfA(D[T]) == yNl ... N n then e(C[D[T]]) y. -'r
Let b(x) = AXl ... xr+m.x, b(y) = AXl ... xr+n.y and b(z) = e(z) for each
other variable z; thus, by Lemma 3.1.43, b(D[T])) -'r
AXl ... xr.y. Hence
e((AXy.yNl ... Nn)(AXl ... xr+m.X)(AXl ... Xr+n.Y)~) -'r y.
r
(r6) Let Mk #A'7 N k , X tţ FV(Mk ) U FV(Nk) and Mk, Nk ~r C[.].
The two inductive hypothesis follow.
• e(C[Mkl) -'r
X.
• If T E A-NF, args(T) :::; r, D[.] == (AUl ... ud.])R1 ... Rh is a context
(k:::; h), where
Rj E {Br,U;,X~,s It E N /\u E Var/\ S ~ Var} (l:::;j:::;h),
nfA(D[T]) == M k and X, Y tţ FV(D[T]) then e(C[D[T]]) -'r X.
Let T == xM1... M m and D[.] == (AX. [.])Uk ~; thus, args(T) :::; r,
r~m
We must yet prove that, ifT* E A-NF, D*[.] == (.x.ui",uk*.[.])Ri ... Rh* is
a context (k* ::; h*) such that either R; = B r or R; = U[ or R; = X~,s
(where 1 ::; j ::; h*, t E fii, u E Var and S <:;;; Var), args(T*) ::; r,
x,i) ti- FV(D*[T*]) and nfA(D*[T*]) == xM1·· .Mm, then
e(C*[D*[T*]]) --7r x, where C*[.] == C[(.-\x.[.])Ur !Y ..~.. B].
r-m
Let D[.] == (.-\xui ... u,,* .[.])UrRi[uklx] ... Rh* [Uklx] ~ and T == T*;
r-m
therefore R;[Uklx] E {Br,U[,X~,s I t E fii 1\ u E Var 1\ S <:;;; Var}
(1 ::; j ::; h*), nfA(D[T]) == M k (since x ti- FV(Mk)), args(T) ::; r and
X, i) ti- FV(D[T]). 80, by induction,
r-m
T == T*. Thus R;[B r Ix] E {Br, U[,X~,s It E fii 1\ u E Var 1\ S <:;;; Var}
where 1 ::; j ::; h*, nfA(D[T]) == nfA(C~[Mk]), args(T) ::; r and x,i) ti-
FV(D[T]). By induction,
58 3. The Call-by-Value A-Calculus
Operational Semantics
5. Parametric Operational Semantics
In this part we will study the evaluat ion of terms and the induced operational
semantics. Our notion of operational semantics is inspired by the structured
operational semantics (SOS) developed by Plotkin [80] and by Kahn [55].
In Sect. 1.2, we introduced in an informal way the notion of evaluat ion,
by saying that a possible way of evaluat ing a term is to apply the reduction
rule to it until a normal from is reached. Clearly, such evaluat ion can never
stop, for example, in the case when D E ..1 and the ..1-reduction is applied to
the term DD, which do not have ..1-normal form.
But the normal forms are not the only terms we can reasonably consider
as output results. For example, we defined the notion of head normal form,
both in the AA and in the Ar setting. It is natural to ask if such terms can
be considered as output values, and so if it is possible to check, through an
evaluation, whether or not a term possesses head normal form.
Hence, in order to study the evaluation of terms, we need to introduce
behind the notion of input values, that of out put values. The definition of a
set of output results is parametric with respect to the set of input values.
Property 5.0.3. 1. A, A-NF, A-HNF and A-LHNF are sets of output values
with respect to A.
2. A and r-NF are sets of output values with respect to r.
3. The set of r-lazy blocked normal forms (r-lbnf's), namely r-LBNF =
{Ax.M I M E A}U{xM1 ... M m IMi EA, m E N}U{(AX.P)QM1 ... M m I
P, Mi EA, Q rţ r , Q E r-LBNF , m E N}, is a set of output values
with respect to r.
4. ris not a set of output values with respect to either A nor r.
5. E is a set of output values with respect to A, but not with respect to r.
6. rf-NF is not a set of out put values with respect to either A nor r.
~l .•.•. ~m
name
Q:
where the premises ~i (1 :::; i :::; m) and the conclusion Q: are logical
judgments (written using metavariables); while name is the name of
the rule.
The intended meaning of a rule is that, for every instance s of
the metavariables in the rule, s(Q:) is implied by the logical AND of
S(~i) (1:::; i:::; m).
For sake of simplicity, we will use the syntax of terms for denoting the
metaterms in the logical rules.
A formal system defining an evaluat ion reIat ion O E t'(L1, 8) is a set oflogical
rules for establishing judgments of the shape M ..1).0 N, whose meaning is
(M, N) E O. We will denote with M ..1).0 the fact that the judgment M ..1).0 N
68 5. Parametric Operational Semantics
can be proved in the system for some N, Le. (M, N) E O. We will denote
with M 1\'0 the fact that there is no N E 8 such that M -U-o N.
The evaluation reiat ion O E [(..1,8) is deterministic if, in case M -U-o,
there is a unique term N such that M -U-o N (Le. the evaluation reiat ion is
a partial function). All the evaluat ion relations we show in this part of the
book are deterministic.
M~oN
if and only if
\fC[.] such that C[M], C[N] E AO (C[M] -U-o implies C[N] -U-o ).
-<o denotes the strict version of ~o, while ~o is the equivalence relation
on terms induced by ~o.
lf M ~o N then M and N are O-operationally equivalent.
Since we are considering "pure" calculi, i.e. calculi without constants, the
only behaviour we can observe on terms is the termination, and this justifies
the previous definit ion of operational semantics.
In the presence of constants, a subset of them (the "basic con-
stants") will be the possible results of a computation, and the defi-
nit ion would change in the folIowing way:
M~N
if and only if
'v'C[.] such that C[M], C[N] E AO, for alI basic constants a,
(C[M].lJ. a implies C[N].lJ. a).
Definition 5.0.8. Let O E &(,,1,8) be an evaluation relation.
(i) The )..,,1-calculus is correct with respect to the O-operational semantics il
and only il M =.4 N implies M ~o N.
(ii) The )..,,1-calculus is complete with respect to the O-operational semantics
il and only il M ~o N implies M =.4 N.
The )..,,1-calculus is correct with respect to the O-operational semantics if
and only if ~o is a ,,1-theory. In fact, it is easy to check that ~o is always a
congruence relation (see Definition 1.3.1).
Example 5.0.9. The evaluat ion relations of Example 5.0.5 are correct with
respect to their respective set of input values. Some counterexamples to the
correctness folIow:
(i) Let J E &(A, A-NF) be {(M, N) E A x A-NF I M -t;{ N}.
The )..A-calculus is not correct with respect to J. In fact, KI(DD) =A I
but KI(DD) ~J I, since KI(DD) 1b while I.lJ.J.
(ii) Let W E &(r, r-LBNF) be {(M, N) E r x r-LBNF I M -->jf N}. The
)..r-calculus is not correct with respect to W. In fact, KI()..x.DD) =r I
but KI()..x.DD) ~w I, since KI()..x.DD) 1fw while I.lJ.w.
The notion of O-relevant context, introduced in the next definition, is a
technical tool that is useful for proving operational equivalences.
Definition 5.0.10. Let O E &(,,1,8).
(i) A context C[.] is O-relevant il and only il there are M, NE AO such that
C[M].lJ.o and C[N]1fo.
(ii) Let M, NEA. A context C[.] is said a discriminating context for M and
N il and only il C[M].lJ.o and C[N]1fo, or vice versa.
M-+~N
M-+~N
------pl
>..x.M -+~ >..x.N
QELl
---------------p3
(>"x.P)QM1 ... M m -+~ P[Q/X]Ml ... M m
The machine described in Fig. 5.1 is "step-by-step", since each of its rules
describes just one application of the reduction ruIe.
Definition 5.1.2 (Universal evaluat ion relation).
Let 8 be a set of output values with respect ta the set of input value ,1.
(i) u~ E 6'(,1,8) is the evaluation relation defined through the following
rules:
M ---+~ P P JJ.uLl N
- - - - (axiom) --------="'- (eval)
M JJ.ULl M M JJ.ULl N
'" '"
(ii) M ~Uf] N if and only il, for all contexts C[.] such that C[M], C[N] E AO,
(C[M] JJ.Uf] implies C[N] JJ.Uf] ).
(iii) M ~uf] N if and only if M ~Uf] N and N ~Uf] M.
It is easy to check that the previous definit ion is well posed, i.e. M JJ.ULl N
implies M ---+~ N. Furthermore, the evaluation reiat ion U~ is deterministic '"
for aU ,1,8.
Theorem 5.1.3 proves that the evaluat ion relation U~ is universal, in
the sense that it subsumes all deterministic evaluation relations obtained by
instantiating ,1 and 8 in a correct way.
Theorem 5.1.3. lf M ---+~ NE 8 then M JJ.ULl.
'"
Proof. Since 8 satisfies the principality condition, M ---+~ N E 8 implies
there is N' E 8 such that M ---+:f N'. Then the proof folIows by induction
on the length of the reduction sequence M ---+:f N' E 8. If M E 8, then the
proof foUows by rule (axiom) of the formal system defining U~. Otherwise,
M ---+:f N' means M ---+~ Nil ---+:f N', so the proof follows by induction. O
For each choice of the sets of the input and out put values, the A,1-calculus
is correct with respect to the U~ operational semantics, as proved in Theorem
5.1.4.
Theorem 5.1.4 (U~-Correctness).
The A,1-calculus is correct with respect ta the U~-operational semantics.
Proof. M =,1 N implies C[M] =,1 C[N], for aU contexts C[.].
If there is P E 8 such that C[M] ---+~ P, then C[M] JJ.ULl, by Theorem
5.1.3. Clearly P =,1 C[N]; thus, by principality, there is P ''" E 8 such that
C[N]---+:f pl, so C[N] JJ.ULl.
In case there is not such a'" P, both C[M]lIuLl and C[N]lIuLl. O
'" '"
So, U~-operational semantics induce a ,1-theory; as far as completeness
is concerned, it depends on the choice of the set of out put values. But alI
operational semantics of interest are not complete, as we will see in the fol-
lowing.
72 5. Parametric Operational Semantics
Example 5.1.5. Let U;(_HNF be the universal evaluat ion reIat ion , where A is
the set of input values and A-HNF is the set of output values.
(i) Let Ma == >..x.(>..uv.xuv)I(DD), MI == >..x. (>..v.xlv) (DD) and M 2 ==
>..x.xI(DD); note that Ma ---+~ MI ---+~ M 2 E A-HNF.
>..x.(>..uv.xuv)I(DD) ,jJ.uAA-HNF >..x.xI(DD); in fact, we can build the fol-
lowing derivation:
M 2 E A-HNF
- - - - - - (axiom)
MI ---+~ M 2 M 2 ,jJ.uA M2
A-HNF (eval)
Ma ---+~ MI MI ,jJ.uA M2
A-HNF (eval)
>..x.(>..uv.xuv)I(DD) ,jJ.uAA-HNF >..x.xI(DD)
(ii) It is possible to check that there is not a derivat ion proving >..x.DD ,jJ.uA ,
A-HNF
i.e. >..x.DD 1Î'uAA-HNF .
Every derivation proving >..x.DD ,jJ.uA A-HNF
must be of the folIowing shape:
for some REA and some derivation d proving >..x.DD ,jJ.uAA-HNF R. Since
alI derivations are applications of a finite number of rules, d cannot exist,
and so also the whole derivation.
In the remainder of this part of the book we will present four different
operational semantics: three for the calI-by-name >..-calculus and one for the
calI-by-value calculus. They formalize the deterministic evaluat ion relations
given in Example 5.0.5, except for G. We will not develop such a semantics,
since the notion of r-normal form is semanticalIy meaningless, as already
noted.
Each one of the operational semantics we are interested in can be derived
from the "universal .d-reduction machine" by instantiating the sets of input
and out put values in a suitable way. But we choose to present the various
operational semantics independently, both for clarity and for technical rea-
sons. In fact, while the universal reduction machine is based on a step-by-step
description of the evaluation relation, the reduction machines we will present
supply an input-output description of it, and this makes the proofs easier.
6. Call-by-Name Operational Semantics
H E [(A, A-HNF) is the first evaluation relation that we will study; it is the
universal evaluat ion reiat ion U;(_HNF (see Example 5.1.5).
In this setting, the converging terms represent computations that can
always produce a given output value when applied to suitable arguments.
In fact, the set of terms having A-HNF coincides with the set of A-solvable
terms.
M-lJ-HN
m~O
- - - - - - - - - - (var)
xM1 ... M m -lJ-H xM1 ... M m
- - - - - - (abs)
Ax.M -lJ-H Ax.N
P[Qjx]M1... M m N -lJ-H
- - - - - - - - - (head)
(Ax.P)QM1... M m N -lJ-H
(ii) M ~H N if and only if, for alt contexts C[.] such that C[M], C[N] E AO,
(C[M] -lJ-H implies C[N] -lJ-H ).
- - - - - - - - (var)
xI(DD) .JJ.H xI(DD)
- - - - - - - - - - (head)
(Av.xlv)(DD) .JJ.H xI(DD)
- - - - - - - - - - - (head)
(Auv.xuv)I(DD) .JJ.H xI(DD)
- - - - - - - - - - - - - - (abs)
Ax.(Auv.xuv)I(DD) .JJ.H Ax.xI(DD)
where the unique leaf is the axiom (var) and the conclusion of the root
node is the judgment Ax.(Auv.xuv)I(DD) .JJ.H Ax.xI(DD). Note that, in
the particular case of the system .JJ.H, every derivat ion is such that each
node has a unique son.
(ii) It is possible to check that there is no derivation proving Ax.DD .JJ.H. In
fact, if a such derivation exists then it must be of the folIowing shape:
d
----(head)
DD.JJ.HR
- - - - - - (abs)
Ax.DD .JJ.H Ax.R
for some R, and some derivation d. But the rule (head) implies that the
derivat ion d must be in its turn of the shape
d
----(head)
DD.JJ.HR
Since alI derivations are the application of a finite number of rules, d
cannot exist, and so also the whole derivation.
The system .JJ.H characterizes completely the class of terms having A-head
normal forms, as shown in Theorem 6.1.3.
Praof. (i) Clearly M[T / z] =A N[T / z], so by the confl.uence theorem M[T / z]
has A-hnf if and only if N[T/z] has A-hnf; hence let M[T/z].!.l-H Uo and
N[T/z].!.l-H Ul , for some UO,Ul EA.
We show that Uo == U1 by induction on the derivat ion of M .!.l-H N.
The case (var) is trivial. The case (abs) follows by induction. The
more complex case is (head); if P[Q/x]M1... M m .!.l-o N then by induc-
tion, (P[Q/x])[T/z]M1[T/z] ... Mm[T/z] .!.l-H V and N[T/z] .!.l-H V, thus
(>.x.P[T/z])Q[T/z]M1[T/z] ... Mm[T/z].!.l-H V too and the proofis done.
(ii) Since M =A N implies MT =A NT, we can assume MT .!.l-H Uo if and
only if NT .!.l-H U1. We show that Uo = U1 by induction on the derivation
of M .!.l-H N. The case (var) is trivial. The case (abs) follows by using the
previous point. The case (head) follows by induction. O
Praof. (=» Assume that C[.] is H-relevant, namely there are M, N E AO such
that C[M] .!.l-H and C[N] 1IH. By induction on C[M] .!.l-H we will prove that
there is a context C'[.] satisfying the statement.
76 6. Call-by-Name Operational Semantics
If the last applied rule is (var) then either C[.] == xCd.] ... Cm [.] (m E N) or
C[.] == [.]Cd.] ... Cm [.] (m N). In the first case the context is not relevant,
E
while the second case is not possible, since M E AO.
If the Iast applied rule is (abs) then either C[.] == [.] or C[.] == AZ.C"[.]. The
first case is immediate, while the second folIows by induction.
If the last applied rule is (head) then either C[.] == [.]CI[.] ... Cm[.] (m E N)
or C[.] == (AZ.Co[.])C1[.] ... Cm [.] (m 2: 1). The first case is trivial, while the
second folIows by inductionj in fact, the context Co[.][CI[.]jz]C2 [.]. •• Cm [.] is
discriminating M and N and so is H-relevant too.
(-{:::) Let C' [.] be a context satisfying the statement of this Lemma, so
C'[M] -ll-H if and only if C[M] -ll-H, for each MEA. Thus M == DD and
N == AXl ... XmZ.z are witnesses of the H-relevance of C[.]. O
Properly 6.1.9. 1 ~H E.
6.2 N-Operational Semantics 77
Proof By absurdum assume that the two terms can be discriminated. This
means that there is a context C[.] discriminating them. Let C[.] be such that
C[I] .JJ.H while C[E]l'IH. Clearly C[.] must be H-relevant.
Let C[.] be a minimal discriminating context for I and E, in the sense that the
derivation of C[I] .JJ.H has a minimal size between alI the proofs of C'[I] .JJ.H,
for every C'[.] discriminating between I and E in such a way that C'[I] .JJ.H
while C'[E]l'IH. The proof is done by considering the last applied rule in the
derivation proving C[I] .JJ.H.
The last used rule cannot be (var), since C[.] == xCd.] ... Cm [.] (m E N) is
not H-relevant. If the last used rule is (abs) then either C[.] == Ax.C'[.] or
C[.] == [.]. In the former case, C'[.] would be a discriminating context such that
the derivation of C'[I] .JJ.H has smaller size than the derivation of C[I] .JJ.H,
against the hypothesis. The latter case is not possible, since clearly [.] is not
a discriminating context for I and E.
Let the last used rule be (head); thus either C[.] == (Ax.Co[.])Cd.] ... Cm [.]
(m ~ 1) or C[.] == [.]Ct[.] ... C m [.] (m E N). Let consider the former case. By
the rule (head), C[I] .JJ.H if and only if Co [I][C1 [IJ/x]C2 [I] .. .Gm [I] .JJ.H. But in
this case Co[.][Cd.]/x]C2 [.] .. .Gm [.] would be a discriminating context for M
and N with a derivat ion having smaller size than C[.], against the hypothesis
that C[.] is minimum.
The case C[.] == [.]C1[.] ... Cm[.]leads to a similar contradiction. In fact, in this
case C1[.] ... Cm [.] would be a discriminating context "smaller" than C[.].
The case when C[I]l'IH and CrE] .JJ.H is symmetric. D
Theorem 6.1.10. The theory H is fully extensional.
N E &(A, A-NF) is the evaluation reIat ion studied in this section; it is the
universal evaluat ion relation U1_NF.
In some sense, N induces the most natural operational semantics for the
AA-calculus; in fact, converging terms represent the completely terminating
computations.
M.JJ.NN
MJJ-NN
------(abs)
Ax.M JJ-N Ax.N
(ii) M::S N N if and only iI, for aU contexts C[.] such that C[M], C[N] E AO,
(C[M] JJ-N implies C[N] JJ-N ).
(iii) M::::O N N if and only if M ::SN N and N ::SN M.
As is true for H, the relation N is also deterministic.
- - - (var)
XJJ-N X
- - - (var) -----(abs)
XJJ-N X Ax.x JJ-N Ax.x
- - - - (var) - - - - - (head)
xxJJ-N xx II JJ-N 1
- - - - - - (abs) (abs)
Ax.xx JJ-N Ax.xx Av.II JJ-N Av.I
- - - - - - (head) (head)
ID JJ-N D (Auv.u)(II) JJ-N Av.I
- - - - - - - - - - - - - - - - - - (var)
Xl (ID)((Auv.u) (II)) JJ-N xlD(Av.I)
- - - - - - - - - - - - - - - - (abs)
AX2.Xl(ID)((Auv.u)(II)) JJ-N AX2.XID(Av.I)
- - - - - - - - - - - - - - - - - - (abs)
AXIX2.Xl(ID)((Auv.u)(II)) JJ-N AXIX2.XID(Av.I)
The system JJ-N characterizes completely, from an operational point of
view, the class of A-normal forms.
If the last applied rule is (head) then either C[.] == [.]Ct[.]. . .Gm [.] (m E N) or
C[.] == (AZ.Co[.])Cl [.] .. .Gm [.] (m ~ 1). The first case is trivial, while the
second folIows by induction; in fact, the context Co[.][Cd.lIz]C2 [.] ••. Cm [.] is
discriminating M and N and so is N-relevant too.
Prope'rty 6.2.9. 1 ~N E.
Proof. By absurdum assume I?6N E. This means that there is a context C[.]
discriminating them. Let C[.] be such that C[I] -U-N while CrE] lIN.
Let C[.] be a minimal discriminating context for 1 and E, in the sense
that the derivat ion of C[I] -U-N has a minimal size between alI the proofs of
C'[I] -U-N, for every C' [.] such that C'[I] -U-N and C'[E] lIN. The proofis done
by considering the last applied rule in the derivation proving C[I] -U-N.
Ifthe last applied rule is (var) then C[.] == XCI [.] ... Cm [.] (m E fiI), so there is
a C k [.] (1 ::::; k ::::; m) discriminating 1 and E with a derivat ion having smaller
size, against the hypothesis that C[.] is minimum.
If the last used rule is (abs) then, either C[.] == AX.C' [.] or C[.] == [.]. In the
former case, C ' [.] would be a discriminating context such that the deriva-
tion of C' [1] -U-N has smaller size than the derivation of C[I]-U-N, against the
hypothesis. The latter case is not possible, since clearly [.] is not a discrimi-
nating context for 1 and E.
Let the last used rule be (head), thus either C[.] == (Ax.Co[.])CI[.] ... C m [.]
(m ~ 1) or C[.] == [.]CI[.] ... Cm [.] (m E fiI). In the former case, the context
C' [.] == Co[.][CI[.]jx]C2 [.] ... Cm [.] would be a discriminating context, such that
the derivation C'[I] has smaller size than C[.], against the hypothesis that
C[.] is minimum. The case C[.] == [.]CI[.] ... Cm[.]leads to a similar contra-
diction. In fact, in this case CI [.] ... C m [.] would be a discriminating context
"smalIer" than C[.].
The case C[I]lIN and CrE] -U-N is symmetric. D
Theorem 6.2.10 shows that the N-operational semantics is fully exten-
sion al (see Sect. 1.3).
L E [(A, A-LHNF) is the evaluation reIat ion studied in this section; it is the
universal evaluation relation U1_LHNF'
The L-operational semantics models the so-called lazy evaluation in a call-
by-name parameter passing environment. It is characterized by the fact that
a A-redex is never reduced in case it occurs under the scope of an abstraction.
This behaviour is similar to that of the real (call-by-name) programming lan-
guages, where the body of a procedure is evaluated only when its parameters
are supplied.
82 6. Call-by-Name Operational Semantics
(i) L E E(A, A-LHNF) is the evaluation relation induced by the formal sys-
tem proving judgments of the shape
M.JJ..LN
where MEA and NE A-LHNF. It consists of the foUowing rules:
m20
- - - - - - - - - - (var)
xM1 ... Mm.JJ..L xM1···Mm
- - - - - - (Iazy)
>..X.M.JJ..L >..x.M
P[Q/x]M1... M m .JJ..L N
- - - - - - - - - (head)
(>"x.P)QM1... Mm.JJ..L N
(ii) M jL N if and only ii, for aU contexts C[.] such that C[M], C[N] E AO,
(C[M] .JJ..L implies C[N] .JJ..L ).
- - - - - - - (Iazy)
>..y.DD .JJ..L >..y.DD
- - - - - - - - - (head)
(>..xy.x)(DD) .JJ..L >..y.DD
The following theorem proves that the system L characterizes completely
the class of A-Iazy head normal forms.
We will prove that the AA-calculus is not complete with respect to the
L-operational semantics by using a syntactical characterization of L-relevant
context.
Proof. (=» Assume that C[.] is L-relevant; namely, there are M, N E AO such
that C[M] JJ.L and C[N] 11'L. By induction on C[M] JJ.L we will prove that
there is a context C / [.] satisfying the statement.
The last applied rule cannot be (var), since C[.] == xC![.] ... Cm [.] (m E N)
is not relevant. If the last applied rule is (lazy) then either C[.] == [.] or
84 6. Call-by-Name Operational Semantics
C[.] == >.z.C"[.]. The first case is immediate; while the second is not possible,
since >.z.C"[.] is not relevant.
If the last applied rule is (head) then either C[.] == [.]C1[.] .. .Gm [.] (m E N)
or C[.] == (>'z.Co[.])Cd.] ... Cm [.] (m ;::: 1). The first case is trivial, while the
second folIows by induction; in fact, the context Co[.][Cd.]jz]C2 [.] ••• Cm [.] is
discriminating M and N and so is L-relevant too.
(~) Let C'[.] be a context satisfying the statement ofthis lemma, so C'[M] JJ..L
if and only if C[M] JJ..L, for each MEA. Thus M == DD and N == >'Xl ... XmZ.z
are witnesses of the L-relevance of C[.]. O
By observing the details of the proof, it is easy to see that, for alI MEA, if
C[M] JJ..L then in the derivation of C[M] JJ..L there are contexts Cd·] , ... , Cm [.]
(m E N) and there is a subderivation proving MC1[M] .. .Gm[M] JJ..L. Note
that the context >.z.[.] is H-relevant nevertheless it is not L-relevant.
Lemma 6.3.7. Let C[.] be L-relevant. If M E AO and C[M] JJ..L then M JJ..L.
Praof. By induction on the derivat ion proving C[M] JJ..L.
The last applied rule cannot be (var), since C[.] == xC1[.] .. .Gm [.] (m E N)
is not relevant. If the last applied rule is (abs) then C[.] == >.z.C'[.] is not
relevant, while the case C[.] == [.] is trivial.
If the last applied rule is (head) then either C[.] == [.]C1[.] .. .Gm [.] (m E N)
or C[.] == (>'z.CO[.])C1[.] ... Cm [.] (m;::: 1). The last case folIows by induction
on Co[M][CdM]jz]C2 [M] ... Cm [M]; so let C[.] == [.]Cd.] ... Cm [.] (m E N). If
M == >.z.M' then immediately M JJ..L, so let M == (>.z.P)QM1 ... M n (n E N).
C[M] JJ..L implies, by rule (head) that P[Q/z]M1 ••• M nCdM] ... C7n [M] -U-L;
since [.]C1[M] .. .Gm[M] is a relevant context (it discriminates DD and M),
by induction P[Q/z]M1 ... M n JJ..L. Thus by applying the rule (head), M JJ..L
folIows. O
6.3.1 An Example
In particular, it folIows that Lo :SL Li. The next goal is to prave the
reverse relation, namely Li :SL Lo.
Let M E AO; it is easyto check that M(>..y.M(>..x.DD) (DD)y)(>..x.DD) -U-L
if and only if LiM -U-L, by rule (head).
86 6. Call-by-Name Operational Semantics
In the second case, the hypothesis that the last applied rule is (head)
implies m 2: 1, and there is a derivation d and a term R such that
By inductive hypothesis,
C1[Lo](C1[Lo](AX.DD)(DD))(AX.DD)C2[Lo]",Cm[Lo].I.l-L
As proved in Property 5.0.3, the set of r-lazy blocked normal forms (r-
lbnf's), namely r-LBNF = {Ax.M I MEA} U {xM1 ... M m IMi EA, m E
N} U {(Ax.P)QM1 ... M m I P,Mi EA, Q rţ r, Q E r-LBNF, m E N}, is a
set of out put values with respect to r. Notice that r-LBNF o = rO.
v E [(r, r-LBNF) is the evaluation relation studied in this section; it is
the universal evaluation relation UF-LBNF' This operational semantics models
the call-by-value parameter passing together with lazy evaluation.
M.l.l-v N
where MEA and NEr -LBNF. It consists of the following rules:
- - - - - - - - - - (var)
xM1 ... Mm.l.l-v xM1 ... M m
- - - - - - (lazy)
Ax.M.l.l- v Ax.M
(ii) M ~y N if and only il, for all context C[.] such that C[M], C[N] E AO,
(C[M] .u.y implies C[N] .u.y ).
The formal system described before, when restricted to closed terms, cor-
responds to the SECD machine introduced by Landin [63], and further stud-
ied by Plotkin [78].
We will prove that the Ar-calculus is not complete with respect to the
V-operational semantics by using the notion of V-relevant context.
7.1.1 An Example
We will show now that Vo ~v VI, where
Vo == >"X.(>"X1X2.DD)(x(>'X1.DD)(>'X1.DD)) ,
VI == >.X.(>'X1X2X3.DD)(x(>'X1.DD)(>'X1X2.DD))(x(>'X1X2.DD)(>"Xl.DD)).
This equivalence was first proved in [44]. The interest of such a result will
be clear when we will study denotational semantics.
Lemma 7.1.11. Let M E AO.
(i) Ii VoM -ll-v then VoM -ll-v >.x.DD.
(ii) liV1M -ll-v then V1M -ll-v >.x.DD.
Proof. Clearly, P E AO and P -ll-v P' imply P' is an abstraction.
(i) Let D 1 == (>'x1.DD) and D 2 == (>'X1X2.DD); thus
d1
1 (iazy)
do MoD 1D -ll-v MI >'x2. DD -ll-v >'x2· DD
1 1 (head)
M-ll-vMo (>'X1X2.DD)(MoD D ) -ll-v >'x2. DD
- - - - - - - - - - - - - - - - - - - - (head)
(>.x.D 2(xD 1D1))M -ll-v >'x2.DD
(ii) Let D 1 == (>'x1.DD), D 2 == (>'X1X2.DD) and D 3 == (>'X1X2X3.DD); thus
do
MJJ-vMo
o
Lemma 7.1.12. Let C[.] be a context such that C[Vo], C[V1] E AO.
(i) Ii C[Vo]-ll-v then :3C'[.] such that C[Vo]-ll-v C'[Vo] and C[V1 ]-ll-v C'[V1].
(ii) Ii C[V1] -ll-v then :3C'[.] such that C[Vo]-ll-v C'[Vo] and C[V1 ]-ll-v C'[V1].
Praof. (i) By induction on the derivat ion proving C[Vo] -ll-v.
(var) This case is not possible, since by hypothesis C[Vo] E AO.
(lazy) C[.] == >'z.Co [.] and C[.] == [.] are both trivial.
(head) Let C[.] == [.]C1[.] ... Cm [.] (m ;::: 1); if m ;::: 2 then by Lemma
7.1.11.(i) it is easy to see that C[Vo]1I'v. In case m = 1, the proof
follows by Lemma 7.1.11. Let C[.] == (>'z.Co[.])CI[.]. ..Gm [.] (m;::: 1),
so by induction on CI [Vo] -ll-v there is CU·] such that CI [Va] -ll-v
C~ [Vo] and CI[V1] -ll-v C~ [VI]. The proof follows by induction on
Co[Vo][C~ [Vo]/ z]CdVo] ... Cm[Vo]-ll-v.
(block) This case is not possible, since by hypothesis C[Vo] E AO.
94 7. Call-by-Value Operational Semantics
Proof. (=;.) Assume C[M] =01) C[)..*x.Mx], so M '---'o )..*x.Mx by definit ion
of ~01)' Clearly )..*u.()..*x.Mx)u =Ll )..*u.Mu, so )..*u.()..*x.Mx)u ~o
)..*u.Mu, since O is a L1-theory, thus )..*x.Mx '---'o )..*u.()..*x.Mx)u too.
Mz ~o ()..*x.Mx)z, since O is a L1-theory. Hence M ~o )..*x.Mx by
op-extensionality. Thus, C[M] ~o C[)..*x.Mx].
({=) Let M '---'o )..*x.Mx, N '---'o )..*x.Nx and Mx ~o Nx, for all
x rţ FV(M)UFV(N). Since O is a L10ry-theory, both M ~o )..*x.Mx and
N ~o )..*x.Nx. Moreover, Mx ~o Nx implies ()..*x.Mx) ~o ()..*x.Nx),
so the proof follows by transitivity of ~o. D
Lemma 8.1.5. Both M '---'H )..*x.Mx and M '---'N )..*x.Mx, for all MEA.
Lemma 8.1.7. M '-'L )..*z.Mz if and only if M -+Â )..x.N, for some NEA.
Proof. (=:}) Assume M does not reduce to an abstraction.
This means that either M -+Â xQ or M -+Â U, where U is a A-unsolvable
term of order o. By correctness, this implies either M ~L xQ or M ~L U.
Let s be a substitution such that s(x) = DD, for aH x.
In both cases, s(xQ) and s(U) are A-unsolvable of order O, therefore
s(xQ) 11'L and s(U) 11'L. On the other hand, s()..*z.Mz) =A )..*z.s(M)z,
so s()..*z.Mz) .u..L, against the hypothesis that M '-'L )..*z.Mz.
C~=) Let M -+Â )..x.N; so )..*z.Mz -+Â )..z.N[z/x] = 0 )..x.N, therefore by
correctness M ~L )..*z.Mz, which implies M '-'L )..*z.Mz. D
r
Proof. (=:}) Assume that M -+ N implies N ţf. r. This means that either
N == xQ for some sequence IIQII > 0, or N == ()..x.P)QR where Q -+r Q'
and Q' (j. r, or M -+r U where U is a r-unsolvable term of order o. We
prove by induction on N that there is a substitution s such that s(N) 11'v.
Let s be a substitution such that Vx E Var, s(x) = )..x.DD E r. The first
and the third cases are obvious: both s(xQ) and s(U) are unsolvable of
order 0, hence s(xQ) 11'v and s(U) 11'v. In the second case, by induction
s(Q) 11'v; so, s(()..x.P)QR) 11'v. In alI cases, s(M) 11'v.
On the other hand, s()..*z.Mz) = )..*z.s(M)z, so s()..*z.Mz) .u..v by rule
(lazy), against the hypothesis that M '-'v )..*z.Mz.
({:::) By definition, r = Var U {Ax.M I MEA}. If M -+r )..x.P' , for some
P', then M =r )..*z.Mz, so M ~v )..*z.Mz and M '-'v )..*z.Mz.
Let M -+r x; for every substitution s : Var -+ rO, it is easy to see
that s(x) E rO and s(M) -+r s(x). By correctness, s(M) .u..v and
s()..*z.Mz) = )..*z.s(M)z E rO, so s()..*z.Mz) .u..v. This implies, by defi-
nition, M '-'v )..*z.Mz. D
8.1.1 Head-Discriminability
• Let us consider the case IIPII = IIYlI· Thus M[P /Y1 -lJ-o and N[P /Y1110, by
correctness. Since M '-../0 )...*x.Mx and N '-../0 )...*x.Nx, )...*x.M[P/Y1x-lJ-o
and )...*x.N[P/Y1x 110. Thus the context ()...Yx.[.])P discriminates Mx and
Nx, namely Mx 'f,o Nx.
100 80 Operational Extensionality
• Let IIPII > IIYllo Then P == PIP2, where IIPIII = IIYlI, and so M[PdY1 P2 -U-o
and N[PdY1P2 11'00 Since X fi. FV(M) U FV(N), ~o is closed under =.<1
and IIP2 11 > O, both (AxoM[PdY1x)P2 -U-o and (AxoN[PdY1x)P2 11'0, and
consequently, by correctness, (AifxoMx)PIP2 -U-o and (AifxoNx)PIP2 11'00
So the context (Aifxo[0])PIP2 is a head context discriminating Mx and Nx,
namely M x ~o N Xo
• Let IIPII < IIYllo Then if == ihif2, where IIPII = Iliflll, and, by .,1-
reduction, Aif20M[PlifIJ -U-o and Aif20N[PlifIJ 11'00 By uniformity, this im-
plies there is a substitut ion s such that s(M[Plifl]) -U-o and s(N[Plifl]) 11'0,
and consequently there is a substitution s' such that s' (M) -U-o and
s'(N) 11'00 Since M '--'o A*xoMx and N '--'o A*xoNx, A*xos'(M)x -U-o
and A*xos'(N)x 11'00 Let FV(M) U FV(N) ~ {ZI, 000' Zk} for some k E N,
and C'[oJ == (AZloooZko[o])S'(Zl)oooS'(Zk)o Then AXoC'[oJ is the context discrim-
inating Mx and Nx, namely Mx ~o Nxo
o
The previous theorem assures us that the notion of operational extension-
ality we defined is meaningful under the hypothesis of uniformityo In fact,
head discriminability means that terms can be discriminated just observing
their applicative behaviour, so by considering them as functions, may be of
arity 00 AH operational theories we considered are head-discriminableo
9. Further Reading
Denotational Semantics
10. ALl-Models
As we will see in the rest of this section, if our aim is to study an op-
erational equivalence then the correctness is the key point. The next lemma
gives us a useful tool for testing the correctness of a model.
Proof. Since the .>..Ll-calculus is correct with respect to ~o, =.::1 implies ~o.
Since "'T M(.::1) coincides with =.::1, the result folIows. D
It is easy to check that T M(A) is not complete with respect to the oper-
ational semantics H, N and L; while T M(r) is not complete with respect to
the operational semantics V. Just take two unsolvable terms of order O, e.g.
DD and (.>..x.xxx)(.>..x.xxx). They are equated in alI the operational semantics
above, while they are different in both T M(A) and T M(r).
108 10. '>'.:1-Models
Remark 10.0.6. In case .d = A and ][)) = lI, our definit ion of the >..d-calculus
model becomes the well-known definit ion of a >.-calculus model. But it looks
different from the original one, given by Hindley and Longo in [50]. In fact,
they ask the interpretation function to satisfy the following six conditions:
1. [x]p = p(x);
2. [M N]p = [M]p o [N]p;
3. [>.x.M]p o d = [M]p[d/x];
4. p(x) = p'(x) for all x E FV(M) ~ [M]p = [M]p,;
5. Y ~ FV(M) ~ [>.x.M]p = [>.y.M[yjx]]p;
6. if [M]p[d/x] = [M']p[d/x] for each d ElI, then [>.x.M]p = [>.x.M']p.
Conditions from 1 to 3 occur identical in our definition. Condition 4 is
more restrictive than the corresponding one in Definition 10.0.1, while con-
ditions 5 and 6 ask that the interpretation be closed by a-equivalence and
>.-abstraction, respectively. Our definition is shorter, and the strengthening
of condition 4 allows one to obtain, as side effect, both the a-equality and
the contextual equality (see Property 10.0.2).
It is an useful exercise for the reader to prove that the two definitions are
equivalent.
The idea of filter >..d-model is based on the notions of type and of type as-
signment system. Types represent properties of terms, and they are expressed
through the language of the implicative and conjunctive fragment of intuition-
istic logic, i.e. the predicate logic with just two connectives, the implicat ion
(--+) and the conjunction (1\), and the constant true (w). For historical rea-
sons, the conjunction will be called the intersection. Intersection types were
first introduced in [27].
Very informally, a term M has the property (]" --+ T if its application
to every term N having the property (]" has the property T, and M has
the property (]" 1\ T if and only if it has both property (]" and property T.
The constant w represents the property of being a term, so it holds for all
terms. A formal description of types is sketched in Sect. 13.1 where types are
interpreted as compact elements of suitable domains.
(JEC =} (J E T(C),
(J, TE T(C) =} ((J --t T) E T(C),
(J, TE T(C) =} ((J 1\ T) E T(C).
(ii) An intersection reIat ion :::; is a preorder relation on T(C), closed under
the following rules:
--(a) ---Ce')
CY:::;w (JI\T:::;T
- - - - - - - - - - - - (d)
(CY ~ T) 1\ (CY ~ 7r):::; CY ~ (TI\7r)
------(g)
(J :::; p, P:::; T
----(t)
CY~w:::;w~w
(v) Given a type system V', the corresponding type assignment system f--~ is
a formal system proving statements of the shape:
B f--~ M: (J
where M is a term, (J E T(C) and B is a basis, i.e a function from Var
to I( C).
B[(J/x] denotes the basis such that B[(J/x](y) = if y == x then (J else B(y).
- - - - - - (var) ----(w)
B[O" / xl f-" x : O" B f-" M: w
Note that ruZes (I\E I ) and (I\Er ) are redundant, since the ruZe (:::::,,).
ExampZe 10.1.2. Let il =< {w}, :::::u'!u > where lu = T({w}) and :::::u is the
least intersection reIat ion such that w :::::u 0", for alI O" E T ({w } ).
It is easy to check that O" c::::u w, for alI O" E T( {w}); in particular, w c::::u w ~ w.
Let Bw be the basis such that Bw(x) = w, for alI x E Var; hence, the folIowing
derivation proves Bw I-u (>.x.xx)(>.x.xx) : w ~ w:
------(w)
Bw I-u DD: w w :::::u w ~ w
----------------(~ll)
Bw I-u DD : w ~ w
It is easy to check that, for every set C of type-constants, it is correct to
choose I(C) = T(C).
Note that if 1(C) =1= T(C) then w rţ 1(C), by the previous lemma.
In the next lemma some useful equivalences between types, true in all
type theories, are proved.
Proof. (i) By rules (b) and (c) of the definit ion of intersection relations.
(ii) By the rule (c) of definit ion of intersection relations, w 1\ rY :::; V rY. On the
other side, rY :::;'17 rY 1\ rY :::;'17 W 1\ rY, by rules (a), (b) and (e) and by the
reflexivity of :::;'17. The proof follows by (t).
(iii) Since rule (d), we need just to prove rY --+ (T 1\ Jr) :::;'17 (rY --+ T) 1\ (rY --+ Jr).
rY --+ (T 1\ Jr) :::; V rY --+ T and rY --+ (T 1\ Jr) :::; V rY --+ Jr by rules (1), (c)
and (c'); thus, rY --+ (T 1\ Jr) :::;'17 (rY --+ (T 1\ Jr)) 1\ (rY --+ (T 1\ Jr)) :::;'17 (rY --+
T) 1\ (rY --+ Jr) by rules (b) and (e). The proof follows by (t).
(iv) Since rule (g), we need just to prove w --+ W S;v rY --+ w, which follows by
rules (a) and (1), and by the reflexivity of :::; v.
(v) Let f.Lo == (rY 1\ T) 1\ Jr and f.Ll == rY 1\ (T 1\ Jr).
f.Lo, f.Ll :::;'17 rY, T, Jr by rules (c), (c') and (t), hence f.Lo 1\ (f.Lo 1\ f.Lo) :::;'17 f.Ll by
rule (e). Thus f.Lo :::;'17 f.Lo 1\ (f.Lo 1\ f.Lo) by rule (b) and then f.Lo :::;'17 f.Ll by
rule (t). The reverse relation can be proved in a symmetric way.
(vi) Both rY 1\ T :::;'17 rY, T and T 1\ rY :::;'17 rY, T by rules (c) and (c'); hence
(rY 1\ T) 1\ (rY 1\ T) :::; V T 1\ rY, and then rY 1\ T :::; V T 1\ rY by rules (b) and (e).
The reverse reIat ion can be proved in a symmetric way.
(vii) By rules (b), (c), (c') and (e). D
The notion of legal type theory, given in the next definition, is a key one,
since we will prove that to be legal is a necessary condition for a type theory
to induce a 'xL1-model.
Definition 10.1.5. Let V' be the type system < G, ::::; V', 1 (G) >.
V' is legal if and only if for alt aEI (G) and T 7=-V' w:
Let V' be a type system < G, ::::;V', I(G) > such that I(G) = T(G) and ::::;V'
is the least inclusion relation: V' is legal.
In case of a legal type theory, rule (f) of the intersection relation defined
in Definition 10.1.1 becomes a double implication. This will be useful in the
following for proving properties of 'xL1-models.
In order to show that a legal type theory induces a 'xL1-model, first some
syntactical properties of a type assignment system induced by a legal type
theory must be proved.
Proof. (i) Immediate, from the definit ion of the type assignment system.
(ii)(~) By rules· (var) and (::::;V').
(=» By induction on the derivation. Note that (---+ 1) and (---+ E) cannot
be used.
(iii) By induction on the derivat ion. Note that 1r E I(G) by Lemma 1O.1.3.(i).
10.1 Filter -XLl-Models 113
Remark 10.1.8. By Lemma 10.1.7.(i), it folIows that the derivat ion of a type
for a closed term is independent from the basis, Le. if M is a closed term
then B f- v M : a implies that B ' f- v M : a, for alI B ' .
Now we are ready to introduce the basic ingredients for defining a filter
model.
Definition 10.1.9. Let'V be the type system < C, :::;'17, I(C) >.
(i) A fllter f an 'V is any set cantaining w and clased under /\ and :::; v,
namely:
114 10. 'xLl-Models
Let .1'(\7) be the set of alt filters on \7, and let I(\7) be the set of filters
containing at least one type belonging to 1 (C).
(ii) Let S be a set of types; '1 S is the filter obtained from S by closing it
under A and ::; v, i. e the least filter containing S.
(iii) Let 0'17 be the binary operation defined on .1'(\7) in the foltowing way:
Note that f E I(\7) and O' ti. I( C) imply O' E f by the conditions on the
set of input types.
The folIowing lemma shows that the definit ion of 0'17 is correct.
The interpretation function will associate ta every term alI the types that
can be assigned to it.
where B cx p means that \Iz E Var B(z) E p(z), and it can be read
as "B agree with p".
Proof. It is easy to see that [M]:(V') is a filter, for alI terms M. The proof
is carried out by verifying the conditions of Definition 10.0.l.
1. We will prove p(x) = {O" E T(O) I::lB cx p such that B f-V' x: O"}.
Let O" E I(O); so, O" E p(x) if and only if ::lB cx p such that B(x) = 0",
which means B f-V' x : O" by rule (var). Note that p(x) E I('\l) implies
that there is J.t E I (O) such that J.t E p( x); if O" ti. I (O) then O" E p( x)
since J.t ::;V' O" by conditions on the input types, hence B f-V' x : J.t implies
B f-V' x : O" by rule (::;V').
2. Let Bo U BI be the basis such that (Bo U BI)(X) = Bo(x) 1\ BI(x).
By using Lemmas 10.1.7.(iii) and 1O.l.7.(vii):
::lBo, BI cx p Bo U BI cx p and }
I {w} U { O" Ţ.V' W ! ::lT E I (O) such that Bo f-V' N : T and =
BI f-V' M : T ---+ O"
t {}
I W U
{,...L
O" -/-V' W
!::lBo, BI cx p
E I(O) suc
h th Bo f-V' N : T
at B l I'V' M : T
and }
=
::J T
::J O"
---+
[>.x.M]:CV') 0V' f =
l' {w} U {T Ţ.V' w I (J E f and (J E I(C) and (J --> T E [>.x.M]:CV')} =
l' {w} U {T Ţ.V' w I (J E f n I( C) and :lB cx p such that B f-V' >.x.M : (J --> T} =
l' {w} U {T Ţ.V' w I :lB cx p such that B[(J/x] f-V' M: T and (J E I(C) and (J E f}
Thus the proof is done, since
{O" I::lE cx p[d/x] s.t. E f-V' M: O"} = {O" I::lE' cx p'[d/y] s.t. E' f-V' M': O"},
in particular, for alI T E I (O)
{O" I::lE cx P[I T/X] s.t. E f-V' M: O"} = {O" I ::lE' cx P'[I T/Y] s.t. E' f-V' M': O"}.
3B cx P s.t. B[T/X] f---\7 M: (J if and only if 3B' cx p' S.t. B'[T/Y] f---\7 M' : (J.
Now we can define the notion of filter >'.1-model (or briefly filter model,
when .1 is either not instantiated Of clear from the context).
Proof. (i) By induction on the context C[.], similarly to the proof ofProperty
1O.O.2.(v).
(ii) B f---\7 M: (J implies (J E [M]:B' where PB(X) =1 B(x), for each x E Var.
But M ~F N implies (J E [N]:B' so ?JB' cx PB such that B' f---\7 N : (J.
It is easy to see that B(x) 'S\7 T E PB(X), so B(x) 'S\7 B'(x), for each
x E Var and, by Lemma 1O.1.7.(iii), B f---\7 N : (J. D
The next property will be very useful in what follows in order to prove
the correctness of some filter models.
Praof. We will prove that the given hypothesis implies the following implica-
tion: Q i;o P implies Q g;F P. If Q i;o P then there is a context C[.] such
that C[Q] -U-o while C[P]1to, which implies, by hypothesis, C[P] LF C[Q],
which in turn implies C[Q] g;F C[P]. 80 Q g;F P by Property 1O.1.13.(i). O
The first filter model for the AA-calculus was built in [10]. A presentation
of a class of filter models, which includes models of both AA-calculus and
Ar-calculus, can be found in [38]; it is less general the that one given in this
book, and it is based on the notion of partial intersection type assignment
system.
11. Call-by-Name Denotational Semantics
In this section, we will introduce a filter model that is fulIy abstract with
respect to the H-operational semantics. By keeping in mind Property 10.1.15
and by observing that if N is A-solvable and M A-unsolvable then M -<H N,
in order to define a model that is correct with respect to the H-operational
semantics, it is sufficient to ask for the property:
By abuse of notation, we will speak about the head variable of a term for
denoting the head variable of its A-hnf.
Example 11.1.2. 1(lx) and 1(>'y.xx) are openly A-solvable, while 1(>'x.xy)
is A-solvable but non-openly A-solvable.
- - - - - - - - - - - (d) ------(9)
(a --+ r) /\ (a --+ 7r) ::;00 a --+ (r /\ 7r) a --+ W ::;00
w --+ W
u ~oo (7', 'T ::;00 T' a' ~(X) a,T ~oo T'
---(r)
a::;oo P P::;oo r
, ,(e) , , (1) ------(t)
a /\ r ::;00 a /\ r (J ---t r ~oo (j ---+ T
a::;oo a a::;oo r
----(hl) ----(h2) ----(h3)
1> ::;00 w --+ 1> W --+ 1> ::;00 1> W::;00
w --+ W
- - - - - - (var)
B[4J/x] f- oo X : 4J
--------«00) (w)
B[Nx] f- oo X : w -+ 4J - B[4J/x] f- oo X : w
( --+E)
B[4J/x] f-CX} xx: 4J
- - - - - - (--+1)
B f- oo D : 4J -+ 4J
In Sect. 11.1.1, the intersection reIat ion :Soo is extensively studied.
11.1 The Model 1t 121
Property 11.1. 7.
(i) Let M be openly A-solvable and let z be its head variable. If B is the
basis such that B(z) = <jJ, then B 1--00 M : <jJ.
(ii) Let M = AXI ... Xn.zMI ... Mm (m, n E N). If B 1--00 M : <jJ then M is
openly solvable.
(iii) If M =A AXI .. ,Xn,XkMI ... Mm (1:S k:S n), then for all bases B:
• B 1--00 M : <jJ -> ... -> <jJ, for every p such that k + 1 :S p :S n + 1;
'-.,-'
p
• B li00 M : <jJ -> ... -> <jJ, for any p :S k.
'-.,-'
p
B[W/XI, ... ,w/xnl 1--00 z: <jJ and B[W/XI' ... ,w/xnl 1--00 z: ~ -> <jJ,
m
B[<jJ/XI, ... , <jJ/xp ,w/xP+1, ... , w/xnl 1--00 XkMI ... Mm : <jJ,
Hence, by rule (---t 1), B r- oo AXl",Xn.XkMl ... Mm : cjJ ---t •.• ---t cjJ ---t cjJ.
~
p
A derivat ion assigning to M a type of the shape cjJ ---t .•• ---t cjJ ---t cjJ, with
~
p
p < k cannot exist, since the only possibility to derive it would be to as-
sign to Xk a type equivalent to w, and in this case only a type equivalent
to w can be assigned to M. O
By using the type assignment system, we can easily prove that the A-
theory induced by the model 'H is a A1']-theory.
Proof. The theory induced by 'H is a A-theory by Corollary 10.0.3, since 'H is
a AA-model by Theorem 11.0.1. In order to prove that it is aIso a A1']-theory,
by Property 2.1. 7, it is sufficient to prove that I '""H E. We will prove both
I [;;;H E and E [;;;H I.
(I [;;;H E) We will prove that B r- oo I : (J implies B r- oo E: (J.
By Property 11.1.36.(i), either (J '::::'.00 W or (J '::::'.00 (Ja 1\ ... 1\ (Jn (n 2: O)
such that 'Vi ~ n, (Ji '::::'.00 71 ---t •.• ---t 7:n
i ---t cjJ for some mi E N. The case
- - - - - - - (var)
r
B[J.L/x][v/y] oo x: J.L J.L::;00 V ---+ T
- - - - - - - - - - - - - - - (:S=) (var)
B[J.L/x][v/y] r oo x: V ---+ T
V B[J.L/x][v/y] r oo y:
-----------------------(~E)
B[J.L/x][v/y] oo xy : Tr
- - - - - - - - - (~I)
r
B[J.L/x] oo Ay.XY : V ---+ T
- - - - - - - - - (~I)
r J.L ---+ V ---+ T ::;00 a
B oo AXY.XY : J.L ---+ V ---+ T
---------------------(:S=)
B r oo AXY.XY : a
- - - - - - (var)
B[J-l/x]
f- oo x : J-l
-+ T J-l :::;00 v
---------------(~=)
B[J-l/x]
f- oo -+ T X:v
- - - - - - - - - (-tI)
B f- oo AX.X : J-l -+ V -+ T J-l -+ V -+ T :::;00 a-
---------------------(~=)
B f- oo AX.X : a-
Hn ~ 1 then the proof follows by inductive hypothesis. D
Property 11.1.10. The type assignment system f--- 00 is closed under = An.
Proof. Easy. D
Property 11.1.14. (i) For every A, there is a term M such that A E A(M).
(ii) If M =A N then A(M) = A(N).
Proof. (.ţ::) We will prove that, if A « A', then B f-- 00 A : a implies B f-- 00
A' : a, by induction on the definition of «. If A == a, then a == w and
the proof is trivial, by rule (w). Otherwise, let A ="1 AXl ... Xn.zAl ... Am and
A' ="1 AXl ... Xn.zA~ ... A~ and Ai« A~ (1::::: i::::: m). By Property 11.1.36.(i),
either a ~oo w or a ~oo ao/\ .. ·/\ak (k ~ 1), where ai ~oo 71
-+ ... -+ 7t
-+ rjJ
(h i E N,i ::::: k). The case a ~oo w is trivial; so let a ~oo 0'0/\ ... /\ ak (k ~ 1).
126 11. Call-by-Name Denotational Semantics
(==» By the semiseparability theorem, A 1:.. A' implies there is a context C[.]
such that C[A] -Ân 1 while C[A'] -Ân n. By Property 11.1.10, this implies
C[A] !l1t C[A'], which in turn implies A !l1t A'. D
The correctness of the model 11. with respect to the operational semantics
H alIows us to transfer some results from the denotational world to the
operational one. So some interesting properties of H can be proved. The
reader can see that the approximation theorem is a quite useful tool.
Corollary 11.1.23. The H-operational semantics is fuUy extensional.
Proof. By correctness and Property 11.1.8. D
The next theorem proves a key result, which implies directly the fulI-
abstraction of the model 11. with respect to the H-operational semantics. It
proves that, if M !;?;1i N, then there is a context H-discriminating them.
Its proof uses the semiseparability property between approximants, namely
if M !;?;1i N then it is possible to find two approximants A E A(M) and
A' E A(N), such that A 1;:. A' and the context discriminating M and N is a
minor modificat ion of the context semiseparating A and A'.
Theorem 11.1.25 (li-Discriminability).
II M !;?;1i N then there is a context C[.] such that C[M], C[N] E AO and
C[M]-U-H while C[N] ltH.
128 11. Call-by-Name Denotational Semantics
Roughly speaking, two terms M and N are in the reIat ion G;k if there are
two terms M' =A1] M and N' =A1] N, having the same structure "up to level
k". So, if Vk ~ 0, M "'k N, any structural difference between them is pushed
to the infinite.
The next theorem proves an unexpected result. It has been proved that the
H-operational semantics is fully-extensional, Le. it is closed under 1]-equality.
We will prove now that it also equates terms being differents for an infinite
number of 1]-reductions.
Let Eoo == Y(Axyz.y(xz)) where Y is a call-by-name fixed point operator.
Observe that, if MEA then EooM =A Az.M(Eooz) =A Az.M(AZl.Z(Eooz1))
=A Az.M(Azl.Z(AZ2.Z1(EooZ2))), and so ono So z can be viewed as obtained
from Eooz by means of an infinite number of applications of the 1] -reduction
rule. We will prove that EooM ~H M.
Proof. We prove 1 "'11. Eoo; the result follows from A-reduction and correct-
ness. Clearly A(I) = {n, AX.X}. Moreover, it is straightforward to check that
A(Eoo) = {n, AZOZl.ZOn, AZOZl.Zo(AZ2.Z1( ... (AZn+l.Znn) ... )) I n ~ O}.
(Eoo [;11. 1) It is immediate to check that every A E A(Eoo) is such that
A ~ 1. Thus the proof follows from Lemma 11.1.18 and from the 'J-i-
approximation theorem.
(I [;11. Eoo) It is easy to see that 1 [;k Eoo, for all k. Then the prooffollows
from the 'J-i-characterization theorem. D
EooM has no normal form, also when M has a normal form. So a term
with normal form is always H-operationally equivalent to a term without nor-
mal form. A syntactical proof of the H-equivalence between the two terms 1
and Eoo was done in [36].
n11. ={ (T E
T(C )IO'==O'OÂ ..... ÂO'n(n~O)SUchthat
00 Vi::; n either O'i == W, or O'i == 7ri - t Ti and Ti ~oo W
}
.
Proof. Note that w ~oo O' if and only if w ::;00 0', by the rule (a).
{::: We will prove that O' E n11. implies w ::;00 0', by induction on n. Let n = O.
If 0'0 == w then the proof is trivial; otherwise, 0'0 == 7r - t T and T ~oo w.
Hence w ::;00 w - t W ::;00 7r - t T, respectively, by rules (h3), (1) and (a);
by rule (t), the proof follows.
Let n ~ 1 and O' == 0'0 Â ..... Â O'n; so Vi ::; n w::;oo O'i by induction. So
(d) (fl -- p) /\ (fl -- 7r) E [21-l implies p,7r '::::'00 W by definit ion of [21-l, so
w :<:;00 w /\ w :<:;00 p /\ 7r, by rules (b) and (e); hence p /\ 7r '::::'00 W and
fl -- (p /\ 7r) E [21-l.
(e) Let fl :<:;00 fl' and 7r :<:;00 7r'; fl /\ 7r E [21-l implies fl,7r E [21-l, so
fl' ,7r' E [21-l by induction; hence fl' /\ 7r' E [21-l.
(1) Let fl' :<:;00 fl and 7r :<:;00 7r'; fl -- 7r E [21-l implies 7r '::::'00 w, hence
w :<:;00 7r :<:;00 7r' implies 7r' '::::'00 W; thus, fl' -- T' E [21-l by definit ion
of [21-l.
(g) trivial, since w __ w E [21-l.
(r), (t), (h3) Easy.
(h1), (h2) Not possible.
Then the proof is done, since O" '::::'00 W implies w :<:;00 0", and therefore
w E [21-l implies O" E [21-l. D
As a corollary, we can prove that :<:;00 is well posed, in the sense that it
does not equate different type constants in C oo •
Proof. By induction on 0". If O" == w then the proof is trivial, by rule (a). If
O" == cp then the proof is trivial, by rule (r). If O" == 0"0 /\ 0"1 then cp :<:;00 O"i
(i :<:; 1) by induction, thus cp :<:;00 cp /\ cp :<:;00 0"0/\ 0"1, by rules (b) and (e). If
O" == 0"0 -- 0"1 then cp :<:;00 0"1 by induction, and 0"0 :<:;00 w by rule (a); thus
Theorem 11.1.35. Let.p1-l = Um2:0 .p~, where .p'{j = {cp} and, for m E N,
O" '::::'00 cp if and only if O" E .p1-l, for aU O" E T(Coo )'
Proof. Note that O" '::::'00 cp if and only if O" :<:;00 cp, by Lemma 11.1.34. Moreover,
it is easy to check that
rp.
---------- rp
a ~oo TI ---> •.• ---> T n ---> W ---> ••. ---> W --->
p
TI ---> ••• ---> T n ---> rp ~oo TI ---> •.• ---> T n ---> W ---> rp
so the proof follows by induction on p. o
132 11. Call-by-Name Denotational Semantics
The next property implies the legality of 00. Let us notice that every type
in T(Goo ) has the following syntactical shape:
(iTI ---+ Td A '" A (iT n ---+ Tn ) A CI A ... A Cm where m, n ~ 0, m +n ~ 1,
where Ci E {W, <,b} (1 :.::; i :.::; m). Moreover remember that every constant in
Goo is equivalent to an arrow type; indeed, W c::: oo W ---+ W and <,b c::: oo w ---+ <,b.
Property 11.1.37. Let m, n,p, q ~ 0, m +n ~ 1, p + q ~ 1, and
(iTI ---+ TI)A ... A(iTn ---+ Tn)AcIA ... ACm :'::;00 (iT~ ---+ TnA ... A(iT~ ---+ T;)AdIA ... Adq
where ci,dj E {W,<,b}, Ci C::: OO iTn+i ---+ Tn+i and dj c::: oo iT~+j ---+ T;+j
(Tn+i, T;+j E {w, <,b}, 1 :.::; i :.::; m,1 :.::; j :.::; q). If T~ '1. W (1 :.::; h :.::; p + q),
then there is {il, ... , id ~ {1, ... , n + m} such that iTi! A ... A iTik ~oo iT~,
Ti! A ... A Tik :'::;00 T~ and Tj '1. w, for each j E {iI, ... , ido
Proof. We reason by induction on the last rule of the derivat ion proving
(iTI ---+ TdA ... A(iTn ---+ Tn)AcIA ... Acm :'::;00 (iT~ ---+ TnA ... A(iT~ ---+ T;)AdIA ... Adq •
(a) Trivial, since w c::: oo w ---+ w makes the implicat ion empty.
(g), (h3) Trivial, since w ---+ w makes the implicat ion empty.
(b), (c), (Ci), (d), (r), (hl), (h2) Immediate.
(e), (f) By induction.
(t) Let pE T( Goo ) be such that (iTI ---+ Td A ... A (iT n ---+ Tn ) ACI A ... ACm :'::;00 p
and p :'::;00 (iT~ ---+ T{) A ... A (iT~ ---+ T;) A d l A ... A d q . p must be of the
shape (/-lI ---+ vd A ... A (/-lt ---+ Vt) A el A ... A e s , where ei E {w, <,b} and
ei C::: oo /-lt+i ---+ Vt+i (Vt+i E {w, <,b}, 1 :S i :S s). By induction, for ev-
ery h such that T~ '1.00 w, there is {i~, ... , i~J ~ {1, ... , t + s} such that
/-li~ A ... A/-li~h ~oo iT~, Vi~ A ... AVi~h :'::;00 T~ and vi7 '1. w, for alll :.::; j :.::; k h .
By induction, for every Vih, J
there is {r~,j, ... , r~,j}
h,l
~ {1, 2, ... , n + m}
such that iT h,j A ... A iT h,j ~oo /-lih and T h,j A ... A T h,j :'::;00 vih and
Tl TWh,j ) Tl TWh,j J
Tr~,j '1. w, for all 1 :.::; u :.::; Wh,j' So the proof follows by rule (e). O
B f- oo M: u implies ApP1i(B,u,M).
We will build the proof in two steps. First, it will be proved that:
B f- oo M: u implies Comp1i(B,u,M), (11.1)
and then
Comp1i(B, u, M) implies ApP1i(B, u, M), (11.2)
where ComP1i(B, u, M) (read: the term M is computable of type u with
respect to a basis B) is a property of the triple < B, u, M >. We will prove
Eq. (11.1) by induction on terms and Eq. (11.2) by induction on types.
A basis B is finite if and only if B(y) c::: oo w except in a finite number of
variables. We will use [Ul/XI, ... , un/xnl to denote a finite basis. By Lemma
1O.1.7.(i), in this section we limit ourselves to consider only such a kind of
basis.
Let B and B' be two basis. B u B' denotes the basis such that, for every
x, B U B'(x) = B(x) 1\ B'(x) (remember that, for every type u, u 1\ w c::: u).
Note that ComP1i(B, q;, M) implies ApP1i(B, q;, M), as a particular case.
Lemma 11.1.40. Comp1i(B,u,M) andM =A M' imply Comp1i(B,u, M'),
i.e. ComP1i is defined modulo =A on terms.
(=}) Let us prove that B f---(X) M: a implies B f---(X) A: a, for some A E A(M)o
Clearly COmp'H([T/X],T,X), by Lemma 11.1.41.(i)0
Let FV(M) ~ {Xl, .. o, Xn}, SO we can assume B = [al/xl, .. o, an/Xn]
without loss of generality, by Lemma 1001.70(i)0 Hence B f---(X) M : a and
Comp'H([ai/Xi], ai, Xi) (1 :s; i :s; n) imply Comp'H(B, a, M) by Lemma
11.1.430 Thus by Lemma 11.1.41.(ii) and the definit ion of approximant,
the proof is doneo
(-{=) We must prove that B f--- (X) A : a for some A E A( M) implies B f--- (X)
M : ao By definition, there is M' such that M =A M' and A matches
M' except at occurrences of Do A derivation of B f---(X) A : acan be
transformed into a derivation of B f---(X) M' : a, simply by replacing every
subderivation
136 11. Call-by-Name Denotational Semantics
-----(w) -----(w)
by
Br-ooD:w Br-ooN:w'
where N is the subterm replaced by D in M'. B f- 00 M' : (J" implies
B f- 00 M : (J", since the type assignment system is closed under = A on
terms, as a consequence of the fact that it induces a AA-model, and the
proof is given.
•
11.1.3 Proof of Semiseparability, 1-l-Discriminability and
1-l-Characterization Theorems
(ii) A <;te A' if and only if one of the following cases arises:
(a) A -=j. D and A' == D;
(b) A =1) AXl ... Xn.xAl ... Am, A' =1) AXl ... Xp.yA~ ... A~ and, either x -=j. y
or I n - m 1#1 p - q 1;
(c) c == j,c' , A =1) AXl ... Xn.xAl ... Am, A' =1) AXl ... Xn.xA~ ... A~ and
Aj <;tc' Aj (1 ::; j ::; m).
Two approximants A and A' are structurally different in a path c if A <;tc A'
is proved without using rule (a), they are structurally similar in a path c if
and only if A <;tc A' is proved using rule (a).
Proof. The proof is quite similar to the proof of Lemma 2.1.15, by replacing
A-NF by A and Ţ.c by f::-c.
(i) By induction on A.
(ii) By induction on c. o
Now we can prove that the algorithm is correct and complete.
138 11. Call-by-Name Denotational Semantics
The rules of the system proving statements A, A' ~D C[.], are the following:
- - - - - - - - - - - (D1)
xA1 ... A m, n ~D (AX.[.])om
- - - - - - - - - - - - - - - (D2)
AXl ... Xn.xAl ... Am, n ~D C[[,]Xl ... Xn]
n<m
---------------------(D5)
XAl ... Am'xA~ ... An ~D (AX.[.])Om 1.. ... 1 KIn
'-v-"
m-n-2
m<n
--------------------(D6)
XAl ... Am'xA~ ... A~ ~D (AX.[.])on KnI L.:;!.-
n-m-2
x f- FV(Ak) U FV(AD
Ak <ţ:. A~ Ak, A~ ~D C[.]
r-m
The proof is given by induction on the pair (A, a) endowed by the lexico-
graphic order, where a is a type of the considered grammar. If a == W then
the proof is trivial. If a == al 1\ ... 1\ ak for some k ~ 1 then the proof folIows
by induction. Thus, let A =ţ. [2 and a == al ----+ ••• ----+ ak ----+ ep for some k ~ 1.
• Let A == XAI ... Am for some m E N.
Clearly [2 E A(N) and A 1::-c [2, for alI paths e; but [2 is not maximal along
e in A(N), by hypotheses. Namely, there is A' E A(N) such that [2 «~ A',
i.e. A' =ţ. [2, by definit ion of «~. 80, there is n ~ max{ k, m} such that
A =1] >'YI···Yn.xAI··.AmYI···Yn and A' =1] >'YI· .. Yn.xA~ ... A~+n E A(N)
by hypothesis (a). ActualIy, alI approximants of N but [2 have the shape
of A'; furthermore, N =111] >'YI ... Yn.xNI ... Nm+n by Property 1l.1.20.(iii),
where A~ E A(Ni ) (1 ::; i ::; m + n). There are two cases.
- Let k > m. 80 B f- oo >'YI ... Yn.xAI ... AmYI ... Yn : ao ----+ ••• ----+ ak ----+ ep, by
Property 11.1.8. By Property l1.1.36.(ii),
n-k
By Lemma 1O.1.7.(vi)
n-k
11.1 The Model 1{ 141
Example 11.1.53.
A(Eexo ) = {D,AZOZl.ZoD,AZOZl,Zo(AZ2,Zl( ... (AZn+!,znD) ... )) In 2: O}.
It is easy to see that 1 1:. A', for all A' E A( E exo ).
Let An == AZOZl,Zo(AZ2,Zl( ... (AZn+l,ZnD) ... )), therefore An «~ An+! where
e == 1.. ... 1. It is easy to see that B f--- exo 1 : a implies that there is A E A(Eexo )
'-v-"
n
such that B f--- exo A: a, by the previous property.
This agrees with the Theorem 11.1.31.
The next lemma shows that, if M g1{ N, there are always two approx-
imants of them which are the "witness" of the difference between M and
N, and such that the context semiseparating the two approximants can be
transformed in a context descriminating the two terms.
Lemma 11.1.54. M g1{ N implies that there are two approximants A E
A(M) and A' E A(N), and a path e such that A l:.c A', and either A and
A' are structurally different in c, or A' is maximal along e in A( N).
142 11. Call-by-Name Denotational Semantics
Praof. M gH N means that there are a basis B and a type a such that
B f- oo M : a while B 1100 N: a. By the approximation theorem, this means
that there is A E A(M) such that B f- A : a, while there is not A' E A(N),
such that B f- A' : a. This implies: A <j;;.. A', for aU A' E A(N).
The proof foUows by Property 11.1.52. D
({=) It is easy to check that M x has A- nf if and only if M has A-nf, so the
proof is done since x is a A-pnf. D
So the class of A-normal forms and the class of A-persistent normal forms
are mutually closed under application.
We will take the set of constants C~ = {4>,,,p, w} and we will use the
type constants 4> and "p, for characterizing respectively the class of A-normal
forms and the class of A-persistent normal forms. Since a A-persistent normal
form is a A-normal form too, it must be that "p ::; 4>. Moreover, by definition
of A-persistent normal form, it must be that "p '::::: 4> ---+ ••• ---+ 4> ---+ "p, and
~
n
4> '::::: "p ---+ ••• ---+ "p ---+ 4>, for aH n ~ 1, by Property 11.2.3 (n E N). We want
'-v--'
n
also w '::::: W ---+ w, since aH terms must have a functional behavior.
------------(d) ------(9)
(a --> T) /\ (a --> 71") :::;.., a --> (T /\ 71") a --> W :::;.., W --> W
Note that 4> ':::::~ "p ---+ 4>, "p ':::::~ 4> ---+ "p and w ':::::~ W ---+ w. Some key
properties of the ~-intersection reIat ion are shown in the Sect. 11.2.1.
We will prove that the type assignment system f- w characterizes the terms
having normal form. Let B'ljJ be the basis assigning 'lj; to each variable; the
typing B'ljJ f- w M : cjJ can be proved if and only if M has A-normal form. So
the correctness of N with respect to the N-operational semantics follows by
Theorem 10.0.4.
- - - - - - - (var)
B[ţL/x][v/y] f--~ x: ţL ţL::;~ V -> T
- - - - - - - - - - - - - - - (:S",,) - - - - - - - (var)
B[ţL/x][v/y] f--~ x: V -> T B[ţL/x][v/y] f--~ y: V
------------------------(~E)
B[ţL/x][v/y] f--~ xy : T
- - - - - - - - - (~I)
B[ţL/x] f--~ Ây.xy : V -> T
- - - - - - - - - (~I)
B f--~ ÂXY.XY : ţL -> V -> T ţL -> V -> T ::;~ (]"
---------------------(:S"")
B f--~ Âxy.xy : (]"
Let B1j; be the basis such that B(x) = 1/J, for alI x E Var, as in Lemma
11.2.7; moreover, let Bw be the basis such that Bw(x) = w, for alI x E Var.
Lemma 11.2.11. (i) B1j; f-~ M : </> if and only if M has A-normal form.
(ii) B f-~ M : a and a ~~ w if and only if M has a A-head normal form.
Proof. (i) ('*) By the approximation theorem, B1j; f-~ M : </> implies there is
A E A(M) such that B1j; f-~ A : </>. We will prove that A does not contain
occurrences of D, by induction on A. Hence M has A-normal form, by
Property 11.2.10.
A == D is not possible, since types derivable for Dare equivalent to w.
If A == AXI",Xn.zAI ... Am and B1j; f-~ A : </> then, by rule (::;~), B1j; f-~ A :
1/J ---7 •••• ---7 1/J ---7 </>, and thus B1j; f-~ zAI ... A m : </> by Lemma 10.1.7.(vi).
~
m
By Lemma 10.1.7.(vii) this implies both (*) B1j; f-~ z : al ---7 ••• ---7 am ---7
</>, and (**) B1j; f-~ Ai : ai, for some al, ... , am (1 ::; i ::; m). (*) implies
1/J ::;~ al ---7 ••• ---7 am ---7 </> by Lemma 1O.1.7.(iii) and so ai ::;~ </>, since 1><1
is legal and 1/J ::::o~ </> ---7 ••• ---7 </> ---7 1/J.
"--v--"
m
Hence B1j; f-~ Ai : </> (1 ::; i ::; m), by rule (::;~). By inductive hypothesis
Ai (1 ::; i ::; m) has no occurrences of D and the proof is done.
80 Bw [J1 / z] f-~ M : w ---7 ••• ---7 W ---7 1f, since the type assignment system
~
n
is closed under =A. If z == Xk for some k ::; n then, it is easy to see that
B w f- ~ M : w ---7 • • • ---7 W ---7 (w ---7 • • • ---7 W ---7 1f) ---7 W ---7 • • • ---7 W ---7 1f,
~~ ~
k-l m n-k
(i) A == n;
(ii) A=.,., AXl",xn.zAl ... Am and A' =.,., AXl".xn.zA~ ... A~
and Ai « A~, for alI i (1 ~ i ~ m), for some n, m E N.
Proof. ({:::) We prove that, if A « A', then B f-~ A : a implies B f-~ A' : a.
The proof is by induction on the definit ion of «, and it is similar to the proof
of the (~) part of the proof of Lemma 11.1.18, where, instead of Properties
11.1.36.(ii) and 11.1.8, Properties 11.2.27.(ii) and 11.2.8 must be respectively
used.
(~) We prove, by contraposition, that A 1:. A' implies A fl:.N A'.
By the semiseparability theorem (Theorem 11.1.17), A 1:. A' implies there
is a context C[.] such that C[A] ---tÂn I while C[A'] ---tÂn n. Since the type
assignment system is closed under =An, this implies C[A] fl:.N C[A'], which
in turn implies A fl:.N A'. O
Now we are able to prove the correctness of the model, with respect to
the N-operational semantics.
Proof. B", f-~ M : 'ljJ implies B", f-~ M : cp ---t .•. ---t cp ---t 'ljJ (n E N) by rule
""'---.....--
n
(~~). Let N be a sequence of normal forms, so by Lemma 11.2.11 B", f-~
N : cp, for every NE N. Hence B", f-~ MN : 'ljJ implies, by rule (~~), that
B", f-~ M N : cp, and so M N has a normal form. O
150 11. Call-by-Name Denotational Semantics
Using the same techniques as for model H, we can use the correctness of
the model N with respect to the N-operational semantics for proving some
of its properties. The proofs of the folIowing properties can be easily carried
out in a similar way to the analogous properties for model H.
Corollary 11.2.21. M r:N N if and only ifVA E A(M), ::lA' E A(N) such
that A r:N A'.
First, let us prove that ::;[><1 is well posed, i.e. different type constants in C[><I
are not ':::0[><1. The folIowing theorem characterizes the syntactic shape of types
that are ':::0[><1 W.
Note that CYI --+ ... --+ CYn --+ W ':::0[><1 W, for alI CYI, ... ,CYn (n E N).
Corollary 11.2.24. (i) 4> 7:[><1 w,
(ii) ~7:[><Iw.
152 11. Call-by-Name Denotational Semantics
Proof. For proving both points, it is sufficient to observe that both <jJ and 'l/J
do not belong to the set nN. D
In order to prove that <jJ ;i'1Xl 'l/J, we need the foUowing lemma.
Lemma 11.2.25. a E I:pN and T ~1Xl a imply TEI:pN, where
IJIN _ {
- a E
T(G) la
== ao A ..... A an (n E N), where
lXl::li ~ n such that ai == ?fI -+ ..• -+ ?fhi -+ 'l/J (h i E N)
}
.
Proof. By induction on the definit ion of ~1Xl. If the last applied rule is either
(b), (c), (c'), (r), (nI) or (n2) the proof is obvious.
If the last applied rule is (f), then T == I-L -+ v and a == p -+ ?f, where p ~1Xl I-L
and v ~1Xl ?f; so, by induction, v E IJIN, which implies T E IJIN.
Cases (t) and (e) foUow easily by induction. AU other cases are not possible. D
Note that a E IJIN does not imply a ~1Xl 'l/J.
The following lemma implies the legality of ~. Note that a type in T( C IXl )
has the following syntactical shape:
where Cj E {cp,'Iji} (1 ::; j ::; m). Moreover, let us recall that every constant
in C IXl is C::::1Xl to an arrow type, indeed w c:::: w -7 w, cp C::::1Xl 'Iji -7 cp and
'Iji C::::1Xl cp -7 'Iji.
where ci,dj E {w,cp,'Iji}, Ci C::::1Xl O"n+i -7 Tn+i and d j C::::1Xl /-lp+j -7 vp+j
(Tn+i,T;+j E {w,cp,'Iji}, 1::; i::; m, 1 ::; j::; q). If T~ 7'1Xl w (1 ::; h::; p+ q),
then there is {il, ... , ik} ~ {1, ... , n + m} such that O"i1 1\ ... 1\ O"ik 21Xl O"~,
Ti1 1\ ... 1\ Ti k ::;1Xl T~ and Tj 7' w, for each j E {il, "', ido
Proof. We reason by induction on the last rule of the derivat ion proving
Also in this case, the proof is very similar to the proof of the approximation
theorem for the model 1i. We will show here just the differences with respect
that proof.
In order to prove the ({=) part of the theorem, we need to prove the
following implication:
B f- M M : a =} ApPN(B, a, M).
We will huild the proof in two steps. First, it will he proved that
(11.3)
and then
It can he proved that CompN is defined modulo =A, as for the model1i.
11.2 The Model N 155
Lemma 11.2.33. Let FV(M) ~ {Xl, ... , Xn } and B = [O"dXI, ... , O"n/Xn].
Ii CompN(B i , O"i, Ni) (1 ::; i ::; n) and B f-1><1 M : T then
({:::) By definition, there is M' such that M = A M', and A matches M' ex-
cept at occurrences of il. A derivat ion of B f--~ A : acan be transformed into
a derivation of B f--~ M' : a simply by replacing every subderivation
----(w) by ----(w)
B f--~ il: w Bf--~N:w '
where N are the subterms replaced by il in M'.
B f--~ M' : a implies B f--~ M : a, since the type assignment system is closed
under = A on terms, as a consequence of the fact that it induces a AA-model,
and the proof is given. •
In this section we use the notion of path c and of the relation «c between
approximants, as defined in Sect. 11.1.3. Moreover, a minor modificat ion of
the semiseparability algorithm presented in Fig. 11.2 (pag.138) is introduced.
Let M and N be two terms such that M "l:..N N; it is always possible
to find two approximants A E A( M) and A' E A( N) and a path c such
that A %:.C A', and the context C[.] such that A,A' ~D C[.] can be easily
transformed in a context N-discriminating M and N.
In order to choose the correct approximants, we use the next definition.
- - - - - - (var)
B[a/x] f-~ x: a
B[f.,L/x] f-~ A : v
- - - - - - - (-->I)
B f-~ Ax.A : f.,L - v
So N =A'1 xN1 ... N m+ 1 and A~ E A(Ni ) (1 ::; i ::; m + 1). Note that, for
Ai and every A~ E A(Ni ), the conditions ofthe theorem are satisfied. So,
by induction, B f-~ Nm+l : T and B f-~ xN1 ... N m : T - a. So, by rule
(- E), B f-~ xN1 ... NmNm+l : a, and the prooffollows by the fact that
typings are preserved by = AI'/"
(AI), (AE), (::;~) The proof follows directly from the inductive hypothesis.
(w) Trivial. O
Lemma 11.2.39. Let M rzNN. Then there are A E A(M), A' E A(N) and
a path c such that A 1C-c A', c is defined on A, A' and one of the following
conditions holds:
1. A and A' are structurally different in c;
2. A' is maximal along c in A( N);
3. c is deep on A but c is not deep on A", for all A" E A( N).
Proof. M rzN N implies there are B, a such that B r-IXI M : a while B IfIXl
N : a. By the N-approximation theorem, this means there is A E A(M) such
that B r-IXI A : a. Then, by Property 11.2.36, there are three cases.
1. There is A' E A(N) such that A 1C-c A', and A and A' are structuralIy
different along c. Then A and A' are the desired approximants.
2. There is A' E A(N) such that A 1C-c A', and A and A' are structuralIy
similar along c, and A' is maximal along c in A( N). Then A and A' are
the desired approximants.
3. Otherwise, c is deep in A and not deep in A", for alI A" E A(N) . So each
A" such that A 1C-c A" and c is defined on A" can be chosen. O
Let A, A' be approximants such that A </:-c A' and r 2': max{args(A), args(A' )}.
The rules of the system proving statements A, A' ~ N C[.], are the following:
--------------(D2)
AXI ... Xn.XAI ... Am, S? ~N C[[.]XI ... Xn]
n<m
-------------------(D5)
XAI ... Am'XA~ ... An ~N (AX.[.])Om 1 .... .! K1S?
'--..-"
m-n-2
m<n
-------------------(D6)
XAI ... Am'XA~ ... A~ ~N (AX.[.])On 1 ..... 1 KfU
'--..-"
n-m-2
Xo1=y
---------------------(D7)
XAI ... Am'yA~ ... A~ ~N (Axy.[.])(AXI ... Xm.1)(AXI ... Xn.S?)
r-m
for aH M, N, if M -U-L (Le. it has A-lazy head normal form) and N 1fL
(Le. it has not A-lazy head normal form) then N Ce M.
is correct with respect to the L-operational semantics.
So we define a legal type theory, say L., based on a set of constants C L
such that, for every M with A-lhnf and N without A-lhnf, there is a basis
B and at least one type a such that B f- L M : a while not B f- L N : a.
Since terms without A-lhnf are aH and only the A-unsolvable terms of order 0,
foHowing the same approach as for the previous two models, it seems natural
to characterize them by assigning them only type w. Let us recall that L
induces a not sensible A-theory; in fact, DD 1fL while >.x.DD -U-L. Since, by
rules (w) and (-+ l), >.x.DD can always be assigned type w -+ W, a natural
choice is to characterize the convergent terms by this type. This aHows us to
have as set of type constants just the singleton {w}. Clearly the inequality
w ~ w -+ w, which holds in the two previous models, is no longer correct in
this setting.
- - - - - - - - - - - - (d)
((T ---> T) /\ ((T ---> 7l") :SL (T ---> (T /\ 7l")
(T ---> T :SL (T
I
---> T
I (1) (T ---> W:SL W ...... W (T :SL (T
Definition 11.3.2 . .c is the >'A-model < F(L.), F(L.), 0L, [.]F(L) >.
Now we will state some properties of the L.-intersection reIat ion that will
be useful in this chapter. Namely, it will be proved that w is Ţ.L to any arrow
type, and the general shape of a type, modulo '::::!.L will be shown. To do this,
we need to characterize the set of types that are'::::!. w.
W --+ ... --+ W --+ W --+ W <L 7Ii --+ .•. --+ T m
i . --+ W --+ W
~ - ,
mi
W --+ •.• --+ W --+ W --+ W --+ W <L W --+ .•• --+ W --+ W --+ W
~ -~
mi mi
In the related type assignment system, every term having A-Ihnf can be
assigned at Ieast the type w --+ W.
Praof. Let M == AX.P and let Bw be a basis such that Bw(x) = w, for alI
x E Var. 80 B f-- L P : w by rule (w), and B f-- L AX.P : w ---+ w by rule (---+ I).
Let M == xM1 ... M m . Let B be such that B(x) = w ---+ ••• ---+ W ---+ W ---+ w.
~
m
Clearly B f-- L Mi : w (1 ::; i ::; m) by rule (w), therefore by rule (---+ E),
B f-- L xM1 ... M m : w ---+ w.
The proof is done, since C is a AA-model, hence it is closed under =A. D
Note that the reduction rule AX.n ---+n n, which has been used in both
models 1i and N, is no longer correct for the lazy semantics.
L
A (M) = A
{I ::JM' such that M =A M' and A is a ALO-normal f orm }
obtained fram M' by replacing some subterms with O.
AL(I) = {O,AX.O,AX.X};
AL(D)= {O, AX.O, AX.XX, AX.XO};
AL(DD) = {O};
AL(K(>-.x.x(II))(DD)) = {O, AX.O, AX.XO, AX.X(AX.O), AX.XI}.
166 11. Call-by-Name Denotational Semantics
The folIowing property shows that the theory of the model C is not sensible.
Property 11.3.11.
(i) If M is A-unsolvable of order n then AL(M) = {Ax1 ... Xp.n I O :::; p:::; n}.
(ii) If M is A-unsolvable of infinite order then AL(M) = {AX1 ... Xp.n I p E N}.
(iii) Let M and N be A-unsolvable respectively of order p and q (p, q E N).
Ifp < q then M Ce N.
Proof. Easy. D
Proof. (i) It is sufficient to prove that 1 ::5L E. Let B 1-- LI: (J"; by Lemma
l1.3.5.(i), either (J" ::::=L w or (J" ::::=L (J.L1 -+ 111) /\ ... /\ (J.Lk -+ IIk), for some
k E N. The case (J" ::::=L w is trivial, so let (J" ::::=L (J.L1 -+ IId /\ ... /\ (J.Lk -+ IIk)'
But B 1-- LI: J.Li -+ IIi by rule (:::;L), therefore by Lemma 1O.1.7.(vi)
B[J.Li/xll--LX: IIi, and by Lemma 1O.1.7.(ii) J.Li :::;L IIi (i:::; k). We prove
that, if J.Li :::;L IIi then B 1-- LE: J.Li -+ IIi; thus the proof folIows by rule
(/\I). The proof is given by induction on J.Li·
If J.Li ::::=L w then IIi ::::=L w, so it is easy to see that B 1-- LE: w -+ W, by
rules (w) and (-+ 1). If J.Li == Ti -+ Pi then B[J.Li/x, Ti/yll-- L xy : Pi, so
B 1-- L AXY.XY : J.Li -+ J.Li, by applying rule (-+ I) twice. FinalIy, by rule
(:::;L), B 1-- L AXY·XY : J.Li -+ IIi, If J.Li is an intersection type then the proof
foHows by induction.
Note that this inclusion is strict. In fact, B 1-- L AXY.XY : w -+ W -+ w, for
alI B, while this typing is not derivable for 1.
11.3 The Model .c 167
----------
p
natural numbers p.
The prooffollows by Property l1.3.5.(ii) and by Correctness.
(iv) By Property l1.3.11.(iii) and by correctness. D
Until now, a syntactical axiomatization of the reIat ion ::$L has not been
found. Note that the "'e reIat ion has an unusual behaviour under application,
as can be seen from the following example, first proved in [2].
------(var)
B f--- LX: B(x)
-----------(~L) --------(w)
Bf--- L x:w-7(Y Bf---Lx:w
--------------------------(~E)
B f--- LXX: (Y
168 11. Call-by-Name Denotational Semantics
:s
Otherwise, p r:::!.L 0"01\ ... 1\ O"n (n :::: 1) such that Vi n, O"i r:::!.L /-Li - Vi by
Property l1.3.5.(i) Hence B[/-Li/y] f- L xy : Vi by Lemma 10.1.7.(vi), and by
Lemma 10.1.7.(vii), B[/-Li/y] f- L Y : Ti and B[/-Li/y] f- LX: Ti - Vi, for some
Ti. 80 by Lemma 10.1.7.(ii), /-Li :SL Ti and B(x) :SL Ti - Vi, hence by rule (f)
:s
of the .L-intersection relation, B(x) :SL /-Li - Vi (i n); it is easy to see that
B(x) :SL 0"01\ ... 1\ O"n. 80 it is possible to build the following derivation:
------(var) -----(var)
B f- LX: B(x) B f- LX: B(x)
----------(~L) --------(~L)
B f- LX: 0"0 1\ ... 1\ O"n - O" B f- LX: 0"0 1\ ... 1\ O"n
-----------------------(~E)
B f- LXX: O"
Property 11.3.19. Let A == Az.xA1 ... Amz, where z tJ- FV(xA1 ... A m ).
If B f- L A: a-+ T, with T 'l-L w then B f-L XAl ... Am: a -+ T.
Lemma 11.3.22. Let FV(M) ~ {Xl, ... , Xn} and B = lat/xl, ... , an/xn).
II Camp.c(Bi , ai, Ni) (1 ~ i ~ n) and B f- L M : T then
Comp.c(B l U ... U Bn, T, M[Nt/XI, ... , Nn/xn]).
by ----(w)
.
Bf-LN:w '
where N is the subterm replaced by il in M'. B f- L M' : a implies
B f- L M : a, since the type assignment system is closed under = A on
terms as a consequence of the fact that it induces a >'A-model, so the
~~~~~
Let Lo = >.x.x(x(>.x.DD)(DD))(>.x.DD),
LI = >.x.x(>.y.x(>.x.DD)(DD)y)(>.x.DD).
We already showed, in Sect. 6.3, that Lo ~L LI. Now we will prove Lo f.c LI,
so C is not complete with respect to the L-operational semantics.
-----------(w)
B[a/x][w/y] f- L x(>-.x.DD)(DD)y : w
---:-----,--- (var) (~l) - , - - - - - . , - - - - - - - (w)
B[a/x] f- LX: a B[a/x] f- L >..y.x(>..x.DD)(DD)y : w -> w (B[a/x])[w/x] f- L DD: w
------------------- (~E) - - - - - - - - (~l)
B[a/x] f- L x(>..y.x(>..x.DD)(DD)y) : (w -> w) -> W -> W B[a/x] f- L >..x.DD : w -> W
----------,,---.,-----------------------(_E)
B[a/x] f- L x(>..y.x(>..x.DD)(DD)y)(>..x.DD) : w -> W
---.:....:---=----=----..:...-...:--...:--...:----..:...-...:----- (-l)
B f- L Li : ((w -> w) -> (w -> w) -> W -> w) -> W -> W
11.3 The Model .c 171
Properly 11.3.23. Let U be any closed A-unsolvable term of order O, and let
the type system V' =< C, :::;v,I(C) > induce a )..A-model M that is fulIy
abstract with respect to the L-operational semantics.
(i) ULM )..x.U LM )..y.x()..x.DD)(DD)y.
(ii) There is () E 1(C), such that B f- v )..x.U : () but B Ifv U: (), for alI bases
B; furthermore, B f- v )..y.x()..x.DD)(DD)y : (), for alI bases B.
(iii) If () is the type considered in point (ii) then () ---t (), () ---t () ---t () E 1 (C) .
Proof. (i) Clearly U -<L )..x.U -<L )..y.x()..x.DD)(DD)y. 80 the prooffolIows
from the definition of a fulIy abstract model.
(ii) By point (i), by the fact that alI A-unsolvables of the same order are
equated in L (by Property 11.3.14.(iv)) and by definition of filter model,
there is () E T(C) such that B f- v )..x.U : () but B Ifv U : (), for every
basis B (since U is closed). So, always by point (i) and by Property
1O.1.13.(ii), for every B, B f-v )..y.x()..x.DD)(DD)y : (). Note that U is
172 11. Call-by-Name Denotational Semantics
now that it is possible to build, start ing from the model 12, the desired fully
abstract model. In a very general way, the idea is to start from the model 12,
to build a space of filters that is a subspace of F( L), consisting just of filters
that are interpretations of closed terms, and then to identify those filters
that are interpretations of terms L-operationally equivalent. The so-obtained
model is no longer a filter model, and the interpretat ion of a term is no longer
the collection of the types that can be assigned to it. The fully abstract model
amounts just to the closed term model of the A-theory L, equipped with a
partial order relation, which is obtained from a preorder on terms, defined in
a stratified way by using the type assignment f- L.
Definition 11.4.1. (i) ~a is a relation on AO defined as follows:
• M ~w N is true;
• M ~a-->T N, where T '::::L W, if and only if
B f- L M : w ~ w implies B f- L N : w ~ w, for all bases B;
• M ~a-->T N, where T 'tL W,
if and only if
VP E AO, B f-L P: (J implies MP ~T NP;
• M ~at\T N if and only if both M ~a N and M ~T N.
The next property will be useful in order to better understand the previous
definit ion.
Property 11.4.2. There is P E AO such that B f- L P : (J, for all B and (J.
In next two lemmas it is proved that :::1 corresponds exactly to the oper-
ational inclusion :5L.
Proof. (~) We will prove that M 11 N implies that there is a closed sequence
of terms P such that M P l1w-+w N P. By hypothesis there is a type a
such that M 110- N, so the proof is done by induction on a.
If a ~L w then a == ~ (n ~ 1), by Theorem 11.3.3; but, since
n
M :::1w N by definit ion, this is not possible.
Let a 7:-L w. If a == J1 -+ II where II ~L w, then the proof is vacuous. If
a == J1 -+ II where II 7:-L w, then there is P E AO such that MP 11" NP,
so the proof folIows by induction. If a == J1A II then the proof folIows by
induction.
(::::}) We will prove that if there is a sequence of closed terms P and a type
r 7:-L w such that MP 117 NP then M 11 N, by induction on IIPII.
If IIPII = O then the proof is trivial, so let IIPII ~ 1 and P == QQ'. But
11.4 A Fully Abstract Model for the L-Operational Semantics 175
Note that, although Ax.DD llw-+w DD, Ax.DD :::lw-+w-+w DD; in fact
for each P E AO, B f- L P : w, and so, by definit ion of :::l, (Ax.DD)P :::lw-+w
(DD)P is true. Hence M :::l0" N and (J :SL T does not imply M :::lT N.
Lemma 11.4.5. Let M,N E AO.
M ~L N if and only if MF :::lw-+w NF, for each sequence of closed terms F.
Proof. Remember that, for every term Q, Q JJ.L if and only if B f- L Q : w ----t
w, by CorolIary 11.3.12.
(=}) Let F be a sequence of closed terms and let B be a basis.
If M ~L N then MF JJ.L implies NF JJ.L; therefore, by CorolIary 11.3.12,
B f- L M F : w ----t w implies B f- L N F : w ----t w. Hence, by definit ion of
:::lw-+w the proof is done.
({:::) Let M F :::lw-+w N F, for each sequence of closed terms F. We will prove
that, if C[M], C[N] E AO and C[M] JJ.L, then C[N] JJ.L, for alI contexts
C[.]. The proof is done by induction on the derivation proving C[M] JJ.L.
If the last applied rule is either (var) or (lazy) , then the proof is immedi-
ate. If the last applied rule is (head), then there are two cases, according
to the possible shape of C[.] .
• C[.] == [.]Cd.] ... C m [.] (m E N).
If m = O then M JJ.L implies B f- L M : w ----t w, so B f- L N : w ----t w by
definit ion of :::lw-+w, and the proof folIows by CorolIary 11.3.12.
Now, let m 2: 1 and D[.] == MCd.] ... C m [.]. Clearly D[M] == C[M] and
- - .
D[.] = (Az.Mo)MCd.] ... C m [.] (m E N), smce MEA. °
If IIMII = O then let D*[.] == Mo[C I [.]jZ]C2[.]. .. C m [.], otherwise
let D*[.] == Mo[Mdz]RCI[.] ... Cm[.] where NI == MIR. In alI cases
D*[M] JJ.L and by induction D*[N] JJ.L, so D[N] JJ.L by rule (head). But
MCI[N] ... Cm[N] JJ.L implies B f- L MCI[N] ... Cm[N] : w ----t w, so by
hypothesis B f- L NCdN] ... Cm[N] : w ----t w. Hence, NCI[N] .. .Gm[N] JJ.L
by CorolIary 11.3.12 .
• C[.] == (Ay.Co[.])CI[.] ... Cm [.] (m E N).
The case m = O is not possible, otherwise the proof folIows by induc-
tion on the derivat ion proving C o [M][CI [M]jy]C2[M] ... C m [M] JJ.L. O
Note that if M is closed then [M]~ = [M]~" for alI p,p'; moreover,
if M, N are closed then [M]~ = [N]~, implies M ~ N and N ~ M, by
Property 11.4.3.(i). Now we can define the new .AA-model.
Proof. Clearly M :::5L N and P :::5L Q imply M P :::5L NQ, therefore the proof
folIows by Theorem 11.4.6. O
It can be interesting to ask for the behaviour of the three filter '\A-models we
defined, with respect to alI the considered calI-by-name operational semantics.
In Sect. 11.1, we already proved that 'li is fulIy abstract with respect to the
H-operational semantics.
It can be readily noticed that 'li is not correct with respect to the N-
operational semantics. In fact, by Property 11.2.22 and by Theorem 11.1.31,
1 ~1t Eoo, but 1 ~N Eoo.
On the other hand, 'li is complete with respect to the N-operational
semantics, namely M ~N N implies M ~1t N. Let us prove that M ~1t N
implies M ~N N. Let M ~1t N; so by the correctness of 'li with respect to
H-operational semantics, this implies that there is a closing context C[.] such
that C[M] has A-hnf, while C[N] has not A-hnf. So there are P1"'Pn such
that C[M]H ... Pn =A 1, while C[N]Pl ... Pn has no A-hnf. Since 1 is a A-nf
and a term without A-hnfin particular does not have A-nf, C'[.] == C[,]Pl ... Pn
is a context such that C'[M]-1.J.N while C'[N]1tN, so M ~N N.
'li is not correct with respect to the L-operational semantics. In fact,
'\y.xy ~1t x while '\y.xy ~L x, as shown in Example 11.3.17. Another coun-
terexample is the pair of terms DD and '\x.DD; indeed, by CorolIary 11.1.21
and Property 11.3.11, Ax.DD ~1t DD but Ax.DD ~L DD.
'li is not complete with respect to the L-operational semantics. In fact,
for every calI-by-name fixed-point operator Z, ZK is a A-unsolvable term of
infinite order, so ZK ~1t 1 while ZK ~L 1 (see Property 11.3.14.(iii)).
But if we take into account the equivalence relation, we have that ~L
implies "'1t. In fact, the folIowing lemma holds, which, together with the
completeness of 'li with respect to the H-operational semantics, proves this
implication.
In Sect. 11.3, we already proved that .c is correct but not complete with
respect to the L-operational semantics .
.c is not correct with respect to both Hand N-operational semantics; in
fact, 1 ~e ZK (see Property l1.3.14.(iii)) while 1 ~H ZK and 1 ~N ZK,
for every call-by-name fixed point operator Z, by Corollary 11.1.21 and by
Property l1.2.15.(i) .
.c is not complete with respect to both Hand N-operational semantics;
in fact, Ax.DD ~H DD and Ax.DD ~N DD while Ax.DD fie DD.
12. Call-by-Value Denotational Semantics
For modeling the >.r-calculus, we must reflect in the model the fact that the
set r of input values is a proper subset of the whole set A. In the setting
of filter >.r-models, this implies that every type system \7 inducing a filter
>.r-model must be such that I(\7) C F(\7).
Since w is the universal type it cannot characterize any property of terms;
note that from B f- v >.x.M : w - a- we cannot conclude B f- v (>.x.M)N : a-
for every N in a correct >.r-model. Indeed, (>.x.M)(DD) 1rv and so every
type a- such that B f- v (>.x.M)(DD) : a- must be such that a- ~ 1(C). Thus
the type w - a- cannot have a meaningful applicative power. This is simply
formalized by assuming w (j. 1 (C), since the condition on the rule (- E) of
the intersection type assignment system, namely
a- E 1(C) B f- v M : a- - T B f-v N: a-
------------------------------(~E).
B f- v MN: T
So, we want a legal type system y', based on a set of constants C..;,
such that there is at least one type a and a basis B such that, if M is
potentialIy r-valuable then B f-..; M : a, otherwise B 17..; M : a. A term is
potentialIy r-valuable if and only if it has S.e-normal form, so it is natural
to characterize terms without S.e-normal form by assigning them only type
w. Moreover, the V-operational semantics performs a lazy evaluation (so it
cannot be w c::::...; W -+ w), and this alIows us to use the type w -+ W to
characterize S.e-normal form.
Definition 12.1.2. y' is the type system <C..;, :;'..;,!(C..;» where C..; = {w},
and :;,..; is the intersection relation induced by the rules in Fig. 12.1.
- - - - - - - - - - - - (d)
(er --t T) II (er --t 7r) :S;v' er --t (T II 7r)
------(9)
er :S;v' P, P :S;v' T
------(t)
er --t W :S;v' W --t W
- - - - - - - - (v)
(W --t W) --t T :S;v' W --t T
------(w)
B[a/x] r,; P: w
- - - - - - - (-+1)
B r,; Ax.P : a --+ W a --+ W S,; W --+ W
-~-----------~---(~v)
B r,; Ax.P : w --+ W
-----(var)
B r,; x: B(x) B(x) S,; w --+ W
-~---------~---(~v)
Br,;x:w--+w
o
The next definit ion is weH given by CoroHary 12.1.27.
B(x) = Bl(X) /\ ... /\ Bm(x) /\ ,(w --+ w) --+ ... --+ (w --+ w), --+ W --+ w.
v
m
aM~a, Ma~a,
The first reduction rule defined in point (i) of Definition 12.1.9, namely
aM ~ a, reflects the lazy behaviour of the r-calculus, while Ma ~ a
reflects its call-by-value behaviour. Note that the Efa-reduction is lazy, since
it is closed under application, but not under abstraction. As usual, terms of
Aa will be considered modulo =Q!.
• AV'«AXYZ.yI)(UV)I) :2 {(Axyz.yI)(uv)I}.
U«AxYZ.yI)(uv)I) :2 {>..z.II}.
• fl E AV';
• If Aj E AV' and Aj ;ţ fl then AXloo.Xn.xAloo.Am E AV'
(1:::; j :::; m and n,m E N).
• If A, Aj E AV', Al rţ rn and Aj ;ţ fl then
AXloo.Xn.(AX.A)Aloo.Am E AV' (1 :::; j :::; m, m ~ 1 and nE N).
PropeTty 12.1.14. A E AV' if and only if there is M such that A E AV' (M).
Proof. Easy. D
The next property implies A V' (M) { fl} if and only if M is not r-
valuable, for each closed term M. It also implies UV'(M) = {fl} if and only
if M is not potentially r-valuable, for each term M (not necessarily closed).
(ii) (~) If there is U E uv' (M) such that U -ţ. il then :lA E Av' (M) such
that A ~~w U E SCil-NF. As done in the proof of Lemma 3.1.35, it
is possible to show that there is rEN and Ar E r n such that both
A[or/xI, ... ,or/xnl ~r Ar and u[or/xI, ... ,or/xnl ~r Ar, where
or == .xXI .. .Xr+I.Xr+I. Since Ar E Av'(M[or /XI, ... , or /x n]), by the
point (i) of this Lemma the proof is done.
(=}) By Property 12.1.8 and by point (ii) ofthe V-approximation theorem.
O
B(x) = (w --+ w) --+ ... --+ (w --+ w) --+ al --+ a2 --+ ... --+ a p --+ w.
, v "
m
Then B f-,j xPI ... Pm : al --+ a2 --+ ... --+ a p --+ w, by rule (--+ E) and
Property 12.1.8. The inductive step is easy, using the basic case, Theorem
12.1.6 and rule (--+ 1).
Let M be r-unsolvable of r-order 00. For every i ~ 1, M --+51' AXI.M1,
Mi --+51' AXi+I.Mi+1' So choose i = p, and obviously there is a typing
B f- ,j Axp.Mp : w --+ W, by Property 12.1.8. Then the proof is similar to
the previous case.
(ii) By induction on p. If p = O, then M is not potentially r-valuable, and
the result follows from Lemma 12.1.17. The case p ~ O follows easily from
the definit ion of r -solvability and of r -order. D
As the previous theorem shows, the V-model does not permit us to dis-
criminate between r-solvable terms and r-unsolvable terms of infinite order.
An intersection type assignment system giving a complete characterization
of the r-solvable terms is shown in [73].
Some properties of the V-operational semantics can be proved by the
approximation theorem.
Praof. (i) It is sufficient to prove that 1 "'v E, then the result follows by
Property 3.1.18 and Lemma 8.1.9. The proof of 1 "'v E can be easily
constructed in a way similar to the proof of Lemma 11.1.8, taking into
account the differences between the two type assignment systems, namely
Property 12.1.28 must be used in place of Property 11.1.36. The proof
follows by correctness.
(ii) Let Z be a fixed-point operator, i.e. ZM =r M(ZM), for all r-valuable
terms M. Then A,j(Z) = {il, Ax.il}.
(iii) Let Z be a call-by-value recursion operator, i.e. ZM =r M(AZ.ZMz),
for all r-valuable terms M.
Then AV(Z) = {il, Az.il, AX.X(AZo.( ... (AZn.il) ... )zo) I n ~ 1}.
(iv) ZK =r K(AZ.ZKz) =r Ayz.ZKz. So AV(ZK) = {AxI ... xn.il I n E N}.
As a result, it is easy to check that B f-,j ZK : a, for all a E T(C,j) and
for all bases B. D
The model V induces a not semisensible r-theory (this notion was defined
in Definition 1.3.4). In order to prove this result, we need to show that there
is an infinite class of approximants which behaves, with respect to typing, as
free variables.
Proof. It is easy, but boring, to check that Av'(ZB) = {Q, Ax.Q, Axy.Q} U
{Ax.A n I n ~ 1}, where An == Az.(Ax.An_I)(xz). Then the prooffoUows from
Lemma 12.1.21, since B f- 1 : a if and only if either a c:::..,; W or a c:::..,; w - t w
or a c:::..,; al  a2 or a c:::..,; f.L - t v, where f.L s..,; v. O
Corollary 12.1.23. The V -operational semantics is not semisensible.
Proof Since ZB is a r-unsolvable term of infinite order, the r-theory V is
not semisensible, by Theorem 12.1.22. Then, by correctness, V is also not
semisensible. O
The fact that V is not semisensible was first proved in [73], using syntac-
tical tools. The model V is not fuUy abstract with respect to V-operational
semantics. In fact, the next theorem shows its incompleteness.
Theorem 12.1.24 (V-Incompleteness).
The model V is incomplete with respect to the V -operational semantics.
Proof. The proof is in Sect. 12.1.4 O
The next theorem proves that there is not a filter Ar-model that is fully
abstract with respect to the V-operational semantics. The proof is similar to
the corresponding one for the L-operational semantics, given in Sect. 11.3.2.
Namely, we will show that there are two terms that are ~v, but they cannot
be equated in every filter model correct with respect to the V-operational
semantics.
Theorem 12.1.25. There is not a fllter Ar -model that is /ully abstract with
respect to the V -operational semantics.
Proof The proof is in Sect. 12.1.4. O
Corollary 12.1.27. Let [lv = {O"o /\ ••••. /\ O"n (n E N) 1 'Vi :S n O"i == w}.
[lv = T(C..;) - 1(C..;).
m q
Let h :S p; if T~ 7:-..; w then 3{il' ... , ik} s::; {I, ... , n}, for some k E N, such
that O"i, /\ .•• /\ O"ik 2:..; O"h /\ (w ---+ w) and Ti, /\ •.• /\ Tik :Sv T~, where Tij 7:-..; w
(i j E {i1, ... ,id).
(d) Let (a --t T) A (a --t 7r) 5:,; a --t (T A 7r)0 The case T,7r i:-,; w is easyo
If T ':::!.,; W and 7r i:-,; w then it is easy to see that T A 7r ':::!.,; 7r, so the
proof is immediateo The remaining case is similar to the previous oneo
(v) It is sufficient to check that w --t w ~,; w A (w --t w); the proof follows
by rule (c')o
(t) Let p be such that (al --t TI) A 000 A (an --t Tn ) A ~ 5:,; p and
m
p 5:,; (a~ --t T{) A 000 A (a~ --t T;) A~o
q
If p ':::!.,; w then w 5:,; (a~ --t T{) A 000 A (a~ --t T;) A~ 5:,; aj --t Tj
q
implies w ':::!.,; aj --t Tj (j 5: p) and so p = O, by Theorem 1201.260
Let p == (MI --t 111) A 000 A (Mr --t IIr ) AwAoooAw, for some r,s E N
~
8
In order to show that the type assignment system f-,; is closed under Ef-
reduction, first we prove that the type assignment system f- ,; is closed under
A-reductiono
- - - - - - (var)
B[T/X]f-";X:T
by a copy of a derivat ion proving B f- ..; Q : T ;
2. replace each typing B[T/X] f-..; P* : f..L in d by B f-..; P*[Q/x] : f..L.
By induction on the derivation d, it is easy to check that d' is well defined.
Let M == C[(AX.P)Q] and N == C[P[Q/x]]. If an occurrence of (AX.P)Q in
M is inside a subterm of M typed by the rule (w), then just replace Q to
each free occurrence of x in term being subject of typings in d. Otherwise,
replace each sub derivat ion d proving a typing for (AX.P)Q by a subderivation
d' built as described before. O
(i) By the A-subject reduction lemma, taking into account that Ef-reduction
is a special case of A-reduction.
(ii) By the weak Ef-subject expansion lemma. •
12.1 The Model V 195
The proof follows the same lines as the corresponding proof in the previous
models. In order to prove the (=» implication both parts of the theorem, we
need to define a computability predicate.
A basis B is finite if and only if B(y) ::::=.,; w -+ W except in a finite number
ofvariables. We will use [aI/xI, ... , an/xnl to denote a finite basis. By Lemma
1O.1.7.(i), in this section we limit ourselves to consider only such a kind of
basis.
Let B and B' be two basis. B U B' denotes the basis such that, for every
x, B U B'(x) = B(x) 1\ B'(x) (remember that a 1\ (w -+ w) ::::=.,; a, for every
type a i:-,; w).
PraoJ. By induction on the definition of ~v. The more complex case is that
of rule (J), so let 1f' ~v 1f, 7 ~V 7' and Campv(B, 1f -+ 7, M).
If 7 ':::::.V w then 7 ' ':::::.V W, so the proofis immediate. If 7, 1f Ţ.v w then the proof
follows by induction. If 7 Ţ.v w but 7 ' ':::::.V w then, by Lemma 12.1.38.(ii),
ApPv(B,1f -+ 7, M). By definit ion of Appv, there is an A E AL(M) such that
B f- v A : 1f -+ 7; thus B f- v A : w -+ w, and the proof follows by definition
of Compv. O
12.1 The Model V 197
Lemma 12.1.40. Let FV(M) <:;; {Xl' ... , Xn} and B = [al/xl, ... , an/xn].
II Ni E r, Compv(B i , ai, Ni) (1 :::; i :::; n) and B f- v M : T, then
B[ţL/x] f- V M' : 1/
- - - - - ' - - - - - - (-+I).
B f- V Ax.M' : ţL ---+ 1/
Compv(B ' U BI U ... U Bn, 1/, M' [Nl/xl, ... , Nn/xn, N/x])
which implies
Praof. Easy, by Theorem 12.1.6, and by the fact that to the term f? only the
type w can be assigned. D
Let Vo == AX.(AXIX2.DD)(X(AXI.DD)(AXI.DD)),
VI == AX.(AXIX2X3.DD)(X(AXI.DD)(AXIX2.DD))(X(AXIX2.DD)(AXI.DD)).
In Sect. 7.1.1 we proved that Vo ~v VI; now we will prove Vo rfv VI. Note
that both Vo and Vi are r-unsolvable of order 2, so the model does not equate
alI r-unsolvable terms of the same order.
------------(w)
B[a/x,w -> W/X1,W -> v' DD: W w/x2ll-
- - : - - - : - - - - - : - : - - - - - (w) - - - - - - - - - , - - - - ; - . . , . : - . . . . : . . . . - - : - - (~I)
B[a/x,w -> w/xI] 1- v' DD: w B[a/x,w -> w/xI] 1- v' D 1 : (w -> w) -> W
- - - - - (var) ------;----'--- (~I) «v')
B[a/xll- v' x: a B[a/xll- v' D 1 : (w -> w) -> W B[a/x,w -> w/x1ll- v' D 1 : w -> W -
- - - ' - - - (AE) - - - - ' - - - - - , - - - - «v') ----=---~--- (~I)
B[a/xll- v' x: ao B[a/xll- v' D 1 : w -> W - B[a/xll- v' D 2 : (w -> w) -> W -> W
--------~--~--:--~~~'-----(~E) --------~:---~----«v')
B[a/xll- v' xD 1 : (w -> W -> w) -> W -> W B[a/xll- v' D 2 : w -> W -> W -
--~-------------:~------~------(~E)
B[a /xll- v' xD 1 D 2 : w -> W
- - : - - - : - - - - - : - - - - - : - - - : - - - - (w)
B[a/x,w w/x2ll- v' DD : w
-> W/X1,W ->
--------:--~-- (~I)
B[a/x,w w/x1ll- v' D 1 : (w -> w) -> W
->
«v')
B[a/x,w -> w/x1ll- v' D 1 : w -> W -
- - , - - - , , - - - (var) (~I) - - : - - - - - - - : - : - - - - - (w)
B[a/xll- v' x: a B[a/xll- v' D2 : (w -> w) -> W -> W B[a/x,w -> w/x1ll-
v' DD: w
- - - ' - - - (AE) - - - - - - , - - - - ' - - - (~I)
(~v')
B[a/xll- v' x: al B[a/xll- v' D 2 : w -> W
B[a/xll- v' D 1 : (w -> w) -> W
-> W
- - - - - ' - - - - - - : : - - - - - - - ' - - - - - (~E) ----.:.......:.---'-----:------- (~v')
B[a/xll- v' xD 2 : (w -> w) -> W -> W B[a/xll- v' D 1 : w -> W
--------~----------~_:__------------'~----(~E)
B[a/xll- v' xD2 D 1 : w -> W
12.1 The Model V 199
d3 d'2
B[u/x]I-,;D3 :(w--->w)--->(w--->w)--->w--->w" B[u/x]l-,;xD I D2 :w--->w'" d21
-'-'--'-----=-----::-:--:-:---::-;;-:--:-;-:::-;;:---,---,--'-'--'---'------ (~E) ( ... )
B[u/x] 1-,; D3(xD I D2) : (w ---> w) ---> W ---> W B[u/x] 1-,; xD 2D I : w ---> W
--------=-------------------------------~-------(~E)
B[u/x] 1-,; (>.X,X2X3.DD)(x(>.x,.DD)(>.XIX2.DD))(x(>.XIX2.DD)(>.XI.DD)): w ---> W
-'-'--'-----=---'-'--------'-'---'--------'-'---------'---'---------'-'--------'-'-'---- (~I)
BI-,;V,:u--->w--->w
Note that we can apply the rule (--t E), since w --t W E 1(0..;); moreover,
each type considered in the basis is an input type.
On the other hand, B r..; Va : a --t w --t w implies, by Lemma 1O.1.7.(vi),
B[a/x] r..; (>.XIX2.DD)(x(>.Xl.DD)(>.Xl.DD)) : w --t w.
Therefore there is J-L E 1(0..;) such that B[a/x] r..; >'XIX2.DD : J-L --t w --t w
and B[a/x] r..; x(>'xl.DD)(>'Xl.DD) : J-L, by Lemma 1O.1.7.(vii).
Since J-L '/:...; w, again by Lemma 10. 1.7. (vii) , there is T E 1(0..;) such that
B[a/x] r..; x(>'xl.DD) : T --t J-L and
B[a/x] r..; >.xl.DD : T. (12.1)
Since T --t J-L '/:...; w, again by Lemma 1O.1.7.(vii), there is 7r E 1(0..;) such
that B[a/x] r..; x: 7r --t T --t J-L and
B[a/x] r..; >.xl.DD : 7r. (12.2)
By Lemma 1O.1.7.(ii) a 5:..; 7r --t T --t J-L, so, since J is legal, there are 3
possible cases.
1.7r 5:..; w --t W --t w is not possible; in fact, it is easy to see that the typing
given in Eq. 12.2 implies w --t w 5:..; 7r, by Theorem 12.1.19.(ii). So, by
Property 12.1.28.(ii), this would imply w --t w '.::::!...; W --t W --t w, which is
an absurd.
2. 7r 5:..; (w --t w) 1\ (w --t W --t w) is not possible. In fact, by rules (c),
(w --t w) 1\ (w --t W --t w) 5:..; w --t W --t W, so we can reason as in the
previous case.
3. 7r 5:..; w --t w and (w --t w --t w) --t W --t w 5:..; T --t J-L, therefore
T 5:..; w --t W --t w by Property 10.1.6. Yet an absurd, by the typing given
in Eq. 12.1 and by Theorem 12.1.19.(ii). •
(i) Alt closed F-unsolvable terms of the same finite order n are equated in M.
(ii) ULM >.x.U.
(iii) There exists (J E I(C) such that B f-V' >.x.U : (J and B f-V' >.xy.U : (J -+ (J,
while B 1iV' U : (J and B 1iV' >.x.U : (J -+ (J, for alt bases Bj moreover,
(J -+ (J E I(C).
(iv) If (J is the type considered in the previous point then ((J -+ (J) -+ (J -+
(J, (J -+ ((J -+ (J) -+ (J E 1(C).
Proof. (i) By the fact that all closed r-unsolvable terms of the same finite
order are equated in V (see Corollary 7.1.9) and by definit ion of full
abstract ion.
(ii) By the fact that U -<v >.x.U and by definit ion of full abstraction.
(iii) Note that >.x.U is an input value for the >.r-calculus, so by the definit ion
of the >.r-model and by the previous point of this lemma, there is (J E
I(C) such that B f-V' >.x.U : (J and B 1iV' U: (J, for all bases B (since U
is closed). It is easy to build a derivation proving B f-V' >.xy.U : (J -+ (J.
If B f-V' >.x.U : (J -+ (J then B f-V' (>.x.U)>.x.U : (J, but (>.x.U)>.x.U is a
A-unsolvable term of order O, so B 1iV' >.x.U : (J -+ (J.
If (J -+ (J rţ I(C) then (J ~V' (J -+ (J, so B f-V' >.x.U : (J -+ (J; hence,
(J -+ (J E I(C).
(iv) If ((J -+ (J) -+ (J -+ (J rţ I(C) then (J ~V' ((J -+ (J) -+ (J -+ (J and
B f-V' Ax.U : ((J -+ (J) -+ (J -+ (J, so B f-V' (>.x.u)(>.xy.U)(>.x.u) : (J
which is an absurdum; hence, ((J -+ (J) -+ (J -+ (J E 1(C). In a similar way,
(J -+ ((J -+ (J) -+ (J E I(C). D
B[(T/x] f-V' xD I D 2 : (J
B[(T/x] f-V' xD 2D I : (J
B[(T/x] f-V' D 3 : (J -+ (J -+ (J
Note that we can apply the rule (-- E), since () E 1 (C); moreover each type
considered in the basis is an input type.
Since in Sect. 7.1.1 we proved that Va ~v VI, by the full abstraction
hypothesis it follows that B f-V' Va : a -- (); so, by Lemma 10.1.7.(vi),
B[a/x] f-V' (AXIX2.DD)(X(AXI.DD)(AXI.DD)) : ().
So there is f.L E 1(C) such that B[a/x] f-V' AXIX2.DD: f.L -- () and B[a/x] f-V'
X(AXI.DD)(AXI.DD) : f.L, by Lemma 10.1.7.(vii).
If f.L ~,; w then w E 1(C), so 1(C) = T(C) and B[a/x] f-V' AXIX2.DD :
w -- (); so B[a /x] f-V' (AXIX2.DD)(DD) : () by rule (-- E), against Lemma
12.1.42.(iii), since (AXIX2.DD)(DD) is a r-unsolvable term of order O.
Let f.L 't,; W; again by Lemma 10.1.7.(vii), there exists T E 1(C) such that
B[a/x] f-V' X(AXI.DD) : T -- f.L and,
B[a/x] f-V' AXI.DD: T. (12.3)
If T -- f.L ~,; w then T - - w 5:.,; w 5:.,; T -- f.L, so by Property 10.1.6 w 5:.,; f.L
and thus f.L ~,; w, which is not possible; hence, T -- f.L 't,; w.
Since T - - f.L 't,; w, again by Lemma 1O.1.7.(vii), there is 7r E 1(C) such that
B[a/x] f-V' x: 7r - - T - - f.L and,
(12.4)
By Lemma 10.1. 7. (ii) a 5:.,; 7r - - T - - f.L, so, since \7 is legal, there are three
possible cases:
1. 5:.V' () -- () is not possible; otherwise the typing given in Eq. 12.4 would
7r
imply B[a/x] f-V' AXI.DD : () -- () against Lemma 12.1.42.
2. 7r 5:. V' ()A (() -- ()) is not possible. In fact, by rule (c), ()A (() -- ()) 5:. V' () -- (),
so we can reason as in the previous case.
3. 7r 5:.V' () and (B -- ()) -- B 5:.V' T - - f.L, so by Property 10.1.6, T 5:.,; () -- ();
yet an absurdum, by the typing given in Eq. 12.3. •
It was proved in Theorem 12.1.25 that there is not a filter Ar-model that is
fully abstract with respect to the V-operational semantics. But we will show
that it is possible to build a fully abstract model starting from the model V,
202 12. Call-by-Value Denotational Semantics
The previous definit ion is well posed, thanks to the following property.
Praperty 12.2.2. There is P E rO such that B f-..; P : (J", for all B and (J".
Note that although in the model V all types are inhabited, this does
not imply that all filters are inhabited. lndeed, the filter 1 {(J"}, where (J" is
((w ---t w) ---t (w ---t W ---t w) ---t W ---t w)I\((w ---t w ---t w) ---t (w ---t w) ---t W ---t w)
is not the interpretat ion of any term, since the re ader can check that every
term having type (J" has also the type (w ---t w) ---t (w ---t w) ---t W ---t w, which
is not in the filter. If this filter were inhabited, then it would be Vo 'tV VI
(see Sect. 12.1.4).
Clearlya '$...; w, since by definit ion M :SIw N is true. If a == f..l --+ 1/, there
are two cases. If 1/ '::::'...; w then B f-..; M : w --+ W and B li..; N : w --+ W,
so the proof is immediate by definition of [::;; v.
If 1/ '$...; w then there is a r-valuable PE AO such that MP ilv NP,
by definit ion of :SI. Hence, M P !le N P by induction, so M !lv N by
Lemma 10.1.13.(i). If a == f..lA 1/ then th~ proof follows by induction.
(ii) We will prove that M :SIa M, for all a, by induction on a. The caSe w is
obvious. Let a == f..l --+ 1/; the case 1/ '::::'...; W is obvious. Let 1/ '$...; w and let
PE AO be a closed r-valuable term such that B f-..; P : f..l. By induction
M P :SIv M P, so the result follows by definition of :SI.
The case a == f..lA 1/ follows by induction.
(iii) By induction on a we prove that :SIa is transitive. The only nontrivial
case is a == 7r --+ T, where T '$...; w. Let M o :SI7r->r MI and MI :SI7r->r M 2 .
If PE AO is a r-valuable term and B f- ..; P : 7r, then MoP :SIr MIP and
MIP :SIr M 2 P, by definition of :SI. So MoP :SIr M 2 P by induction; hence
M o :SI7r->r M 2 by definit ion of :SI. D
Next two lemmas prove that the reIat ion :SI grasps exactly the behaviour
of the V-operational semantics.
Lemma 12.2.4. Let M, N E AO.
M :SI N if and only if M P :SIw->w N P, for each sequence of closed r -valuable
terms P.
Praof. (-{:=) We will prove that M il N implies that there is a closed sequence
of r-valuable terms P such that MP ilw->w NP. By hypothesis there is
a type a such that M ilO' N, so the proof is done by induction on a.
If a'::::'...; w then a == ~ (n 2: 1), by Theorem 12.1.26; but since
n
M :SIw N by definit ion, this is not possible. If a == f..l --+ 1/ and 1/ '::::'...; w
then the proof is trivial. If a == f..l --+ 1/ and 1/ '$...; w then there is a
r-valuable term P E AO such that MP ilv NP, so the proof follows by
induction. If a == f..lA 1/ then the proof follows by induction.
(=}) We will prove that, if there is a sequence of closed r-valuable terms P
and a type T '$...; w such that M P ilr N P, then M il N. The proof will
be given by induction on IIPII.
If IIPII = O then the proof is trivial, so let IIPII 2: 1 and P == QQ'. Since
Q' is a closed r-valuable term, B f-..; Q' : w --+ w by Property 12.1.8.
This implies MQ il(w->w)->r NQ by definition of :SI; so the proof follows
by induction. D
Prao! Let Q be a closed r-valuable term. Then Q -ll-v if and only if B f- y'
Q:w -> w, by Property 12.1.8 and Lemma 12.1.17.
The next definit ion overload the meaning of :'Sl on a subset of filters,
namely :'Sl induces a preorder on ? (J), i.e. the set of filters of F( J) that
are interpretations of closed terms.
Definition 12.2.7. Let f,g E ?(J) and let p be an enviranment.
f :'Sl g if and only if M, N E AO such that [M]:(v') = f and [N]:(y') = g
imply M :'Sl N. Moreover, f ~ g if and only if f :'Sl g and g :'Sl f·
12.2 A Fully Abstract Model for the V-Operational Semantics 205
Definition 12.2.11. Let M t:vv N denote [MI~V :::! [NI~V, for alt ( E
(Var - t ~ ). Moreover, let M "'vv N denote M t: vv N and N t: vv M.
Consequently, the model VV induces a partial order on the interpretation
of terms (not only closed terms).
Lemma 12.2.12. Let M,N E AO. M t:vv N if and only if M:::! N.
Proo! Let ( E (Var -t 71), and let p be such that p(x) E «x) for all x E Var.
M t:vv Nifandonlyif[MI~v:::! [NI~V ifandonlyif[[MI:(v)]:::! [[NI:(v)]
if and only if [MI:(v') :::! [NI:(v) if and only if M :::! N. D
The following theorem implies the full abstract ion of VV with respect to
the V-operational semantics.
Theorem 12.2.14 (VV-Completeness).
The model VV is complete with respect to the V -operational semantics.
Prao! We will prove [f;vv implies lcv.
M [f;vv N means [MI~V :ll [NI~V, for some ( E (Var - t 71).
Since the
codomain of (is 71,
if FV(M)UFV(N) = {Xl, ... , Xm} then there are Pi E rO
such that «xd = [[PiI:(v)]. Thus, let s be such that s(xd = Pi (1 ::; i ::; m),
hence s(M), s(N) E AO. By Property 10.0.2.(iv), [s(M)I~,v :ll [s(N)I~,v, for
all (' E (Var - t ~), so in particular s(M) [f;vv s(N).
By Lemma 12.2.12, s(M) :ll s(N), so there is a sequence of closed r-valuable
terms Q such that s(M)Q :llw .....w s(N)Q, by Lemma 12.2.4.
Let C[.] == (AXI ... Xm.[.])s(xt) ... s(xm)Q; clearly C[M], C[N] E AO, and more-
over C[M].JJ.v and C[N]1rv, so M lcv N. D
The technique used here for building the fully abstract model of the V-
operational semantics is similar to that used in [71] and [44], for different
calculi. The use of intersection types and filter models allows for the appli-
cation of such techniques to a wider class of models.
13. Filter Ă~-Models and Domains
13.1 Domains
There is an analogy between A.1-filter models and A.1-models that are w-
algebraic lattices, which was first noticed in [28] and further developed in [1]
and [3]. This analogy lies in the fact that type symbols in a ,xLl-filter model
play the role of names for compact elements in the corresponding w-algebraic
lattice. It is out of the aim of this book to give a complete survey of the ,xLl-
models based on w-algebraic lattices. In case where Ll = A, there are some
textbooks giving a complete development of this topic, e.g. [5, 81, 87]. Here
we will just give some basic informations in order to assure readability to
those readers who are not expert in this topic, without developing the proofs
for standard properties.
Let us recall the definit ion of a w-algebraic complete lattice.
Definition 13.1.1. (i) A complete lattice (IL, [;;;IL) is a set IL, equipped by
a order relation [;;;IL, such that for aU X ~ IL both uX (the least upper
bound of X) and nX (the greatest lower bound of X) exist.
(ii) X ~ IL is directed if and only if every two elements of X have an upper
bound in X.
(iii) x E IL is compact if and only if every directed X ~ IL is such that:
x [;;;IL uX implies x [;;;IL y for some y E X.
Let comp(lL) be the set of compact elements of L.
(iv) IL is w-algebraic if and only if x = u{y [;;; x I y compact} and comp(lL)
is countable.
Let us use the word domain in order to denote a w-algebraic complete
lattice. It is easy to see that in a domain there is always a bot tom (minimum)
element, that as usual we denote by _L
Definition 13.1.2. (i) A function h : IL ~ IL' is monotone if and only if:
x [;;;IL y implies h(x) ~IL' h(y).
(iii) A continuous function h : lI.. ---'> lI.. ' is strict if and only if:
h(..LJL) =v ..Lv·
(iv) The pointwise order between two continuous functions h, k : lI.. ---'> lI..' is
defined in the following way:
(v) Two domains (lI.., [;:;IL) and (lI..', [;:;v) are isomorphic if and only if there
are two continuous functions h : lI.. ---'> lI..' and k : lI..' ---'> lI.. such that:
- h o k = idv ,
- k o h = idlL ,
where idlL and idv denote the identity function respectively on lI.. and lI..' .
The notion of step function will play a key role in the construction of the
isomorphism between filter spaces and domains.
Let [lI.. ---'> 1I..'] = {f I f : lI.. ---'> lI..' is continuous }, and let [lI.. ---'>.L lI..'] = {f I
f : lI.. ---'> lI..' is continuous and strict}. The following result holds.
Lemma 13.1.4. Let lI.. and lI..' be domains.
(i) ([lI.. ---'> lI..' ], [;:;IL-+V) is a dom ain whose compact elements are least upper
bounds of finite sets of step functions.
(ii) ([lI.. ---'>.L lI..'], [;:;IL-+V) is a dom ain whose compact elements are least upper
bounds of finite sets of strict step junctions.
A further operat ion on domains that will be useful is the lijting. Let
(IL, ~lL) be a domain and let IL.l= IL U {..i}, where ..i is a fresh element not
belonging to IL. Moreover, let a ~lLl. b if and only if either a = ..i or a ~lL b.
The foUowing lemma holds.
Lemma 13.1.5. lf (IL, ~d is a dom ain then (IL.l, ~lLl.) is a dom ain (the
lijting of (IL, ~lL)).
Praof. Easy. o
Let us caU domain constructor an operat ion on domains. We will consider
in this section a restricted set of domain constructors, namely
Proof. Easy. o
Definition 13.1. 7. Let (IL, ~d and (IL', ~v) be domains. A retraction pair
is a pair of continuous functions (i : IL ~ IL', j : IL' ~ IL) such that:
- joi = idlL ,
- i oj ~ idv .
Ii (i, j) is a retraction pair fram IL to IL', i is called the embedding and j is
called the projection.
Property 13.1.8. (i) Let (il,jl) be a retraction pair from IL to IL' and (i 2,j2)
be a retraction pair from IL' to IL". Then (i 2 o il, jl o j2) is a retraction
pair from IL to IL".
(ii) An embedding (projection) function has a unique corresponding projec-
tion (embedding).
(iii) If (i, j) is a retraction pair from IL to IL' then both i and j are strict.
- c(i) = Ax:c(IL). i o x o j ,
- c(j) = Ax:c 2 (IL).j o x o i.
It is easy to check that (c(i),c(j)) is a retraction pair between c(IL) and
c 2 (IL) .
• In case of lifting, let (i,j) be a retraction pair between IL and c(IL), where
c = (.).L. Let
- c(i) = Ax:c(IL). if x = ..lc(IL) then ..lc2(IL) else i(x) ,
- c(j) = Ax:c 2 (IL). if x = ..lc2(IL) then ..lc(IL) else j(x).
Then (c(i), c(j)) is a retraction pair between c(IL) and c 2 (IL).
In case c is a compound domain constructor, the extension of c to retraction
pairs can be made starting from the previous defined extension and then
using Property 13.1.8.(i).
x = c(X),
where c is a domain constructor, and = denotes the isomorphism between
domains.
Theorem 13.1.11. Let (IL, !;;;IL) be a domain, and let (i,j) be a retraction
pair between IL and c(IL). The inverse limit
idcm(II..) if m = n,
{ n 1
rm,n = c - (i) o .. o cm(i) if m < n,
cn(j) o .. o c m - 1 (j) if n < m
It is easy to check that if m :S n then (rm, n , r n, m) is a retraction pair between
cm(lL) and cn(lL), by Property 13.1.8.(i). Let
- in,oo : cn(IL) --+ IL oo be Ax:cn(lL). (r n,o(x),rn,l(x), ... , rn,n(X), rn,n+l(X), ... );
- jn,oo : IL oo --+ cn(IL) be Ax:lL oo . (x)n ,
where (.)n denotes the n-th element of a sequence;
- 1: lLoo --+ c(lLoo ) be U(n20) (in+1 ,oo o rn,n+1 o jn,oo);
- J:c(lLoo)--+lLoo be U(n20)(in,ooorn+1,nojn+l,oo)'
Then (I, J) is a retraction pair between IL oo and c(IL oo ), such that 10 J =
idc(II.. oo )' so the two domains are isomorphic. O
Procedure compact-as-types(lI.. oo )
1. Choose a set of type constants C IL such that there is a bijection (.)+
between CIL and the compact elements of 1I.., such that (w)+ = ..iIL .
2. Define an intersection reIat ion :S:V'IL such that a :S:V'IL T if and only if
(T)+ !;;;;IL (a)+, for alI a, TE C IL .
3. Let T( CIL ) be the set of types built from the set of constants CIL.
Let (.)* be the function from T(CIL ) to comp(lI.. oo ) defined as folIows.
(3.1) If a E CIL then (a)* = io,oo((a)+).
(3.2) If cE {[o ---+.], [. ---+ .]..L,} then (a ---+ T)* = S(a)',(T)"
Otherwise, in case c = [. ---+..L ']..L, if (a)* i=- ..iIL oo then (a ---+ T)* =
S(a)' ,(T)" while if (a)* = ..iIL oo then (a ---+ T)* = Sa,(T)* where a =
S ..L ILoo ,..LILoo •
(3.3) (a A T)* = (a)* U (T)*.
4. Extend the intersection reIat ion :S:V'IL as folIows.
(4.1) If a, ţii, I/i E CIL (1 :s: i :s: n) and i((a)+) = Ul<i<n S(JLi)+,(Vi)+
where n E N, then both a :S:V'IL (ţiI ---+ 1/1) A ... A rţi~ ---+ I/n ) and
(ţiI ---+ I/d A ... A (ţin ---+ I/n ) :S:V'IL a.
(4.2) If c = [. ---+..L ']..L then (w ---+ w) ---+ T :S:V'IL W ---+ T,
The definit ion ofthe mapping (.)* need some comments. Point (3.2) maps
every arrow type into a step function. Note that if c = [. ---+..L ']..L, by definit ion
of strict function, Sa,b E lI.. oo implies either a i=- ..i or a, b = ..i. So types of
the shape w ---+ T, where (T)* i=- ..i, are in some sense redundant, and they
are mapped into a step function that is the maximum one less to the step
function S..L,(T)*'
Point (4.1) takes into account the initial retraction pair. Point (4.2) re-
flects point (3.2). Moreover, if C IL is finite (so lI.. and c(lI..) are finite) then
the number of rules to be joined to the intersection reIat ion :S:V'IL can be
transformed in a finite number.
The folIowing lemma proves that the procedure is correct, in the sense
that (.)* is a surjection, and the inclusion reIat ion between types respects the
order reIat ion of the domain.
(ii) (~) By induction on the definition of ~V'IL' taking into account the last
used rule.
(a) Then the prooffoHows since ..1 ~lI..oo a, for aH a, and since (w)* = ..1.
(b), (c), (e'), (e) By the definition of least upper bound.
(1), (d) By the Definition 13.1.3.iii.
(g) By the fact that (w ---> w)* = .lx ...1, that is the smaHest step function.
(r) Obvious.
(t) By induction.
Let U ~V'1L (f..ll ---> vd  ...  (f..ln ---> vn) be the conclusion of a rule added
by the point (4.1) of the procedure compact-as-types. Clearly also the
rule (f..ll ---> vd  ...  (f..ln ---> vn) ~V'1L U was added by construction, i.e.
U ~V'1L (f..ll ---> VI) Â ... Â (f..ln ---> v n). Hence (U)* and Ul<i<n S(JL;)*,(v;)*
denote the same compact element. - -
The case (f..ll ---> VI) Â ... Â (f..ln ---> V n) ~V'1L U is symmetric.
In both cases, u, /-li, Vi E CII.. (1 ::; i ::; n), i((u)+) = Ul<i<n s(JL;)+,(v;)+
and (u)+ = j (Ul~i~n s(JL;)+ ,(v;)+ ). - -
Let (w ---> w) ---> T ~V'1L W ---> T be the conclusion of a rule added by the
point (4.2) ofthe procedure compact-as-types. Hence c = [. --->l- ']l- and
if (T)* i=- (w)* then s(w)*,(r)* does not belong to lI..oo . In such case, by the
point (3.2) of the procedure compact-as-types,
((w ---> w) ---> T)* = (w ---> T)*.
( ~) Let (T) * ~lI..oo (u) *. The proof is given by induction on the total
number of symbols of u and T.
If (T) * = ..1 then the proof is trivial, since ..1 = (w) *, and w is the biggest
type. If T or u are type constants then the proof foHows by construction.
If u == Ul ---> U2 and T == TI ---> T2, then by the Definition 13.1.3.(iii)
and the definit ion of (.) *, (T2) * ~lI..oo (U2) * and (Ul) * ~lI..oo h) *. Thus by
induction TI ~V'1L Ul and U2 ~V'1L T2, and the prooffoHows by rule (f) of
Definition 1O.1.1.(ii).
214 13. Filter ,XL\-Models and Domains
Note that the proof of part (-{=) of the Lemma 13.1.13 gives a justification
of the legality condition (Definition 10.1.5) on a type system in order to
induce a >'..:1-model. In fact, this condition reflects a semantic property on
step functions.
Praof. Let us define the functions h : ILoc ~ F(V'L) and k : F(V'L) ~ ILoc in
the folIowing way:
- h(a) =i {O' I (0')* ~ a},
- k(f) = U{(O')* 10' E f}.
By Lemma 13.1.13, hand k realize the desired isomorphism. D
Now we are ready to prove that each of the filter models we presented is
isomorphic to a model built as the inverse limit solution of a domain equation.
X= [X~Xl.
Note that the minimal solution ofthis equation is the domain ({..1.}, id{J..})'
since there is just one continuous function from {..1.} to {..1.}, namely the func-
tion ).x . ..1.. 80 take as initial domain (IT, ~u), where IT = {..1.u, Tu}, and ~u is
defined as ..1.u ~u Tu. Take the domain ([IT ~ IT], ~u--->u), which is a domain
by Lemma 13.1.4.(i), and choose, as embedding function between (IT, ~u) and
([IT ~ IT], ~u--->u), the function i so defined:
13.1 Domains 215
- i(..ill ) = ..i[ll-+ll]'
- i(T ll ) = 8.l 1l ,T p
and let TI oo be the inverse limit solution so obtained.
The correspondence between C oo and comp(TI) is defined in the following
way:
- (w)+ = ..ill,
- (cjJ)+ = T ll ·
Let the function (.)* : T(Coo ) --+ comp(TI oo ) be the function made according
to the procedure compact-as-types.
The procedure compact-as-types(TI oo ) generates, at point (4.1), the rules
(h1), (h2) and (h3) of Fig. 11.1 (pag. 120) of the intersection relation ::;00.
Note that point (4.2) is not applied in this case.
Let p : Var --+ TI oo ; the interpretation function [.]lloo (see [67]) is:
- [x]~oo = p(x),
- [M N]~oo = I([M]~oo) ([N]~oo),
- [>'x.M]~oo = J(l-d.[M]~[d/x])'
where 1 and J are defined in the proof of Theorem 13.1.11.
Theorem 13.1.15. LetI =< TI oo , TI oo , 0lloo' [.]lloo > where 0lloo == l-xy.I(x)(y).
I i8 a >'A-calculus model, and it is isomorphic to 'H.
ProoJ. It is easy to check that I satisfies the conditions of Definition 10.0.1,
so it is a >.,d-model. By Theorem 13.1.14, (TI oo , [;;;lloo) is isomorphic to F(oo),
ordered by set inclusion. Now we will prove that, if ( : Var --+ TI oo and
p : Var --+ F(oo) are such that "ix E Var, ((x) and p(x) are isomorphic
elements, then "iM E A [M]~oo is isomorphic to [M]:(oo). Since an element
in a domain is completely determined by the set of compact elements less
equal to it, we need only to prove that:
lS;iS;n
dE comp(lloc)
The model I was the first denotational AA-calculus model. It was built
by Scott [89], and the induced A-theory was extensively studied in [54, 97],
where the approximation theorem is proved by using the technique of indexed
reductions. An analysis of the characterization of term in the I-model can be
found in [32]. By the structure of lI, it is possible to have a different inverse
limit solution, by choosing as initial embedding function the function i', such
that i'(J..IT) = 1.[IT-tIT] and i'(T IT ) = 8hTIl • This model was first defined by Park
[75], and it induce a A-theory quite different from H, which was extensively
studied in [53].
13.1.2 N as Domain
Take as initial domain (N, [;;;1\1), where N = {1.I\I' x, T I\I}, and [;;;1\1 is defined
as 1.1\1 [;;;1\1 b, for alI bEN and x [;;;1\1 T 1\1. Take the domain ([N -- N], [;;;I\I-tl\l) ,
which is a domain by Lemma 13.1.4.(i), and choose, as embedding function
between (N, [;;;1\1) and ([N -- N], [;;;I\I-tl\l) , the function i so defined:
- i(1.I\I) = 1. [I\I-tl\l],
- i(x) = 8T N ,x,
- i(T 1\1) = 8 x ,T N,
Let the function (.)* : T(C~) --t comp(Noe ) be the function made according
to the procedure compact-as-types.
The procedure compact-as-types(Noe ) generates, by point 2, the rule
(nO) of Fig. 11.3 (pag. 145). Furthermore, point (4.1) generates the rules
(nI), (n2), (n3), (n4) and (n5) of Fig. 11.3 of the intersection relation ~~.
Note that point (4.2) is not applied in this case.
Let the interpretation function [.]1'>1 and the composition 0N oo be defined
00
Theorem 13.1.16. Let.J =< Noe, Noe, 0N oo ,[.]N oo > and 0N oo == .lxy.I(x)(y) .
.J is a )..A-calculus model, and it is isomorphic to N.
The model.J was first presented and studied in [30], as filter model. There
the approximation theorem was proved using the computability technique
we also used here. The notion of A-persistent normal form, on which the
construction of the model is based, was first introduced in [17].
13.1.3 .c as Domain
Take the following domain equation:
x= [X --t X]~.
By the presence of the lift ing domain constructor, this equation admits a
minimal solution. In fact, take as initial domain (lE, ~1E), where lE = {..lJE}, and
~1E is the identity relation. Take the domain ([lE --t lEh, ~[IE--+IE]..L)' which is a
domain by Lemma 13.1.4.(i) and Property 13.1.6, and choose, as embedding
function between (E, !;1E) and ([E --t E], !;[IE--+IE]), the function i so defined:
- i(..lIE) = ..l[IE--+IE]..L'
and let lE oe be the inverse limit solution so obtained.
The correspondence between eL and comp(lE) is defined in the following
way:
- (w)+=..lIE.
Let the function (.)* : T(C~) --t comp(lEoe ) be the function made according
to the procedure compact-as-types.
The procedure compact-as-types(lEoe ) generates, at point (4.1), the
trivial rule w ~ w of the intersection relation ~L. Note that point (4.2)
is not applied in this case.
Let the interpretation function [.]1E and the composition 0lE oo be defined
00
as follows:
- [x]~oo = p(x),
218 13. Filter Ad-Models and Domains
Theorem 13.1.17. Let E =< lE oo , lE 00 , 0IEoo' [.]IEoo > where 0IEoo is defined
as Axy.I(x)(y).
E is a >'A-calculus model, and it is isomorphic to 12.
Proof. Similar to the proof of Theorem 13.1.15, taking into account the dif-
ferent definit ion of interpretat ion. O
13.1.4 V as Domain
This equation, like that one showed in the previous subsection, also admits
a minimal solution. In fact, take as initial domain (1U, ~u), where 1U = {l.u},
and ~u is the identity relation. Take the domain ([1U --->.1 1U].1,~[U->.l.U].l.)'
which is a domain by Lemma 13.1.4.(i) and Property 13.1.6, and choose, as
embedding function between (1U, ~1[J) and ([1U --->1- 1U], ~[l[J->.l.l[Jl)' the function
i so defined:
- i(l.u) = l.[u->.l.u].l.
and let 1U 00 be the inverse limit solution so obtained.
(CJ ---> 7)* = S(a)*,(r)* if either (CJ)*, (7)* = l.Uoo or (CJ)* "1 l.U oo '
(CJ ---> 7)* = S(w->w)*,(r)* if (CJ)* = l.U oo .
Moreover, the intersection reIat ion built by the procedure generates, at point
(4.1), the trivial rule w :S w, while at point (4.2) rule (v) of Fig. 12.1 (pag.
182) is generated.
Let p: Var ---> 1U oo /l.u oo ; the interpretation function [.]uoo(see [44]) is:
- [x]~oo = p(x),
- [M N]~oo = J' (I([M]~oo) )([N]~oo),
- [>'x.M]~oo = J(I'(strict(Ad.[M]~[d/x])))'
13.1 Domains 219
where 1 and J are defined in the proof of Theorem 13.1.11, l' and J' are the
isomorphism pair between [1U oo ~1- 1U oo ] and [1U oo ~1- 1U oo h, and strict is a
function such that
x = ..l1!J=,
strict(f)(x) = {~(~) otherwise.
Theorem 13.1.18. Let U =<1U oo , 1Uoo / ..l1!J=, 0I!J=, [.]I!J=> where 0I!J= is de-
fined as J..xy.I(x)(y).
U is a >..r -calculus model, and it is isomorphic ta V.
Proof. Similar to the proof of Theorem 13.1.15, taking into account the fact
that only the strict functions are present in the domain.
By Theorem 13.1.14, (1U oo , ~I!J=) is isomorphic to F(y') , ordered by set
inclusion. Then the proof follows from the definit ion of [.]I!J= . O
The model V was first presented and studied in [44], both as an inverse
limit solution of the previous domain equation and as a filter model. There
the approximation model was proved using the indexed reduction technique.
Other filters >'A-models. In [37] two filter >'A-models are designed which
completely characterise sets of terms with similar computational behaviours.
Moreover, in [4, 40] filter >'A-models characterizing the easiness property
of terms are proposed. Shortly, a term is easy when it can be consistently
equated to every other term.
Other classes of >'A-models. Berry [14] proposed a different class of do-
mains based on the notion of sta bIe functions. Starting from this notion,
Girard [47] proposed qualitative domains as >'A-models. Later qualitative
domains were that were later refined in the coherence domains. The first de-
notational semantics of linear logics is based on this kind of domains[48]. The
definit ion of intersection reIat ion can be modified in order to describe this
class of models using intersection types, as was proved in [52]. The notions of
strongly stable functions and hypercoherence spaces, on which another class
of >'A-models is based, were introduced in [23]. Models based on the notion
of bidomain, which is a space endowed with two notions of order (continuous
order and stable order), were introduced in [99]. In this setting, a model cor-
rect with respect to the L-operational semantics was constructed in [61]. A
quite complete presentation of the "webbed" >'A-models, i.e. those whose do-
mains are subdomains of some (P(D), s.:;:), can be found in [13]; clearly aH the
>'A-models presented in this book belong to this class. >'A-models based on
game sematics were presented in [43]. Categorical presentations of >'A-models
in a typed setting can be found [8, 31, 62, 59, 90].
Incompleteness. The first incompleteness result fQJ the >'A-calculus seman-
tics was proved in [53], where a >.-theory was shown for which there do not
exist a correct and complete model in the class of Scott's models built by an
inverse limit construction. Further investigations on this topic, using topolog-
ical tools, was made in [86]. Incompleteness results for the class of >'A-models
based on sta bIe functions was proved in [11].
222 14. Further Reading
Computational Power
15. Preliminaries
In the Introduction we claimed that both the >'A-calculus and the >.r-calculus
can be seen as paradigms for programming languages in the calI-by-name and
calI-by-value settings respectively. In this chapter this claim will be justified.
In fact, we will show that both the calI-by-name and the calI-by-value >.-
calculi have the computational power of Turing machines, or equivalently,
they are computationally complete. The completeness can be achieved without
adding special constants to the language, but alI data structures needed for
computing, in particular booleans, natural numbers and functions, can be
coded into A.
We will show how to code useful data structures. Moreover, we will prove
that alI the calI-by-name and calI-by-value reduction machines presented in
Part II of this book can be effectively used for computing. In fact, computa-
tional completeness can be achieved by using each one of them.
It is well known that not alI the partial functions from natural numbers to
natural numbers can be effectively computed. The most famous detinition of
the class of computable functions was given by Turing, by using the Turing
machines. But Kleene's definition of partial recursive functions [56] makes it
easier to detine the coding of functions in a >.Ll-calculus [57].
The class of computable functions, or partial recursive functions, is given
in two stages. First, the class of primitive recursive functions is defined.
They are generated from a set of initial functions by closure under particular
constructions (composition and primitive recursion). The primitive recursive
functions include most functions ever encountered in practical mathematics
and computer science. However, alI primitive recursive functions are total,
and hence the class must necessarily falI short of the full class of computable
functions.
The second stage of Kleene's characterization extends the class of prim-
itive recursive functions by adding an additional operator of minimalization
that introduces unbounded and possibly nonterminating searches. Therefore
the class of alI partial recursive functions is obtained.
226 15. Preliminaries
ij k = O,
otherwise.
Note that, in the previous definition, the function h is defined on all nat-
ural numbers, by hypothesis. Now, the full class of partial recursive functions
can be defined as follows.
The next lemma shows that in order to represent the booleans, the choice
of taking two A1J-different normal forms is correct in each one of the re duct ion
machines we defined.
Proof. If O E {H, N, L} then let C[.] be such that M, N =t A C[.] (see Fig. 2.1
pag. 32), otherwise let C[.] be such that M, N =t r C[.] (see Fig. 3.1 pag. 52).
Then C[M] ./J.o x and C[M] ./J.o y, for two different variables x and y. The
term Cond == AUXY.C[u] plays the desired role in all the reduction machines
under consideration. D
In the next definit ion a numeral system is presented that plays the desired
role in aU the operational semantics we have studied.
Note that basic elements of (]t are A-normal forms, so they are both input
and output values for all the machines. The proof can be done in the same
manner for aH the caH-by-name reduction machines.
In all the formal systems presented in order to induce evaluation relations
H, N, L, V, there is a rule named (head). It is easy to see that, for each
one of the given operational machines, (head) is reversible in the sense that
in aH considered cases when the conclusion is derivable then its premises
are derivable. In order to simplify the proofs, in the call-by-name setting,
i.e. when O E {H,N,L}, we will denote by (head)+ a sequence of n ~ 1
applications of rule (head) in a derivation.
We need some properties of the operational semantics.
Praof. (i) In case O E {H, N, L}, the proof follows respectively by Proper-
ties 6.1.4,6.2.4 and 6.3.4. Let O == V. By the confluence theorem we can
assume MP -1).v R if and only if NP -1).v Q. We show that R == Q by
induction on the last applied rule in M -1).v N. Rules (var) and (block)
are not possible, since M E AO; while (abs) and (head) are trivial.
(ii) Since M 11'0, for all O, implies that M is both a A and a r-unsolvable
of order O, then M N is an unsolvable of order O too. D
Note that point (i) of the previous property is just a consequence of the
fact that every reduction machine reduces at every step the head redex.
Theorem 15.2.8. If O E {H, N, L} then lJt is an O-numeral system.
Praof. We prove that lJt satisfies all the conditions given in Definition 15.2.4.
(i) {T, F} is an O-representation of booleans, by Lemma 15.2.2 and since in
all cases ~o is a A-theory.
(ii) Zero, Succ, Test, Pred are both input and out put values.
1. Zero -1).0 'O', where 'o' == Zero. By induction on n we will prove that
the numeral 'n + l' is the term Ax.xF' n' E L1 n 8.
Let Succ( ... (SuccZero) ... ) -1).0 'n'; thus
'----v----"
n
Succ(Succ( ... (SuccZero) ... )) -1).0 R,
, v
"
n+l
Now we check that 1)1 is also a numeral system in a call-by value setting.
Zero .JJ-v 'O', where 'O, == Zero. By induction on n we will prove that
the numeral 'n + l' is the term Ax.xF'n' E r n r-LBNF.
Let us assume that Succ( ... (SuccZero) ... ) .JJ-v 'n', by induction; there-
-----------.JJ-v
n
fore Succ(Succ( ... (SuccZero) ... ))
~ V J
R if and only if Succ'n' .JJ-v R by
n+l
induction and (head), if and only if'n'(Auvx.xF(Ay.yUV)).JJ-v R by rules
(head) and (lazy), since Succ == At.t(AUVX.xF(Ay.yUV)).
If n = O, then this happens only if (Auvx.xF(Ay.yuv))TT .JJ-v R by rules
(head) and (lazy), so it is easy to see that R == Ax.xF(Ay.yTT) == '1'.
Otherwise, 'n'(Auvx.xF(Ay.yUV)).JJ-v R if and only if
(Auvx.xF(Ay.yuv))F'n -1'.JJ-v R,
if and only ifAX.xF(Ay.yF' n - 1') .JJ-v R. But Ax.xF(Ay.yF' n - 1') E A-
NF, so R == Ax.xF(Ay.yF' n - 1') == 'n + 1'.
is O-representable.
Proof By hypothesis there are terms 'h"", , 91"", ... ,' 9m ..., O-representing func-
tions h, 91, ... , 9m. Let
'f"" -= "Xl··
, .x p •'h""('''''
91 Xl· .. X p ) ••• ('''''
9m Xl .. .X p ) •
'h""(' 9l""Nl ... N p ) ••• (' 9m ""Nl ... N p ) -0-0 'h(9l(nl' ... , n p ), •• ·,9m(n1, ... , n p ))"".
But' f'N1 ... N p -0-0 R if and only if 'h ""(' 91""N1... N p ) ••• (' 9m ""N1 ... N p ) -0-0 R
(by (head)+), so the proof is done since h, 91, ... , 9m are total. O
Proof Trivial. o
The folIowing lemma shows how YA can be used for mimicking primitive
recurSlOn.
1601 Call-by-Name Computational Completeness 235
Proof. By hypothesis there are terms rh' and rg, representing hand go We
will prove that r f' is O-represented by JAP, where P is:
Let Ni -U-o r ni" Q -U-o rk' for some k,ni E N (1 ~ i ~ m); the proofwill be
given by induction on ko
Lemma 16.1.6. Let h: Nn ---; N and gl, ... ,gn : Nm ---; N be O-representable
partial recursive functions. The function dejined f'T"Om them by composition,
namely
f(X1, ... ,xm ) = h(gl(X1, ... ,xm ), ..... 'gn(X1, ... ,xm )),
is O-representable.
P'T"Oof. Let
Let Ni -U-o r ni' (1 :::; i :::; m). r f'N 1... N m -U-o R if and only if
rg1'N1... N m KII) ... (r gn 'N1... N m KII)(FN1... N m ) -U-o R (by (head)+).
Let j be the minimum integer such that r gj 'N1 ... N m 11'0 (1 :::; j :::; m).
rg1'N1 ... NmKII) ... (rgn'N1 ... NmKII)(FN1 ... Nm) -U-o R if and only if
Irg2'N1 ... NmKII) ... (rgn'N1 ... NmKII)(FN1 ... Nm) -U-o R (by (head)+) if
and only if r g2'N1... N m KII) ... (r gn 'N1 ... NmKII)(FN1 ... N m ) -U-o R (by
(head) if and only if r gj 'N1 ... NmKII)···r gn 'N1... N m KII)(FN1... N m ) -U-o
R. But r gj 'N1... N m 11'0 implies r gj 'N1... N m is a A-unsolvable of order O
in case 0== L. So rgj'Nl ... NmKII) ... rgn'Nl ... NmKII)(FN1 ... Nm) is a
A-unsolvable of order O, respectively, and so in alI cases,
In case r gi 'N1... N m -U-o, for alI i (1 :::; i :::; n), r f'N 1... N m -U-o R if and
only if (FN1 ... N m ) -U-o R, and the proof folIows the same line as that of
Lemma 16.1.2. D
(ii) The proof is similar to that of the previous point, by using the fact that
h is a total function. O
Proof (i) Let f(n) = k, thus k is the minimum integer such that h(n, k) = O.
By induction on k, the prooffolIows by Lemma 16.1.7.
(ii) By Lemma 16.1.7. O
P == Athxy.Test(hxy)y(thx(Succ V)).
Then the proof folIows directly by Property 16.1.8. o
So the O-representability of alI partial recursive function folIows.
Now let us prove that also the V-reduction machine can compute alI partial
recursive functions. We will point out just the differences between calI-by-
name and calI-by-value computability. The most interesting difference occurs
in the coding of recurs ion and minimalization, which is done through a fixed-
point operator in the calI-by-name setting. We have seen that a calI-by-value
fixed-point operator is such that, when applied to a r-valuable term, it is
operationalIy equal to a not r-valuable term. In fact, if we think to interpret
terms as function, the undefined value is the fixed-point of every function,
when parameters are passed by value. So in order to deal with both recursion
and minimalization, we will use a calI-by-value recursion operator, whose be-
haviour was been defined at the end of Sect. 3.1. Other quite small differences
are in the composition of partial functions.
Let Yr == (Axf.f(AZ.xxfz))(Axf.f(AZ.xxfz)); clearly Yr is a recurs ion
operator. The folIowing theorem shows its operational behaviour.
238 16. Representing Functions
f(Xl, ... ,xm ) = h(gl(Xl, ... ,xm ), ..... 'gn(xt, ... ,xm »
is V -representable.
Praof. Let H == >.xl ... xm.rh'(rgl'Xl ... Xm) ..... (rgn'Xl ... Xm); it is easy to
check that H is a V-representation of f, by Property 16.2.3. D
In the literature, computability, for both the call-by-name and the call-by-
value -X-calculi, was defined starting from an approach different from the
present one. In fact, the representation of computable functions was devel-
oped inside a theory, while we have chosen an operational point of view. The
next definit ion is the classical one for the -XA-calculus.
functions, given by Kleene, in the >'-I-calculus [57]. The idea of using fixed-
point operators to represent primitive recursion and minimalization comes
from Turing [95].
The system we proposed in Section 15.2 is a slight modification of the
numeral system of Barendregt [9], recalled in the following definition.
which works similarly to Yr. The computability in the theory =r was com-
pletely developed by Paolini [72], using Y r and the Barendregt numeral sys-
tem.
Bibliography
1. Samson Abramsky. Domain theory in logical form. Annals of Pure and Applied
Logic, 51(1-2):1-77, 1991.
2. Samson Abramsky and Luke Ong. FuH abstract ion in the lazy lambda calculus.
Information and Computation, 105(2):159-267, 1993.
3. Fabio Alessi. Strutture di Tipi, Teorie dei Domini e Modelli del Lambda Calcolo.
Tesi di dottorato di ricerca in informatica, Universita di Milano e Torino, 1990.
4. Fabio Alessi, Mariangiola Dezani-Ciancaglini, and Furio HonseH. Filter models
and easy terms. In Antonio Restivo, Simona Ronchi DeHa Rocca, and Luca
Roversi, editors, Theoretical Computer Science, 7th Italian Conference, ICTCS
2001, Torino, Italy, October 4-6, 2001, volume 2202 of Lecture Notes in Com-
puter Science, pages 17-37. Springer-Verlag, 2001.
5. Roberto M. Amadio and Pierre-Louis Curien. Domains and Lambda-Calculi,
volume 46 of Cambridge 'I'racts in Theoretical Computer Science. Cambridge
University Press, Cambridge, 1998.
6. Andrea Asperti, Cecilia Giovannetti, and Andrea Naletto. The bologna optimal
higher-order machine. Technical Report UBLCS-95-9, University of Bologna,
Department of Computer Science, March 1995.
7. Andrea Asperti and Stefano Guerrini. The Optimal Implementation of Func-
tional Programming Languages. Cambridge University Press, Cambridge, 1998.
8. Andrea Asperti and Giuseppe Longo. Categories, Types, and Structures: An
Introduction to Category Theory for the Working Computer Scientist. Founda-
tions of Computing Series. The MIT Press, Cambridge, MA, 1991.
9. Henk Barendregt. The Lambda Calculus: Its Syntax and Semantics (2nd edi-
tion). North-HoHand, Amsterdam, 1984.
10. Henk Barendregt, Mario Coppo, and Mariangiola Dezani-Ciancaglini. A fil-
ter lambda model and the completeness of type assignment. The Joumal of
Symbolic Logic, 48(4):931-940, December 1983.
11. Olivier Bastonero and Xavier Gouy. Strong stability and the incompleteness of
stable models for lambda- calculus. Annals of Pure and Applied Logic, 100(1-
3):247-277, 1999.
12. Olivier Bastonero, Alberto Pravato, and Simona Ronchi DeHa Rocca. Struc-
tures for lazy semantics. In Gries and de Roever, editors, Programming Concepts
and Methods, pages 30-48. Chaptman & HalI, 1998.
13. Chantal Berline. From computation to foundations via functions and appli-
cation: The A-calculus and its webbed models. Theoretical Computer Science,
249(1):81-161, October 2000.
14. Gerard Berry. Stable models of typed lambda-calculi. In Giorgio Ausiello and
Corrado Bohm, editors, Automata, Languages and Programming, Fifth Collo-
quium, ICALP, Udine, Italy, July 17-21, 1978, volume 62 of Lecture Notes in
Computer Science, pages 72-89. Springer-Verlag, 1978.
242 Bibliography
15. Corrado Băhm. Alcune proprieta delle forme ,81]-normali nel >'K-calculus. Pub-
blicazione n. 696, Instituto per le Applicazioni del Calcolo, Roma, 1968.
16. Corrado Băhm and Mariangiola Dezani-Ciancaglini. A CUCH-machine: the
automatic treatment of bound variables. International Journal of Computer
and Information Sciences, 1(2):171-191, June 1972.
17. Corrado Băhm and Mariangiola Dezani-Ciancaglini. >.-terms as total or partial
functions on normal forms. In G. Goos and J. Hartmanis, editors, >'-Calculus
and Computer Science Theory, volume 37 of Lecture Notes in Computer Science,
pages 96-121, Berlin, DE, 1975. Springer-Verlag.
18. Corrado Băhm, Mariangiola Dezani-Ciancaglini, P. Peretti, and Simona Ronchi
Della Rocca. A discrimination algorithm inside >.-calculus. Theoretical Com-
puter Science, 8(3):271-291, 1978.
19. Corrado Băhm and W. Gross. Introduction to the CUCH. In E. R. Caianiello,
editor, Automata Theory, pages 35-65. Academic Press, New York, 1966.
20. Corrado Băhm and Adolfo Piperno. Characterizing X-separability and one-
side invertibility in >'-,8-il-calculus. In Proceedings, Third Annual Symposium
on Logic in Computer Science - LICS'88, pages 91-103, Edinburgh, Scotland,
5-8 July 1988. IEEE Computer Soeiety Press.
21. Corrado Băhm, Adolfo Piperno, and Stefano Guerrini. Lambda-definition of
function(al)s by normal forms. In Donald Sannella, editor, Programming Lan-
guages and Systems-ESOP'94, 5th European Symposium on Programming, vol-
ume 788 of Lecture Notes in Computer Science, pages 135-149. Springer-Verlag,
1994.
22. Corrado Băhm, Adolfo Piperno, and Enrico Tronei. Solving equations in
lambda-calculus. In Logic Colloquium'88, Amsterdam, 1988. North-Holland.
23. Antonio BuceiareIIi and Thomas Ehrhard. A theory of sequentiality. Theoretical
Computer Science, 113(2):273-291, 7 June 1993.
24. Rod Burstall and Furio Honsell. Operational semantics in a natural deduction
setting. In Gerard Huet and Gordon Plotkin, editors, Logical F'rameworks, pages
185-214, Cambridge, 1991. Cambridge University Press.
25. Alonzo Church. The Calculi of Lambda Conversion, volume 6 of Annals of
Mathematical Studies. Princeton University Press, Princeton, 1941. Reprinted
by University Microfilms Inc., Ann Arbor, MI in 1963 and by Klaus Reprint
Corp., New York in 1965.
26. Alonzo Church and J. Barkley Rosser. Some properties of conversion. Trans-
actions of the Aerican Mathematical Society, 39:472-482, 1936.
27. Mario Coppo and Mariangiola Dezani-Ciancaglini. An extension of the basic
functionality theory for the >.-calculus. Notre Dame Journal of Formal Logic,
21 (4) :685-693, October 1980.
28. Mario Coppo, Mariangiola Dezani-Ciancaglini, Furio Honsell, and Giuseppe
Longo. Extended type structure and filter lambda models. In G. LoIIi, G. Longo,
and A. Marcja, editors, Logic Colloquim'82, pages 241-262. Elsevier Seience
Publishers B.V. (North-Holland), Amsterdam, 1984.
29. Mario Coppo, Mariangiola Dezani-Ciancaglini, and Simona Ronchi Della
Rocca. (Semi)-separability of finite sets of terms in Scott's Doo-models of the >.-
calculus. In Giorgio Ausiello and Corrado Băhm, editors, Automata, Languages
and Programming, Fifth Colloquium, volume 62 of Lecture Notes in Computer
Science, pages 142-164, Udine, Italy, 17-21 July 1978. Berlin, Springer-Verlag.
30. Mario Coppo, Mariangiola Dezani-Ciancaglini, and Maddalena Zacchi. Type
theories, normal forms and Doo lambda models. Information and Computation,
72(2):85-116, 1987.
31. Roy L. Crole. Categories for Types. Cambridge University Press, Cambridge,
1993.
Bibliography 243
32. Pierre Louis Curien. Sur l'eta-expansion infinie. Comptes Rendus de l'Academie
des Sciences, to appear.
33. Pierre-Louis Curien and Hugo Herbelin. The duality of computation. In
Proceedings of the ACM Sigplan International Conference on Functional Pro-
gramming (ICFP-OO), volume 35(9) of ACM Sigplan Notices, pages 233-243,
Montreal, Canada, September 18-21 2000. ACM Press.
34. Haskell B. Curry and Robert Feys. Combinatory Logic - Volume 1. Studies in
Logic and the Foundations of Mathematics. Elsevier, North-Holland, (Amster-
dam, London, New York), L. E. J. Brouwer, E. W. Beth, A. Heyting editors,
edition, 1958. With two sections by William Craig. Second edition, 1968.
35. Haskell B. Curry, J. Roger Hindley, and Jonathan P. Seldin. Combinatory Logic
- Volume 2, volume 65 of Studies in Logic and the Foundations of Mathematics.
Elsevier, North-Holland, (Amsterdam, London, New York), A. Heyting, H. J.
Keisler, A. Mostowski, A. Robinson, P. Suppes editors, edition, 1972.
36. Rene David and Karim Nour. A syntactical proof of the operational equivalence
of two A-terms. Theoretical Computer Science, 180(1-2):371-375, 10 June 1997.
37. Mariangiola Dezani-Ciancaglini, Silvia Ghilezan, and Silvia Likavec. Be-
havioural inverse limit models. Theoretical Computer Science, 2003. To appear.
38. Mariangiola Dezani-Ciancaglini, Furio Honsell, and Fabio Alessi. A complete
characterization of complete intersection-type preorders. ACM Transactions on
Computational Logic, 4(1):120-147, January 2003.
39. Mariangiola Dezani-Ciancaglini, Furio Honsell, and Simona Ronchi
Delia Rocca. Models for theories of functions strictly depending on ali
their arguments. The Journal of Symbolic Logic, 51(3):845-846, 1986.
(Abstract).
40. Mariangiola Dezani-Ciancaglini and Stefania Lusin. Intersection
types and lambda theories. In Electronic Proceedings of WIT'02
(http://www.irit.Jr/zeno/WIT2002/proceedings.shtml). 2002.
41. Roberto Di Cosmo. A brief history of rewriting with extensionality. In Fairouz
Kamareddine, editor, International Summer School on Type Theory and Rewrit-
ing, Glasgow, 1996. Kluwer.
42. Pietro Digianantonio. Game semantics for the pure lazy A-calculus. In Samson
Abramsky, editor, Typed Lambda Calculi and Applications: 5th International
Conference, TLCA 2001 Krakow, Poland, May 2-5, 2001, volume 2044 of Lec-
ture Notes in Computer Science, pages 106-120, Berlin, June 2003. Springer-
Verlag.
43. Pietro Digianantonio, Gianluca Franco, and Furio Honsell. Game semantics
for untyped A,81)-calculus. In Jean-Yves Girard, editor, Typed Lambda Cal-
culi and Applications: 4th International Conference, TLCA '99, L'Aquila, ltaly,
Apri11999, volume 1581 of Lecture Notes in Computer Science, pages 114-128,
Berlin, July 2003. Springer-Verlag.
44. Lavinia Egidi, Furio Honsell, and Simona Ronchi Delia Rocca. Operational,
denotational and logical descriptions: a case study. Fundamenta Informatica?,
16(2):149-170, 1992.
45. Matthias Felleisen and Daniel P. Friedman. A syntactic theory of sequential
state. Theoretical Computer Science, 69(3):243-287, 1989. Preliminary version
in Proc. 14th ACM Symp. Principles of Programming Languages 1987, pages
314-325.
46. Matthias Felleisen, Daniel P. Friedman, Eugene E. Kohlbecker, and Bruce F.
Duba. A syntactic theory of sequential control. Theoretical Computer Science,
52:205-237, 1987.
47. Jean-Yves Girard. The system F of variable types, fifteen years later. Theo-
reti cal Computer Science, 45(2):159-192, 1986.
244 Bibliography
67. Albert Meyer. What is a model of the lambda calculus? Information and
Computation, 52(1):87-122, 1982.
68. Robert Milner. FulIy abstract models of typed lambda-calculus. Theoretical
Computer Science, 4:1-22, 1977.
69. John C. Mitchell. Foundations of Programming Languages. The MIT Press,
Cambridge, MA, 1996.
70. Eugenio Moggi. The Partial Lambda-Calculus. PhD thesis, Edinburgh Univer-
sity, February 1988. Report CST-53-88.
71. C.-H. Luke Ong. FulIy abstract models of the lazy lambda calculus. In 29th
Annual Symposium on Foundations of Computer Science, pages 368-376, White
Plains, New York, 24-26 October 1988. IEEE Computer Society Press.
72. Luca Paolini. Call-by-value separability and computability. In Antonio Restivo,
Simona Ronchi DelIa Rocca, and Luca Roversi, editors, Theoretical Computer
Science, 7th Italian Conference, ICTCS 2001, Torino, Italy, October 4-6, 2001,
volume 2202 of Lecture Notes in Computer Science, pages 74-89. Springer-
Verlag, 2001.
73. Luca Paolini and Simona Ronchi DelIa Rocca. CaII by value solvability. Theo-
retical Informatics and Applications, 33(6):507-534, nov 1999.
74. Luca Paolini and Simona Ronchi DelIa Rocca. The parametric parameter pass-
ing },-calculus. Information and Computation, 189(1):87-106, feb 2004.
75. D. M. R. Park. The Y-combinator in scott's lambda-calculus models. Research
Report CS-RR-013, Department of Computer Science, University of Warwick,
Coventry, UK, June 1976.
76. Adolfo Piperno. An algebraic view of the Bohm-out technique. Theoretical
Computer Science, 212(1-2):233-246, February 1999.
77. Andrew M. Pitts. Operational semantics and program equivalence. In
G. Barthe, P. Dybjer, and J. Saraiva, editors, Applied Semantics, volume 2395
of Lecture Notes in Computer Science, pages 378-412. Springer-Verlag, 2002.
(Revised version of lectures at the International Summer School On Applied
Semantics, APPSEM 2000, Caminha, Minho, Portugal, 9-15 September 2000.).
78. Gordon D. Plotkin. CalI-by-name, calI-by-value and the },-calculus. Theoretical
Computer Science, 1:125-159, 1975.
79. Gordon D. Plotkin. LCF considerd as a programming language. Theoretical
Computer Science, 5:223-225, 1977.
80. Gordon D. Plotkin. A structural approach to operational semantics. DAIMI
FN-19, Aarhus University, Aarhus, Denmark, September 1981.
81. Gordon D. Plotkin. Domains. Dept. of Computer Science, University of Edin-
burgh, 1983.
82. Alberto Pravato, Simona Ronchi DelIa Rocca, and Luca Roversi. The caII by
value },-calculus: a semantic investigation. Mathematical Structures in Computer
Science, 9(5):617-650, 1999.
83. G. E. Revesz. Lambda-Calculus Combinators and Functional Progmmming,
volume 4 of Cambridge 'JIracts in Theoretical Computer Science. Cambridge
University Press, Cambridge, 1988.
84. Simona Ronchi DeHa Rocca. Discriminability of infinite sets of terms in the
Doo -models of the },-calculus. In Egidio Astesiano and Corrado Bohm, edi-
tors, Proceedings of the 6th ColZoquium on Trees in Algebra and Progmmming
(CAAP'81), volume 112 of Lecture Notes in Computer Science, pages 350-364,
Genova, Italy, March 1981. Springer-Verlag.
85. Simona Ronchi DeHa Rocca. Operational semantics and extensionality. In
Proceedings of the 2nd Imternational ACM SIGPLAN Conference on Principles
and Practice of Declarative Programming (PPDP-OO), pages 24-31, Montreal,
September 20-23 2000. ACM Press.
246 Bibliography
->LlO1/,97 nfA,29
(.)*, 212 .J).0,67
(.)+, 212 r,7
=Ll,7 r-NF,35
=01/,97 r-hnf,39
=Llo1/,97 r-lbnf,66
=Ll1/,23 r-nf, 35, 66
App1i, 133 rn,184
App.c, 168 ~, 145
ApPN,154 La, 85, 170
Appv,195 LI, 85, 170
BUB', 133, 168, 195 A,3
B,189 An, 123
B n ,29 A1],26
C M ,145 A-hnf, 25, 66
CL, 163 A-lhnf, 25, 66
C oo , 120 A-nf, 25, 66
C.,;,182 A-pnf,144
Comp1i,133 An-nf,124
Comp.c,168 AI, 7
ComPN,154 N,77
Compv,195 n,123
Cond, 227 n 1i ,129
Eoo, 128, 139 tp1i, 130
l(C), 109 Pred, 229
l(CM), 145 Ift, 36
l(CL), 163 Ift.e, 36
l(Coo ), 120 Ift.e-nf, 36
l(C.,;), 182 ~D' 138
an, 29 ~N' 159, 160
T(C),109 ~r, 52
T(CM),145 ~A, 28
T(CL), 163 Succ,229
T(Coo ), 120 T,229
T(C.,;),182 Test, 229
U,I71 e,65
U~, 29 '\t0,68
Y,27 Va, 93,198
Yr,238 VI, 93,198
YA,234 Var, 3
lil,205 e,65
248 Index
-+.d,6 'IjJ,145
-+:d,9 -+n,123
'\., 39 -+01),97
se, 36 -+'6.01),97
SeD-nf,185 -+'6.,7
S, 36, 66 -+rn,184
Zero, 229 -+vn , 184
L,163 -+ALn,165
~N, 78 -+An,123
~H, 73 -+Ln,165
~v, 90 -+01),97
~L, 82 -+'pf,36
~o, 68 -+3fn,185
args, 29 <:::],202
H, 67, 73 <:::]0",202
L,67 J).v,89
N,67 :::::'e,29
0,66 '-', 96
V, 67 '-'H,97
-+;f,42 '-'L, 98
0,105 '-'N, 97
0'17,114 '-'v, 98
1;;;1L,207 n,207
e,210 I;;;k, 128
[.], 105 1;;;:F,116
"'1212,176 I;;;rt, 125
"'VV, 206 1;;;1212, 176
=,3 I;;;N,146
E(.1, 8), 67 I;;;vv,206
')1, 229 V, 182
~, 96 i,114
J).H,73 f- L ,164
00, 120 f-CX),120
A-term,3 f- v' 183
(.Î, 44 f-~, 146
J).L, 82 M, 3
:s;~, 145 A, 124
:S;L,163 AV,185
:S;CX),120 AL, 165
:S;v,182 E,218
:S;'I7IL, 212 F( V), 204
«, 125 7-l, 121
«~, 139 'I, 215
«e, 136 :1,217
A, 208 LL,176
'\7,109 L,163
J).N,77 N,145
qy, 120 U,219
:::Sv,90 Uv, 185
:::SN,78 VV,205
:::SH,73 V, 183
:::SL,82 rr..,207
:::S0,68 rr..CX),21O
Index 249
abstraction, 3 contractum
active, 9 - tJie, 36
- Ee, 42 - .1,6
algorithm correctness
- r -separability, 52 - H, 75
- A-separability, 32 - L, 83
- N-Semiseparability, 160 - N, 79
- semiseparability, 138 - V, 90
application, 3
approximant, 124 D,4
- ..In, 185 defined, 159
- Ln, 165 degree
- defined, 159 - r, 39
- maximal along a path, 139 - A, 26
- upper, 185 derivation, 67, 110
arguments, 8 - size, 67
discriminability
basis, 109 - 'H, 127
- agree, 114 - N, 150
- finite, 133, 154, 168, 195 - head, 99
binder,4 domain, 207
block - constructor, 209
- head, 8
body, 8 E,4
embedding, 209
calculus environment, 105
- AA, 25 equivalence
- Ar, 35 - operational, 68
- A.1, 6 evaluat ion relation, 66
- complete, 69 - deterministic, 68
correct, 69 - nondeterministic, 68
call-by-name, 8, 25 - uniform, 99
call-by-value, 8, 35 universal, 71
closure
- Var, 7 filter, 113
- reduction, 7 fixed point
- substitution, 7 - r, 40
compact, 207 - A, 27
compact-as-types procedure, 212 - operator, 27, 41
complete development, 15 function
confluence, 8 - Z, 226
- Ee, 41 - O-representable, 233
congruence, 21 - composition, 226
context, 6 - continuous, 207
- H-relevant, 75 - embedding, 209
- L-relevant, 83 - minimalization, 226
- N-relevant, 79 - monotone, 207
- V-relevant, 91 - partial recursive, 226
- .1-valuable, 12 - primitive recursive, 226
- discriminating, 69 - projection, 209, 226
- head, 12 - step, 208
- relevant, 69 - strict, 207
cont inuous , 207 - successor, 226
250 Index