DeepAI

Eager Functions as Processes

We study Milner's encoding of the call-by-value λ-calculus into the π-calculus. We show that, by tuning the encoding to two subcalculi of the π-calculus (Internal π and Asynchronous Local π), the equivalence on λ-terms induced by the encoding coincides with Lassen's eager normal-form bisimilarity, extended to handle η-equality. As behavioural equivalence in the π-calculus we consider contextual equivalence and barbed congruence. We also extend the results to preorders. A crucial technical ingredient in the proofs is the recently-introduced technique of unique solutions of equations, further developed in this paper. In this respect, the paper also intends to be an extended case study on the applicability and expressiveness of the technique.

• 4 publications
• 4 publications
• 7 publications
02/07/2022

Eager Functions as Processes (long version)

We study Milner's encoding of the call-by-value λ-calculus into the π-ca...
04/16/2018

Trees from Functions as Processes

Levy-Longo Trees and Bohm Trees are the best known tree structures on th...
04/23/2018

Bisimulations for Delimited-Control Operators

We propose a survey of the behavioral theory of an untyped lambda-calcul...
06/29/2018

Divergence and unique solution of equations

We study proof techniques for bisimilarity based on unique solution of e...
04/22/2021

On sequentiality and well-bracketing in the π-calculus

The π -calculus is used as a model for programminglanguages. Its context...
02/20/2020

Contextual Equivalence for Signal Flow Graphs

We extend the signal flow calculus—a compositional account of the classi...
05/26/2018

A Theory of Encodings and Expressiveness

This paper proposes a definition of what it means for one system descrip...

Introduction

Milner’s work on functions as processes (Milner, 1990, 1992), that shows how the evaluation strategies of call-by-name -calculus and call-by-value -calculus (Abramsky, 1987; Plotkin, 1975) can be faithfully mimicked in the -calculus, is generally considered a landmark in Concurrency Theory, and more generally in Programming Language Theory. The comparison with the -calculus is a significant expressiveness test for the -calculus. More than that, it promotes the -calculus to be a basis for general-purpose programming languages in which communication is the fundamental computing primitive. From the -calculus point of view, the comparison provides the means to study -terms in contexts other than purely sequential ones, and with the instruments available to reason about processes. Further, Milner’s work, and the works that followed it, have contributed to understanding and developing the theory of the -calculus.

More precisely, Milner shows the operational correspondence between reductions in the -terms and in the encoding -terms. He then uses the correspondence to prove that the encodings are sound, i.e., if the processes encoding two -terms are behaviourally equivalent, then the source -terms are also behaviourally equivalent in the -calculus. Milner also shows that the converse, completeness, fails, intuitively because the encodings allow one to test the -terms in all contexts of the -calculus — more diverse than those of the -calculus.

The main problem that Milner work left open is the characterisation of the equivalence on -terms induced by the encoding, whereby two -terms are equal if their encodings are behaviourally equivalent -calculus terms. The question is largely independent of the precise form of behavioural equivalence adopted in the -calculus because the encodings are deterministic (or at least confluent). In the paper we consider contextual equivalence (that coincides with may testing and trace equivalence) and barbed congruence (that coincides with bisimilarity).

For the call-by-name -calculus, the answer was found shortly later (Sangiorgi, 1993b, 2000): the equality induced is the equality of Lévy-Longo Trees (Longo, 1983), the lazy variant of Böhm Trees. It is actually also possible to obtain Böhm Trees, by modifying the call-by-name encoding so to allow also reductions underneath a -abstraction, and by including divergence among the observables (Sangiorgi and Xu, 2014). These results show that, at least for call-by-name, the -calculus encoding, while not fully abstract for the contextual equivalence of the -calculus, is in remarkable agreement with the theory of the -calculus: several well-known models of the -calculus yield Lévy-Longo Trees or Böhm Trees as their induced equivalence (Lévy, 1975; Longo, 1983; Barendregt, 1984).

For call-by-value, in contrast, the problem of identifying the equivalence induced by the encoding has remained open, for two main reasons. First, tree structures in call-by-value are less studied and less established than in call-by-name. Secondly, proving completeness of an encoding of into requires sophisticated proof techniques. For call-by-name, for instance, a central role is played by bisimulation up-to contexts. For call-by-value, however, existing proof techniques, including ‘up-to contexts’, appeared not to be powerful enough.

