Non-deterministic untyped -calculus - Semantic Scholar

0 downloads 0 Views 605KB Size Report
hfM1 p; :::;Mn pg;fN1 p ; :::;Nm p gi 2 Pair(M;N): Given M;N 2 S1, Pair(M;N) selects the subterms to be compared during the rst step of the analysis of the internal ...
Non-deterministic untyped -calculus A study about explicit non determinism in higher-order functional calculi (Preliminary Version) Ugo de' Liguoro

Dipartimento di Matematica Universita di Roma \La Sapienza" Via Salaria 113, 00198 Roma December, 1991

Contents 1 Introduction 1.1 1.2 1.3 1.4

Explicit non determinism : What this thesis is about : Related work : : : : : : : Summary and results : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

2 Non-determinism and type-free -calculus 2.1 2.2 2.3 2.4 2.5

Powerdomains : : : : : : : : : : : : : : : : : : : The non-determinism in term rewriting systems The classical -calculus : : : : : : : : : : : : : : Lazy and Call-by-value -calculi : : : : : : : : : The non deterministic -calculus : : : : : : : : 2.5.1 Typed non-deterministic -calculus : : : 2.5.2 Type-free non deterministic -calculus :

: : : : : : : : : : :

: : : : : : : : : : :

: : : : : : : : : : :

: : : : : : : : : : :

: : : : : : : : : : :

: : : : : : : : : : :

3 Operational semantics

3.1 The standardization theorem : : : : : : : : : : : : : : : : : 3.1.1 Residuals, Developments and Standard Reductions 3.1.2 Proving the Standardization Theorem : : : : : : : : 3.2 Non deterministic Bohm trees for Must-semantics : : : : : 3.3 The semiseparability theorem : : : : : : : : : : : : : : : :

4 Denotational semantics 4.1 4.2 4.3 4.4

Non deterministic algebras : : : : : : : : : : Semilinear and linear applicative structures : Syntactical and canonical model : : : : : : : Full abstraction theorem : : : : : : : : : : : 1

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : : : : : : : : :

: : : : : : : : : : :

: : : : :

: : : : :

: : : :

: : : :

3

3 5 7 7

9

9 12 16 22 26 26 30

34

34 34 37 43 49

58

58 63 71 73

4.5 A non-extensional model based on the notion of Monad : : : : 81 4.5.1 Strong monads : : : : : : : : : : : : : : : : : : : : : : 82 4.5.2 The model N in the category of CPO : : : : : : : : : 86

5 Theories

91

5.1 The theory c : : : : : : : : : : : : : : : : : : : : : : : : : : : 91 5.2 The theory r : : : : : : : : : : : : : : : : : : : : : : : : : : : 98 5.3 The theory Tmust : : : : : : : : : : : : : : : : : : : : : : : : : 100

2

Chapter 1 Introduction 1.1 Explicit non determinism Non determinism is a natural concept in formal language theory and in complexity theory, where it is essential to increase expressive power or eciency. It is however implicit in many aspects of practical programming. Think of any situation in which more processes interact each other, either directly, by sending and receiving messages, or indirectly, by using shared computing resources. In all this cases, if the whole environment is described both in its static and its dynamic aspects, then one can think of it as a deterministic system. But as soon as we abstract from such dependances or from execution speed and other unpredictable events, the behavior of the system must be considered as nondeterministic. In this perspective many authors have considered explicit non deterministic control structures, and this is true not only in the case of calculi explicitly designed to model concurrent computation, such as CCS, CSP and Process Algebras, but also within the framework of term rewriting and -calculus, that is of formal systems whose inspiration source is not automata theory, but recursion theory. In late 70's and early 80's, interest in explicit non determinism led to extensive studies of such constructs, with regard to operational semantics, algebraic semantics, and denotational semantics (see e.g. [Plo82, Apt-Plo, Nivat, Boud80, Abr83]; the latter essentially consisted in the introduction and development of powerdomains constructions [Plo76, Plo-Smy]. 3

These researches coincided with a rst period in which the adequacy of Scott's elegant theory for abstract modeling of computation was tested against more intentional aspects of computing, such as value passing mechanisms, and sequentilality of an important class of term rewriting systems [Huet-Levy] and -calculus [Berry]. The adequacy problem was understood in [Plo77, Mil77] as the full abstraction problem, namely as the problem of nding an abstract interpretation, usually an ordered structure, inducing the same partial ordering on terms as the evaluation mechanism under consideration does. On the other hand the studies about modeling various kinds of value passing mechanisms were faced with problems whose denotational counterpart actually amounts to di erent ways of composing functions (see [Henn80]), and it is not dicult to see behind them a concurrency perspective in which, at the present time, they are rediscovered [Mil90]. In this setting non determinism was seen as a possible descriptive tool, while retaining a certain level of abstraction [Henn82]. Similar things could be said about the non deterministic analysis of parallelism e.g. in [Henn-Plo]; a similar philosophy inspires Milner and Hoare work about communicating systems based on interleaving semantics, although it is very hard to model communication abilities using powerdomains. Once non determinism has been introduced as an explicit control structure in the setting of applicative programming, the problem of understanding the interaction with functional application becomes central, since it actually includes many of those we have just mentioned. As a matter of fact callby-name and call-by-value re ect di erent de nition of the functional spaces we are working with, as recent studies about laziness [Abr-Ong] and computational -calculus [Moggi] have shown. Similarly run-time-choice and calltime-choice (see chapter 2), introduced by [Henn80] in the setting of term rewriting, and rephrased by [Sharma] in that of pure -calculus, are likely to be mechanisms capturing properties of di erent functional spaces. To the sake of our interest in this thesis, it is worth to mention [Ash-Henn], where a non deterministic extension of Plotkin's PCF where considered and the full abstraction problem for the resulting system was investigated. In this connection, problems arising from the value passing mechanism are even more dicult than in the rst order case of term rewriting, as it will be discussed in the rst chapter of the thesis. About the drawbacks of the construction of [Ash-Henn] was the fact that operational and denotational equality for the 4

new system was not an extension of those of the deterministic subsystem; researchers, unsatis ed with the solution proposed by the authors, tried to get an abstract modeling of control techniques such as sharing of subcomputations, to preserve the conservativity of the new system with respect to the original one [Ast-Co]. PCF is a typed language, and the higher order systems mentioned above are typed as well: no work was carried out about non deterministic type free -calculus, with the only exception of the attempt by [Sharma]. The deveolpment of the theory of concurrency coincides with the eclipse of the studies about explicit non determinism. Reasons are to be found in the major ability of the automata paradigm in modeling communication and synchronization. Recent studies in this area, to overcome limitations in the expressive power of process algebras, introduce in the calculi typical features of applicative languages, namely functional application and abstraction. We refer to Milner's -calculus [Mil89], where this happens implicitly through the ability of passing also port names as values, and to Thomsen CHOCS [Thom], were functional abstraction and application are introduced explicitly. This fact has raised new interest in the old problem of combining functionality and non determinism; morever the natural way of looking at this calculi is that of type-free -calculus, instead of the typed calculus: this means that the interest is now closer to the neglected direction of [Sharma].

1.2 What this thesis is about The major topic of investigation in this thesis is the interplay between functionality and non determinism. We are interested in the understanding of this phenomenon in the special case of untyped applicative calculi, where self application is the natural way to encode recursive objects. Suppose you are modeling non determinism by adding an explicit choice operator  to the syntax of the pure -calculus. The operational behaviour of this operator is simply decribed by the reduction rules

M  N ?! M and M  N ?! N: It is immediate that the convertibility relation induced by these rules, when adding to usual -reduction rules and closing under context formation, is the 5

trivial one; so that the rst question we ask is:  Under what criteria should we consider two terms of the extended language equivalent? May be we could consider our terms as standing for the set of their normal forms, where we have to use plural because of the lack of the Church-Rosser property. We know however that this is not a good criterion even for the classical -calculus, where (symmetrically) the theory identifying all terms without normal form is inconsistent. The classical way out is to identify all \unsolvable" terms and to distinguish those terms which, in at least one context, behave di erently, getting an unsolvable and a solvable term respectively. To make use of the concepts of \solvable" and \unsolvable" in our setting we have to nd a suitable extension of them, so that the next problem is:  Is there a natural extension of the notion of solvability which possibly includes the classical one? After some progress in the understanding of the syntax we have choosen, we must turn our attention to the abstract objects we are describing, and to investigate their structure. If the functional interpretation is the intended one, we could conider our system as a calculus of functions from sets to sets. In this perspective, because of the type free setting we are working with, we should think of an object as something being, at the same time, a function and a set, that is a possible argument of a function, even of itself. Now should we see such functions as sets of functions, so that the value of their application to an argument is the set of the values of each function in the set applied to the given argument? Should we consider \additive" functions w.r.t. the (semantic counterpart of) the operator ? What about functional abstraction of an object which is actullay a set? Are these sets always nite? All these questions, and others naturally arising from any answer to them could be summarized as follows:  What are the models of this calculus?  Does the equality induced by the abstract interpretation in the model coincide with the operational semantics induced by the extension of the notion of solvability? 6

Our study would be defective if, once answered all previous questions, we couldn't give any information about the properties of the structures of interest and of their calculi. This typically amounts to ask for an axiomatization of the equality relation studied so far, that is to study the theory of the intended models. This would provide us with the technical machinery to compare the equality in the extended language with those known for the classical calculus. All this could be summarized:  What looks like an axiomatization of the non deterministic calculus?  Does the resulting theory extend the theory or the theories of the classical calculus?  If yes, is this extension conservative?

1.3 Related work Boudol's -calculus [Boud89] Goes in the opposite direction of Milner's calculus, that is from -calculus to higher order process algebras; a fragment of this calculus has been given a model by [Jag-Pan]. Altough the full calculus includes operators whose semantics is problematic even from an intuitive point of view, its relevance is due to the fact of hinting the other way around, that is to start with assessed theories and mathematics about recursion and higher order calculi, before embarking in higher order process calculi. Non deterministic extensions of the pure -calculus calculus are of interest also in the analysis of lazy -calculus and of other reduction oriented calculi: this is shown by recent work [Boud91] and by the interesting topic coding such calculi in the -calculus [Mil90]. We nally recall the work of Moggi [Moggi] about the computational calculus, proposing the categorical notion of monad as a general framework to capture intensional aspects of computing, including nondeterminism.

1.4 Summary and results The thesis is organized as follows. In a rst chapter (chapter 2) the topics quickly sketched in this introduction are discussed and the problem of the interplay between functionality and explicit non determinism in the type free 7

setting is illustrated. The chapter surveys some of the works referred to above and introduces an extension af pure -calculus with an operator  meaning non deterministic choice. Chapter 3 is devoted to the study of operational semantics, concentrating on a preorder we call \must-preorder", written vmust, which is a possible generalization of the classical notion of \solvability"; it is also an adaptation to our framework of the homonym testing relation, introduced in [DeN-Henn] for CCS. As a rst step in the understanding of the operational semantics, we prove that, in spite of the lack of the Church-Rosser property, a standardization theorem can be established. The main novelty in this chapter is the introduction of \non deterministic Bohm trees", allowing a concrete representation of the functional behaviour of a non deterministic term. This is proved by the semiseparability theorem at the end of the chapter (for classical results about semiseparability in the -calculus see [CDR, Wads, Bar]). Chapter 4 investigates denotational semantics. The concepts of linear and semilinear applicative structures are introduced. An inverse limit construction in the category of non deterministic algebras gives a rst example of a proper semilinear structure, which turns out to be extensional. In this chapter it is proved that the order in the model coincides with the operational order induced by quotienting the preorder vmust, and the order de ned by tree \inclusion" (full abstraction theorem). We nally investigate a semilinear structure built in the category of CPO using Moggi's construction. This turns out to be non extensional, thus proving the independence of the axiom stating that the abstraction distributes over choices. Chapter 5 studies theories. We prove consistency of the full c -calculus and r -calculus introduced in [Sharma]; the former calculus is also proved to be conservative w.r.t. the theory . The theory Tmust , induced by the preorder vmust, is shown to be a conservative extension of the theory H (see [Bar]) of the classical -calculus, providing by the way an indipendent (synctactical) proof of consistency of Tmust itself, and of the theory r , which is a subtheory of Tmust. This is a surprising result, distinguishing the pure calculus from its typed version (with constants) studied in [Ash-Henn]. Some of the results presented in this thesis will appear in [deL-Pip].

8

Chapter 2 Non-determinism and type-free -calculus In this chapter we quickly recall the essential de nitions and facts about domains and powerdomains. We illustrate the problem of introducing explicit non determinism in the ( rst order) algebraic setting of term rewriting systems. After a short presentation of classical -calculus and of some of its variants introduced in [Plo75, Abr-Ong], we illustrate a nondeterministic extension of PCF and nally introduce the type-free non deterministic -calculus, we will study in the rest of the thesis.

2.1 Powerdomains In this section we survey some facts about constructions modeling non determinism in the framework of usual denotational semantics. This exposition is intended to x notation and to keep the subsequent treatment selfcontained as much as possible; consequently proofs will be omitted or simply sketched. A detailed account of these topics can be found in now standard literature (see e.g. [Gun-Sco]). De nition 1 Let hP; vi be any (pre)-ordered set; de ne Fin(P ) = fu  P j u nite; u 6= ;g; then for u; v 2 Fin(P ) de ne 9

i) u v[ v , 8x 2 u 9y 2 v: x v y;

ii) u v] v , 8y 2 v 9x 2 u: x v y;

