Call-by-value solvability, revisited Beniamino Accattoli1 and Luca Paolini2 ´ INRIA and LIX (Ecole Polytechnique), France Dipartimento di Informatica, Universit` a degli Studi di Torino, Italy 1

2

Abstract. In the call-by-value lambda-calculus solvable terms have been characterised by means of call-by-name reductions, which is disappointing and requires complex reasonings. We introduce the value-substitution lambda-calculus, a simple calculus borrowing ideas from Herbelin and Zimmerman’s call-by-value λCBV calculus and from Accattoli and Kesner’s substitution calculus λsub . In this new setting, we characterise solvable terms as those terms having normal form with respect to a suitable restriction of the rewriting relation.

1

Introduction

The most commonly used parameter passing policy for programming languages is call-by-value (CBV). Landin in [14] pioneered a CBV formal evaluation for a lambda-core of ALGOL60 (named ISWIM) via the SECD abstract machine. Ten years later, Plotkin [21] introduced the λβv calculus in order to grasp the CBV paradigm in a pure lambda-calculus setting. The λβv -calculus narrows the β-reduction rule by allowing the contraction of a redex (λx.t) u, only in case u is a value, i.e. a variable or an abstraction. Unfortunately, the semantics analysis of the λβv -calculus has turned out to be more elaborate than the semantic of the classical call-by-name (CBN) λ-calculus. CBN and CBV solvability. Solvability [7,12,13] is a pervasive notion in the semantic analysis of (CBN) lambda-calculus (see [25,6]). For instance, it underlies the fundamental notions of approximants, B¨ohm-trees, separability, and sensible λ-theories. A term t is solvable if there exists a head context H s.t. H[t] →∗β I, where I = λx.x is the identity. If t is not solvable then it is unsolvable. Solvability was first considered in connection with λ-definability of partial recursive functions. It was noted that representing the everywhere undefined function using the set of terms without normal form is not adequate, such a function should rather be associated to unsolvable terms, which form a strict subset of the set of terms without a normal form. Quoting from [25]:

[...] only those terms without normal forms which are in fact unsolvable can be regarded as being ”undefined” (or better now: ”totally undefined”); by contrast, all other terms without normal forms are at least partially defined. Essentially the reason is that unsolvability is preserved by application and composition [...] which [...] is not true in general for the property of failing to have a normal form. In CBN unsolvable (resp. solvable) terms can be characterized operationally as the terms without (resp. with) a head normal form. A solid theory of CBV is expected to enjoy an operational characterization of solvability, i.e. a strategy which terminates if and only if the term is solvable. The idea is that such a strategy gives a notion of evaluation for the represented functions. A term t is CBV-solvable whenever there is a head context H s.t. H[t] →∗βv I. An operational characterization has been provided in [20,22] but, unfortunately, it is obtained through call-by-name β-reduction, which is disappointing and not satisfying. The result is improved in [19] where the characterisation is built upon strong normalization via CBN weak3 reduction. An operational characterisation of solvability gives a way to compute the results of the represented functions. If it is not possible to get an internal characterisation, i.e. one which uses the rules of the calculus itself, then there is an inherent weakness in the rewriting rules of the calculus. For λβv it is indeed the case, let us illustrate the point with an example. Let ∆ = λx.xx. There is no head context sending (via βv -reduction) the following term to the identity: t = (λy.∆) (x z) ∆

(1)

and—as a consequence—t should be unsolvable and divergent in a good call-by-value calculus, while it is in λβv -normal form (!). The weakness of βv -reduction is a fact widely recognized and accepted, indeed there have been many proposals of alternative CBV calculi [10,11,16,23,8]. The value-substitution λvsub -calculus. In this paper we introduce the value-substitution λvsub -calculus, a simple CBV calculus with two rewriting rules. It extends the syntax of λ-calculus with an explicit substitution constructor t[u/x] (an avatar of let-expressions), but these substitutions are just delayed, they are not propagated in a small-step way. Our calculus borrows ideas from two existing calculi, Herbelin’s and Zimmerman’s 3

Weak β-reduction is the applicative-only closure of the β-rule, i.e. it is obtained from usual β-reduction by forbidding reductions under abstractions. In literature, it is sometimes called lazy β-reduction.

λCBV -calculus [10] and Accattoli’s and Kesner’s λsub -calculus [4], as we explain in Section 2. In particular, it is a reformulation at a distance [5,4]—i.e. without commutative rules—of λCBV . We prove that in the value-substitution calculus solvable terms can be characterised internally as the terms having normal form with respect to a sub-reduction of the calculus that we call stratified-weak reduction. Stratified-weak reduction plays in our characterization the same role of head β-reduction in CBN. The characterisation is obtained in two steps. First, we tackle the weaker notion of potentially valuable terms, i.e. terms for which there exists a substitution sending them into values (note that the identity is a value). Such terms are shown to be exactly those having normal form with respect to weak λvsub -reduction. Second, solvable terms are shown to be sort of hereditarily potentially valuable terms. Behavioural equivalence. The gain in moving from λCBV to λvsub is the fact that λvsub can be extended with a behavioural equivalence ≡vo , induced by the absence of commutative rules. The idea is that ≡vo relates terms differing only for the position of substitutions but behaving the same. Formally, ≡vo is a strong bisimulation of λvsub with itself. The calculus λvsub modulo ≡vo is particularly well-behaved, roughly because strong bisimulations preserve most operational properties. We use ≡vo to show that our characterisation of solvability in λvsub lifts to λCBV . The value-substitution calculus can also be related to the call-by-value translation (·)v of λ-calculus with explicit substitutions into multiplicative and exponential intuitionistic linear logic (IMELL) proof-nets, identified by (A ⇒ B)v =!(Av ( B v ) [9], which actually was our starting point. In particular, the equivalence ≡vo relates terms which map to the same proof-net. However, proof-nets do not appear in this paper. Related work. There exist various alternative approaches to CBV [10,11,16,23]. Unlike λvsub they all have many rewriting and commutative rules, and for none of them solvability has been studied. Since λvsub is essentially a refinement of λCBV , we compare them explicitly in Section 2.1, while we refer to the introduction of [10] for more relations with the literature. Solvability has also been recently studied for some extensions of λ-calculus in [17,24], but both works consider a call-by-name calculus. Outline. Section 2 introduces the calculus, shows that it is a subcalculus of λCBV and provides a simple proof of confluence for λvsub . Section 3 introduces CBV-solvability and explains the problems it poses. Section 4 proves that terms having weak normal form are potentially valuable and that terms having stratified-weak normal form are solvable. Section 5 proves the converse implications. Section 6 introduces the be-

havioural equivalence and lifts the characterisation of solvability to λCBV . Proofs. We omit all proofs, which can be found in the appendix.

2

The Value-Substitution Calculus

The value-substitution calculus λvsub is a lambda-calculus with explicit substitutions whose syntax is given by the following grammar: v ::= x | λx.t

t, s, r ::= v | t s | t[s/x]

where x, y, z are variables, v is the set of values and t[s/x] denotes an explicit substitution, i.e. a syntactical representation of a delayed substitution. In t[s/x], the subterm s is called the content of the explicit substitution. We use t{s/x} for the term obtained by the capture-avoiding substitution of s to each occurrence of x in t. There are two kinds of binder: λx.t and t[u/x], both binding x in t. All terms are considered up to α-conversion. Contexts are defined via the grammar: C ::= [·] | λx.C | C t | t C | C[t/x] | t[C/x] where [·] is a fresh constants. We use C[t] for the term obtained by the capture-allowing substitution of t to [·] in C and L for a (possibly empty) lists [t1 /x1 ] . . . [tk /xk ] of explicit substitutions. The value-substitution calculus is endowed with two rewriting rules (dB for B at a distance 4 and vs for value-substitution): (λx.t)L s 7→dB t[s/x]L

t[vL/x] 7→vs t{v/x}L

We use →dB , →vs and →λvsub for the closure by all contexts of 7→dB , 7→vs and 7→dB ∪ 7→vs , respectively. Some comments on the rewriting rules are in order. The rule →dB does not require the argument of the redex to be a value. The rule →vs instead can fire only when the content of the explicit substitution is of the form vL (i.e. a value followed by a list of substitutions), generalizing the usual requirement of being a value. Note that the unsolvable term t in (1) (page 2) diverges in λvsub : t = (λy.∆) (x z) ∆ →dB ∆[x z/y] ∆ →dB x0 x0 [∆/x0 ][x z/y] →vs ∆ ∆[x z/y] →dB . . .

(2)

The embedding of Plotkin’s λβv -calculus into λvsub is simply given by the identity, and each βv -reduction step (λx.t) v →βv t{v/x} factors in 4

B is often used for the rule (λx.t) s → t[s/x]

λvsub as (λx.t) v →dB t[v/x] →vs t{v/x}, as in the call-by-value calculi of [10,16]. The presence of the list of substitutions L may not seem necessary, but it is in fact the key to avoid commutation rules, as we explain in the next subsection. The following immediate lemma will be used implicitly throughout the paper. Lemma 1. If v0 , v1 ∈ Val then v0 {v1 /x} ∈ Val . Moreover, v0 →λvsub v00 Proof at page 16. implies v00 ∈ Val . 2.1

Relation with Herbelin’s and Zimmerman’s λCBV

The calculus we introduced borrows ideas from two already existing calculi, Herbelin’s and Zimmerman’s λCBV [10] and Accattoli’s and Kesner’s λsub [4]. Both calculi extend the syntax of λ-calculus: the former uses a let x = u in t construct, while the latter uses an explicit substitution construct t[u/x]. The two construct are in fact equivalent: we present both calculi with explicit substitutions, since let is quite verbose and easily gives rise to big terms. A key feature of λCBV is that the CBV restriction on redexes is imposed on explicit substitutions and not on β-redexes. The rewriting rules of λCBV —omitting the observational ones—follow. Operational rules

Structural rules

(λx.t) s ⇒ t[s/x] t[v/x] →letv t{v/x}

t[u/x] s →letapp (t s)[u/x] t[s[u/y]/x] →letlet t[s/x][u/y]

Structural rules commute explicit substitutions to enable hidden operational redexes. For instance, (λx.t)[u/y] s becomes a ⇒-redex only after the structural step (λx.t)[u/y] s →letapp ((λx.t) s)[u/y]. Similarly, t[v[u/y]/x] becomes a →letv -redex only after a →letlet -step. The substitution calculus λsub is a CBN calculus with explicit substitutions designed to reflect reductions in λj-dags [3] and pure proofnets [2]. It has two rewriting rules: (λx.t)L s →dB t[s/x]L

t[u/x] →s t{u/x}

where L is a list of substitutions, like in λvsub . The main feature of λsub is distance, i.e. the absence of commutative rules for substitutions: in →dB the function λx.t and the argument s can interact even if there is L between them. This is motivated by the close relation between λsub and graphical formalisms as (Pure) Proof-Nets or λj-dags, see [3,2]. The valuesubstitution calculus is a reformulation at a distance of λCBV , making the structural rules superfluous.

The rules of λvsub are sort of macro-rules of λCBV : (λx.t)L s →∗letapp ((λx.t) s)L ⇒ t[s/x]L t[vL/x] →∗letlet t[v/x]L →letv t{v/x}L that provide a straightforward simulation of λvsub into λCBV . Proposition 1. →λvsub ⊆→+ CBV , and so the equational theory of λvsub is contained in the theory of λCBV . Akin to other CBV calculi, λCBV equates more than Plotkin’s calculus. Indeed, the two terms: (λx.λx0 .t) (y y 0 ) (z z 0 )

(λx.((λx0 .t) (z z 0 ))) (y y 0 )

(3)

are not βv -interconvertible, while in λCBV both reduce to t[z z 0 /x0 ][y y 0 /x]. In Section 6 we show that in a sense λvsub (strictly) contains the equational theory of λCBV , despite the fact that λvsub is a subcalculus of λCBV . 2.2

Confluence

The proof of confluence is particularly simple. It is based on the following well-known lemma (used, for instance, to prove confluence of the ληcalculus). Lemma 2 (Hindley-Rosen, [6], Proposition 3.3.5.(ii), page 64). Let →1 and →2 be two rewriting relations on a set X. If they are both confluent and they commute, i.e. if t →∗1 u1 and t →∗2 u2 then there exists s such that u1 →∗2 s and u2 →∗1 s, then →1 ∪ →2 is confluent. The idea is to take →1 =→dB , →2 =→vs and →1 ∪ →2 =→λvsub and prove the hypothesis of the lemma. Confluence of →dB and →vs follows from their respective local confluence, Newman’s Lemma and the fact that they are strongly normalising (separately). Proof at page 16.

Lemma 3. →dB and →vs are both confluent and strongly normalising reductions. Commutation of →dB and →vs follows by an easy and standard argument based on the particular shape of their local commutation diagram.

Proof at page 17.

Lemma 4.

1. →vs and →dB locally commute: If t →vs u1 and t →dB u2 then there is s s.t. u2 →vs s and u1 →∗dB s. 2. →vs and →dB commute: If t →∗vs u1 and t →∗dB u2 then there is s s.t. u2 →∗vs s and u1 →∗dB s. Thus Lemma 2 gets: Corollary 1. →λvsub is confluent.

3

Call-by-value solvability

First of all, let us recall the definition of solvability. Definition 1 (Solvable Terms). A term t is solvable if there exist terms u1 , . . . , uk and variables x1 , . . . , xh , with h, k ≥ 0, such that (λx1 . . . xh .t) u1 . . . uk →∗λvsub I, where I is the identity. We call (λx1 . . . λxh .[·]) u1 . . . uk a head context. Let ∆ be λx.xx. With respect to solvability the difference between CBN and CBV is well represented by the term t = I[∆ ∆/x]. The subterm ∆ ∆ is a typical example of unsolvable term. In CBN one has that t → I by simply erasing the substitution, and thus t is CBN solvable. In a CBV setting, instead, the substitution is blocked, because ∆ ∆ is not a value, nor it can be reduced to a value. Even worse, no plugging of t in a head context can turn ∆∆ in a value. Thus, there is no head context sending t on the identity, and t is CBV-unsolvable. We need to find a notion of reduction for which t diverges. To understand the difficulty is useful to recall the structure of the proof of the characterisation of CBN-solvability: 1. t has head normal form ⇒ t is solvable: this direction is proved by induction on the structure of t building a special head context H which erases all non-head subterms of t and produces the identity; 2. t is solvable ⇒ t has head normal form: it is a corollary of the standardisation theorem, if H[t] reduces to the identity then it does so by head reduction, and the fact that extraction of t from H[t] preserves head normalisability. We adapt the same pattern of the CBN approach, defining a new form of reduction (to be introduced in a while). The main difference is that in CBV not every non-head subterm can be erased, only values. Thus the proof of the first step is more involved. The head context transforming a

solvable term into the identity needs to provide appropriate substitutions turning the content of explicit substitutions into values. So it is mandatory to first characterise potentially valuable terms. Definition 2 (Potentially valuable term, [20]). A term t is potentially valuable whenever there are terms u1 , . . . , un , variables x1 . . . xn and a value v such that t{u1 /x1 } . . . {un /xn } →∗λvsub v5 . For example, values, and terms which reduce to values, are potentially valuables. A potentially valuable term which does not reduce to a value is x y (consider {I/x}), while ∆∆ is not potentially valuable. We show that a term is potentially valuable iff it has a weak normal form, and then we will build the characterisation of solvability on top of this one. Weak contexts are contexts whose hole is not under an abstraction: W ::= [·] | W t | t W | W[t/x] | t[W/x] The reduction →w is the closure by weak contexts of 7→dB ∪ 7→vs . We note →¬w the complement of →w , defined as →λvsub \ →w , which is the reduction which reduces redexes under at least one λ. To catch solvability we extend weak reduction as follows. A stratifiedweak context SW is defined as: SW ::= W | λx.SW | SW t | SW[t/x] The reduction →sw is the closure by stratified-weak contexts of 7→dB ∪ 7→vs . Weak contexts are widely used in literature, while stratified-weak contexts are an adptation of the ahead-strategy defined in [20]. They extend weak contexts allowing weak reductions under abstractions in head position, which have the important property that cannot be duplicated nor erased. Note that the diverging reduction (2) (page 4) of the unsolvable term of the introduction is a weak (and thus a stratified-weak) reduction.

4

Terms having stratified-weak normal form are solvable

Let us sketch the organization of this section. 1. We prove that terms having a weak normal form are potentially valuable, by: 5

Potentially valuable terms can be defined via head-contexts, as for solvable terms, but our definition simplifies some technical points.

(a) characterising weak normal forms explicitly; (b) proving that weak normal forms are potentially valuable; (c) proving that terms having weak normal form are potentially valuable. 2. We prove that terms having a stratified-weak normal form are solvable, by: (a) characterising stratified-weak normal forms explicitly; (b) proving that stratified-weak normal forms are solvable; (c) proving that terms having stratified-weak normal form are solvable. The characterization of weak normal forms, noted wnf , uses an aux# iliary syntactic category wnf for terms which have not the form vL. The # idea is that a substitution t[u/x] can be reduced by 7→vs iff u ∈ / wnf . Lemma 5 (Weak normal forms). following grammar:

Let t ∈ λvsub and consider the Proof at page 17.

# # wnf ::= x | λx.t | wnf | wnf [wnf /x] # # # # # # wnf ::= x[wnf /x1 ] . . . [wnf /xn ] wnf | wnf wnf | wnf [wnf /x]

(weak n.f.) (#-weak n.f.)

with x possibly among x1 , . . . , xn and n ≥ 0. Then: 1. t is in →w -normal form iff t ∈ wnf . # 2. t is in →w -normal form and not of the form vL iff t ∈ wnf where L is a list of substitutions of #-weak normal forms. In λCBV , thanks to the structural rules, weak normal forms are simpler, they have either the shape xt1 ...tn L or the shape (λx.t)L, where ti are weak normal forms and L is a list of explicit substitutions having as # # content terms in wnf . However, using λCBV would not get rid of wnf and the operational study in the paper would be more complex, since λCBV has more rules. In Section 6 we will show how to characterise solvability in λCBV , by exploiting the characterisation in λvsub . We need some meta-notations. If n ∈ N then on is the term λx0 ...xn .xn (i.e. o0 = λx0 .x0 = I and oi+1 = λxi+1 .oi ), moreover we use the notation o≥n to denote a term of the shape λx0 ...xk .xk where k ≥ n. Clearly, a term o≥n can be noted o≥n−1 , loosing information. Let t be a term, we note t[n] a term of the form t{o≥n /x1 , . . . , o≥n /xk } with FV(t) = {x1 , . . . , xk }. Note that on is a closed value and t[n] is a closed term, for all n ∈ N. The following lemma is one of the key points of the characterisation. Its proof is delicate, technical and non-trivial.

Lemma 6. Let t ∈ λvsub .

Proof at page 18.

# 1. If t ∈ wnf then exists h ∈ N s.t., for all j ∈ N, t[h+j] →∗λvsub o≥j . 2. If t ∈ wnf then exists h ∈ N s.t. for all j ∈ N exists v s.t. t[h+j] →∗λvsub v.

Therefore, t is potentially valuable. Since Lemma 6 hides many details in notations to simplify the statement, let us spend some words on its first point. The first point says that substituting a family of terms o≥h+j (all of them, with at least h + j abstractions) to all the free variables of t we can obtain a term o≥j (with at least j abstractions). The following lemma is used to lift the result to terms having weak normal form, and its proof is straightforward. Proof at page 20.

Lemma 7. If t →w t0 then t{v/x} →w t0 {v/x}. It is easily seen that Lemmas 6 and 7 imply the following corollary.

Proof at page 21.

Corollary 2. If t has a →w -normal form then it is potentially valuable. Now we show that →sw -normalizing terms are solvable. The first step is a characterisation of stratified-weak normal forms.

Proof at page 21.

Lemma 8 (Stratified-weak normal forms). A term t is in →sw normal form if and only if it belongs to the following syntax: # # snf ::= x | λx.snf | wnf | snf [wnf /x].

The second step is that stratified-weak normal forms are solvable. Proof at page 22.

Lemma 9. If t is an →sw -normal form then there exist h, k ∈ N such that, for all j ∈ N, t[h+j] |o≥h+j .{z . . o≥h+j} →∗λvsub o≥j . k

Therefore, t is solvable. The next immediate lemma is used to lift the result to terms having stratified-weak normal forms, i.e. to get the third and last step. Proof at page 23.

Lemma 10. If t →sw t0 then H[t] →sw H[t0 ] for any head context H. The characterisation of solvability easily follows.

Proof at page 23.

Corollary 3. If t has a →sw -normal form then t is solvable.

5

Solvable terms have stratified-weak normal form

To complete the characterisation of solvability we need to prove that solvable terms have stratified-weak normal form. The proof of this direction relies on the rewriting properties of stratified-weak reduction, in particular a sort of standardisation theorem stating that →∗λvsub ⊆→∗sw →∗¬sw , where →¬sw is the complement of →sw w.r.t. →λvsub , and the diamond property for →sw . Similarly, we show that potentially valuable terms have weak normal form. Lemma 11 (Diamond property). →w (resp. →sw ) enjoys the dia- Proof at page 23. mond property, i.e., if t →w ui (resp. t →sw ui ) and u1 6= u0 then there exists s s.t. ui →w s (resp. ui →sw s), for i = 0, 1. The diamond property is an abstract way to say that morally →sw and →w are deterministic strategies. Indeed, it implies that all maximal reduction sequences from a given term have the same length, which in turn gives the following corollary. Corollary 4. A term t has a →w -normal form (resp. →sw -normal form) iff t is →w -strongly normalisable (resp. →sw -strongly normalisable). We also need two factorisation properties [15], simple forms of standardisation, which can also be seen as postponement properties. Let →¬w be the complement of →w w.r.t. →λvsub . Theorem 1 (Factorisation). 1. →∗λvsub ⊆→∗w →∗¬w . 2. →∗λvsub ⊆→∗sw →∗¬sw . The proofs of the two properties are non-trivial. To avoid annoying repetitions we approached them abstractly. This lead the first author to develop an abstract technique for factorisation theorems in [1], where the two cases of our interest are proved. Both solvable (resp. potentially valuable) terms have been defined using →∗λvsub , but thanks to the factorisation theorems we can limit reductions to stratified-weak (resp. weak) redexes. Corollary 5. Let t ∈ λvsub . 1. If t →∗λvsub v then there exists a value v0 s.t. t →∗w v0 →∗¬w v. 2. If t →∗λvsub I then t →∗sw I.

Proof at page 24.

The simplification given by the corollary is a key point in the proof of the next theorem. Theorem 2. Let t ∈ λvsub . If t is solvable then t has a stratified-weak Proof at page 24. normal form. We conclude with the similar result for potential valuability. Proof at page 24.

Theorem 3. Let t ∈ λvsub . If t is potentially valuable then it has a →w -normal form.

6

Behavioural equivalence and solvability for λCBV

At first sight there is no way of simulating λCBV in λvsub , since the structural rules have no counterpart. However, in λvsub the rules →letapp and →letlet can be recovered: they are just lifted to another, more subtle level. In λvsub two terms can have the same behavior and differ only for the position of substitutions, which is not relevant because substitutions do not block redexes. This can be formalized in a precise way, using the standard tool for behavioural equivalence: bisimulations. Definition 3. Let ≡vo be the equivalence defined as the reflexive, symmetric, transitive, and contextual closure of the following relations: t[s/x][u/y] ∼vo1 t u[s/x] ∼vo2 t[s/x] u ∼vo3 t[s[u/y]/x] ∼vo4

t[u/y][s/x] (t u)[s/x] (t u)[s/x] t[s/x][u/y]

if if if if

x∈ / fv(u)&y ∈ / fv(s) x∈ / fv(t) x∈ / fv(u) y∈ / fv(t)

Remark that ≡vo allows the commutation of explicit substitutions with every constructor except abstractions6 . Moreover, →letapp and →letlet are particular cases of ∼vo3 and ∼vo4 , respectively. Let (S, →S ) be a reduction systems. A strong bisimulation for (S, →S ) is a symmetric relation ≡⊆ S × S s.t. s ≡ t implies that if s →S s0 then there exists t0 s.t. t →S t0 and s0 ≡ t0 , for any pair s, t ∈ S. Proof at page 24.

Lemma 12. ≡vo is a strong bisimulation for both (λvsub , →λvsub ) and (λvsub , →sw ). 6

The relation ≡vo is the CBV version of the relation ≡o for the structural λ-calculus λj in [5], of which λsub is a big-step variant.

Actually, ≡vo has a stronger property, it induces a bijection of redexes and an isomorphism of reduction graphs, not just a bisimulation. However, such stronger property seems to not be useful here. Strong bisimulations behave very well with respect to the underlying rewriting system, they preserve most operational properties. We just state some basic facts (whose proofs are easy, see [2], pp. 86-87). Lemma 13. Let (S, →S ) be a reduction system, ≡ a strong bisimulation for it, and define →S/≡ := ≡→S ≡. Then: 1. ≡ preserves reduction lengths; 2. ≡ can be postponed with respect to →S , i.e. →∗S/≡ ⊆→∗S ≡; 3. if →S is confluent then →S/≡ is confluent and →S is Church-Rosser modulo ≡; 4. →S/≡ preserves S-strong normalization. Hence →λvsub /≡vo enjoys all these properties (→λvsub is confluent). Summing up, in order to study λvsub modulo ≡vo it is enough to study λvsub , since all properties of λvsub lift to λvsub modulo ≡vo , with essentially no effort. It can be shown that the CBV translation of λvsub to proof-nets [9] maps two ≡vo -equivalent terms to the same proof-net, and thus ≡vo equivalent terms can be considered as the same computational object. The following lemma shows that λCBV is a subcalculus of λvsub modulo ≡vo (Point 3). Lemma 14. We have: 1. 2. 3. 4.

If t →λCBV u reducing an operational redex then t →λvsub u. If t →λCBV u reducing a structural redex then t ≡vo u. If t →∗λCBV u then t →∗λvsub ≡vo u. t →∗λvsub I iff t →∗λCBV I.

The calculus λvsub modulo ≡vo equates more than λCBV . For instance, x x[y y/z] ≡vo (x x)[y y/z] while the two terms are different λCBV normal forms. Define a term t is solvable in λCBV if there exists a head context H s.t. H[t] →∗λCBV I (note the use of →λCBV instead of →λvsub ). Then, Lemma 14.4 states that a term is solvable in λvsub iff it is solvable in λCBV . We now show that our characterisation of solvability lifts to λCBV . The calculi λvsub and λCBV share the same syntax, and therefore the same notions of weak and stratified-weak contexts. By closing the rules of λCBV by stratified-weak contexts we get stratified-weak reduction for λCBV , noted →swCBV . The following lemma relates →sw and →swCBV .

Proof at page 27.

Lemma 15. We have: 1. If t →sw u then t →+ swCBV u. 2. If t →swCBV u reducing an operational redex then t →sw u. 3. If t →∗swCBV u then t →∗sw ≡vo u. In order to show that our characterisation of solvability lifts to λCBV we need the following easy property. Proof at page 27.

Lemma 16. The structural rules of λCBV are strongly normalising. We can finally conclude.

Proof at page 28.

Theorem 4. We have: 1. t has a →sw normal form iff t has a →swCBV normal form. 2. t is solvable in λCBV iff t has a →swCBV -normal form.

7

Conclusions and future work

We presented λvsub , a new CBV calculus with explicit substitutions, compared it to Herbelin’s and Zimmerman’s λCBV , and proved an internal operational characterisation of solvable terms, simplifying and improving over previous results on CBV solvability. We plan to put forward the study of CBV through λvsub . First goals are to adapt the logical characterization of solvability based on intersection types given in [20,19], and the separability theorem proved in [18]. Simplifications and improvements are expected. We are also interested in a small-step variant of λvsub evaluation, in order to study a call-by-value version of head linear reduction and the connection to call-by-value abstract machines. Acknowledgements The first author wants to thank Simona Ronchi Della Rocca for inviting him in Turin in march 2011, where this work started.

References 1. Accattoli, B.: An abstract factorisation theorem for explicit substitutions (december 2011), https://sites.google.com/site/beniaminoaccattoli/factorisation.pdf 2. Accattoli, B.: Jumping around the box. Ph.D. Thesis, Universit` a di Roma La Sapienza (2011)