In this paper we study the above open problem for call-by-value. Our main result is that the equivalence induced on -terms by their call-by-value encoding into the -calculus is eager normal-form bisimilarity (Lassen, 2005; Lassen and Levy, 2007). This is a tree structure for call-by-value, proposed by Lassen as the call-by-value counterpart of Lévy-Longo Trees. Precisely we obtain the variant that is insensitive to -expansion, called -eager normal-form bisimilarity.

To obtain the results we have however to make a few adjustments to Milner’s encoding and/or specialise the target language of the encoding. These adjustments have to do with the presence of free outputs (outputs of known names) in the encoding. We show in the paper that this brings problems when analysing -terms with free variables: desirable call-by-value equalities fail. An example is given by the law:

 (1) I(xV)=xV

where is and is a value. Two possible solutions are:

1. rule out the free outputs; this essentially means transplanting the encoding onto the Internal -calculus (Sangiorgi, 1996), a version of the -calculus in which any name emitted in an output is fresh;

2. control the use of capabilities in the -calculus; for instance taking Asynchronous Local  (Merro and Sangiorgi, 2004) as the target of the translation. (Controlling capabilities allows one to impose a directionality on names, which, under certain technical conditions, may hide the identity of the emitted names.)

In the paper we consider both approaches, and show that in both cases, the equivalence induced coincides with -eager normal-form bisimilarity.

In summary, there are two contributions in the paper:

1. Showing that Milner’s encoding fails to equate terms that should be equal in call-by-value.

2. Rectifying the encoding, by considering different target calculi, and investigating Milner’s problem in such a setting.

The rectification we make does not really change the essence of the encoding – in one case, the encoding actually remains the same. Moreover, the languages used are well-known dialects of the -calculus, studied in the literature for other reasons. In the encoding, they allow us to avoid certain accidental misuses of the names emitted in the communications. The calculi were not known at the time of Milner’s paper (Milner, 1992).

A key role in the completeness proof is played by a technique of unique solution of equations, recently proposed (Durier et al., 2017). The structure induced by Milner’s call-by-value encoding was expected to look like Lassen’s trees; however existing proof techniques did not seem powerful enough to prove it. The unique solution technique allows one to derive process bisimilarities from equations whose infinite unfolding does not introduce divergences, by proving that the processes are solutions of the same equations. The technique can be generalised to possibly-infinite systems of equations, and can be strengthened by allowing certain kinds of divergences in equations. In this respect, another goal of the paper is to carry out an extended case study on the applicability and expressiveness of the techniques. Then, a by-product of the study are a few further developments of the technique. In particular, one such result allows us to transplant uniqueness of solutions from a system of equations, for which divergences are easy to analyse, to another one. Another result is about the application of the technique to preorders.

Finally, we consider preorders — thus referring to the preorder on -terms induced by a behavioural preorder on their -calculus encodings. We introduce a preorder on Lassen’s trees (preorders had not been considered by Lassen) and show that this is the preorder on -terms induced by the call-by-value encoding, when the behavioural relation on -calculus terms is the ordinary contextual preorder (again, with the caveat of points (1) and (2) above). With the move from equivalences to preorders, the overall structure of the proofs of our full abstraction results remains the same. However, the impact on the application of the unique-solution technique is substantial, because the phrasing of this technique in the cases of preorders and of equivalences is quite different.

Further related work.

The standard behavioural equivalence in the -calculus is contextual equivalence. Encodings into the -calculus (be it for call-by-name or call-by-value) break contextual equivalence because -calculus contexts are richer than those in the (pure) -calculus. In the paper we try to understand how far beyond contextual equivalence the discriminating power of the -calculus brings us, for call-by-value. The opposite approach is to restrict the set of ’legal’ -contexts so to remain faithful to contextual equivalence. This approach has been followed, for call-by-name, and using type systems, in (Berger et al., 2001; Toninho and Yoshida, 2018).

Open call-by-value has been studied in (Accattoli and Guerrieri, 2016), where the focus is on operational properties of -terms; behavioural equivalences are not considered. An extensive presentation of call-by-value, including denotational models, is Ronchi della Rocca and Paolini’s book (Rocca and Paolini, 2004).

In (Durier et al., 2017), the unique-solution technique is used in the completeness proof for Milner’s call-by-name encoding. That proof essentially revisits the proof of (Sangiorgi, 2000), which is based on bisimulation up-to context. We have explained above that the case for call-by-value is quite different.

Structure of the paper.