iii) u v\ v , u v[ v ^ u v] v.

Proposition 1 Let hP; vi be any (pre)-ordered set; if S  P then abbreviate fx 2 P j 9y 2 S: x v yg with #S and similarly fx 2 P j 9y 2 S: y v xg with "S . Then, for any u; v 2 Fin(D): i) v[ ; v] and v\ are preorders; ii) u v[ v ,#u #v; iii) u v] v , "u "v; iv) u v[ u [ v; v) u [ v v] u. De nition 2 Let hP; vi be any (pre)-ordered set and S  P ; then i) S is downward closed i S =#S ; ii) S is directed i S = 6 ; and 8x; y 2 S 9z 2 S: x v z ^ y v z; iii) S is an ideal i it is downward closed and directed.

Finally Idl(P; v) = fI  P j I is an ideal w.r.t. vg.

If x is an element of a pre-ordered set P , it is easy to verify that #fxg is an ideal: it is called the principal ideal generated by x.

De nition 3 A CPO D is a partially ordered set with a bottom and all lubs of directed subsets; furthermore

i) x 2 D is a nite object i for all directed S  D G x v S ) 9y 2 S: x v y;

10

ii) K(D) = fx 2 D j x is niteg;

iii) D is algebraic i for all x 2 D G x = fy 2 K(D) j y v xg; iv) D is !-algebraic i it is algebraic and K(D) is countable.

CPOs are usually considered with Scott topology; it is known that functions between CPOs are continuous under this topology i they preserve directed lubs.

Theorem 1 Let hP; vi be a (pre)-order with a bottom ?, then hIdl(P; v); i is an algebraic CPO with principal ideals as nite objects. If P is countable, then Idl(P; v) is !-algebraic. De nition 4 Let D be an algebraic CPO, then i) M(D) = Fin(K(D)); ii) D = Idl(M(D); v ), for  2 f[; ]; \g. Historically D\ is Plotkin powerdomain, and D] is Smyth powerdomain (see [Plo76, Smy]). D[ is called Hoare powerdomain; it is actually the set of closed subsets of D w.r.t. the Scott topology.

De nition 5 A partial order hP; vi is bounded complete i it has a bottom and every bounded subset of P has a lub. A domain is an !-algebraic CPO which is bounded complete. Proposition 2 If D is an algebraic CPO, then D is an algebraic CPO for  2 f[; ]; \g; furthermore if D is a domain, then D[ and D] are domains. It is known that, even if D is a domain, in general D\ is not bounded complete: this was the reason in [Plo76] for introducing the category SFP.

11

2.2 The non-determinism in term rewriting systems

Suppose to be given a signature  = hS ; Fi, where S is the set of sorts, and F the (non empty) set of operators, each one of a xed aritity. For the sake of simplicity we choose S to be a singleton set (the reader is referred to the standard literature for the general case of multisorted signatures and algebras), and de ne:

De nition 6 A -algebra is a structure A = hA; ff A : An ! A j f 2 F ; f of arity ngi: A is a monotonic (continuous) algebra i A is an ordered set with a least element (a CPO), and each operation f A is a monotonic (continuous, that is preserving directed limits) function.

-algebras form a category -Alg, whose objects are -algebras, and morphism are -homomorphisms, where, if A and B are -algebras, then a map ' : A ! B is a -homomorphism i for all f 2 F and a1 ; . . . ; an 2 A

'(f A(a1 ; . . . ; an )) = f B ('(a1); . . . ; '(an )): The set of terms we form from the objects in F is a -algebra T , where = f for all f 2 F . This algebra is the initial algebra in -Alg, that is for every -algebra A there exists a unique morphism 'A from T to A. If X is any set of variables (disjoint from F ), the structure T (X ) is the -algebra freely generated from X .

f T

De nition 7 A term rewriting system in the given signature  is a nite subset R  T (X )  T (X ) such that, for all ht; t0 i 2 R: i) t 6 x for any x 2 X ;

ii) Var(t)  Var(t0 ), where Var(t) is the set of variables occurring in t.

A term rewriting system R induces a binary relation !R over T ; it is de ned as follows: 12

De nition 8 Call (ground) substitution the unique extension to T of a map # : X ! T ; then !R is the least binary relation over T such that: i) ht; t0 i 2 R ^ 9#: s  #(t) ) s !R #(t0 ); ii) s !R s0 ) 8f 2 F ; s1; . . . ; si?1; si+1 . . . sn 2 T : f (s1; . . . ; si?1; s; si+1 . . . sn) !R f (s1; . . . ; si?1; s0; si+1 . . . sn) where n is the arity of f .

+ and !  as its transitive, re exive and Writing !R simply !, we de ne ! transitive closure respectively.

Intuitively a term rewriting system abstractly describes an evaluation mechanism for symbolic computation. A system satis es the property of being Church-Rosser i (CR) 8t; t0; t00 2 T : t ! t0 ^ t ! t00 ) 9t000 2 T : t0 ! t000 ^ t00 ! t000 : Informally a reduction is any nite or in nite sequence of terms t0 ; t1; . . . such that t0 ! t1 !    A system is strongly normalizing (SN) if there exists no in nite reduction. In general term rewriting systems are not SN, but if they are CR, each term t has at most one normal form, we could consider as the \value" of t. We do not need, however, to consider all terms without normal form as unde ned objects. Following the algebraic approach of [ADJ, Gue] terms can be interpreted in the initial algebra of the subcategory -ConAlg of the continuous -algebras with continuous -homomorphisms.

De nition 9 Let be a nullary symbol not in F , and call + the signature resulting by adding it to F . De ne the binary relation  over T+ as the least preorder such that: i)  t for all t 2 T+ ;

ii) t1  t01; . . . ; tn  t0n ) f (t1 ; . . . ; tn )  f (t01 ; . . . ; t0n ) for all f 2 F .

The relation  is actually a partial order; we call T1 the ideal completion of T+ under . 13

Proposition 3 T1 is the initial algebra in the category -ConAlg. Proof. See [ADJ].

2

Now, xed a rewriting system R we de ne a map !R : T ! T+ by 8 > if 9ht0 ; t00 i 2 R 9#:
: f (!R (t1 ); . . . ; !R (tn )) otherwise

where t  f (t1 ; . . . ; tn ), and we have the basis of the induction when n = 0. The idea is that !R takes the current \approximation" of its argument, modulo the subterms which have to be computed with respect to the rewriting system R; these parts are mapped in , which means \unde ned", so that the relation !R (t)  !R (t0 ) means that t is less de ned, less explicit than t0 w.r.t. R. Example 1 Let F = fa(0) ; h(1); f (1); g(2) g, where we use exponents to express arity (therafter they are omitted), and consider the rewriting system R = fhf (x); g(x; f (h(x)))ig. Now the term t  f (a) has an in nite reduction, namely: f (a) ! g(a; f (h(a))) ! g(a; g(h(a); f (h(h(a)))))

! 

Computing the approximations of the terms occurring in the reduction we have: !R (f (a)) =

!R (g(a; f (h(a)))) = g(a; ) !R (g(a; g(h(a); f (h(h(a)))))) = g(a; g(h(a); )); which is easily seen to be increasing w.r.t. . What we have just seen in the example 1 is a general fact, as it is stated in the following proposition.

Proposition 4 Given any rewriting system R we have i) t ! R t0 ) !R (t)  !R (t0 );  t0 g is directed wrt . ii) R j= CR ) 8t 2 T : f!R (t0 ) j t ! R 14

Proof. Part (i) is proved by a straightforward induction on t. Part (ii) is then immediate.

2

Under the assumption that R is CR, this proposition allows us to assign to each term t 2 T the object Ff!R (t0 ) j t ! R t0 g as its value, existing in T1 because of the propositions 3 and 4. Note that, if t has a normal form t0 , then the limit is t0 itself (remember that there exists a natural injection of T into T1 , namely 'T1 ). Add to the signature  a binary operator or expressing explicit nondeterminism; call R + or the system R [ fhx or y; xi; hx or y; yig, using in x notation. No matter whether R j= CR or not, R + or is not ChurchRosser; consequently, for some t 2 T+ or we loose the directness of the set f!R+ or (t0 ) j t ! R+ or t0g. Example 2 Let  as in example 1, and consider + or ; let R be the system with the unique rule hf (x); g(x; x or f (h(x)))i. We compute again t  f (a) w.r.t. R + or : f (a) ! g(a; a or f (h(a))) ! g(a; f (h(a))) ! g(a; g(h(a); h(a) or f (h(h(a))))) but also

! 

   ! g(a; a or f (h(a))) ! g(a; a):

The map !R+ or is still increasing along each reduction, but for example !R+ or (g(a; a)) = g(a; a); while !R+ or (g(a; g(h(a); h(a) or f (h(h(a)))))) = g(a; g(h(a); )); and there is no upper bound of these objects wrt  in T+ . A possible way out is proposed e.g. in [Boud80]; we use it, however, to sketch how powerdomains t in the algebraic theory we are surveying: this is not the case of [Boud80], where this approach is criticized (see also [Smy] and [Abr83] for the limits of this construction). First de ne a map : T+ or ! Fin(T ) inductively as follows: 15

i) (t or t0 ) = (t) [ (t0 ); ii) (f (t1 ; . . . ; tn )) = ff (t01 ; . . . ; t0n ) j t0i 2 (ti ); i = 1; . . . ; ng. Suppose that R j= CR and consider all possible reducts of a given term t 2 T+ or by the relation !R : this means that we evaluate t considering the operator or as a \constant" operator, not to be further computed. Now we take as the approximated value of each reduct t0 of t the nite set  !R (t0 ), which is a subset of T+ . Then by the very construction we have:

Proposition 5 Identify T+ with its homomorphic image into T1 via the  + -homomorphism '(s) =#s; then, for all t 2 T+ or : i)  !R (t) 2 M(T1 ); ii) f  !R (t0 ) j t ! R t0 g is directed wrt v[; v] ; v\ . 2 A natural extension of the \algebraic" interpretation in the case of CR systems is now to assign as the value of each term t 2 T+ or , wrt the F rewriting system R + or , the limit f  !R (t0 ) j t !R t0 g, existing in the algebra (T1 ) for  2 f[; ]; \g (note that in this algebra the operations are the \extensions" of the operations in T1 : see e.g. [Abr83] and chapter 4 in this thesis).

2.3 The classical -calculus Classical -calculus theory is mainly concerned with the study of -convertibility. Reduction relations, although studied at length, seem to be only auxiliary, proof theoretic tools for proving consistency of equational theories, usually extending the theory . The primacy is made more evident by the fact that every known model of the -calculus is actually a model of conversion instead of reduction (however in recent time some people started to study possible notions of models for the reduction see [Jac-Mar-Zac, Plo91]). The theory  and its basic properties are sketched below.

De nition 10 Let X be an in nite denumerable set of variables, then the set  of terms is the least one such that:

16

i) X  ;

ii) M; N 2  ) (MN ) 2 ;

iii) M 2 ; x 2 X ) x:M 2 .

In clause (iii) the  is a binding operator, whose scope is M ; an occurrence of x in a term M is free i it is not in the scope of an abstraction of the form x. Usually the set of variables having a free occurrence in M is denoted by FV(M ). Members of the set 0 = fM 2  j FV(M ) = ;g are called closed terms. Some terms have, for historical reasons, a name; we list here some of them: I  x:x; K  xy:x; O  xy:y; S  xyz:xz(yz);   x:xx Uni  x1 . . . xn:xi where for Uni it is required that i  n. As usual with binding operators some care is needed when de ning substitution. In the sequel  will mean syntactical equality.

De nition 11 Let M; N 2  and x 2 X then M [N=x] is de ned inductively: i) x[N=x]  N ; ii) y[N=x]  y for y 2 X ? fxg; iii) (M1 M2)[N=x]  (M1[N=x])(M2[N=x]); iv) (x:M )[N=x]  (x:M ); v) (y:M )[N=x]  z:(M [z=y])[N=z ] where z 2 X ? FV(N ). In clause (v) the z , to be choosen in some xed way, is replaced to the y to avoid variable clashes with possible free occurrences of the y itself in N .

De nition 12 The theory  is the set of closed equations derivable from the

following axioms and rules:

) x:M = y:M [y=x] for y 62 FV(M ), 17

) %) ) ) ) ) )

(x:M )N = M [N=x], M = M, M = N ) N = M, M = N; N = L ) M = L, M = N ) LM = LN , M = N ) ML = NL, M = N ) x:M = x:N .

The relation of -reduction is usually introduced substituting in the de nition above = with the symbol ?!, and deleting rule (). Equivalently one can de ne the binary relation

= fh(x:M )N; M [N=x]i j M; N 2 g and take its \compatible closure" ?! (see [Bar]), that is