Proof at page 27.

3. Accattoli, B., Guerrini, S.: Jumping boxes. In: CSL. pp. 55–70 (2009) 4. Accattoli, B., Kesner, D.: The permutative λ-calculus, accepted at LPAR 2012 5. Accattoli, B., Kesner, D.: The structural λ-calculus. In: CSL 2010. Lecture Notes in Computer Science, vol. 6247, pp. 381–395. Springer-Verlag (2010) 6. Barendregt, H.P.: The Lambda Calculus – Its Syntax and Semantics, vol. 103. North-Holland (1984) 7. Barendregt, H.: Solvability in lambda-calculi. The Journal of Symbolic Logic 39(2), 372 (1975) 8. Dyckhoff, R., Lengrand, S.: Call-by-value lambda-calculus and ljq. J. Log. Comput. 17(6), 1109–1134 (2007) 9. Fern´ andez, M., Siafakas, N.: Labelled lambda-calculi with explicit copy and erase. In: LINEARITY. pp. 49–64 (2009) 10. Herbelin, H., Zimmermann, S.: An operational account of call-by-value minimal and classical lambda-calculus in ”natural deduction” form. In: TLCA. pp. 142–156. Lecture Notes in Computer Science (2009) 11. Hofmann, M.: Sound and complete axiomatisations of call-by-value control operators. Mathematical Structures in Computer Science 5, 461–482 (1995) 12. Hyland, J.M.E.: A survey of some useful partial order relations on terms of the lambda calculus. In: Lambda-Calculus and Computer Science Theory. pp. 83–95 (1975) 13. Klop, J.W.: On solvability by lambda i - terms. In: Lambda-Calculus and Computer Science Theory. pp. 342–345 (1975) 14. Landin, P.J.: A correspondence between ALGOL 60 and Church’s lambdanotation: Part I and Part II. Communications of the ACM 8(2-3), 89–101,158–165 (1965) 15. Melli`es, P.A.: A factorisation theorem in rewriting theory. In: Category Theory and Computer Science. pp. 49–68 (1997) 16. Moggi, E.: Computational lambda-calculus and monads. In: LICS. pp. 14–23. IEEE Computer Society Press, Piscataway, NJ, USA (1989) 17. Pagani, M., Rocca, S.R.D.: Linearity, non-determinism and solvability. Fundam. Inform. 103(1-4), 173–202 (2010) 18. Paolini, L.: Call-by-value separability and computability. In: ICTCS. pp. 74–89 (2001) 19. Paolini, L., Pimentel, E., Ronchi Della Rocca, S.: Lazy strong normalization. Electr. Notes Theor. Comput. Sci. 136, 103–116 (2005) 20. Paolini, L., Ronchi Della Rocca, S.: Call-by-value solvability. Theoretical Informatics and Applications 33(6), 507–534 (Nov 1999) 21. Plotkin, G.D.: Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science 1, 125–159 (1975) 22. Ronchi Della Rocca, S., Paolini, L.: The Parametric λ-Calculus: a Metamodel for Computation. Texts in Theoretical Computer Science: An EATCS Series, SpringerVerlag, Berlin (2004) 23. Sabry, A., Felleisen, M.: Reasoning about programs in continuation-passing style. LISP and Symbolic Computation 6, 289–360 (1993) 24. Saurin, A.: Standardization and B¨ ohm trees for Λµ-calculus. In: FLOPS. pp. 134– 149 (2010) 25. Wadsworth, C.P.: The relation between computational and denotational properties for Scott’s D∞ -models of the lambda-calculus. SIAM Journal of Computing 5(3), 488–521 (Sep 1976)

Proof Collection Proof of LEMMA 1, page 5 Proof. – There are two cases. • If v0 = x then v0 {v1 /x} = v1 , which is a value by hypothesis. • If v0 = λy.u then v0 {v1 /x} = λy.u{v1 /x} which is a value. Thus, v0 {v1 /x} ∈ Val . – There are two cases. • If v0 = x then t cannot reduce. • If v0 = λx.u then v00 = λx.u0 with u →λvsub u0 and v00 is a value. Proof of LEMMA 3, page 6 Proof. – →dB ) Strong normalisation is obvious, since it strictly reduces the number of constructors. Confluence of →dB is immediate, since it is orthogonal. – →vs ) Strong normalisation follows from strong normalisation of the call-by-name case, let us explain why. The CBN rule t[u/x] → t{u/x} is strongly normalising [5]. The same measure used there works for the CBV case. We justify this fact without a detailed proof, since it follows from two easy facts: • The measure of [5] is stable by the rule t[u[s/y]/x] → t[u/x][s/y] ([2], lemma 6.27, pp. 162-163). The proof is a straightforward check of the value of the measure on the two terms. • Hence the rule t[vL/x] →vs t{v/x}L terminates iff the rule t[vL/x] → t{vL/x} terminates, which is a particular case of the CBN rule, that does terminate. Local confluence of →vs follows by a straightforward case analysis. We discuss two cases: 1. When one →vs -redex contains the other in the value that it substitutes, i.e. when t = w[vL/x] →vs w{v/x}L = u1 and t →vs w[v0 L] = u2 . The diagram closes with u1 →∗vs w{v0 /x} = s and u2 →vs w{v0 /x} = s. 2. When one →vs -redex superpose with the other, for instance when t = w[v0 [v1 L1 /y]L0 /x] →vs w{v0 /x}[v1 L1 /y]L0 = u1 and t →vs w[v0 {v1 /y}L1 L0 /x] = u2 . The diagram closes with u1 →∗vs w{v0 /x}{v1 /y}L1 L0 = w{v0 {v1 /y}/x}L1 L0 = s and u2 →vs w{v0 {v1 /y}/x}L1 L0 = s. Every other case is straightforward. By Newman’s Lemma we get that →vs is confluent. t u

Proof of LEMMA 4, page 6 Proof. – By induction on t. The only interesting case is when the →vs redex contains the →dB -redex in the value which is substituted, i.e. when t = w[vL/x] →vs w{v/x}L = u1 and t →dB w[v0 L] = u2 . The diagram closes with u1 →∗dB w{v0 /x} = s and u2 →vs w{v0 /x} = s. Every other case is straightforward. – The argument getting commutation from diagrams as in the previous point is completely standard, however, we present it for the sake of completeness. To get the right inductive invariant a stronger statement is proved: if t →kvs u1 and t →∗dB u2 then there is s s.t. u2 →kvs s and u1 →∗dB s. Let t →hdB u2 . The proof is by induction on (k, h). If k = 0 or h = 0 it is straightforward. Then let k > 0 and h > 0, and u01 and u02 s.t. t →vs u01 →k−1 u1 and t →dB u02 →h−1 u2 . By the previous point vs dB 0 0 applied to t, u1 and u2 there exists s1 s.t. u02 →vs s1 and u01 →∗dB s1 . Now we are going to apply the i.h. three times: to 0 ∗ k−1 1. u01 →k−1 vs u1 and u1 →dB s1 . We get that there is s2 s. t. s1 →vs s2 ∗ ans u1 →dB s2 . 2. u02 →vs s1 and u02 →h−1 dB u2 , since k may be 1 but certainly h − 1 < h. We get that there exists s3 s.t. s1 →∗dB s3 and u2 →vs s3 . 3. s1 →k−1 s2 and s1 →∗dB s3 (obtained in the two previous apvs plications off the i.h.). Then there exists s4 s.t. s2 →∗dB s4 and s3 →k−1 vs s4 . Now we conclude, since u1 →∗dB s2 →∗dB s4 (by the first and third use of the i.h.) and u2 →vs s3 →k−1 vs s4 (by the second and third use of the i.h.). Proof of LEMMA 5, page 9 # Proof. Note that wnf ⊆ wnf . ⇒) we prove both points simultaneously by induction on t. There are two cases:

1. t is of the form vL. The content of the substitutions in L cannot be of the form vL, otherwise t would have →w -redexes. Since they are # smaller than t we can apply the i.h. and get that they are in wnf . It is left to show that v ∈ wnf , which is obvious. 2. t is not of the form vL. Then t has the form (s u)L, with a possibly empty L. For L we reason as in the previous case. The subterm u by i.h. is in wnf . Now consider s: either it is not of the form vL, and thus # it belongs to wnf or it necessarily has the shape xL. For L we reason as in the previous point and conclude.

# ⇐) By mutual induction on wnf and wnf . Two cases: # – t ∈ wnf and t ∈ / wnf . Subcases: • t is a value: it is obvious. # • t has the form s[u/x] with s ∈ wnf and u ∈ wnf : by i.h. both s and u are in →w -normal form, and u has not the form vL, so the substitution s[u/x] is not a 7→vs redex and t is a →w -normal form. # – t ∈ wnf . Subcases: • t = xL u with u ∈ wnf and L s.t. the contents s1 , . . . , sn of its # substitutions are in wnf . Clearly, t has not the form vL. By i.h. u and s1 , . . . , sn are →w -normal forms. Moreover, none among s1 , . . . , sn has the form vL, and so t is →w -normal. # • t has the form s u with s ∈ wnf and u ∈ wnf . Clearly, t has not the form vL. By i.h. both s and u are in →w -normal form, and s has not the form vL, and so the application s u cannot be a →dB -redex, which implies that t is a →w -normal form. # # • t has the form s[u/x] with s ∈ wnf and u ∈ wnf . By i.h. s has not the form vL, and thus the same is true for t. By i.h. both s and u are in →w -normal form, and u has not the form vL, so the substitution s[u/x] is not a 7→vs redex and t is a →w -normal form. t u

Proof of LEMMA 6, page 10 # Proof. The proof is given by mutual induction on wnf and wnf . Cases:

– Let t be a #-weak normal form, we consider the possible subcases. • Let t = x[w1# /x1 ] . . . [wn# /xn ] w where w is a weak normal form and wi] are ]-weak normal form for all i. Since w ∈ wnf , by i.h. there is hw ∈ N such that w[hw +j] →∗w v ∈ Val , for all j ∈ N. Since # wi# ∈ wnf for all i, by i.h. there exist h1 , . . . , hn s.t. (wi# )[hi +j] →∗w o≥j , for all j ∈ N. Let h = 1 + max{hw , h1 , . . . , hn }. There are two almost indentical cases: 1. x ∈ / {x1 , . . . , xn }. Let j ∈ N. Then: (x[w1# /x1 ] . . . [wn# /xn ] w)[h+j] o≥h+j [(w1# )[h+j] /x1 ] . . . [(wn# )[h+j] /xn ] w[h+j] o≥h+j [o≥j /x1 ] . . . [o≥j /xn ] w[h+j] o≥h+j [o≥j /x1 ] . . . [o≥j /xn ] v o≥h+j {o≥j /x1 } . . . {o≥j /xn } v o≥h+j v o≥(h+j)−1 .

= →∗λvsub →∗λvsub →∗λvsub (o≥j are values) →∗λvsub (o≥h+j is closed) →∗λvsub (h > 0)

By definition, h − 1 ≥ 0 so that h + j − 1 ≥ j. Now, o≥j+(h−1) can be written o≥j , and so we conclude 2. x ∈ {x1 , . . . , xn }. Let j ∈ N. Then: (x[w1# /x1 ] . . . [wn# /xn ] w)[h+j] x[(w1# )[h+j] /x1 ] . . . [(wn# )[h+j] /xn ] w[h+j] x[o≥j /x1 ] . . . [o≥j /xn ] w[h+j] x[o≥j /x1 ] . . . [o≥j /xn ] v o≥h+j {o≥j /x1 } . . . {o≥j /xn } v o≥h+j v o≥(h+j)−1 .

= →∗λvsub →∗λvsub →∗λvsub (o≥j are values) →∗λvsub (o≥h+j is closed) →∗λvsub (h > 0)

By definition, h − 1 ≥ 0 so that h + j − 1 ≥ j and we conclude. • Let t = w# w where w is a weak normal form and w# is a #-weak normal form. By i.h. there is h# ∈ N such that (w# )[h# +j] →∗λvsub o≥j , for all j ∈ N. By i.h. there is hw ∈ N such that w[hw +j] →∗λvsub V al, for all j ∈ N. Let h = max{h# + 1, hw }, and j ∈ N. Then: (w# w)[h+j] = (w# )[h+j] (w)[h+j] →∗λvsub (w# )[h+j] v →∗λvsub ≥1+j o v →∗λvsub o≥j . • Let t = w0# [w1# /x] where w0# , w1# are #-weak normal form. By i.h. for i ∈ {1, 2} there exists hi ∈ N such that (wi# )[hi +j] →∗λvsub o≥j , for all j ∈ N. Note that: (w1# )[h0 +h1 +j] →∗λvsub o≥h0 +j for all j ∈ N. Let j ∈ N. We have, (w0 [w1# /x])[h0 +h1 +j] = (w0 [(w1# )[h0 +h1 +j] /x])[h0 +h1 +j] →∗λvsub (w0 [o≥h0 +j /x])[h0 +h1 +j] →λvsub (w0 {o≥h0 +j /x})[h0 +h1 +j] The last term can also be written as (w0# )[h0 +j] , that by hypothesis reduces to o≥j . – Let t be a weak normal form, we consider the possible subcases. • If t be a value then the proof is obvious. • If t = w# then proof is given by the previous point.

• Let t = w0 [w1# /x] where w0 is a weak normal form and w1# is a #-weak normal form. By i.h. there are h0 , h1 ∈ N and v such that (w0 )[h0 +j] →∗λvsub v and (w1# )[h1 +j] →∗λvsub o≥j , for all j ∈ N. Note that: (w1# )[h0 +h1 +j] →∗λvsub o≥h0 +j for all j ∈ N. Let j ∈ N. Then: (w0 [w1# /x])[h0 +h1 +j] = (w0 [(w1# )[h0 +h1 +j] /x])[h0 +h1 +j] →∗λvsub (w0 [o≥h0 +j /x])[h0 +h1 +j] →λvsub ≥h +j [h +h +j] 0 0 1 (w0 {o /x}) The last term can also be written as (w0# )[h0 +j] , that by hypothesis reduces to a value. t u Proof of LEMMA 7, page 10 Proof. By induction on t. Given L = [u1 /x1 ] . . . [un /xn ] we use the notation L{v/x} for [u1 {v/x}/x1 ] . . . [un {v/x}/xn ]. – Base cases. • Let t = (λy.s)L u →dB s[u/y]L = t0 . t{v/x} = ((λy.s)L u){v/x} = (λy.s{v/x})L{v/x} u{v/x} →dB s{v/x}[u{v/x}/y]L{v/x} = t0 {v/x} • Let t = s[v0 L/y] →vs s{v0 /y}L = t0 . Let v00 = v0 {v/x} and note that v00 ∈ Val by Lemma 1. t{v/x} = = = →vs = =

s[v0 L/y]{v/x} s{v/x}[v0 {v/x}L{v/x} /y] s{v/x}[v00 L{v/x} /y] s{v/x}{v00 /y}L{v/x} s{v/x}{v0 {v/x}/y}L{v/x} s{v0 /y}L{v/x} = t0 {v/x}

– Inductive cases. • Let t = s u →w s0 u = t0 where s →w s0 . By i.h. s{v/x} →w s0 {v/x} Then (s u){v/x} = s{v/x} u{v/x} →w s0 {v/x} u{v/x} = (s0 u){v/x} • All other inductive cases are analogous.

t u

Proof of COROLLARY 2, page 10 Proof. s be the →w -normal form of t. By lemma 6 s is potentially valuable, i.e. there exist a substitution σ and a value v s.t. sσ →∗w v. It is straightforward to generalise Lemma 7 so that it holds for →∗w and for an arbitrary substitution. Then we get tσ →∗w sσ →∗w v and t is potentially valuable. t u Proof of LEMMA 8, page 10 Proof. Remark that if t has the form s u or s[u/x] then stratified-weak reduction extends weak reduction only in s, i.e. t is a →sw -normal form implies that u is a →w -normal form. ⇒) By induction on t. Cases: – t = x) obvious. – t = λx.u) Then u is a →sw -normal form. By i.h. u ∈ snf , and we conclude. – t = s[u/x]) then s is a →sw -normal form and by i.h. s ∈ snf . The subterm u is a →w -normal form. Moreover, u is not the form vL, # otherwise t would have a redex. Then by lemma 5 u ∈ wnf . – t = s u) u is a →w -normal form. The subterm s cannot be of the form (. . . (λx.s0 )L1 s1 )L2 s2 ) . . . sn−1 )Ln for some n ≥ 0, otherwise it would have a →sw -redex (given by the lambda and s1 or by the lambda and u). Then it has the form: (. . . (xL1 s1 )L2 s2 ) . . . sn−1 )Ln for some n ≥ 0. But by the remark at the beginning of the proof every subterm si and the content of every substitution in Li are →w -normal, for all i ∈ {1, . . . , n}. Hence, t is →w -normal, and it has not the form # vL, so by lemma 5 u ∈ wnf . ⇐) By induction on snf . Cases: – t = x) trivial. – t = λx.u with u ∈ snf ) by i.h. u is →sw -normal and so does t. # – t = s[u/x] with s ∈ snf and u ∈ wnf ) by lemma 5 u is →w -normal and not of the form vL and by i.h. s is →sw -normal, and so t is →sw normal.

# – t ∈ wnf ) Then by lemma 5 t is →w -normal and it is not of the form vL, i.e. t has the form:

(. . . (xL1 s1 )L2 s2 ) . . . sn−1 )Ln with si and the content of every substitution in Li →w -normal, for all i ∈ {1, . . . , n}. So t is →sw -normal. t u Proof of LEMMA 9, page 10 Proof. The proof is done by induction on →sw -normal forms. – If t = x then just take k = h = 0. – If t = λx.s with s ∈ snf then by i.h. exists h and k 0 such that s[h+j] o| ≥h+j .{z . . o≥h+j} →∗λvsub o≥j . k0

for all j ∈ N. Hence taking k = k 0 + 1 and by remembering that on is closed for every j ∈ N, we get: (λx.s)[h+j] o≥h+j |o≥h+j .{z . . o≥h+j}

k0 ((λx.s)o≥h+j o≥h+j . . . o≥h+j )[h+j]

|

{z

= →dB →vs

}

k0

(s{o≥h+j /x} |o≥h+j .{z . . o≥h+j})[h+j]

=

(s{o≥h+j /x})[h+j] |o≥h+j .{z . . o≥h+j}

=

k0

k0

s[h+j] o| ≥h+j .{z . . o≥h+j}

→∗λvsub o≥h+j

k0

– If t ∈ wnf then the statement follows from lemma 6.(1). # – Let t = s[u/x] with s ∈ snf and u ∈ wnf . By i.h. there exist h0 , k ∈ N such that 0 0 0 s[h +j] o| ≥h +j .{z . . o≥h +j} →∗λvsub o≥j k

for all j ∈ N. Moreover, by lemma 6.(1), there exists h00 ∈ N s.t. 00 u[h +j] →∗λvsub o≥j for all j ∈ N. Let h = h0 + h00 and j ∈ N. Note that 0

u[h+j] →∗λvsub o≥h +j

Then:

(s[u/x])[h+j] |o≥h+j .{z . . o≥h+j}

=

k

(s[u[h+j] /x])[h+j] o| ≥h+j .{z . . o≥h+j} →∗λvsub k

0

(s[o≥h +j /x])[h+j] o| ≥h+j .{z . . o≥h+j} →λvsub k

0

(s{o≥h +j /x})[h+j] o| ≥h+j .{z . . o≥h+j} k

Now,

0 (s{o≥h +j /x})[h+j] o≥h+j

|

.{z ..o

≥h+j

k

[h0 +j] ≥h0 +j

s

} can also be written as

o|

0

.{z . . o≥h +j} k

and we already saw that it reduces to o≥j .

t u

Proof of LEMMA 10, page 10 Proof. Obvious, since head contexts are stratified-weak contexts, and →sw is defined by means of stratified-weak contexts. Proof of COROLLARY 3, page 10 Proof. Let t0 be the →sw -normal form of t. By Lemma 9 for all j ∈ N, there exist h, k ∈ N such that (t0 {o≥h+j /x1 } . . . {o≥h+j /xh }) |o≥h+j .{z . . o≥h+j} →∗λvsub oj . k

k+h

}| { z Let be (λx1 . . . xh .[·]) o≥h+j . . . o≥h+j , so it is easy to see that H0 [t0 ] →∗λvsub oj . Hence, let H be the context H0 [·] I| .{z . . I} thus H[t0 ] →∗λvsub I. Since H0 [·]

j

t →∗sw t0 by Lemma 10 we get H[t] →∗sw H[t0 ], and thus we conclude with H[t] →∗λvsub H[t0 ] →∗λvsub I. t u Proof of LEMMA 11, page 11 Proof. A reduction step t →λvsub t0 can duplicate or erase a redex R of t if and only if t = C[u[vL/x]] →vs C[u{v/x}L] = t0 and R is contained in the value v. A such redex R is neither weak nor stratified-weak. In particular, any two weak (resp. stratified-weak) redexes of t are either disjoint or one contained into the other but with no possibility of duplication and erasure. Hence, the diamond property follows. t u

Proof of COROLLARY 5, page 11 Proof. 1. By Theorem 1.1 we get that there exists u s.t. t →∗w u →∗¬w v. Now u must be a value, because no reduction under λ can turn it into a value. 2. By Theorem 1.2 we get t →∗sw →∗¬sw I. No term can →¬sw -reduce to I, hence t →∗sw I. t u Proof of THEOREM 2, page 12 Proof. If t is solvable then there exists a head context H s.t. H[t] →∗λvsub I. By Corollary 5.2 we get H[t] →∗sw I. Now I is a →sw -normal form, so we get that H[t] has a →sw -normal form. Suppose that t has no →sw -normal form. We show that H[t] has no →sw -normal form, which is absurd. By Corollary 4 strong and weak normalisation for →sw coincide, so that in order to show that H[t] has no →sw -normal form it is enough to show that it has an infinite →sw -reduction. But if t has no →sw -normal form then it has an infinite →sw -reduction, and by Lemma 10 so does H[t]. t u Proof of THEOREM 3, page 12 Proof. If t is potentially valuable then by definition there exist a value v and terms u1 , . . . , un s.t. s = t{u1 /x1 . . . un /xn } →∗λvsub v. By corollary 5.1 we get s →∗w v. Since values are particular →w -normal forms then s has a →w -normal form. Now suppose that t has no →w -normal form. We show that so does s, which is absurd. By Corollary 4 strong and weak normalisation for →w coincide, so that in order to show that s has no →w normal form it is enough to show that it has an infinite →w -reduction. But if t has no →w -normal form then it has an infinite →w -reduction, and by Lemma 7 so does s. t u Proof of LEMMA 12, page 12 Proof. Define ≡o0 as the context closure of ∼vo1 ∪ ∼vo2 ∪ ∼vo3 ∪ ∼vo4 . We have ≡vo =≡∗o0 . We prove that: if t0 ≡o0 t1 →λvsub s1 then there exists w s.t. t0 →λvsub w ≡vo s1

(4)

The statement then follows by induction on the reflexive and transitive closure of ≡o0 . Let us show that: the reflexive case is trivial and if t0 ≡o0 t00 ≡ko0 t1 →λvsub s1 then by i.h. exists w s.t. t00 →λvsub w ≡vo s1

and by (4) there exists w0 s.t. t0 →λvsub w0 ≡vo w ≡vo s1 . The proof of (4) is by induction on ≡o0 . Actually, before to proceed with the proof one should first prove the following two easy properties: 1. If t ≡o0 t0 then t{x/u} ≡o0 t0 {x/u}. 2. If u ≡o0 u0 then t{x/u} ≡vo t{x/u0 }. Used in the inductive cases for the explicit substitutions. But we omit their proofs, which are straightforward inductions. Moreover, the statement about →sw is not proved explicitly, it is enough to observe that in the proof whenever the step is →sw then it is mapped on a →sw -step. – Base cases: • Let t0 = t[u/y][s/x] ≡o0 t[s/x][u/y] = t1 with x ∈ / fv(u) and y∈ / fv(s). If t1 →λvsub s1 because: ∗ t →λvsub t0 then t0 = t[u/y][s/x] →λvsub t0 [u/y][s/x] ≡o0 t0 [s/x][u/y] = s1 . ∗ u →λvsub u0 or s →λvsub s0 then it is similar to the previous case. ∗ s = vL and t[vL/x][u/y] →vs t{v/x}L[u/y] = s1 . Then: t0 →vs t[u/y]{v/xx}L = t{v/x}[u/y]L ≡vo t{v/x}L[u/y] = s1 ∗ The case where u = vL and t[s/x][vL/y] →vs t[s/x]{v/y}L = s1 is similar to the previous one. • Let t0 = t u[s/x] ≡o0 (t u)[s/x] = t1 with x ∈ / fv(t). If t1 →λvsub s1 because: ∗ t →λvsub t0 then t0 = t u[s/x] →λvsub t0 u[s/x] ≡o0 (t0 u)[s/x] = s1 . ∗ s →λvsub s0 or u →λvsub u0 then it is similar to the previous case. ∗ s = vL and t1 = (t u)[vL/x] →vs (t u){v/x}L = s1 . Then: t0 = →vs ≡vo =

t u[vL/x] t u{v/x}L (t u{v/x})L (t u){v/x}L = s1

∗ t = λy.t0 and t1 = ((λy.t0 ) u)[s/x] →dB t0 [u/y][s/x]. Then: t0 = (λy.t0 ) u[s/x] →dB t0 [u[s/x]/y] ≡o0 t0 [u/y][s/x] = s1

• The case symmetric to the previous one, i.e. t0 = (t u)[s/x] ≡o0 t u[s/x] = t1 with x ∈ / fv(t), is proved analogously. It will be so for all following cases, so we shall omit the symmetric cases. • Let t0 = t[s/x] u ≡o0 (t u)[s/x] = t1 with x ∈ / fv(u). If t1 →λvsub s1 because: ∗ t →λvsub t0 then t0 = t[s/x] u →λvsub t0 [s/x] u ≡o0 (t0 u)[s/x] = s1 . ∗ s →λvsub s0 or u →λvsub u0 then it is similar to the previous case. ∗ s = vL and t1 = (t u)[vL/x] →vs (t u){v/x}L = s1 . Then: t0 = →vs ≡vo =

t[vL/x] u t{v/x}L u (t{v/x} u)L (t u){v/x}L = s1

∗ t = λy.t0 and t1 = ((λy.t0 ) u)[s/x] →dB t0 [u/y][s/x]. Then: t0 = (λy.t0 )[s/x] u →dB t0 [u/y][s/x] = s1 Note that here it is reflexivity of ≡vo which is used. • Let t0 = t[u[s/x]/y] ≡o0 t[u/y][s/x] = t1 with x ∈ / fv(t). If t1 →λvsub s1 because: ∗ t →λvsub t0 then t0 →λvsub t0 [u[s/x]/y] ≡o0 t0 [x/u][s/x] = s1 . ∗ u →λvsub u0 or s →λvsub s0 it is analogous to the previous case. ∗ s = vL and t1 →vs t[u/y]{v/x}L = s1 . Then t0 = →vs ≡vo =

t[u[vL/x]/y] t[u{v/x}L/y] t[u{v/x}/y]L t[u/y]{v/x}L = s1

∗ u = vL0 and t1 = t[x/vL0 ]L →vs t{v}L0 L. Then t0 = t[x/vL0 L] →vs t{v}L0 L = s1 . Note that here it is reflexivity of ≡o0 which is used. – Inductive cases. We only show the interesting ones: • Application: the only case where the reduction interact with the contextual closure is t0 = (λx.t)L u ≡o0 (λx.t0 )L u = t1 →λvsub t0 [x/u]L = s1 . Then t0 →λvsub t[x/u]L ≡o0 t0 [x/u]L = s1 . The variants t0 = (λx.t)L u ≡o0 (λx.t)L u0 = t1 →λvsub t[x/u0 ]L = s1 and t0 = (λx.t)L u ≡o0 (λx.t)L0 u = t1 →λvsub t[x/u]L0 = s1 are analogous. All other inductive cases for application are straightforward.

• Explicit substitution. We only show the interesting cases. ∗ t0 = t[x/vL] ≡o0 t0 [x/vL] = t1 →λvsub t0 {x/v}L = s1 . Then by property 1 we get t0 →λvsub t{x/v}L ≡o0 t0 {x/v}L. ∗ t0 = t[x/vL] ≡o0 t[x/v0 L] = t1 →λvsub t{x/v0 }L = s1 . Then by property 2 we get t0 →λvsub t{x/v}L ≡vo t{x/v0 }L. Proof of LEMMA 14, page 13 Proof. 1. Obvious. 2. Obvious. 3. From the previous two points it follows that →∗λCBV ⊆→∗λvsub /o . By lemmas 13.2 and 12 we get →∗λvsub /o ⊆→∗λvsub ≡vo , and so t →∗λvsub ≡vo u. 4. ⇒) By Lemma 1. ⇐) If t →∗λCBV I then by Point 2 t →∗λvsub ≡vo I. Note that I has no explicit substitution, and so the only term u s.t. u ≡vo I is I itself. Thus t →∗λvsub I. t u Proof of LEMMA 15, page 14 Proof. 1. It follows from the definitions of the two stratified-weakreductions and by noting that the simulation proving Lemma 1 maps a →sw reduction on a →swCBV -reduction. 2. By the definitions of the two stratified-weak reductions. 3. From point 2 and Lemma 14.2 it follows that →∗swCBV ⊆→∗sw/o . By lemmas 13.2 and 12 we get →∗sw/o ⊆→∗sw ≡vo , and so t →∗sw ≡vo u. Proof of LEMMA 16, page 14 Proof. Structural reduction moves substitutions to the right and preserves the number of constructors of the term: this suggests an easy measure for termination. Define the following measure for contexts: |[·]| =0 |C u| = |C| + 1 |u C| = |C| + 1 |λx.C| = |C| + 1 |u [C/x]| = |C| + 1 |C [u/x]| = |C| P Note the last case. The measure of a term t is defined as t=C[s[u/x]] |C|. Now, consider a step t = C[s[u/x] w] → C[(s w)[u/x]]. For all substitutions in s, w and C nothing changes (because of the case |C u| = |C|

in the definition of |C|), but for [u/x] and the substitutions in u, for which the measure of the surrounding context decreases. Consider a step t = C[s[u[w/y]/x]] → C[s[u/x][w/y]]. The reasoning is analogous to the one of the previous kind of step. Hence structural reduction decreases |t|, which is a well-founded measure, and so it is strongly normalising. Proof of THEOREM 4, page 14 Proof. 1. ⇒) Let u be a →sw -normal form of t. By lemma 15.1 we get t →∗swCBV u. Now let w be a structural normal form of u, which exists by Lemma 16. By Lemma 14.2 we get u ≡vo w, and since ≡vo is a strong bisimulation for →sw (Lemma 12), the fact that u is →sw normal implies that w is →sw -normal. By lemma 15.3 we get that w is normal for the stratified-weak operational reduction of λCBV . Hence, w is normal for both the operational and the structural reduction of λCBV , i.e. it is →swCBV -normal. ⇐) Let u be the →swCBV normal form of t. By Lemma 15.3 there exists s s.t. t →∗sw s ≡vo u. Since →sw ⊆→+ swCBV (by Lemma 15.1) we get that u is →sw normal. Since ≡vo is a strong bisimulation for →sw we get that s is →sw -normal and conclude. 2. t is solvable in λCBV iff there is a stratified-weak context HW s.t. HW[t] →∗λCBV I. By Lemma 14.4 this happens iff HW[t] →∗λvsub I. By Corollary 3 and Theorem 2 this happens iff t has a →sw normal form, which by the previous point is equivalent to have a →swCBV normal form.

Call-by-value solvability, revisited

him in Turin in march 2011, where this work started. References. 1. Accattoli, B.: An abstract factorisation theorem for explicit substitutions (decem- ber 2011), https://sites.google.com/site/beniaminoaccattoli/factorisation.pdf. 2. Accattoli, B.: Jumping around the box. Ph.D. Thesis, Universit`a di Roma La. Sapienza (2011) ...