We recall basic definitions about the call-by-value -calculus and the -calculus in Section 1. The technique of unique solution of equations is introduced in Section 2, together with some new developments. Section 3 presents our analysis of Milner’s encoding, beginning with the shortcomings related to the presence of free outputs. The first solution to these shortcomings is to move to the Internal -calculus: this is described in Section 4. For the proof of completeness, in Section 4.2, we rely on unique solution of equations; we also compare such technique with the ‘up-to techniques’. The second solution is to move to the Asynchronous Local -calculus: this is discussed in Section 5. We show in Section 6 how our results can be adapted to preorders and to contextual equivalence. Finally in Section 7 we highlight conclusions and possible future work.

1. Background material

Throughout the paper, ranges over relations. The composition of two relations and is written . We often use infix notation for relations; thus means . A tilde represents a tuple. The -th element of a tuple is referred to as . Our notations are extended to tuples componentwise. Thus means for all components.

1.1. The call-by-value λ-calculus

We let and range over the set of -calculus variables. The set of -terms is defined by the grammar

Free variables, closed terms, substitution, -conversion etc. are defined as usual (Barendregt, 1984; Hindley and Seldin, 1986). Here and in the rest of the paper (including when reasoning about processes), we adopt the usual “Barendregt convention”. This will allow us to assume freshness of bound variables and names whenever needed. The set of free variables in the term is . We group brackets on the left; therefore is . We abbreviate as , or if the length of is not important. Symbol stands for the always-divergent term .

A context is a term with a hole , possibly occurring more than once. If is a context, is a shorthand for where the hole is substituted by . An evaluation context is a special kind of context, with exactly one hole , and in which the inserted term can immediately run. In the pure -calculus values are abstractions and variables.

Evaluation contexts Ce := [⋅] | CeM | VCe V := x | λx.M

In call-by-value, substitutions replace variables with values; we call them value substitutions.

Eager reduction (or -reduction), , is determined by the rule:

 Ce[(λx.M)V]⟶Ce[M{V/x}].

We write  for the reflexive transitive closure of . A term in eager normal form is a term that has no eager reduction.

Proposition 1.1 ().
1. If , then and , for any value substitution .

2. Terms in eager normal form are either values or of the shape .

Therefore, given a term , either where is a term in eager normal form, or there is an infinite reduction sequence starting from . In the first case, has eager normal form , written , in the second diverges, written . We write when for some .

Definition 1.2 (Contextual equivalence).

Given , we say that and are contextually equivalent, written , if for any context , we have iff .

1.2. Tree semantics for call-by-value

We recall eager normal-form bisimilarity (Lassen, 2005; Lassen and Levy, 2007; Støvring and Lassen, 2009).

Definition 1.3 (Eager normal-form bisimulation).

A relation between -terms is an eager normal-form bisimulation if, whenever , one of the following holds:

1. both and diverge;

2. and for some , values , , and evaluation contexts and with and for a fresh ;

3. and for some , , with ;

4. and for some .

Eager normal-form bisimilarity, , is the largest eager normal-form bisimulation.

Essentially, the structure of a -term that is unveiled by Definition 1.3 is that of a (possibly infinite) tree obtained by repeatedly applying -reduction, and branching a tree whenever instantiation of a variable is needed to continue the reduction (clause (2)). We call such trees Eager Trees (ETs) and accordingly also call eager normal-form bisimilarity the Eager-Tree equality.

Example 1.4 ().

Relation is strictly finer than contextual equivalence : the inclusion follows from the congruence properties of (Lassen, 2005); for the strictness, examples are the following equalities, that hold for but not for :

 Ω=(λy.Ω)(xV)xV=(λy.xV)(xV).
Example 1.5 (η rule).

The -rule is not valid for . For instance, we have . The rule is not even valid on values, as we also have . It holds however for abstractions: when .

The failure of the -rule is troublesome as, under any closed value substitution, the two terms are indeed eager normal-form bisimilar (as well as contextually equivalent). Thus -eager normal-form bisimilarity (Lassen, 2005) takes -expansion into account so to recover such missing equalities.

Definition 1.6 (η-eager normal-form bisimulation).

A relation between -terms is an -eager normal-form bisimulation if, whenever , either one of the clauses of Definition 1.3, or one of the two following additional clauses, hold:

1. and for some , , and such that , with and for some value , evaluation context , and fresh .

2. the converse of (5), i.e., and for some , , and such that , with and for some value , evaluation context , and fresh .

Then -eager normal-form bisimilarity, , is the largest -eager normal-form bisimulation.

We sometimes call relation the -Eager-Tree equality.

Remark 1.7 ().

Definition 1.6 coinductively allows -expansions to occur underneath other -expansions, hence trees with infinite -expansions may be equated with finite trees. For instance,

 xηλy.xyηλy.x(λz.yz)ηλy.x(λz.y(λw.zw))η…