De nition 13 ?! is the least binary relation on  such that i) ?! , ii) M ?! N ) ML ?! NL; LM ?! LN; x:M ?! x:N . + and ?!  are respectively the transitive and the transitive The relations ?!  . and re exive closures of ?! ; = is the symmetric closure of ?! Proposition 6 8M; N 2 :  ` M = N , M = N: Proof. Straightforward induction in both directions.

The main result about ( ) is known as the Church-Rosser theorem:

2

Theorem 2 (Church-Rosser)  N ^ M ?!  L ) 9P 2 : N ?!  P ^ L ?!  P: 8M; N; L 2 : M ?! 18

Proof. See [Bar].

2

Corollary 1 For any M; N 2   L ^ N ?!  L; i) M = N , 9L 2 : M ?! ii) the theory  is consistent.

Even if consistent, the theory  is not Hilbert-Post complete, that is we can add to it new equations without loosing consistency. A classical example is the (scheme of) axiom () x:Mx = M

if x 62 FV(M );

yielding a theory equivalent to that obtained from  adding (ext) Mx = Nx ) M = N

if x 62 FV(M ) [ FV(N ):

A fundamental limitative result about consistent extensions of the theory  is Bohm's theorem.

De nition 14 For any M 2 , i) M is a normal form, i :9N 2 : M ?! N ; write NF for the set of these terms;

 N. ii) M has a normal form i 9N 2 NF: M ?!

It is easily seen that any term in normal form has the shape

x1 . . . xn :M1 . . . Mm; where the Mi are in normal form too; it is also easy to see that there are terms that doesn't have normal form: tipically .

De nition 15 The set of contexts [ ] is recursively de ned as follows: i) [ ] 2 [ ] the hole; ii) X  [ ]; 19

iii) C [ ]; C 0[ ] 2 [ ] ) C [ ]C 0[ ] 2 [ ]; iv) C [ ] 2 [ ] ) x:C [ ] 2 [ ].

In the sequel contexts are assumed having just one hole. If M 2  and C [ ] 2 [ ], then C [M ] 2  is the term resulting by replacing (in a sense lling) the hole in C [ ] by M .

Theorem 3 (Bohm) Let M; N 2  be two distinct -normal forms, then there exists a context C [ ] and two distinct variables x; y such that

 ` C [M ] = x and  ` C [N ] = y: It follows from Bohm's theorem that any theory equating two terms having distinct -normal forms is inconsistent. In view of this result it is tempting to subdivide -terms into two classes: those having a normal form and those without normal form. The distinction should coincide with that between meaningfull and meaningless terms, so that the latter could be all equated. This leads however to inconsistency. Consider for example the terms P  xyz:xy() and Q  xyz:xz (): Both of them are without normal form; now if P = Q is postulated, then P KMN = QKMN is derivable for any M; N 2 ; it follows that M = N is derivable as well. The notion of being meaningless seems to be better captured by the following de nition.

De nition 16 M 2  is fully unde ned i 8N 2  8C [ ] 2 [ ]: C [M ] has a normal form ) C [N ] has a normal form: This means that being meaningless consists in having no in uence in any ending computation. Among the main achievements of the classical studies about -calculus is the characterization of these terms by means of the notion of (un)solvability: this is why the classical theory could be called the theory of solvability. 20

De nition 17 i) M 2 0 is solvable i 9n 2 ! 9N1; . . . ; Nn:  ` MN1 . . . Nn = I; ii) M 2  is solvable i its closure ~x:M is solvable; where x1 . . . xn:M is the closure of M i FV(M ) = fx1; . . . ; xng . The set of solvable terms is denoted by SOL.

De nition 18 i) M 2  is in head normal form i it is of the shape x1 . . . xn:M1 . . . Mm; no matter what the Mi are; the set of such terms is denoted by HNF;

 N. ii) M 2  has a head normal form i 9N 2 HNF: M ?!

In a sense being in head normal form means to be a normal form at least at the rst level.

Proposition 7 For any M 2 , M 2 SOL , M has a head normal form: 2

Proof. See [Bar].

Theorem 4 For any M 2 ,

M is fully unde ned , M 62 SOL: Proof. For (() see [Bar] theorem 14.3.24; for ()) simply observe that if M 2 SOL then by proposition 7  ` M = ~x:M1 . . . Mn and we can suppose wlog that for some xi 2 ~x, xi   ; then  ` Mx1 . . . xi?1Unn+1 +1xi+1 . . . xnI = I; while x1 . . . xi?1Unn+1 +1xi+1 . . . xnI has no normal form.

2

21

2.4 Lazy and Call-by-value -calculi Machines are hardly assimilable to theories; on the contrary they are better seen as evaluation devices converting a term, representing a program applied to its input, into its value, that is eventually to a normal form. This amounts to stress reduction instead of convertibility, while the equational theory, to be thought of as the theory of program equivalence, has to be reconstructed from the concept of a suitable observable property, usually a convergency predicate. Among the rst studies in this direction is Plotkin's [Plo75], recently rediscovered and further investigated by Abramsky in [Abr-Ong], and thereafter in a series of papers (e.g. [Egi-Hon-Ron]).

De nition 19 Over the set 0 of closed -terms the following family of binary relations #kl is de ned: i) x:M #0l x:M ; ii) M #hl x:M 0 ; M 0[N=x]#kl L ) MN #hl +k+1 L; iii) M #l N , 9k: M #kl N ; iv) M #l , 9N: M #l N . Call the predicate #l convergency predicate. Intuitively M #k N means that M converges to N within k steps. This

notion of convergency is not equivalent to that of having a normal form w.r.t. ?! , nor it means having a head normal form: it means to reach, actually in a unique way, the normal form w.r.t. the following reduction relation:

De nition 20 The relation ?!l     is the least one such that ( ) (x:M )N ?!l M [N=x]; ( ) M ?!l M 0 ) MN ?!l M 0N . This reduction relation, clearly included into ?! , captures the idea of

leftmost outhermost reduction strategy, up to a variable in head position or an abstraction: what is usually called a weak normal from. Morever 22

Proposition 8 For all M 2 0  N 6?! ; M #kl N , M ?! l l  N has length k; it follows that # is the convergency predicate for and M ?! l l h0; ?!li.  N ; if k = 0 Proof.((): by induction on the length k of the reduction M ?! l then M  N  x:M 0 for some M 0, hence M #0l M 0; if k > 0 then the reduction has the form

M  M0 ?!l M1 ?!l . . . ?!l Mr ?!l Mr+1 ?!l . . . Mk  N where, for some r < k, Mr  (x:P )Q  Pr Q, Mr+1  P [Q=x], while Mi  PiQ and Pi ?!l Pi+1 for each i < r. Now P0 ?!l Pr  x:P 6?!l , which is a reduction of length r < k , then, by inductive hypothesis, P0 #rl x:P ; on the other hand P [Q=x] ?!l Mk  N 6?!l with a reduction of length k ? r ? 1; it follows, by inductive hypothesis, that P [Q=x] #kl ?r?1 N , so that M #kl N . ()): again by induction on k. In case k = 0 we have M  x:M 0 for some M 0, hence the thesis is trivial since x:M 0 6?!l . If k > 0, then M  PQ for some P and Q such that P #rl x:P 0, P 0 [Q=x] #sl N , and r + s + 1 = k. By inductive hypothesis P ?!l x:P 0 in r steps so that  PQ ?! l (x:P 0 )Q in r steps ?! l P 0 [Q=x]  ?!l N in s steps:

2

The equational theory called in [Abr-Ong] the lazy -calculus is de ned as follows:

De nition 21 For M; N 2 0: i) M vB N , 8P~ 2 0: M P~ # ) N P~ #; ii) M B N , M vB N vB M ; iii) l ` M = N , M B N . 23

To see that the theory de ned above is consistent we recall the notion of Morris theory (see [Bar]).