254KB Sizes 0 Downloads 161 Views

Recommend Documents

Call-by-value solvability, revisited
An operational characterisation of solvability gives a way to compute the ... 3 Weak β-reduction is the applicative-only closure of the β-rule, i.e. it is obtained.

Employment by Lotto Revisited
“stable” if each firm and worker has an acceptable match, and no firm and worker .... given matching µ, a firm-worker pair (f,w) is a blocking pair if they are not ...

Solvability problem for strong nonlinear non- diagonal ...
the heat operator, function b = 0 satisfies d) and has a special structure. It is known that in this problem singularities may appear in time inside of Q (see. [2]). As we see, there exist two reasons of nonsmoothness of global solution for (1), (2).

Representation: Revisited - GEOCITIES.ws
SMEC, Curtin University of Technology. The role of representation in ... Education suffered a decline in the last 20 or 30 years. (vonGlaserfled, 1995), which led ...

Representation: Revisited
in which social interchange has a major role in constructing and representing knowledge ... Explicitly speaking, the construction and representation of meaning.

Black Hole Information Revisited
Jun 22, 2017 - 4D: hard radiated quanta are always accompanied by an infinite cloud of tightly correlated soft quanta. In this note we conjecture that the full ...

Signatures of Branched Coverings and Solvability in ...
Jul 5, 2012 - By using the geometry of a sphere, Euclidean and hyperbolic planes one can construct universal ... and the hyperbolic plane is identified with its Poincare model in the unit disc. |z| < 1. We consider ..... linearly independent over Q.