A concrete example is given by taking a fixpoint , and setting . We then have , and then , and so on. Hence, we have .

1.3. The π-calculus, Iπ and ALπ

In all encodings we consider, the encoding of a -term is parametric on a name, i.e., it is a function from names to -calculus processes. We also need parametric processes (over one or several names) for writing recursive process definitions and equations. We call such parametric processes abstractions. The actual instantiation of the parameters of an abstraction is done via the application construct . We use for processes, for abstractions. Processes and abstractions form the set of -agents (or simply agents), ranged over by . Small letters range over the infinite set of names. The grammar of the -calculus is thus:

 A:=P\Large{∣}F(agents)P:=0\Large{∣}a(˜b).P% \Large{∣}¯¯¯a⟨˜b⟩.P\Large% {∣}νaP(processes)\Large{∣}P1|P2\Large{∣}!a(˜b).P\Large{∣}F⟨˜a⟩F:=(˜a) P\Large{∣}K(abstractions)

In prefixes and , we call the subject and the object. When the tilde is empty, the surrounding brackets in prefixes will be omitted. We often abbreviate as . An input prefix , a restriction , and an abstraction are binders for names and , respectively, and give rise in the expected way to the definition of free names (fn) and bound names (bn) of a term or a prefix, and -conversion. An agent is name-closed if it does not contain free names. As in the -calculus, following the usual Barendregt convention we identify processes or actions which only differ on the choice of the bound names. The symbol will mean “syntactic identity modulo -conversion”. Sometimes, we use as abbreviation mechanism, to assign a name to an expression to which we want to refer later.

We use constants, ranged over by for writing recursive definitions. Each constant has a defining equation of the form , where is name-closed; are the formal parameters of the constant (replaced by the actual parameters whenever the constant is used).

Since the calculus is polyadic, we assume a sorting system (Milner, 1993) to avoid disagreements in the arities of the tuples of names carried by a given name and in applications of abstractions. We will not present the sorting system because it is not essential. The reader should take for granted that all agents described obey a sorting. A context of is a -agent in which some subterms have been replaced by the hole or, if the context is polyadic, with indexed holes ; then or is the agent resulting from replacing the holes with the terms or .

We omit the operators of sum and matching (not needed in the encodings). We refer to (Milner, 1993) for detailed discussions on the operators of the language. We assign parallel composition the lowest precedence among the operators.

Operational semantics.

The operational semantics of the -calculus is standard (Sangiorgi and Walker, 2001) (including the labelled transition system). The reference behavioural equivalence for -calculi will be the usual barbed congruence. We recall its definition, on a generic subset of -calculus processes. A -context is a process of with a single hole in it (the hole has a sort too, as it could be in place of an abstraction). We write if can make an output action whose subject is , possibly after some internal moves. (We make only output observable because this is standard in asynchronous calculi; adding also observability of inputs does not affect barbed congruence on the synchronous calculi we will consider.)

Definition 1.8 (Barbed congruence).

Barbed bisimilarity is the largest symmetric relation on -calculus processes such that implies:

1. If then there is such that and .

2. iff .

Let be a set of -calculus agents, and . We say that and are barbed congruent in , written , if for each (well-sorted) -context , it holds that .

Remark 1.9 ().

Barbed congruence has been uniformly defined on processes and abstractions (via a quantification on all process contexts). Usually, however, definitions will only be given for processes; it is then intended that they are extended to abstractions by requiring closure under ground parameters, i.e., by supplying fresh names as arguments.

As for all contextually-defined behavioural relations, so barbed congruence is hard to work with. In all calculi we consider, it can be characterised in terms of ground bisimilarity, under the (mild) condition that the processes are image-finite up to . (We recall that the class of processes image-finite up to is the largest subset of -calculus processes which is derivation closed and such that implies that, for all actions , the set quotiented by  is finite. The definition is extended to abstractions as by Remark 1.9.) All the agents in the paper, including those obtained by encodings of the -calculus, are image-finite up to . The distinctive feature of ground bisimilarity is that it does not involve instantiation of the bound names of inputs (other than by means of fresh names), and similarly for abstractions. In the remainder, we omit the adjective ‘ground’.

Definition 1.10 (Bisimilarity).

A symmetric relation on -processes is a bisimulation, if whenever and , then for some with .

Processes and are bisimilar, written , if for some bisimulation .

We will use two subcalculi: the Internal -calculus (I), and the Asynchronous Local -calculus (AL), obtained by placing certain constraints on prefixes.