De nition 22 Let P  0 be such that P 6= ;; 0; then de ne i) M vP N , 8C [ ] 2 0 [ ]: C [M ] 2 P ) C [N ] 2 P ; ii) M P N , M vP N vP M ; iii) TP = fM = N j M; N 2 0; M P N g. TP is a Morris theory i P is closed under conversion. Proposition 9 i) if TP is a Morris theory, then it is a -theory, that is a consistent extension of the set fM = N j M; N 2 0 ;  ` M = N g, closed under derivability in ;

ii) for all M; N 2 0; M vB N , 8C [ ] 2 0[ ]: C [M ]# ) C [N ]#;

iii) for all M; N 2 0 ; M B N , M F N , where F = fM 2 0 j 9M 0 2 : M = x:M 0g.

Since F is closed under -conversion, it follows that l is a Morris theory, hence a -theory. Proof. See [Abr-Ong]

2

The idea of Morris theory allows to see the classical theory of solvability in a reduction oriented perspective. First we introduce formally the notion of head reduction.

De nition 23 ( ) (x:M )N ?!h M [N=x]; ( ) M ?!h M 0 ) MN ?!h M 0N ; ( ) M ?!h N ) x:M ?!h x:N . 24

De nition 24

i) xM1 . . . Mn #0h xM1 . . . Mn;

ii) M #rh N ) x:M #rh x:N ;

iii) M #rl x:M 0; M 0 [N=x]#sh L ) MN #rh+s+1 L; iv) M #h N , 9k: M #kh N ; v) M #h , 9N: M #h N .

Remark 1 In clause (iii) of the above de nition the relation #l is used instead of #h: this is due to the fact that, when reducing a term of the form MN by head reduction, if M reduces to an abstraction x:M 0, it is in general not true that this is in head normal form; however the head reduction will not go on reducing M 0; it will proceed instedad with the step (x:M 0)N ?!h M 0[N=x], exactly as with the lazy reduction relation. Arguing in a similar way as for the proposition 8, one can prove:

Proposition 10 For all M 2 0  N 6?! ; M #kh N , M ?! h h  N has length k. It follows that M # , M 2 SOL. and M ?! h h Now the set SOL0 = SOL \ 0 is a proper, non empty subset of 0 which is closed under -conversion. This determines the Morris theory TSOL usually called H, which is w.r.t the reduction relation ?!h exactly the same as the theory l w.r.t the relation ?!l . We shall see in the sequel how this

theory can be consistently extended to cope with a non deterministic choice operator. Finally we sketch yet another -calculus strongly related with the notion of a reduction relation, namely Plotkin's call-by-value -calculus.

De nition 25 Let Val be the set of variables and abstractions; then de ne ?!v as the least binary relation on  such that: ( ) (x:M )N ?!v M [N=x] if N 2 Val; 25

( ) M ?!v M 0 ) MN ?!v M 0N ; () M ?!v M 0 ) NM ?!v NM 0.

De nition 26 Over the set 0 of closed -terms the following family of binary relations #kv is de ned: i) x:M #0v x:M ; ii) M #hv x:M 0 ; N #kv N 0; M 0 [N 0=x]#iv L ) MN #hv +k+i+1 L; iii) M #v N , 9k: M #kv N ; iv) M #v , 9N: M #v N . The predicate #v is the convergency predicate w.r.t. ?!v . By de ning

the theory v in the same way as l we get an equivalence among terms called v in [Plo75]. It should be noted that it is not a -theory, althought it is consistent: this can be immediately seen considernig the equation KI() = I which is in  but not in v .

2.5 The non deterministic -calculus To model in the setting of typed and untyped -calculus explicit non-determinism we need an enriched language, including some new operator representing the choice control structure. Now we have to de ne a (non Church-Rosser) reduction relation formalizing the evaluation mechanism, and to give an axiomatization allowing reasoning about non-deterministic terms; to this aim we are faced with the problem of nding an intuitive operational semantics justifying our choice of the new axioms, and, at the same time, with the problem of relating the new theory with the underlying theory of the original \deterministic system".

2.5.1 Typed non-deterministic -calculus

In [Ash-Henn] a nondeterministic control operator or is added to Plotkin's system PCF (see[Plo77]), and the denotational semantics of the resulting system, we are going to call NPCF, is studied with the help of techniques 26

from the powerdomain theory. It should be noted, however, that this is only partly true, since the powerdomains involved are only the simpler ones, namely those of at domains, because they are used only in de ning the interpretation of ground types.

De nition 27 The set Type is inductively de ned: i) o;  2 Type (ground types); ii) ;  2 Type ) ( !  ) 2 Type. As usual parentesis in type expressions associate to the right. Now the set of S NPCF terms Term = 2Type Term is de ned: iii) xi 2 Type for all i 2 !;

iv) tt; ff 2 Termo ; kn 2 Term , for all n 2 !; S; P 2 Term!; Z 2 Term!o ; v) for each  2 Type, if  2 Termo!! , and Y 2 Term(!)! ;

vi) M 2 Term! ; N 2 Term ) (MN ) 2 Term ;

vii) M 2 Term ) x :M 2 Term! ;

viii) M; N 2 Term ) (M orN ) 2 Term .

The reduction relation of the calculus NPCF is de ned by the following axioms and rules:

Skn ! kn+1 Pkn+1 ! kn Zk0 ! tt Zkn+1 ! if ttMN ! M if MN ! N (x:M )N ! M [N=x] YM ! M (YM ) 27

M orN ! M M orN ! N M ! M0 MN ! M 0 N M ! M 0 if c 2 fS; P; Z; if g cM ! cM 0 The operational semantics of a \program" in this calculus, that is of a closed term of ground type, is de ned as the set of constants it reduces to, plus a special value ? meaning the possibility of diverging (when there exists an in nite reduction starting with it), or deadlocking (\blocking"), that is when reducing to a normal form which is not a constant (eg. Pk0, or xM for any M ). Call Eval(M ) such a set when M is a program. Now

De nition 28 Given M; N 2 Type , for some , de ne M vop N i for all context C [ ] of ground type closing both M and N , we have Eval(C [M ])  Eval(C [N ]). De ne 'op=vop \ v?op1. Observe that a program M can diverge i either it is blocked, or it reduces to an \unsolvable" deterministic term, that is a term that cannot reduce to a constant, or, by a straightforward use of Konig lemma, there exists a reduction sequence starting with it, in which the rules of or are used in nitely often. The matematical model of this language is constructed in [Ash-Henn] in the category of NDA (see chapter 4) interpreting o and  in the Plotkin powerdomain of at domains of respectively booleans and natural numbers, and functional types  !  in the space of linear functions from the interpretation of  to the interpretation of  . To get the interpretation map for the terms, a clause dealing with the operator or has to be added to the interpretaion map of [Plo77], namely: [ M  orN  ]  = [ M ]  + [ N ]  where + is the continuous idempotent, commutative and associative operation existing in [ ] . The main result about this construction is a full abstraction theorem for \procedures" that is: 28

Theorem 5 Given M; N 2 Type where  = 1 ! . . . ! n and the i are all ground types (in which case M; N are called procedures), it holds that

M 'op N , 8: [ M ]  = [ N ]  :

This however doesn't hold in the general case.

In [Ast-Co] it was observed that the operational equivalence 'op, when restricted to the sublanguage of PCF, doesn't coincides with the analogue notion introduced by Plotkin in [Plo77]; more precisely let M; N 2 PCF be closed terms of the same type; suppose that for each closing ground context C [ ] not containing any occurrence of or , Eval(C [M ]) = Eval(C [N ]): but it is not true that the same holds allowing some occurrence of or in C [ ]. Example 3 Let F and G be combinators of type o ! o such that: F  x:if (Zx)k0k0 G  x:if (Zx)xk0: Since any closed term of type o either has an in nite reduction, or it reachs a \blocked" term (in both cases its value is unde ned) or a numeric constant, these combinators are operationally equivalent in PCF. Now consider the context C [ ]  [ ](k0 or k1), which is a NPCF context: then Eval(F (k0 or k1)) = fk0g 6= Eval(G(k0 or k1) = fk0; k1 g: From Example 3 it is clear that problems arise because the reduction of a term can make many copies of a subterm containing or , in such a way that each copy can behave di erently. The solution proposed in [Ast-Co], that is introducing a sharing mechanism, leads to a strong restriction of the calculus, which seems a serious one. Example 4 Consider the combinator H of type o ! o which satis es: Hx ! x or H (Sx): This combinator exists, and is de nable using the paradoxical combinator Y putting H  Y(hx:x or h(Sx)): 29

A simple computation shows that, if we do not constrain di erent copies (technically speaking residuals) of or to behave the same, then Eval(Hk0 ) = f?; k0; k1; . . .g, where ? means the possibility of diverging; on the other hand, if we add the constraint, we get simply f?; k0 g. However this is not a typical problem of the higher order calculus NPCF; we can reproduce it within the framework of term rewriting systems. We cannot adopt here the same strategy to solve the problem, that is to delay all choices. Consider for example the term (S or P)k1: then we connot delay the or reduction, since we would have in any case terms not in normal form, whose \approximated meaning", in the sense of the section 2.2, would be the unde ned object.

2.5.2 Type-free non deterministic -calculus

Let us start by intoducing the syntax of the calculus. To rule out any possible confusion with the \parallel or", we shall use an entirely di erent symbol for explicit non-determinism.

De nition 29 The set  of the terms of the non-deterministic -calculus

is the least set s.t. i)   ,

ii) M; N 2  ) M  N 2 . The set of closed terms is denoted by 0 .

The terms are considered modulo -congruence; clearly   . In the spirit of the reduction-oriented -calculi we shall consider the reduction relation as the primitive one; the equational theory we will discuss in the last chapter is the nal product of the whole study, and not its starting point. Following [Henn80, Sharma], we distinguish two parameter-passing mechanisms, namely two -rules. Run-time-choice and call-time-choice are both call-by-name value passing mechanisms, although there is a similarity between call-time-choice and call-by-value, because in both cases there is a restriction to a proper subset of the whole set of terms: those terms that can be considered, in a sense, values. 30

De nition 30 (Rules)

(i) Run-time choice ( r ) (x:M )N ! M [N=x]; where (M  N )[L=x]  M [L=x]  N [L=x];

(ii) Call-time choice ( c ) (x:M )N ! M [N=x] if N 2 ; (iii) () N ! N 0 ) MN ! MN 0 ; ( ) M ! M 0 ) MN ! M 0N; ( ) M ! M 0 ) x:M ! x:M 0; () x:Mx ! M if x 62 FV (M ),

(:1) (:2) (:3) (:4)

M ! M0 ) M  N ! M0  N, N ! N 0 ) M  N ! M  N 0; M  N ! M; M  N ! N: The rules ( c ) and ( r ) yield two di erent reduction relations, namely ?!c and ?!r . The constraint to disallow di erent behaviour of residuals of the same non-deterministic subterm, that is containing at least an occurrence of , is actually equivalent to force the choice before the substitution caused by some -contraction. Hence it seems to us that the same e ect of the (rather complex) construction in [Ast-Co], is simply catched by the c rule. We do not insist about this constrained calculus, since we prove in the last chapter, that one gets an extension, and a conservative one, even for the case of the run-time-choice calculus. This is surprising, and is essentially due to the absence of types and constants in the pure calculus we are interested in. By the ?! symbol we will mean the run-time-choice reduction relation.

De nition 31 Consider the terms

x1 . . . xn:(y:P )QM1 . . . Mm; x1 . . . xn:(P  Q)M1 . . . Mm : the underlined subterms are called head redexes; when a head redex is contracted the reduction is called a head reduction and it is written ?!h ; it is called internal reduction otherwise, written ?!i . Anticipating a result to be proved in the next chapter we claim: 31

 N , then there exists an L 2  Theorem 6 For any M; N 2 , if M ?! 

such that

 L ?!  N: M ?! h i

As we have just seen in a previous section, in the classical -calculus a term has no meaning when it doesn't reduce to a head normal form, that is when it is unsolvable. In the present extension, two possible generalizations suggest themselves: the rst one says that a term is solvable i it reduces to a head normal form (we would call it may convergency): a study using a similar notion is e.g. [Boud91]. The second one de nes a term to be solvable i it has no in nite head reduction: we call this must convergency and write M #must or simply M #. Beside any other justi cation for choosing the latter notion as a research topic, we will show that it naturally leads to a conservative extension of the well known sensible theory H. Inspired by the extensional equivalence of Morris [Morris] and its analogue by Wadsworth [Wads] and by the idea of testing given by De Nicola and Hennessy [DeN-Henn] for process algebras, we de ne the following notions (see also [Jag-Pan]):

De nition 32 For M 2  de ne i) M #must , M has no in nite head reduction, ii) M vmust N , 8C [ ]: C [M ]#must ) C [N ]#must, iii) M 'must N , M vmust N vmust M . We write M " to mean not M #. It should be noted that vmust is a preorder, so that, taking the quotient under 'must, we get an order which is a precongruence.

Furthermore, such order is sensitive to the choice structure of a term, as the following example shows. Example 5 let M  x:x(y  z) and N  (x:xy)  (x:xz), and consider the context C [ ]  (yz:[ ])H0 H1, with H0  x:xU33 and H1  xy:yy,   x:xx, U33  x1x2x3:x3 ; a simple computation shows that C [M ]" while C [N ]#; hence N 6vmust M : it will be proved that M vmust N . 32

We observed in a previous section, that constraining the calculus to have uniform behaviour of residuals of the same subterm, may result in a calculus where each term has at most a nite set of normal forms. One may wonder whether the same problem doesn't arise in the case of our must convergency notion. We show that this is not the case in the following example. Example 6 We can reproduce in pure calculus, using any numeric system, the example 4. It is easily seen that, since H 0 has an in nite head reduction, it is diverging from the point of view of must convergency. On the other hand this is not the case for the combinator satisfying  x  Succ(Hx) H 0 x ?!

for which it can be shown that H 0 0 has the same set of normal forms that H 0.  N then M v Finally, we note that, if M ?! must N , i.e. the order increases under reduction.

33

Chapter 3 Operational semantics 3.1 The standardization theorem In the theory of reduction of the classical -calculus there are two fundamental theorems: the Church-Rosser theorem and the standardization theorem. The rst one is the main tool for establishing consistency of -conversion relation, which coincides with the equality in the theory ; the second one plays a crucial role in the study of the algebraic semantics of the calculus. In the case of the extensions of the -calculus studied in this thesis Church-Rosser theorem clearly fails. It will be shown in this section, however, that a standardization theorem still holds. This will provide the basis for the development of the operational semantics.

3.1.1 Residuals, Developments and Standard Reductions

To de ne the notion of standard reduction some machinery is needed, basically to keep track of the redexes and of the order in which they are contracted. Given M 2 ,  2 M means that  is a redex occurrence in M ; similarly, if F = f1; . . . ; n g, then F  M means that i 2 M , for all 1  i  n. Finally, suppose the (binary) syntactical tree of each term M 2  labelled with strings in f0; 1g in the usual way: then by M=u, for u 2 f0; 1g, is meant the subterm of M rooted at u. 34

To be precise a redex occurrence is a couple h; ui formed by a redex and by the label of the node where it occurrs in a term M : this will be understood without any special notation.

De nition 33 If 1; 2 2 M , with 1  M=u and 2  M=v; then de ne 1  2 , u lex v; where lex is the lexicographic ordering. Now 1 =2 is the set of residuals of 1 after contracting 2, de ned as the following set of redex occurrences in M : i) u = v ) 1=2 = ;;

ii) 1 < 2 or 2 < 1 and 1 62 2 and 2 62 1 ) 1 =2 = f1 g;

iii) 2 2 1 ) 1=2 = f01 g, where 01 is obtained from 1 replacing 2 with its contractum; iv) 1 2 2, then there are three subcases: a) 2  (x:P )Q, 1 2 P ) 1=2 = f1 [Q=x]g; b) 2  (x:P )Q, 1 2 Q ) 1 =2 = f1 ; . . . r g where each i is a copy of 1 and r is the number of occurrences of x in P ; c) 2  P  Q, 1 2 P ) 1 =2 = f1 g, if 2 reduces to P ; 1 =2 = ; otherwise; the case 1 2 Q is similar.

The concept of residuals, introduced above in the case of one step reductions, can be extended to any reduction sequence .  N is any nite reduction sequence; suppose that  : M ?! then it has the form:

Notation:

1 M ?! 2 M    ?! n M  N;  : M  M0 ?! 1 2 n  M is for n  0; write  = 1 +    + n ; furthermore with i;j : Mi ?! j meant the subreduction of  from Mi to Mj . Finally jj= n is the length of .

35

De nition 34 Suppose  2 M and  = 1 +    + n, then the set of residuals of  modulo , written =, is de ned inductively:

 = 1 ) = = =1;  = 1 + 0 ) = = Sf0 =0 j 0 2 =1 g: The idea behind residuals is that if  2 0 =, then  has not been created by . Now given any F  M , it will be useful to consider reductions, starting in M , never contracting redexes not in F or among their residuals.

De nition 35 Let F  M and  a ( nite or in nite) reduction starting in

M ; then: i)  is a development of F i

8i < 'n?1  . . .  'm if m < n if m = n m;n = > Id : n  . . .  m?1 if n < m iii) ;n : D !lin Dn and n; : Dn !lin D are de ned:

;n(x) = xn n;(y) = hn;m(y)im2! As usual with inverse limit constructions, each Dn embeds into D, by the hn;; ;ni embedding-projection pair; we will write xn = n;  ;n(x) for x 2 D and an = (n;  ;n)] (a) = ]n;  ];n(a) for a 2 D]

De nition 50

i) The map F : D ! [D] !lin D] is de ned by: G F (x) = a 2 D] : xn+1(an ) n

and F~ : D ! [D !cont D] by: F~ = (g:g  fj  jg)  F ;

66

ii) the map G : [D] !lin D] ! D is de ned by: G G(f ) = (a 2 Dn] :(f (]n; (a)))n ) n

and G~ : [D !cont D] ! D by: G~ = G  ext; iii) the operation  : D  D ! D is de ned by: x  y = F~ (x)(y) = F (x)fjyjg:

We list in the following lemma some relevant properties of the domain D Lemma 14 For any x; y; z 2 D and a 2 D] , i) (xm )n = xmin(n;m); ii) x = Fn xn; a = Fn an ; iii) xn+1  yn = xn+1(fjyn jg); iv) xn+1  y = xn+1  yn = (x  yn)n ; v) x0  y = x0 = (x  ?)0; vi) (x + y)n = xn + yn = (xn + yn)n . Proof. (i) Consequence of the fact that hn;; ;ni is an embedding-projection pair. (ii) x = Fn xn is standard in inverse limit constructions; to see a = Fn an : a) Let h'; i be an injection-projection pair from some D to some E : then '(K(D))  K(E ): Indeed, let x 2 K(D) then for any directed Y  E '(x) v F Y ) x v (F Y ) = F (Y ) ) 9y 2 Y: x v (y) ) 9y 2 Y: '(x) v '  (y) v y: 67

b) K(D) = Sn K(Dn): indeed if d 2 K(Dn) then d 2 K(D) follows from (a) and the fact that hn;; ;ni is an embedding-projection pair; on the other hand, from d 2 K(D) it follows G d = dn ) 9m: d = dm: n

Now, given any directed S  Dm F ;m(d) v F S ) d =  m;  ;m(d) v m;( S ) F ) d v m;(S ) ) 9s 2 S: d v m;(s) ) 9s 2 S: ;m(d) v s: That an v a for all n is immediate. Vice versa, let u 2 a, then u = fd1; . . . ; dr g 2 M(D); using (b) we know that each di is compact in some Dmi , then we choose m = maxfmi j 1  i  rg: by (a) u 2 M(Dm). On the other hand [ ];m(a) = f ;m (v) j v 2 ag but

 ;m(u) = fj;m (d1)jg ] . . . ] fj;m (dr )jg = fjd1 jg ] . . . ] fjdr jg = #u so that u 2#u  am , from which we conclude that a v Fn an . (iii) Let us note preliminarly that, by the very de nition of ()] :

fjyjgn = ];nfjyjg = fj;n(y)jg = fjynjg: Now

xn+1  yn = FF (xn+1)fjynjg = Fm(xn+1)m+1fjynjgm = m(xn+1)m+1(fjyjgn )m = xn+1fjyjgn = xn+1fjyn jg: (iv)-(v) Similar to the proof of the corresponding properties for Scott D1 models. 68

(vi) By linearity of ];n we immediately have (x + y)n = xn + yn. On the other hand (xn + yn)n = (xn)n + (yn)n = xn + y n :

2

Lemma 15 The mappings F and G are continuous and linear, that is they are NDA morphisms. Furthermore the structure hD; ; +i is a semilinear applicative strucure. Proof. Let x; y 2 D and a 2 D] , then F (x + y) (a ) = F (x + y )(a ) by lemma 14 (vi) n+1 n n+1 n n n+1 n ( x ( a ) + y ( a )) by lemma 13 = F n n+1 n Fn+1 n F = n xn+1(an) + n yn+1(an ) by continuity of +

hence

F (x + y) = = = =

a 2 D] : FF(x + y)n+1(anF) a 2 D] : Fn xn+1(an ) + n yn+1(an) F (a 2 D] : n xn+1(an )) + (a 2 D] : n yn+1(an )) F (x) + F (y):

Let f; g 2 [D] !lin D] and a 2 D] , then ((f + g)(a))n = (f (a) + g(a))n = (f (a))n + (g(a))n by lemma 14 (vi); it follows G(f + g) = FFn(b 2 Dn] :((f + g)(]n; (b)))n ) = Fn(b 2 Dn] :(f (]n;(b)))n + (g(]n; (b)))n ) = Fn((b 2 Dn] :(f (]n; (b)))n ) +F(b 2 Dn] :(g(]n; (b)))n )) = n(b 2 Dn] :(f (]n;(b)))n ) + n(b 2 Dn] :(g(]n; (b)))n ) = G(f ) + G(g): This establishes the linearity property; the continuity property is proved in the same way as in the cathegory of CPO. 69

Finally, let x; y; z 2 D: (x + y)  z = F~ (x + y)(z ) = F (x + y)(fjz jg) = (F (x) + F (y))(fjz jg) by linearity of F = F (x)(fjz jg) + F (y)(fjz jg) = (x  z ) + (y  z ):

2

Theorem 11 The domain D satis es the equation D ' [D] !lin D] in the category of NDA and consequently in that of SNDA; it satis es also

the equation

D ' [D !cont D]

in the category of CPO as pictured in the diagram G - [D] !lin D]  ext - [D !cont D] D  F g:g  fj  jg

We conclude that the structure hD; ; +i is an extensional semilinear applicative structure. Proof. To prove the theorem it remains to show that F and G are mutually inverse: actually the second isomorphism will follow from this one and from corollary 4, which applies to the ()] functor as well. a) G  F = Id: by de nition (G  F )(x) = G(f ) where G f = a 2 D] : xn+1(an); n

now we observe that if y is in (the image of) Dn the y = yn, and similarly if a is in the image if Dn] ; now given such an a (f (a))n = (Fm xm+1(am ))n = (xn+1(a))n = xn+1(a): 70

It follows that

G(f ) = FFn(a 2 Dn] :xn+1(a)) = n xn+1 = x:

b) F  G = Id: we note that G(f )n+1 (an) = (f (]n;(an )))n = (f (a))n so that (F  G)(f )(a) = Fn (f (a))n = f (a); that is (F  G)(f ) = (f ). To prove extensionality: 8z: x  z = y  z ) F~ (x)(z)F~(y)(z) ) F~ (x) = F~ (y) ) x = G~  F~(x) = G~  F~(y) = y:

2

Remark 5 The structure hD; ; +i is actually a semilinear applicative struc-

ture which is not linear: this will follow from the full abstraction theorem and from the fact that (H0  H1) 6'must H0  H1 for H0  x:xU33 and H1  xy:yy.

4.3 Syntactical and canonical model We present a notion of model, which actually does not directly interpret the relation ?!r , but the equivalence relation induced by vmust. De nition 51 A syntactical model is a semilinear applicative structure M = hX; ; +i, equipped with a map [ ] :  ! (Env ! X ), such that the triple hX; ; [ ] i, for any  2 Env = V ar ! X , satis es: 71

i) [ x]  = (x);

ii) [ MN ]  = [ M ]   [ N ]  ;

iii) [ x:M ]   d = [ M ] [d=x] for all d 2 X ;

iv) dFV(M ) = 0dFV(M ) ) [ M ]  = [ M ] 0 ; v) [ x:M ]  = [ y:M [y=x]]] if y 62 FV(M );

vi) (8d 2 X: [ M ] [d=x] = [ N ] [d=x] ) ) [ x:M ]  = [ x:N ]  ; which are the clauses of the classical de nition of syntactical -model of [Hin-Lon], and furthermore vii) [ M  N ]  = [ M ]  + [ N ]  . Finally we call extensional any syntactical model whose underlining semilinear applicative structure is extensional.

Lemma 16 If M = hX; ; +i is an extensional syntactical model, then for any M; N 2  and for all  2 Env: [ x:M  N ]  = [ (x:M )  (x:N )]] : Proof. Let d 2 X be an arbitrary element; then, for any  2 Env, [ x:M  N ]   d = [ M  N ] [d=x] by def. 51 (iii) = [ M ] [d=x] + [ N ] [d=x] by def. 51 (vii) = [ x:M ]   d + [ x:N ]   d by def. 51 (iii) = ([[x:M ]  + [ x:N ]  )  d by semilinearity:

Since d is arbitrary, it follows that [ x:M  N ]  = [ x:M ]  + [ x:N ]  by def. 51 (vi) = [ (x:M )  (x:N )]] by def. 51 (vii):

2

De nition 52 Given the structure hD; ; +i and  2 Env = V ar ! D, we de ne the map [ ] :  ! (Env ! D) as follows: 72

i) [ x]  = (x),

ii) [ MN ]  = [ M ]   [ N ]  , iii) [ x:M ]  = G~ (d 2 D:[ M ] [d=x] ), iv) [ M  N ]  = [ M ]  + [ N ]  .

This is a good de nition, since in (iii) the continuity and linearity of application, abstraction and + ensure that the function d 2 D :[ M ] [d=x] is continuous and linear as well.

Proposition 16 The quadruple hD; ; +; [ ] i is a syntactical model, furthermore it is extensional.

Proof. By theorem 11 the structure hD; ; +i is an extensional semilinear applicative structure. The rest is routine; e.g. [ x:M ]   d = F~ (G~ (d0 :[ M ] [d0 =x] ))(d) = (d0:[ M ] [d0 =x] )(d) = [ M ] [d=x] ;

hence de nition 51 (iii) is veri ed.

2

4.4 Full abstraction theorem The main result of this chapter is a theorem stating that the operational and denotational semantics constructed so far coincide.

Theorem 12 (Full Abstraction Theorem) For all M; N 2  M vmust N , 8: [ M ]  v [ N ]  : To prove the theorem we shall use ideas from classical -calculus. It was after work by Wadsworth and Hyland that the deep connection between the algebraic semantics (see [Levy]), presented in [Bar] in terms of Bohm trees, and the notion of approximation in Scott's models of the -calculus has been 73

understood. In the present setting we show how this construction carries over to our nondeterministic extension of the -calculus, using NBT in place of Bohm trees. In the sequel the intended interpretation is D.

De nition 53 Let I be an indexing function that is a map I : ( ) ! !; then, writing M I to mean the (fully) indexed term associated to M by I : i) [ I ]  = ?; ii) [ xI ]  = ((x))I (x) ;

iii) [ (MN )I ]  = ([[M I ]   [ N I ]  )I (MN ) ; iv) [ (x:M )I ]  = (G~ (d:[ M I ] [d=x] ))I (x:M ) ;

v) [ (M  N )I ]  = ([[M I ]  + [ N I ]  )I (M N ) .

Lemma 17 For any M 2  and all  2 Env: G [ M ]  = [ M I ] : I

Proof. By induction on M using the equation x =

F x of lemma 14. n n

2

In the sequel we call terms together with their indexes modulo some indexing function indexed terms (see [Bar]).

De nition 54 First extend the de nition of substitution to indexed terms inductively from the base clause xm [N n=x]  (N n )m . Now de ne the follow-

ing binary relation > over indexed terms: i) (x:M )n+1N > (M [N n =x])n; ii) (x:M )0 N > (M [ 0 =x])0; iii) n > 0; iv) x: n > 0; v) nM > 0;

74

vi) n  M > 0;

vii) M  n > 0;

viii) (M  N )n+1L > (MLn  NLn)n ; ix) (M  N )0L > (M 0  N 0)0 ; x) (M m )n > M min(m;n); xi) M m > N n ) C [M m] > C [N n].

Lemma 18 i) > j= WCR; ii) > j= SN; iii) > j= CR. Proof. Part (i) is proved by case inspection of overlapping right hand sides; we treat the following two cases (the others are similar):

Case 1: (i)-(iv)

>

(x: m )n+1N

5 ( 0 )n+1N

>

0 N

Case 2: (iii)-(viii)

75

( m )n

>

5

0

>

( m  M )n+1L

( m Ln  MLn )n

5

( 0  MLn )n

5 ( 0)n+1L

5

>

0L

>

( 0 )n

5

0

(ii) Extension of the classical proof of strong normalization of the labelled -calculus (see [Bar]). Just note the decreasing index in clauses (i) and (viii) of the de nition 54, and that the length of the term decreases in the other cases. (iii) From (i) and (ii) by Newman lemma (see any text about term rewriting, including [Bar]).

2

Corollary 6 i) N  = fjM j j M in > ? nf g, where jj is the index erasing map; ii) 8M 2  8I 9N 2 N  9J : M I > N J . Proof. Recall that N  = fM [k] = #1  !k (M ) j M 2 ; k 2 !g. Let us observe that, after the very de nition of #1, this set could be inductively de ned by: i) 2 N ;

ii) M1; . . . ; Mm 2 N  ^ x1; . . . ; xn; x 2 V ar ) x1 . . . xn:xM1 . . . Mm 2 N ;

iii) M; N 2 N  ? f g ) M  N 2 N ; now to prove (i) is routine. (ii) follows from (i) and the lemma above. 76

2

Lemma 19

M 2 N  ) 9k 2 ! 8h  k: !h (M ) = !k (M ); hence, de ning height(M ) as the minimal k satisfying the above statement, M  N , M height(M ) N , M  N [height(M )] : Proof. Note that, since M 2 N , the NBT(M ) di ers from the synctatical tree only in that the operator  is treated as a set constructor, and some abstractions are pushed into sums: e.g. !k (x:P  Q) = !k (x:P ) [ !k (x:Q) = !k (x:P  x:Q): Now take as k the depth of the synctatical tree of M .

Lemma 20 For any M; N 2  and any indexing functions I and J : i) M I > N J 2 N  ) N  M ; ii) M I > N J ) 8: [ M I ]  = [ N J ]  .

2

Proof. The NBT of M is the same of that of N with the possible exception of some nodes labelled with ; since N 2 N the thesis follows by induction on the height of N . To prove (ii) one checks the clauses in de nition 54 along the equations of lemma 14; e.g. [ (M  N )n+1L] = [ (M  N )n+1]  [ L] = [ M  N ] n+1  [ L] = ([[M ] + [ N ] )n+1  [ L] : Now call x = [ M ] , y = [ N ] , z = [ L] : (x + y)n+1  z = (xn+1 + yn+1)  z = xn+1  z + yn+1  z = (x  zn)n + (y  zn)n = (x  zn + y  zn)n = [ (MLn  NLn)n ] :

2

77

Lemma 21 For any M 2 , if L 2 N  and L  M , then [ L] v [ M ] .

Proof. Using the inductive de nition of N . Case 1: L  , then [ L] = ? v [ M ] :

In the sequel, since L 6 , L  M implies that M #: let fM1; . . . ; Mr g be the principal hnfs of M . Case 2: L  x; now x 1 M ) x  1 M1 ^ . . . ^ x  1 Mr ; hence, for i = 1; . . . ; r, Mi  y1 . . . yni :xM1i . . . Mni i : By lemma 17 we know that [ x] = FI [ xI ] ; hence we proceed by induction on q = I (x). Subcase 2.1: q = 0, then, by lemma 14 (v), for i = 1; . . . ; r: [ x0] = [ x] 0 = [ y1 . . . yni :x0

| .{z. . }] ni v [ Mi ] : We conclude [ x0] v [ M1] + . . . + [ Mr ] = [ M ] . Subcase 2.2: q > 0, then, by lemma 14 (iv), for i = 1; . . . ; r: [ xq ] = [ y1 . . . yni :xq y1q?1 . . . ynq?i ni ] : Now each pair in Pair1 (!2 (L); !2 (Mi )) will have the shape: hffyjq?j gg; fM1; . . . ; Msgi and fyjq?j g  Mh for h = 1; . . . ; s. By ind. hyp. [ yjq?j ] v [ N1] + . . . + [ Nt ] = [ Mh ] given that Mh = fN1 ; . . . ; Nt g. This means that again [ xq ] v [ Mi ] for each i, so that [ xq ] v [ M ] 78

Case 3: L  x1 . . . xm:xL1 . . . Ln , then the pairs in Pair1(!k (L); !k (M )), where k = height(L), are of the form

hfLj g; fM1j ; . . . ; Mrj gi; where Lj = !k?1 (Lj ). By ind. hyp. [ Lj ] v [ Mhj] for h = 1; . . . ; r; we conclude, as in subcase 2.2, that [ L] v [ M ] . Case 4: L  L1  . . .  Ln where we can suppose that the Li are not sums. Let again k = height(L) > 0. From the de nition of  we know that a) 8[P ] 2 (L; M): [P ] \ L = 6 ;; b) 8hU ; Vi 2 Pair(L; M): U v] V . where L = !k (L) and M = !k (M ). To the sake of simplicity suppose that

L = fxL1; xL2g and M = fxM1; xM2; xM3g; then Pair1 (L; M) contains only the pair hfL1; L2g; fM1; M2; M3gi: We know that

8j  3 9i  2: Li k?1 Mj ;

so that the inductive hypothesis applies giving that

8j  3 9i  2 :[ Li] v [ Mj ] ; that is

8j  3 9i  2 :[ xLi] v [ xMj ] :

Since in any Smyth algebra D, for any a1; . . . ; an ; b1; . . . ; bm 2 D

8j  m 9i  n: ai v bj ) a1 + . . . + an v] b1 + . . . + bm; we get the thesis observing that [ L] = [ xL1] + [ xL2] and [ M ] = [ xM1] + [ xM2] + [ xM3] :

2 79

Lemma 22 For any M 2  and natural number k, G 8 2 Env: [ M ]  = [ M [k] ] : k

Proof. For any k 2 !, M [k] 2 (omitting the environment)

N  and M [k]  M , hence by lemma 21

[ M [k] ] v [ M ] that is

G k

[ M [k] ] v [ M ] :

Let I be any indexing map, then by corollary 6 there exist J and L 2 N  such that M I > LJ . By lemma 20 [ M I ] = [ LJ ] and L  M ; now [ LJ ] v [ L] and, being L 2 N  , L  M [k] , where k = height(L), by lemma 19; again by lemma 21 it follows that [ L] v [ M [k] ] ; hence

[ M I ] = [ LJ ] v [ L] v [ M [k] ] : From this we conclude, by lemma 17, G G [ M ] = [ M I ] = [ M [k] ] : I

k

Theorem 13 For all M; N 2 , 8 2 Env: [ M ]  v [ N ]  ) M vmust N: Proof.

M [1] = , 8k: M [k] =

, 8k: [ M [Fk] ] = ? , [ M ] = k [ M [k]] = ? by lemma 22 80

2

since [ ]] = ?; hence

M 6vmust N ) 9C [ ]: C [M ]# ^C [N ]" ) 9C [ ]: !1(C [M ]) 6= f g = !1(C [N ]) ) 9C [ ]: [ C [M ]]] 6= ? = [ C [N ]]] ) [ M ] 6v [ N ] ; being the context operation the composition of abstraction, application and +, that is a monotonic function.

2

Corollary 7 For all M; N 2 , i) M  N ) [ M ] v [ N ] , ii) M vmust N , M  N , [ M ] v [ N ] . Proof. To establish (i):

M  N ) 8k: M [k]  M  N ) 8k: [ M [k]] v [ N ] : ) [M] v [N]: Now (ii) follows from (i) and theorems 8 and 13.

2

4.5 A non-extensional model based on the notion of Monad In this section we construct a di erent semilinear applicative structure, which is not extensional. In [Moggi] a notion of model for the computational calculus has been introduced; this notion uses the categorical concept of monad to give a uniform treatment of various aspects of computing, such as call-by-value and continuations. Now it has been observed in [Henn-Plo] that the powerdomain functors actually form monads over the category of CPO; hence Moggi's construction applies. 81

4.5.1 Strong monads

De nition 55 Given a category C , a monad is a triple hT; ; i where i) T : C ! C is a functor; ii)  : T 2 ! T and  : 1C ! T are natural transformations; iii) the following diagrams commute:

T 3(A) T (A )

T (A)

?

T 2(A)

A

- T 2(A) A

- T (A?)

- T 2(A)  T (A) T (A) QQ   Q A idA idAQQ  QQs ? + T (A)

T (A)

T (A)

The easiest example of a monad is given by the powerset functor over the category SET. In this case the \multiplication"  is given by in nitary union, while the \unit"  is the singleton function. De nition 56 Let C be a cartesian category and : (A  B)  T (C ) ! A(B T (C )) the obvious isomorphisms; then a morphism tA;B : AT (B ) ! T (A  B ) is a tensorial strength i the following diagrams commute: tAB;C

(A  B )  T (C )

?

A  (B  T (C ))

id  tB;C-

A  T (B  C ) 82

- T ((A  B)  C ) tA;BC-

?

T ( )

T (A  (B  C ))

id

AB id  B

AB

?

id  B

? - T (A  B)

tA;B

A  T (B ) A  T 2(B )

- AB

tA;T (B)-

T (A  T (B ))

T (tA;B )-

T 2 (A  B ) AB

?

- T (A ?B) A strong monad is quadruple hT; ; ; ti such that hT; ; i is a monad, tA;B

A  T (B )

and tA;B is a tensorial strength, for all objects A and B . Continuing the previous example, the tensorial strength in the case of the powerset functor is t(x; Y ) = f(x; y) j y 2 Y g: In his work Moggi generalizes the notion of CCC to that of a cartesian category with all exponentials of a special shape; one gets a CCC in the particular case that the functor T is the identity. De nition 57 Given any strong monad hT; ; ; ti over a cartesian category T : T (B )A  A ! T (B )i, with the C , a T -exponantial is a pair hT (B)A ; evalA;B universal property: T  T (f )  id; 8f : C  A ! T (B) 9!T (f ) : C ! T (B)A : f = evalA;B that is the following diagram commutes: f

CA

- T (B) 3

   evalT

T (f )  id

  ?  T (B )A  A  83

A;B

When modeling programs in a category C , usually one interprets terms into morphisms, and types into objects. The idea in [Moggi] is to ditinguish between the types of values, say A, from the type T (A) of computations of type A. Now, in the categorical semantics of pure -calculus (see [Sco, Koy]), one works within a cartesian closed category C ; since the calculus is type free, types are just one (for the opinion that the pure calculus is a special case of the typed one see [Sco]), and C is supposed to have an object U , called the \universal object", such that U U is a retract of U via ( ; ') (this can always be achieved in the subcategory of projections since there the exponentiation functor is covariant and locally continuous: see [Plo-Smy]) . In this way terms are interpreted into \points" of U , that is morphisms from O to U , where O is the terminal object of C (more precisely we have to require that U has \enough points": see [Koy]). Given two points x; y : O ! U , their application is de ned:

x  y = app  hx; yi = eval  h'  x; yi; where app : U  U ! U is eval  '  id. On the other hand, using the idea of T (A) as the type of computations with values of type A, Moggi introduces two possible extensions of this construction, to the case of a cartesian category C , with a strong monad hT; ; ; ti over it and all T -exponentials. In any case programs will be interpreted as points of an object T (A); if the idea is to model call-by-name value passing mechanism, then programs will take as input a computation instead of a value: the object we need in place of U above is now an N such that there is a retraction T (N )T (N ) < N , via( N ; 'N ). Let A;B : A  B ! B  A the obvious isomorphism, and de ne ~tA;B : T (A)  B ! T (A  B ) by t~A;B = T ()  tB;A  ; then the following diagram illustrates the construction of the morphism appN : T (N )  T (N ) ! T (N ):

84

appN

T (N )  T (N ) t~N;T (N )

?

T (N  T (N )) T ('N  id)

?

??N

? - T 2(N ) ? ? ? T (evalT

T (evalTT (N );N  'N  id)

T (T (N )T (N )  T (N ))

- T (N ) ? ?

??

T (N );N )

If one wishes to model call-by-value value passing mechanism, then programs have to be interpreted in points of an object T (V ) such that there is a retraction T (V )V < V : actually in this case the input of programs will be values instead of computations. Let A;B : T (A)  T (B ) ! T (A  B ) be de ned as A;B = A;B  T (t~A;B )  tA;B ; then the following diagram illustrates the construction of the morphism appV : T (V )  T (V ) ! T (V ):

85

T (V )  T (V )

appV

- T (V ) ? ?

??V

V;V

? T (evalT  'V  id) ? T (V );V - T 2(V ) T (V  V ) ? ? T ('V id) ? T T (evalT (V );V ) ? ? ? T (T (V )V  V ) ? 

4.5.2 The model N in the category of CPO

Run-time-choice calculus is a typical case of call-by-name calculus, while call-time-choice may be seen as a kind of call-by-value calculus, supposing that our \values" are deterministic terms. We illustrate in this section how Moggi's construction can be used in the former case; the latter is similar and easier. Our aim is to solve in the category of CPO the domain equation

N = N ] ! N ]; with usual inverse limit techniques. We recall that 2, the two point CPO, is such that 2  = 2] ; it follows that [2 ! 2]  = [2] ! 2] ]: by the way we can identify them. Consequently the following de nition is well given:

De nition 58 Take N0 = 2 and Nn+1 = [Nn] ! Nn] ]; then inductively de ne 'n : Nn ! Nn+1 and n : Nn+1 ! Nn by 1. '0(x) = y:x, 0 (y) = y(?), 2. 'n+1(x) = ']n  x  n] , n+1(y) = n]  y  ']n. 86

The O-functoriality of ()] ensures that h'n; n i is an embedding-projection pair, for each n, so that we can take

N = lim (Nn ; n ):

From [Henn-Plo] we know that, for any D, hD]; fj  jg; Ui is a monad on the category of domains (or of SFP objects depending on the powerdomain functor we consider). To obtain an applicative structure over N] we need a continuous function t : N]  N] ! (N]  N)] which is a tensorial strength of our monad in the sense of [Moggi]: this is achieved de ning t0 : N]  M(N) ! (N]  N )] by

t0 (a; fd1 ; . . . ; dng) = fjha; d1 ijg ]    ] fjha; dn ijg and taking its unique continuous extension. Proposition 17 The quadruple hN ]; fj  jg; U; ti is a strong monad in the sense of [Moggi]; in particular, for any a 2 N] and d 2 N we have t(a; fjdjg) = fjha; dijg. Proof. Routine

N ].

We are now ready to de ne the application on 

2

De nition 59 ] 8a; b 2 N]: a  b =def ( (eval  H  id)]  t^)(a; b) where t^ : N]  N] ! (N  N] )] is de ned simmetrically from t.

As for D, each Nn embeds into N, say by the hn;; ;ni embeddingprojection pair; setting xn = ;n(x) for x 2 N and an = ];n(a) for a 2 N] we can state:

Lemma 23 For any x 2 N and a; b 2 N], i) a =

F a, n n

ii) fjxn+1jg  an = xn+1(an ),

87

iii) an+1  b = an+1  bn = (a  bn)n , iv) a0  b = a0 = (a  ?)0.

Proof.

fjxn+1jg  an = xn+1(an) = (UU (eval  H  id)]  t^)(fjxn+1jg; an) = (U (eval  H  id)] )(fjhxn+1; an ijg) = (fjH (xn+1)(an )jg) = H (xn+1)(an ) F = m(xn+1)m+1(an)m = xn+1(an )

This establishes (ii). The rest is similar as in the proof of lemma 14.

2

Proposition 18 The map H : N ! [N] ! N]] de ned by G H (x) = a 2 Nn] : xn+1(an ) n

and the map K : [N] ! N] ] ! N de ned by G K (f ) = (a 2 Nn] :(f (n; (a)))n ) n

are continuous and mutually inverse. Proof. Similar to the proof of therem 11 using lemma 23

2

Proposition 19 The triple hN]; ; ]i is a semilinear applicative structure;

it is however not linear.

Proof.This is a consequence of the fact that t~ is linear in its rst argument U by construction, while and (eval  H  id)] are linear being obtained by using ext: the composition of linear functions is linear. However the function fj  jg is not linear: hence the application is not linear in its second argument.

2

88

De nition 60 Given the structure hN]; ; ]i and  2 Env = V ar ! N], we de ne the map [ ] :  ! (Env ! N] ) as follows:

[ x]  = (x), [ MN ]  = [ M ]   [ N ]  , [ x:M ]  = fjK (a 2 N] :[ M ] [a=x] )jg, [ M  N ]  = [ M ]  ] [ N ] . This is a good de nition, since in (iii) the continuity of application, abstraction and ] ensures that the function a 2 N] :[ M ] [a=x] is continuous as well. Theorem 14 The quadruple hN]; ; ]; [ ] i is a syntactical model. Proof.By proposition 19 we know that hN] ; ; ]i is a semilinear applicative structure; excluding in the de nition 51 those clause which are immediately satis ed, we are left with clauses (iii) and (vi). Clause (iii): Let f 2 [N] ! N] ] and a 2 N] , then fjK (f )jg  a = (UU (eval  H  id)]  t~)(fjK (f )jg; a) = (U (eval  H  id)] )fjhK (f ); aijg prop. 17 = Ufj(H  K )(f )(a)jg by def. 55 = fjf (a)jg since H  K = id = f (a) by def. 55 and (iii) follows since [ x:M ]   a = fjH (b:[ M ] [b=x] )jg  a = (b:[ M ] [b=x] )(a) = [ M ] [a=x] : i) ii) iii) iv)

Clause (vi):

8a 2 N]: [ M ] [a=x] = [ N ] [a=x] ) a:[ M ] [a=x] = a:[ N ] [a=x] ) fjH (a:[ M ] [a=x] )jg = fjH (a:[ N ] [a=x] )jg ) [ x:M ]  = [ x:N ]  by de nition 60 (iii). 89

2

Remark 6 N 6j= x:M  N = x:M  x:N : this follows from the fact that

the interpretation of an abstraction is a \singleton", while the interpretation of a sum is the \union" of the interpretations of the summands. Now consider two functions f; g : N] ! N] , such that there is no upper bound to them: then K (f ) and K (g) have no upper bound in N; it follows that fjf jg  fjgjg cannot be in the homomorphic image of N into N] via fj  jg.

90

Chapter 5 Theories 5.1 The theory c

The reduction relation ?!c is connected to the equational theory c introduced in [Sharma]; there Sharma proved that a subtheory of c was consistent, namely the theory obtained deleting axiom ( ). The result was established by de ning a notion of reduction (di erent from ?!c ) essentially by orienting from left to right the axioms of c , and then proving a ChurchRosser theorem. The proof of the consistency theorem was however very long, and the diculty with the axiom ( ) couldn't be overcome. On the contrary we give here a very short proof of the consistency of the whole theory, in a way that, in our opinion, enlights the fact that the c -calculus is nothing more than a calculus of nite sets of classical terms.

De nition 61 The theory c is the equational theory over  whose axioms and rules are as follows ( c) (x:M )N = M [N=x] if N 2 ; () M = M ; () M = N ) N = M ;

( ) M = N; N = L ) M = L;

() M = N ) LM = LN ;

91

( ) M = N ) ML = NL;

( ) M = N ) x:M = x:N ;

(1) M  M = M ;

(2) M  N = N  M ;

(3) (M  N )  L = M  (N  L); (") M = N ) M  L = N  L;

() (M  N )L = ML  NL;

() L(M  N ) = LM  LN ;

( ) x:M  N = x:M  x:N ;

As a rst step we prove a simple property of the reduction relation ?!c , that fails in case of ?!r .

Notation: We will write ?! c when a one step c-contraction occurs; similarly we write ?! when only one -contraction occurs. ?! c and  ?! are their re exive and transitive closures respectively. Lemma 24 8M; M1; M2 2 : M ?! c M1 ?!) 9M3 2 : M ?! M3 ?! c M2 that is

M

c



? M

3

- M1 

c

- M?2

Proof. By induction on M , and then by cases. The only interesting case is when M  (x:M 0 )M 00 and M1  M 0[M 00=x]; in M1 ?! M2 the only possibility is that a (residual of a)  redex in M 0 is contracted, since it must be the case that M 00 2 . It follows that M 0  C [P1  P2] for some P1 and

92

P2 and M1  C 0[P1[M 00=x]  P2[M 00=x]] if x is not bounded above in C [ ] and C 0[ ] results from C 0[ ] substituting M 00 for all free occurences of x; in this case M2  C 0[Pi [M 00=x]] for i = 1 or 2. Then (x:M 0 )M 00 ?! (x:C [Pi])M 00 ?! c (C [Pi])[M 00 =x]  C 0[Pi [M 00=x]] so that we take M3  (x:C [Pi])M 00 . If x is bounded above the hole [ ] in the context C [ ] the proof is similar and easier.

Corollary 8  N ) 9L 2  : M ?!  L ?!  N: 8M; N 2 : M ?! c   c

2

Proof. The proof is illustrated in the following picture, where vertical arrows represent one-step -reductions, horizontal arrows represent one-step c-reductions, and each square is an application of lemma 24:

M

? M1 - M2

? ? L1 - M3 - M4 - M5

? -? -? -? L2 L3 M6 M7 - N

L

2

Remark 7 This corollary is not true in the case of ?!r : for a similar result, but under stronger restrictions, see [Sharma]. De nition 62 Let A   and M; N 2 , then i) A+ = fM j 9N 2 A: M = N g;  Lg+ ; ii) det(M ) = fL 2  j M ?! c iii) M c N , det(M )  det(N ); 93

iv) M =c N , M c N c M .

The operation ()+ is the usual closure under -conversion; the intuitive meaning of det(M ) is \the set of deterministic values of M ".

De nition 63 Let A  ; A is -closed i A = A+. Furthermore if A; B

are -closed then

i) AB = fMN j M 2 A; N 2 Bg+;

ii) x:A = fx:M j M 2 Ag+ ;

iii) A[B=x] = fM [N=x] j M 2 A; N 2 Bg+.

Lemma 25 For any M; N 2  i) det(M  N ) = det(M ) [ det(N ); ii) det(x:M ) = x:det(M ); iii) det(MN ) = det(M )det(N ). Proof. Parts (i) and (ii) are clear. To see (iii):  L0 = L L 2 det(MN ) ) 9L0 2 : MN ?! c

by de nition; by corollary 8 there is a P 2  s.t.  P ?!  L0 ; MN ?!  c  P implies that P  M 0 N 0 where M ?!  M 0 and N ?!  N 0. now MN ?!    On the other hand we note that no c contraction can delete an occurrence of a  e.g.: 

KL(M  N ) 6?! c L  L0 implies P 2  being L0 2 . We since M  N 62 . It follows that P ?! c conclude that L 2 det(M )det(N ), that is det(MN )  det(M )det(N ). The inverse inclusion is clear.

2

94

Lemma 26 M 2  ; N 2  ) det(M [N=x]) = det(M )[det(N )=x]: Proof. By induction on M .

Case 1: M  x then det(x[N=x]) = det(N ) = det(x)[det(N )=x]:

Case 2: M  y 6 x then det(y[N=x]) = det(y) = det(y)[det(N )=x]:

Case 3: M  M1M2 then det((M1M2 )[N=x]) = det(M1 [N=x]M2[N=x]) = det(M1 [N=x])det(M2 [N=x]) by lemma 25 (iii) = det(M1 )[det(N )=x]det(M2)[det(N )=x] by ind. hyp. = det(M1 M2)[det(N )=x] since N 2 

where in the last step above we observe that, since N 2 , det(N ) is a set of -convertible terms; now in the classical calculus we know that

Q1 = Q2 ) P [Q1=x] = P [Q2=x] from which it follows that (P1 [Q1=x])(P2[Q2=x]) = (P1P2)[Q1=x] = (P1P2)[Q2=x]: Case 4: M  x:M 0: trivial. Case 5: M  y:M 0, where y 6 x, and supposing x 62 FV(N ) then det((y:M 0 )[N=x]) = det(y:M 0[N=x]) = y:det(M 0[N=x]) by lemma 25 (ii) = y:det(M 0)[det(N )=x] by ind. hyp. = det(y:M 0)[det(N )=x] by lemma 25 (ii):

95

Case 6: M  M1  M2 then

det((M1  M2)[N=x] = det(M1 [N=x]  M2[N=x]) = det(M1 [N=x]) [ det(M2[N=x]) = fP [Q=x] j P 2 det(M1 ) [ det(M2 ); Q 2 det(N )g = fP [Q=x] j P 2 det(M1  M2); Q 2 det(N )g = det(M1  M2)[det(N )=x]

using lemma 25 (i).

2

Theorem 15 For any M; N 2  c ` M = N ) M =c N: Proof.