Solvability of Centralized Supervisory Control under ...
S/G. In order to account for actuation and sensing limitations, the set of events Σ is partitioned in two ways. ..... (Consistency checking). (Eic,Γic) ∈ Qic,j ...... J. Quadrat, editors, 11th International Conference on Analysis and Optimization

Robust Bundle Adjustment Revisited - GitHub
Two notable exceptions are [22] and [9], which are dis- ..... Another option proposed in [9] is to rewrite ψ(r) as. (√ ..... adjustment) on a standard laptop computer.

Process Consultation Revisited
... proficient essay writing and custom writing services provided by professional ... the Helping Relationship (Prentice Hall Organizational Development Series), ...

genesis revisited pdf
... was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. genesis revisited pdf.

Avian genomes revisited
Sep 19, 2017 - to access, are a key component of amniote genomes. They experience ..... Recovery of homologous sequences from avian data. We targeted ...

INSTITUTION AND DEVELOPMENT REVISITED - UNCTAD
Sri Lanka. GHA. Ghana. MYS. Malaysia. GIN. Guinea. PAK. Pakistan. GNB. Guinea-Bissau. SGP .... institutions and WTO accession, 2009, 50 p. No. 42 Sudip ...

INSTITUTION AND DEVELOPMENT REVISITED - UNCTAD
The purpose of this series of studies is to analyse policy issues and to stimulate discussions in the area of international trade and development. The series includes studies by. UNCTAD staff and by distinguished researchers from academia. This paper

Revisited Linguistic Intuitions
Jun 10, 2011 - 843—all unadorned page references are to. Devitt [2010]) ..... LITTLE—at least one course in cognitive science, but no syntax. NONE—none of ...

Institution and Development Revisited: A ...
Mar 11, 2008 - HEI Working Paper No: 05/2008. Institution and Development Revisited: A Nonparametric Approach. Sudip Ranjan Basu. United Nations.

The Epidemiological Transition Revisited
fore postulated a fourth stage in the epidemiologic transition. During the “age .... framework, the mortality rates from Groups 1, 2, and 3 in a given country, year, and ... sent the proportions of all deaths that are attributed to each of a set of

The deadlock of democracy revisited
Sep 3, 1998 - did in the Philippines… No country .... long debate in the field of comparative politics. .... which distance from the ideal point is considered. 13.

Matching with Multiple Applications Revisited
Oct 6, 2003 - v vacancies. Each unemployed worker submits a applications with a $. &$,%, ..., v' given. These applications are randomly distributed across ...