Iπ.

In I, all outputs are bound. This is syntactically enforced by replacing the output construct with the bound-output construct , which, with respect to the grammar of the ordinary -calculus, is an abbreviation for . In all tuples (input, output, abstractions, applications) the components are pairwise distinct so to make sure that distinctions among names are preserved by reduction.

Alπ.

AL is defined by enforcing that in an input , all names in appear only in output position in . Moreover, AL being asynchronous, output prefixes have no continuation; in the grammar of the -calculus this corresponds to having only outputs of the form (which we will simply write ). In AL, to maintain the characterisation of barbed congruence as (ground) bisimilarity, the transition system has to be modified  (Merro and Sangiorgi, 2004), allowing the dynamic introduction of additional processes (the ‘links’, sometimes also called forwarders).

Theorem 1.11 ().
1. In I, on agents that are image-finite up to , barbed congruence and bisimilarity coincide.

2. In AL, on agents that are image-finite up to  and where no free name is used in input, barbed congruence and bisimilarity coincide.

All encodings of the -calculus (into I and AL) in the paper satisfy the conditions of Theorem 1.11. Thus we will be able to use bisimilarity as a proof technique for barbed congruence. (In part (2) of the theorem, the condition on inputs can be removed by adopting an asynchronous variant of bisimilarity; however, the synchronous version is easier to use in our proofs based on unique solution of equations).

2. Unique solutions in Iπ and ALπ

We adapt the proof technique of unique solution of equations, from (Durier et al., 2017) to the calculi I and AL, in order to derive bisimilarity results. The technique is discussed in  (Durier et al., 2017) on the asynchronous -calculus (for possibly-infinite systems of equations). The structure of the proofs for I and AL is similar; in particular the completeness part is essentially the same because bisimilarity is the same. The differences in the syntax of I, and in the transition system of AL, show up only in certain technical details of the soundness proofs.

We need variables to write equations. We use capital letters for these variables and call them equation variables. The body of an equation is a name-closed abstraction possibly containing equation variables (that is, applications can also be of the form ). We use to range over such expressions; and to range over systems of equations, defined as follows. In the definitions below, the indexing set can be infinite.

Definition 2.1 ().

Assume that, for each of a countable indexing set , we have a variable , and an expression , possibly containing some variables. Then (sometimes written ) is a system of equations. (There is one equation for each variable ; we sometimes use to refer to that equation.)

A system of equations is guarded if each occurrence of a variable in the body of an equation is underneath a prefix.

is the abstraction resulting from by replacing each variable with the abstraction (as usual assuming and have the same sort).

Definition 2.2 ().

Suppose is a system of equations. We say that:

• is a solution of the system of equations for if for each it holds that .

• The system has a unique solution for if whenever and are both solutions for , we have .

Definition 2.3 (Syntactic solutions).

The syntactic solutions of the system of equations are the recursively defined constants , for each , where is the indexing set of the system.

The syntactic solutions of a system of equations are indeed solutions of it.

A process diverges if it can perform an infinite sequence of internal moves, possibly after some visible ones (i.e., actions different from ); formally, there are processes , , and some , such that and for all , . We call a divergence of the sequence of transitions . In the case of an abstraction, has a divergence if the process has a divergence, where are fresh names. A tuple of agents is divergence-free if none of the components has a divergence.

The following result is the technique we rely on to establish completeness of the encoding. As announced above, it holds in both I and AL.

Theorem 2.4 ().

In I and AL, a guarded system of equations with divergence-free syntactic solutions has unique solution for .

Techniques for ensuring termination, hence divergence freedom, for the -calculus have been studied in, e.g., (Yoshida et al., 2004; Demangeon et al., 2010; Sangiorgi, 2006).

2.1. Further Developments

We present some further developments to the theory of unique solution of equations, that are needed for the results in this paper. The first result allows us to derive the unique-solution property for a system of equations from the analogous property of an extended system.

Definition 2.5 ().

A system of equations extends system if there exists a fixed set of indices such that any solution of can be obtained from a solution of by removing the components corresponding to indices in .

Theorem 2.6 ().

Consider two systems of equations and where extends . If has a unique solution, then the property also holds for .

We shall use Theorem 2.6 in Section 4.2, in a situation where we transform a certain system into another one, whose uniqueness of solutions is easier to establish.

Remark 2.7 ().

We cannot derive Theorem 2.6 by comparing the syntactic solutions of the two systems and . For instance, the equations and have (strongly) bisimilar syntactic solutions, yet only the latter equation has the unique-solution property. (Further, Theorem 2.6 allows us to compare systems of different size.)