( c ) (x:M )N = M [N=x] if N 2 ; let M 2  and N 2 , then using lemma 25 det((x:M )N ) = det(x:M )det(N ) = (x:det(M ))det(N ) = A say, then

P 2 A , 9Q 2 det(M ): P = (x:Q)N = Q[N=x] , P 2 det(M )[det(N )=x] = det(M [N=x]); by lemma 26. (), (), ( ) Obvious. () det(ML) = det(M )det(N ) by lemma 25 (iii) = det(N )det(L) by ind. hyp. = det(NL) by lemma 25 (iii):

( ) Similar to the previous one. 96

( ) Immediate consequence of lemma 25 (ii). (1 ), (2 ), (3 ) From det(M  N ) = det(M ) [ det(N ) (lemma 25 (i)) and idempotency, commutativity and associativity of [. (") Immediate from lemma 25 (i). () det((M  N )L) = det(M  N )det(L) by lemma 25 (iii) = (det(M ) [ det(N ))det(L) by lemma 25 (i) = det(M )det(L) [ det(N )det(L) = det(ML  NL) by lemma 25 (i),(iii):

() Similar to the previous one. ( ) x:M  N = x:M  x:N ; det(x:M  N ) = x:det(M  N ) by lemma 25 (ii) = x:(det(M ) [ det(N )) by lemma 25 (i) = x:det(M ) [ x:det(N ) = det(x:M  x:N ) by lemma 25 (i), (ii):

We conjecture that M =c N ) c ` M = N .

2

Corollary 9 The theory c is consistent. Proof. For any M; N 2  M =c N , det(M ) = det(N ) , M = N; that is =c restricted to  coincides with = . This implies that the theory induced by =c is a conservative extension of : hence it is consistent. Then, by the theorem, c is consistent.

2

97

5.2 The theory r

In previous chapters we studied the properties of the relation ?!r and gave both operational and denotational characterizations of the equivalence of programs it induces. In this section our aim is to present an axiomatization of this equivalence, allowing to compare this relation with the -convertibility relation of the classical -calculus. Here too, as in the case of the theory c we get inspiration from [Sharma] and [Boud91]. De nition 64 The theory r is the equational theory over  whose axioms and rules are as follows ( r ) (x:M )N = M [N=x]; () M = M ; () M = N ) N = M ; ( ) M = N; N = L ) M = L; () M = N ) LM = LN ; ( ) M = N ) ML = NL; ( ) M = N ) x:M = x:N ; (1) M  M = M ; (2) M  N = N  M ; (3) (M  N )  L = M  (N  L); () M = N ) M  L = N  L; () (M  N )L = ML  NL;

Remark 8 This theory has been presented in [Sharma]. It is very similar to the theory c . It di ers however because of the lack of axiom () and of the unrestricted axiom ( r ); this is responsible for the fact that the theory r is not a subtheory of c . This theory was proved consistent in [Sharma] with syntatical methods: for us it is actually a corollary of previous results. 98

Theorem 16 The syntatical model D is a non trivial model of r , hence

r is consistent.

Proof. By de nition 51, lemma 16 and proposition 16 we know that D is a synctactical model (actually an extensional one); now the proof that the equations and rules up to ( ) are validates runs as in the classical way; the rest is an immediate consequence of the de nition of the interpretation of  and of the semilinearity of D.

2

In his proof Sharma didn't prove consistency of the full theory, which in his formulation had among its axioms also

x:M  N = x:M  x:N: We do not include this axiom in the theory r because of its special status, illustrated in the following proposition. Another equation which appeared in the literature (see [Ash-Henn]) is () M  N = x:Mx  Nx if x 62 FV(M  N ); it is clearly connected (actually equivalent) with the axiom . ( )

Proposition 20 i) r 6` ; ii) r +  ` ; iii) r +  ` . Proof. (i) The non extensional model N is a model of r but not of .

(ii) Let y 62 FV(M ) [ FV(N ): (x:M  N )y = M [y=x]  N [y=x] by ( r ) = (x:M )y  (x:N )y by ( r ) = (x:M  x:N )y by () from which x:M  N = x:M  x:N follows by (). 99

(iii) Let x 62 FV(M ):

M = M M by (1 ) = x:Mx  Mx by () = x:Mx by (1 ):

2

We leave as an open question whether the theory r + is extensional, but we conjecture it is not.

5.3 The theory Tmust In this section we compare the theory induced by the equivalence studied throughout this thesis with the theories  +  and H. The main theorem is a conservativity result; it is readly seen that this can be considered as an alternative (synctatical) proof of the consistency for the theory Tmust de ned below.

De nition 65 Tmust = fM = N j M; N 2 0; M 'must N g: We know from the semantic construction in the previous chapters that:

Proposition 21 The theory Tmust is the theory of the model M, hence it is consistent.

Proof. Immediate consequence of the full abstraction theorem.

2

This fact is not illuminating, however, with respect to the question of conservativity. To establish this result we are going to prove a \simulation lemma" which says that contexts containing the  operator do not discriminate more w.r.t. must-convergency than classical contexts do.

De nition 66 Let M 2 , F  M a subset of the set of redexes occurring in M , and  a head reduction starting with M ; then i)  is nitely often in F i  M ?!  M )  62 F = ; 9m 8n  m: 0;n+1 : M ?! r n+1 0;n r n

100

ii) let  be any head reduction of M nitely often in F then

m deg(F ; ) = maxfn j 9m 2 ! 9R 2 F =0;m: M ?! h ~x:RM1 . . . Mng;

iii) let 1; . . . ; n be head reductions of M nitely often in F then deg(F ; 1; . . . ; n) = maxfdeg(F ; i) j 1  i  ng:

Remark 9  is nitely often in F i it contracts at most a nite number of (residuals of) redexes in F .

The next lemma is based on the idea that, if a context containing the operator  converges on a term M , while it diverges on a term N , the choices caused by the 's inside the context which are essential for this convergecydivergency property, are bounded above by those which are necessary to converge on M . On the other hand we know that all the reductions on M will converge, while there is a diverging reduction on N . The point is to simulate the choices of this last reduction, encoding them in a classical context.

Lemma 27 Given M; N 2  9D[ ] 2 [ ]: D[M ]# ^D[N ] ") 9C [ ] 2 [ ]: C [M ]# ^C [N ] " : Proof. W.l.o.g. let us suppose that M; N 2 0 ; then exists F 2  s.t. FM # and FN ". Let F 0 be the term in  obtained from F by substituting all occurrences of a subterm of the form P  Q with an occurrence of xPQ, where x is a fresh variable. For any r 2 ! de ne Tr  xyz1 . . . zr w:w(xz1 . . . zr )(yz1 . . . zr ): We show that there exists an F 00 2  and a vector L~ 2 (V ar [ fK; O; g) s.t.

F 00M L~ # and F 00N L~ " : Let 1; . . . ; m be the set of the head reductions of FM , and  be any divergent head reduction of FN ; let F be the set of  redexes of F . Case 1:  doesn't contract any redex in F : then choose F 00  F 0 and L~ is empty. 101