The second development is a generalisation of Theorem 2.4 to preorders; we postpone its presentation to Section 6.

3. Milner’s encodings

3.1. Background

Milner noticed (Milner, 1990, 1992) that his call-by-value encoding can be easily tuned so to mimic forms of evaluation in which, in an application , the function is run first, or the argument is run first, or function and argument are run in parallel (the proofs are actually carried out for this last option). We chose here the first one, because it is more in line with ordinary call-by-value. A discussion on the ‘parallel’ call-by-value is deferred to Section 7.

The core of any encoding of the -calculus into a process calculus is the translation of function application. This becomes a particular form of parallel combination of two processes, the function and its argument; -reduction is then modeled as process interaction.

The encoding of a -term is parametric over a name; this may be thought of as the location of that term, or as its continuation. A term that becomes a value signals so at its continuation name and, in doing so, it grants access to the body of the value. Such body is replicated, so that the value may be copied several times. When the value is a function, its body can receive two names: (the access to) its value-argument, and the following continuation. In the translation of application, first the function is run, then the argument; finally the function is informed of its argument and continuation.

In the original paper (Milner, 1990), Milner presented two candidates for the encoding of call-by-value -calculus (Plotkin, 1975). They follow the same idea of translation, but with a technical difference in the rule for variables. One encoding, , is so defined:

 V[[λx.M]]\scriptsize def=(p) ¯¯¯p(y).!y(x,q).V[[M]]⟨q⟩V[[MN]]\scriptsize def=\omit\span\omit\span\omit(p) (νq)(V[[M]]⟨q⟩|q(y).νr(V[[N]]⟨r⟩|r(w).¯¯¯y⟨w,p⟩))V[[x]]\scriptsize def=(p) ¯¯¯p⟨x⟩

In the other encoding, , application and -abstraction are treated as in ; the rule for variables is:

 V′[[x]]\scriptsize def=(p) ¯¯¯p(y).!y(z,q).¯¯¯x⟨z,q⟩.

The encoding is more efficient than , as it uses fewer communications.

3.2. Some problems with the encoding

The immediate free output in the encoding of variables in breaks the validity of -reduction; i.e., there exist a term and a value such that  (Sangiorgi, 1993a). The encoding fixes this by communicating, instead of a free name, a fresh pointer to that name. Technically, the initial free output of is replaced by a bound output coupled with a link to (the process , receiving at and re-emitting at ). Thus -reduction is validated (Sangiorgi, 1993a). (The final version of Milner’s paper (Milner, 1992), was written after the results in (Sangiorgi, 1993a) were known and presents only the encoding .)

Nevertheless, only delays the free output, as the added link contains itself a free output. As a consequence, we can show that other desirable equalities of call-by-value are broken. An example is law (1) from the Introduction, as stated by Proposition 3.1 below. This law is desirable (and indeed valid for contextual equivalence, or the Eager-Tree equality) intuitively because, in any substitution closure of the law, either both terms diverge, or they converge to the same value. The same argument holds for their -closures, and . We recall that is barbed congruence in the -calculus.

Proposition 3.1 ().

For any value , we have:

 V′[[I(xV)]]≄πV′[[xV]] and V[[I(xV)]]≄πV[[xV]].

(The law is violated also under coarser equivalences, such as contextual equivalence.) Technically, the reason why the law fails in can be illustrated when , for encoding . We have:

 V[[xy]]⟨p⟩ ≃π¯¯¯x(v).νw (¯¯¯v⟨w,p⟩|!w(u).¯¯¯y⟨u⟩) V[[I(xy)]]⟨p⟩ ≃π¯¯¯x(v).(νw,q) (¯¯¯v⟨w,q⟩|!w(u).¯¯¯y⟨u⟩ |q(z).¯¯¯p(z′).!z′(w′).¯z⟨w′⟩)

In presence of the normal form , the identity becomes observable. Indeed, in the second term, a fresh name, , is sent instead of continuation , and a link between and is installed. This corresponds to a law which is valid in AL, but not in .

This problem can be avoided by iterating the transformation that takes us from to (i.e., the replacement of a free output with a bound output so to avoid all emissions of free names). Thus the target language becomes Internal ; the resulting encoding is analysed in Section 4.

Another solution is to control the use of name capabilities in processes. In this case the target language becomes AL, and we need not modify the initial encoding . This situation is analysed in Section 5.