Case 2: 1 ; . . . ; m do not contract any redex in F : then choose F 00  F 0 [ =x]. Case 3: both  and 1; . . . ; m contract redexes in F . Since 1; . . . ; m are nite, they are nitely often in F , hence k = deg(F ; 1 ; . . . ; m ) for some k. We proceed as follows { we choose an r  k and take F 00  F 0[Tr =x]; { we perform all possible head reductions of F 00M until either a head normal form is reached, or a term with Tr in head position; { we reduce F 00N until a term with Tr in head position is reached: this must happen since  reduces some redex in F and no head normal form can be reached, otherways we would have FN #. Suppose that the term obtained in the reduction of F 00N is ~x:(Tr PQ)N1 . . . Nm and, supposing r choosen greater than m, the next steps in the head reduction of F 00 N will give U0  ~xzm+1 . . . zr w:w(PN1 . . . Nm zm+1 . . . zr )(QN1 . . . Nm zm+1 . . . zr ): We note that w 62 FV(PN1 . . . Nm)[FV(QN1 . . . Nm ). Correspondingly from the reductions of F 00M we get U1  ~x1:(Tr P1Q1)M1;1 . . . M1;m1



Uq  ~xq :(Tr Pq Qq )Mq;1 . . . Mq;mq Uq+1  ~xq+1:q+1Mq+1;1 . . . Mq+1;mq+1



Up  ~xp:p Mp;1 . . . Mp;mp and from these, for 1  i  q, the head reductions proceed giving certain Ui0 of the form ~xi zmi+1 . . . zr w:w (Pi Mi;1 . . . Mi;mi zmi+1 . . . zr ) (Qi Mi;1 . . . Mi;mi zmi +1 . . . zr ); where we make a similar remark about the w as for U0 . Because of our assumptions all head variables appearing in the terms above are 102

bounded variables, hence thy must occurr in the pre xed string of abstractions of the respective terms. For any closed term in head normal form de ne its \head distance" as follows: hd(v1 . . . vn :R1 . . . Rm) = i if   vi : Now we can always assume that for all q + 1  i  p hd(U0 ) 6= hd(Ui ); because we simply suppose the r to be choosen suitably large. If this condition is satis ed also for 1  i  q then we take F 00  F 0[Tr =x] and L~  y1 . . . yh?1 , where h = hd(U0 ), and we are done. Hovever nothing prevents us from having some Uj0 , where 1  j  q, s.t. hd(Uj0 ) = hd(U0 ), and of course this cannot be remedied with a choice of r, since both head distances will depend on it. In this case suppose that the original reduction  has, after ~x:(P  Q)N1 . . . Nm, a choice to the left, namely it continues with ~x:PN1 . . . Nm . In this case, if l = maxfj ~x j; j ~xq+1 j; . . . ; j ~xp jg, then take L~  y1 . . . yh?1Kyh+1 . . . yl L~ 0; where L~0 remains to be determined. (Clearly, if the choice is to the right, we take O instead of K). By the way Ui0 L~ # if i 6= 0 and hd(Ui0 ) 6= hd(U0 );

since the head variable will be replaced by some y, and the rest can be ignored; otherwise  PN . . . N ~y; U0L~ ?! h 1 m and  P M . . . M ~y 0 Ui0L~ ?! h i i;1 i;mi 0 where ~y; ~y  y1 . . . yh?1yh+1 . . . yl . If either  or 1; . . . ; m do not contract any other redex in F , we are in a case similar to case 1 or to case 2: consequently we shall choose the L~ 0 accordingly. Otherways the present case applies, and we repeat the same reasoning. This process, however, is bounded because the 103

1 ; . . . ; m were nitely often in F . This implies that we must reach a point in which either (the simulation of)  de nitely diverges, or all the reducts obtained from (the simulation of) 1 ; . . . ; m are similar to the Ui above, when q + 1  i  p: that is we can suppose that they all have a di erent head distance from that of the term coming from . In the former case we add nothing to the L~ constructed up to that point; in the last case we add w1 . . . ws ; supposing s to be the head distance of the term coming from .

2

We remind the reader that H = fM = N j M; N 2 0; 8C [ ] 2 [ ]: C [M ] 2 SOL , C [N ] 2 SOLg: It is known that H is the theory of the model D1. We conclude this section with the conservativity theorem.

Theorem 17 i) r +  Tmust, ii) Tmust is a conservative extension of H, iii) Tmust is a conservative extension of  + . Proof. To prove the rst part, simply note that Tmust is the theory of a model

of r , and that this model validates since it is extensional (by lemma 16). As to (ii): let M; N 2 0 be such that Tmust 6` M = N ; then there is a context D[ ] 2 [ ] such that, say, D[M ] # and D[N ] ". By lemma 27, there is a context C [ ] 2 [ ] such that C [M ] #, that is C [M ] 2 SOL and C [N ] 62 SOL; hence H 6` M = N : it follows that H  Tmust . On the other hand, and a fortiori, if M; N 2 0, then Tmust ` M = N ) 8D[ ] 2 [ ]: D[M ]# , D[N ]# ) 8C [ ] 2 [ ]: C [M ] 2 SOL , C [N ] 2 SOL ) H ` M = N; since # d = SOL. Finally (iii) follows from (ii) and the fact that H is an extensional -theory.

2

104

Acknowledgements I wish to thank Professor Bohm for introducing me to the lambda calculus, and for his patience, expecially in the early attempts I made to start research work. Thanks are due to Mariangiola Dezani, for her constant encouragement and for reading manuscripts of this thesis in their various stages. The stimulating conferences held in Rome by Boudol about his \parallel lambda calculus" provided suggestions and raised problems this thesis has tried to answer to. I would like to thank Adolfo Piperno for his help expecially on separability techniques, that we have extended to the enriched calculus studied here. The semantic construction owes much to the suggestions and comments Moggi gave to me about a previous attempt to use his semantic constraction for \computational lambda calculus". Last but not least I have to thank a researcher I am deeply indebted to, who has been guide to me to the world of theoretical computer science in all its aspects, hinting the fundamental readings at the basis of my scienti c culture: Gianfranco Mascari.

105

Bibliography [Abr83] S. Abramsky, \On Semantic Foundations for Applicative Multiprogramming" LNCS 154, 1983. [Abr-Ong] S. Abramsky, C.H.L. Ong, Full Abstraction in the Lazy Lambda Calculus, Research Rep., Dept. of Comp., Imperial College 1989. [Ada-Rei-Nel] J, Adamek, J, Reiterman, E. Nelson, \Continuous Semilattices" TCS 43, 1986. [ADJ] J. Goguen, J. Thatcher, E. Wagner, J. Wrigth, \Initial algebraic semantics and continuous algebras", J. ACM 24, 1977. [Apt-Plo] K.R. Apt, G.D. Plotkin, \A Cook's Tour of Countable Nondeterminism", LNCS 115, 1981. [Ash-Henn] E.A. Ashcroft, M.C.B. Hennessy, \A mathematical Semantics for a Non-deterministic Typed Lambda Calculus", TCS 11, 1980. [Ast-Co] E. Astesiano, G. Costa, \Nondeterminism and Fully Abstract Models", R.A.I.R.O. Theor. Inf. 14, 1980. [Bar] H.P. Barendregt, The Lambda-Calculus: Its Syntax and Semantics, North-Holland, 1984. [Berry] G. Berry, \Stable models of typed lambda-calculi", LNCS 62, 1978. [Bohm] C. Bohm, \Alcune proprieta' delle forme --normali nel -Kcalcolo", Pubblicazioni dell' I.A.C. n. 696, Roma 1968.

106

[Boud80] G. Boudol, \Semantique Operationelle at Algebrique Des Programmes Recursifs Non-Deterministes" These d'Etat, Universite de Paris VII, 1980. [Boud86] G. Boudol, \Computational semantics of term rewriting systems" in Algebraic Methods in Semantics, M. Nivat, J. Reynolds (eds.), 1986. [Boud89] G. Boudol, \Towards a lambda-calculus for concurrent and communicating systems", LNCS 351, 1989. [Boud90] G. Boudol, \A Lambd-Calculus for Parallel Functions", Report of INRIA, 1990. [Boud91] G. Boudol, \A Lambda Calculus for (Strict) Parallel Functions", INRIA Preprint, 1990. [CDR] M. Coppo, M. Dezani-Ciancaglini, S. Ronchi della Rocca, \(Semi)separability of nite sets of terms in Scott's D1-models of the calculus", LNCS 62, 1978. [deL-Pip] U. de'Liguoro, A. Piperno, \Must preorder in non-deterministic untyped -calculus", CAAP '92, to appear. [DeN-Henn] R. De Nicola, M.C.B. Hennessy, \Testing Equivalences for Processes", TCS 34, 1983. [Egi-Hon-Ron] L. Egidi, F. Honsell, S. Ronchi della Rocca, \The lazy callby-value lambda calculus", to appear in Proc. of MFCS '91, 1991. [Gue] I. Guessarian, \Algebraic Semantics", LNCS 99, 1981. [Gun-Sco] C.A. Gunter, D. Scott, \Semantic Domains" in Handbook of Theoretical Computer Science, J. van Leeuwen (ed.), Elsevier Publ. Co., 1990. [Henn80] M.C.B. Hennessy, \The Semantics of Call-by-value and Call-byname in a nondeterministic Environment", SIAM J. Comput. 9, 1980. [Henn82] M.C.B. Hennessy, \Powerdomains and nondeterministic recursive de nitions", LNCS 137, 1982. 107

[Henn-Plo] M.C.B. Hennessy, G.D. Plotkin, \Full Abstraction for a Simple Parallel Programming Language", LNCS 74, 1979. [Hin-Lon] J.R. Hindley, G. Longo, \Lambda Calculus Models and Extensionality", Z. Math. Logik Grundlag. Math. 26, 1980. [Huet-Levy] G. Huet, J.J. Levy, \Call-by-need computations in nonambiguous linear term rewriting systems", INRIA Reports 359, 1979. [Hyl] M. Hyland, \ A Syntactic Characterization of the Equality in some Models for the Lambda Calculus", J. of the London Math. Soc. 12, 1976. [Jac-Mar-Zac] B. Jacobs, I. Margaria, M. Zacchi, \Expansion and Conversion Models in the Lambda Calculus From Filters with Polymorphic Types", to appear. [Jag-Pan] R. Jagadeesan, P. Panangaden, \A Domain-theoretic Model for a Higher-order Process Calculus", LNCS 443, 1990. [Koy] K. Koymans, \Models of the lambda-calculus", Inform. Control 52, 1982. [Levy] J.J. Levy, \An algebraic interpretation of the  K -calculus and a labelled -calculus", LNCS 37, 1975. [Mil77] R. Milner, \Fully Abstract Models fro Typed -calculi", TCS 4, 1977. [Mil89] R. Milner, J.G. Parrow, D.J. Walker, \A Calculus of Mobile Processes, Parts I and II", Report of ECS-LFCS-89-85 and 86, Edinburgh Un., 1989. [Mil90] R. Milner \Functions as Processes", LNCS 443, 1990. [Moggi] E. Moggi, \Notions of Computation and Monads", Inf. Comp. 93, 1991. [Morris] J.H. Morris, Lambda Calculus Models of Programming Languages, Dissertation, M.I.T. 1968. 108

[Nivat] M. Nivat, \Nondeterministic Programs: an Algebraic Overview" IFIP Congress '80, 1980. [Plo75] G.D. Plotkin, \Call-by-name, Call-by-value and the -calculus", TCS 1, 1975. [Plo76] G.D. Plotkin, \A Powerdomain Construction", SIAM J. of Comp. 5, 1976. [Plo77] G.D. Plotkin, \LCF considered as a programming language", TCS, 5, 1977. [Plo82] G.D. Plotkin, \A powerdomain for countable non-determinism", LNCS 140, 1982. [Plo91] G. D. Plotkin, \Semantics for Type Checking", to appear. [Plo-Smy] G.D. Plotkin, M. Smyth, \The category theoretic solution of recursive domain equations", SIAM J. Computing 11, 1982. [Sco] D. Scott, \Relating theories of the lambda calculus", in To H.B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, J.R. Hindley, J.P. Seldin (eds.), Academic Press, 1980. [Sharma] K. Sharma, Syntactic Aspects of the Non-deterministic Lambda Calculus, Master's thesis, Washington State University, September 1984. Available as internal report CS-84-127 of the Comp. Sci Dept. [Smy] M.B. Smyth, \Power Domains", J. Comp. Sys. Sci. 16, 1978. [Thom] B. Thomsen, \A Calculus of Higher-Order Communicating Systems", ACM 143, 1989. [Wads] C.P. Wadsworth, \ The relation between computational and denotational properties for Scott's D1 -models of the lambda-calculus", SIAM J. of Comp. 5, 1976.

109

Suggest Documents