Moreover, in both solutions, the use of link processes validates the following law — a form of -expansion — (the law fails for Milner’s encoding into the -calculus):

 λy.xy=x

In the call-by-value -calculus this is a useful law (that holds because substitutions replace variables with values).

4. Encoding in the Internal π-calculus

4.1. Encoding and soundness

Figure 1 presents the encoding into I, derived from Milner’s encoding by removing the free outputs as explained in Section 3. Process represents a link (sometimes called forwarder; for readability we have adopted the infix notation for the constant ). It transforms all outputs at into outputs at (therefore are names of the same sort). Thus the body of is replicated, unless and are continuation names (names such as over which the encoding of a term is abstracted). The definition of the constant therefore is:

 ▹\scriptsize△=⎧⎪ ⎪ ⎪ ⎪⎨⎪ ⎪ ⎪ ⎪⎩(p,q) p(x).¯¯¯q(y).y▹x\omit if p,q are continuation names(x,y) !x(p,z).¯¯¯y(q,w).(q▹p|w▹z)\omit otherwise

(The distinction between continuation names and the other sorts of names is not necessary, but simplifies the proofs.)

The encoding validates -reduction.

Lemma 4.1 (Validity of βv-reduction).

For any in , implies .

The structure of the proof of soundness of the encoding is similar to that for the analogous property for Milner’s call-by-name encoding with respect to Levy-Longo Trees (Sangiorgi, 2000). The details are however different, as in call-by-value both the encoding and the trees (the Eager Trees extended to handle -expansion) are more complex.

We first need to establish an operational correspondence for the encoding. For this we make use of an optimised encoding, obtained from the one in Figure 1 by performing a few (deterministic) reductions, at the price of a more complex definition. Precisely, in the encoding of application, we remove some of the initial communications, including those with which a term signals that it has become a value. Correctness of the optimisations is established by algebraic reasoning.

Using the operational correspondence, we then show that the observables for bisimilarity in the encoding -terms imply the observables for -eager normal-form bisimilarity in the encoded -terms. The delicate cases are those in which a branch in the tree of the terms is produced — case (2) of Definition 1.3 — and where an -expansion occurs — thus a variable is equivalent to an abstraction, cases (5) and (6) of Definition 1.6.

For the branching, we exploit a decomposition property on -terms, roughly allowing us to derive from the bisimilarity of two parallel compositions the componentwise bisimilarity of the single components. For the -expansion, if , where , we use a coinductive argument to derive and , for fresh; from this we then obtain .

Lemma 4.2 (Soundness).

For any , if then .

4.2. Completeness and Full Abstraction

To ease the reader into the proof, we first show the completeness for , rather than .

The system of equations.

Suppose is an eager normal-form bisimulation. We define a (possibly infinite) system of equations , solutions of which will be obtained from the encodings of the pairs in . We then use Theorem 2.4 and Theorem 2.6 to show that has a unique solution.

We assume an ordering on names and variables, so to be able to view (finite) sets of these as tuples. Moreover, if is an abstraction, say , then is an abbreviation for its uncurrying .

There is one equation for each pair . The body is essentially the encoding of the eager normal form of and , with the variables of the equations representing the coinductive hypothesis. To formalise this, we extend the encoding of the -calculus to equation variables by setting

 I[[XM,N]]\scriptsize def=(p) XM,N⟨˜y,p⟩ ~{}~{% } where ˜y=fv(M,N).

We now describe the equation , for . The equation is parametrised on the free variables of and (to ensure that the body is a name-closed abstraction) and an additional continuation name (as all encodings of terms). Below .

1. If and , then the equation is the encoding of :

 XM,N =(˜y) I[[x]] =(˜y,p) ¯¯¯p(z).z▹x
2. If and , then the equation uses a purely-divergent term; we choose the encoding of :

 XM,N=(˜y) I[[Ω]]
3. If and , then the equation encodes an abstraction whose body refers to the normal forms of , via the variable :

 XM,N=(˜y) I[[λx.XM′,N′]]=(˜y,p) ¯¯¯p(z).!z(x,q).XM′,N′⟨˜y′,q⟩
4. If and , we separate the evaluation contexts and the values, as in Definition 1.3. In the body of the equation, this is achieved by: rewriting into , for some fresh , and similarly for and (such a transformation is valid for ); and referring to the variable for the evaluation contexts, , and to the variable for the values, . This yields the equation (for fresh):

 XM,N=(˜y) I[[(λz.XCe[z],C′e[z]) (x XV,V′)]]

As an example, suppose , where and . The free variables of are and . We obtain the following equations:

Solutions of ER.

Having set the system of equations for , we now define solutions for it from the encoding of the pairs in .

We can view the relation as an ordered sequence of pairs (e.g., assuming some lexicographical ordering). Then indicates the tuple obtained by projecting the pairs in onto the -th component (). Moreover is the -th pair in , and is .

We write for the closed abstractions resulting from the encoding of , i.e., the tuple whose -th component is , and similarly for .

Lemma 4.3 ().

and are solutions of .

Proof.

We show that each component of is solution of the corresponding equation, i.e., for the -th component we show .

We reason by cases over the shape of the eager normal form of . The most interesting case is when , in which case we use the following equality (for fresh), which is proved using algebraic reasoning:

 (2) I[[(λz.Ce[z])(xV)]]≈I[[Ce[xV]]].

We also exploit the validity of for (Lemma 4.1).

Unique solution for ER.

We use Theorem 2.6 to prove uniqueness of solutions for . The only delicate requirement is the one on divergence for the syntactic solution. We introduce for this an auxiliary system of equations, , that extends , and whose syntactic solutions have no -transition and hence trivially satisfy the requirement. Like the original system , so the new one  is defined by inspection of the pairs in ; in , however, a pair of may sometimes yield more than one equation. Thus, let with .

1. When and , the equation is

 XM,N=(˜y,p) 0.
2. When and , we introduce a new equation variable and a new equation; this will allow us, in the following step (3), to perform some optimisations. The equation is

 XM,N=(˜y,p) ¯¯¯p(z).XVV,V′⟨z,˜y′⟩,

and we have, accordingly, the two following additional equations corresponding to the cases where values are functions or variables:

 XVλx.M′,λx.N′=(z,˜y) !z(x,q).XM′,N′⟨˜y′,q⟩XVx,x=(z,x) z▹x
3. When and , we refer to , instead of , so to remove all initial reductions in the corresponding equation for . The first action thus becomes an output:

 XM,N=\omit\span\omit\span\omit(˜y,p) ¯¯¯x(z,q).(XVV,V′⟨z,˜y′⟩|q(w).XCe[w],C′e[w]⟨˜y′′,p⟩)

Lemmas 4.4 and 4.5 are needed to apply Theorem 2.6. (In the statement of Lemma 4.4, ‘extend’ is as by Definition 2.5.)

Lemma 4.4 ().

The system of equations extends the system of equations .

Proof.

The new system  is obtained from  by modifying the equations and adding new ones. Ones shows that the solutions to the common equations are the same, using algebraic reasoning.

Lemma 4.5 ().

has a unique solution.

Proof.

Divergence-freedom for the syntactic solutions of  holds because in the equations each name (bound or free) can appear either only in inputs or only in outputs. As a consequence, since the labelled transition system is ground (names are only replaced by fresh ones), no -transition can ever be performed, after any number of visible actions. Further, is guarded. Hence we can apply Theorem 2.4.

Lemma 4.6 (Completeness for ).

implies , for any .

Proof.

Consider an eager normal-form bisimulation , and the corresponding systems of equations  and . Lemmas 4.5 and 4.4 allow us to apply Theorem 2.6 and deduce that  has a unique solution. By Lemma 4.3, and are solutions of . Thus, from , we deduce , where . Hence also .

Completeness for η.

The proof for is extended to , maintaining its structure. We highlight the main differences.

We enrich  with the equations corresponding to the two additional clauses of (Definition 1.6). When and , where , we proceed as in case 4 of the definition of , given that ; the equation is:

 XM,N=(˜y) I[[λz.((λw.Xw,Ce[w]) (x Xz,V))]].

We proceed likewise for the symmetric case.

In the optimised equations that we use to derive unique solutions, we add the following equation (relating values), as well as its symmetric counterpart:

 XVx,λz.N′=(y0,˜y)\omit\span\omit\span\omit!y0(z,q).¯¯¯x(z′,q′).(XVz,V⟨z′,˜y′⟩|q′(w).Xw,Ce[w]⟨˜y′′,q⟩).

Finally, to prove that and are solutions of , we show that, whenever and , with :

 I[[M]] ≈EM,N[Ic[[R1]]]⟨˜y⟩ =I[[λz.((λw.w)(xz))]]

and

 I[[N]] ≈EM,N[Ic[[R2]]]⟨˜y⟩ =I[[λz.((λw.Ce[w])(xV))]].

To establish the former, we use algebraic reasoning to infer . For the latter, we use law (2) (given in the proof of Lemma 4.3).

For any in ,