# Complete Call-by-Value Calculi of Control Operators, I

We give new call-by-value calculi of control operators that are complete for the continuation-passing style semantics. Various anticipated computational properties are induced from the completeness. In the first part of a series of papers, we give the characterization of termination properties using the continuation-passing style semantics as well as the union-intersection type discipline.

## Authors

• 4 publications
• ### Complete Call-by-Value Calculi of Control Operators II: Strong Termination

We provide characterization of the strong termination property of the CC...
07/07/2017 ∙ by Ryu Hasegawa, et al. ∙ 0

• ### On completeness and parametricity in the realizability semantics of System F

A general approach to the realizability semantics of System F is obtaine...
02/14/2018 ∙ by Paolo Pistone, et al. ∙ 0

• ### A Functional Abstraction of Typed Invocation Contexts

In their paper "A Functional Abstraction of Typed Contexts", Danvy and F...
10/14/2021 ∙ by Youyou Cong, et al. ∙ 0

• ### Memoisation: Purely, Left-recursively, and with (Continuation Passing) Style

Memoisation, or tabling, is a well-known technique that yields large imp...
07/15/2017 ∙ by Samer Abdallah, et al. ∙ 0

• ### Space-Efficient Gradual Typing in Coercion-Passing Style

Herman et al. (2007, 2010) pointed out that the insertion of run-time ch...
08/07/2019 ∙ by Yuya Tsuda, et al. ∙ 0

• ### Semantic Bounds and Strong Call-by-Value Normalization

This paper explores two topics at once: the use of denotational semantic...
04/28/2021 ∙ by Beniamino Accattoli, et al. ∙ 0

• ### Reliable Intersection Control in Non-cooperative Environments

We propose a reliable intersection control mechanism for strategic auton...
02/22/2018 ∙ by Muhammed O. Sayin, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## Introduction

After the presentation of the first formal system embodying control operators by Felleisen et al. krj20 , and after the striking exposition of its relevance to the classical logic by Griffin ucb27 , the studies of first-class continuation exploded. Various systems have been proposed by now. If we restrict the search range to call-by-value calculi, we still find an abundance; krj20 kwx35 zfk00 to name a few. In this paper, we add new systems further to the end of the long list. Our contribution is to present new call-by-value calculi that are complete and still satisfy good properties, as explained shortly in turn.

The semantics of call-by-value calculi (as well as call-by-name calculi) is traditionally given by the continuation-passing style (CPS) translation. From its start, it has been used in connection with the implementation of programming languages aaj61 . Flanagan et al. suggests relationship to optimization wmx35 . With regard to mathematical logic, it corresponds to the Kuroda translation that is a variant of Gödel’s double negation translation tuj96 sjt10 . Now the CPS translation is commonly accepted as the standard semantics.

Given the semantics, completeness is one of the most desirable properties. If a system is not complete, it suffers a loss of a part of the wealth that is inherited from the target of the semantics. The target of the CPS semantics is simply the lambda calculus, the -reduction of which is the condensation of the essence of computation. If not complete, thus failing to inherit the essence, the concerned system definitely misses certain quality that it should intrinsically possess.

The widespread systems are not complete, however. None of the calculi listed in the first paragraph are complete. Therefore the quest for complete call-by-value systems with control operators are pursued over many years. After the first system presented by Sabry, a number of systems are proposed in the literature yrs06 vyh68 lss57 iba58 fck86 gnj37 iab45 vtp88 mhx11 .

Though many complete call-by-value systems are proposed so far, the computational properties are hardly explored. Consider the Church-Rosser property or termination of evaluation, for example. Most of the systems are equational from the beginning, thus hopeless. A few are designed as calculi having evaluation or reduction rules. As far as the author knows, however, computational properties are scarcely contended (one exception is confluence in mhx11 ). It seems difficult to design a complete but well-behaved calculus.

One of the reasons why we lack of computational properties is that we must add a number of exotic rules to a core system to obtain a complete system. For instance, several systems have a rule where is a call-by-value evaluation context. It deviates from the general pattern of reduction rules that concerns with combination of a few basic constructors. Moreover, if the number of added rules increases, intricacy of verifying properties is liable to accelerate. In order to obtain anticipated results, therefore, we must try to (i) restrict the added rules to manageable ones and (ii) find a proof method that overcomes the difficulty caused by the increasing number of rules.

Our main contribution is to show that a simple (indeed, very simple) modification in the call-by-value lambda calculus leads us to complete calculi. We add a little “twist” to its syntax. If we view a calculus as a two-story structure of syntax (terms) and reductions, we modify only the level of syntax. As a consequence, we have only standard reduction rules found in the literature, achieving the goal (i) above. This contrasts with previous approaches where the syntax is largely maintained and the reductions are modified.

Making use of our syntax, we verify a sharpened completeness result (Thm. 1.14). It is a kind of completeness that takes reduction sequences into account, not only equational relations. Similar results are given for different calculi ndy68 eiq93 pjd29 . For call-by-value calculi with control operators, this type of completeness is proven first (as we comment above, most previous systems have no notion of reduction from the beginning).

The sharpened completeness is a key result. It provides us with a machinery to verify computational properties. If the target calculus satisfies a certain property, the sharpened completeness informs us how to reinstall it in the source language. Definitely this type of argument is not our original idea. Fujita especially uses similar technique extensively eiq93 pjd29 . We can find a similar approach in de Groote owr18 , Sabry and Wadler ndy68 , and Crolard ltb70 as well. We systematically apply the method to prove various properties. This way we achieve the goal (ii) above.

We dub this method proof by parasitism. It is the image of depriving nourishment from its host at low cost. The source language controls the target calculus and let it work hard for him. The properties of the target calculus are sucked through a channel prepared by completeness.

We apply the method of proof by parasitism to verify desirable syntactic properties. Let denote the CPS translation of a term . We first consider an untyped system. We prove the following.

(1)Our calculus enjoys the Church-Rosser property (Thm. 2.15).

(2) is normalizable if and only if is normalizable (Thm. 2.20).

(3)The call-by-value evaluation of terminates if and only if is solvable (Thm. 2.28).

Next we turn to type theory. We give a union-intersection type discipline for the CCV -calculus. The main results are the following type-theoretic characterization of computational properties. (4)The type system satisfies the subject reduction/expansion property (Thm. 3.42).

(5)A term terminates with respect to the call-by-value evaluation if and only if the term is typeable (Thm. 3.43, (1)).

(6)A term is weakly normalizing if and only if it has a type judgment that contains neither empty intersection nor empty union (Thm. 3.43, (2)).

For the call-by-name -calculus, van Bakel developped a type system that incorporated union and intersection fxo45 . Subject reduction/expansion are verified, though computational properties are not explicitly characterized. As far as the author knows, there has been no attempt to prove the type-theoretic characterization for the call-by-value -calculus.

We have similar results characterizing the strong termination property by the CPS semantics as well as by types. However, to avoid the paper’s being too long, we decide to discuss strong termination in the second part of the series of papers.

Finally we disclose the tricks to obtain our complete calculi. Landin introduced the let-construct in (ljk61, , p. 91). This notation is inherited by Reynolds aaj61

, and is widely accepted through the spread of programming language ML, probably. In the context of call-by-value lambda calculus, the let notation is conveniently used. However we notice that, in an earlier influential paper

rsw67 , Landin first used the where-construct . It has the same effect as the let-construct, but the body is written first. Later he turned to preferring the let-construct, saying “The only consideration in choosing let and where will be relative convenience of writing an auxiliary definition before or after the expression it qualifies” in ljk61 . We propose in this paper to return to Landin’s original choice to write the let-binding to the right of its body.

Another leap is audacious identification between terms. It means that we deviate from the standard tradition that terms are built in the form of trees. We have an analogy in arithmetic. For instance, an expression allows two tree forms, and . However, we, humans, can understand the expression simultaneously as whichever of these trees, or even as addition of three numbers, with intended ambiguity. We appeal to this power of humans, who can identify the entities that look similar. While this ability is not shared by computers, there is no harm, for the behavior of identified terms is indistinguishable observationally. The main philosophy in our design is to build a system that is usable for humans.

These modifications affect only the structure of the call-by-value lambda calculus. It is orthogonal to control operators in a sense. So we incorporate control operators into our call-by-value lambda calculus in two different ways. The first is the -calculus and the second the catch/throw calculus after Crolard ltb70 . We focus mainly on the former, giving only short discussion for the latter in §4.

## 1 The CCV λμ-calculus

In this section, we propose a new type-free system of call-by-value -calculus. We call it the CCV -calculus (CCV is the acronym of “complete call-by-value”). In fact, the calculus is complete for the standard CPS transformation 1.13. We verify sharpened completeness involving reduction, not only equality, in Thm. 1.14.

### 1.1 Syntax

The let-construct after Landin is frequently used in the syntax of languages. Traditionally it is written in the form . Some authors use it as a syntax sugar of , while others use it as a primitive. For example, Moggi’s -calculus is an example of the latter dvp96 . The let-flat rule of the -calculus is

where we assume that is not free in .

We also take the let-construct as a primitive distinct from the lambda-construct. However, we write the let-binding to the right of its body. We adopt the following syntax:

instead of . Note that the order of and is reversed. The two terms of the let-flat rule above correspond to

and

in the new form. Let us observe that these two terms differ only in associativity of brackets.

The new let-form works in harmony with the -binding of the -calculus ygh05 lhr24 . The call-by-value variant of the -calculus is given in zfk00 nty36 . In the rest of this subsection, we give definition of the CCV -calculus based on this new form of the let-construct.

Variables are split into two categories: ordinary variables and continuation variables .

The terms and jumps of the CCV -calculus are defined by the following syntax:

 M ::= x   |   λx.M   |   MM   |   M↾x:=M   |   μk.J J ::= [k]M   |   J↾x:=M

where ranges over ordinary variables and over continuation variables. We call the prefix a jumper.

The terms and jumps are syntactically separated. For example, is disallowed. The lambda-abstraction and the mu-abstraction bind the abstracted variables as usual. Moreover, the let-sentences and bind the variable the scopes of which are and . Definition of the set or of free (ordinary and continuation) variables is standard. For example, is given by . The terms and the jumps obey ordinary -conversion rules. For example, equals if is not free in .

plus.1

1. We use curly braces for substitution to avoid too much of the overloading of the square brackets. We use two ways of substitution notation, and . We select either from the aspect of readability.

2. We write in place of for simplicity.

As usual, we regard -convertible terms to be equal. In addition to this, we introduce new identification rules between terms involving the let notation.

We assume the following equality axioms:

 L↾x:=(M↾y:=N) = (L↾x:=M)↾y:=N if y∉L (μk.J)↾x:=M = μk.(J↾x:=M) if k∉M [k](L↾x:=M) = ([k]L)↾x:=M.

The first rule is the associativity of let-constructs, the second the commutativity between and let, and the third the commutativity between jumper and let. To be precise, the first equality remains valid when but . However we may assume with -conversion if needed.

Let us consider the first rule of Def. 1.1. In rewriting from left to right, the side condition does not actually matter. The violation of the condition disappears if we -convert the bound variable with fresh as in . To the contrary, for the rewriting from right to left, the side condition must be definitely fulfilled. For example, never equals , since spills out of its scope. Similarly, the second equality of the definition is always applicable from left to right, up to the -conversion of if needed. Hence, if we follow the convention that we do -renaming whenever needed, we may assume that the brackets are always set as in the right hand sides of Def. 1.1.

We often omit brackets as

 L↾x:=M↾y:=N μk.J↾x:=M.

If the side conditions of Def. 1.1 fail, these are forcibly understood to be the right hand sides of the definition. If the conditions hold, we can regard the bracketing to be in either way. If we must select one for some reasons, we adopt the convention that the right hand sides are canonical. We omit also brackets between jump and let as in

.

We do not fix which bracketing is canonical for this pattern.

The introduction of equality means that we work on equivalence classes of syntactic trees. There is no mathematical need to switch the positions of bodies and arguments of let-binding. However, it would be unbearable to work with equivalences such as throughout. Our syntax makes the equivalence look friendlier to humans as well as it simplifies verification of properties.

We do not need any more the let-flat rule mentioned at the beginning. It is an advantage brought by the addition of the equality axioms. Likewise we can dispense with a rule flipping the order of and let, that implicitly exists in the other systems. For example, the reader may challenge a non-trivial exercise to prove the corresponding equality from the axioms in Tab. 10 of (fck86, , p. 246).

A term is a value if it is either a variable or a lambda abstraction . Otherwise it is called a non-value. Letter is preferably used to denote values, often with no mention.

The following are the reduction rules of the CCV -calculus, where the leftmost column gives the names of rules for future reference:

 (ad1) NM → zM↾z:=N (N is a non-value) (ad2) VN → Vz↾z:=N (V is a value; N is a non-value) (βλ) (λx.M)V → M↾x:=V (V is a value) (βlet) M↾x:=V → M{V/x} (V is a value) (βμ) M↾x:=μk.J → to0.0pt$μk.J{[k]□↦[k]M↾x:=□}$ (βjmp) [l]μk.J → J{l/k} (ηλ) λx.Vx → V (V is a value and x∉V) (ηlet) x↾x:=M → M (ημ) μk.[k]M → M (k∉M).

The first two rules are called administrative rules. In them, is a fresh variable. The notation is a standard context substitution in the -calculus. Each of occurring in is substituted with , unless that lies in the scope of another in . This process is done recursively. Namely, if contains further, the substitution rule is applied to them as well. The substitution is a shorthand of .

As usual, substitutions and invoke -renaming to avoid accidental collisions of bound variables. We recall that the let-construct binds a variable as well as and . Hence, for example,

,

where we need the renaming of bound with fresh to avoid a capture by the substitution .

plus.1

1. By virtue of -renaming, substitution operations respect equalities between terms. This warrants the safety of omission of brackets in Rem. 1.1.

2. There is ambiguity of the contexts captured by -reduction, caused by the equality rules given in Def. 1.1. For example, let us consider

.

We have two ways of bracketing. If we read it left-associative, -reduction captures the context as

.

However, if we regard the let-bindings to be right-associative, -reduction captures a partial context as

.

This ambiguity is intended. Both reductions are allowed in our system. We note that the latter converges to the former by one more application of rule .

Similarly two ways of bracketing in with admit different reductions:

and

.

These terms converge to a common term if we apply rule to them.

3. As derived from the reduction rules, we have

where and are jumps. In fact, if has the shape , the left hand side contracts by rule to , from which we obtain the right hand by rule . If has the shape , we transfer it to the shape by the equality rules of 1.1. We do not need the second rule exchanging precedence between and let, though. (The last miscellaneous comment is returned later in 1.4.)

The derived rule above corresponds to the second case of rule in (iba58, , Fig. 5, p. 347). They split cases by types. Although our system is type-free, the behaviours are different between terms and jumps. The latter correspond to the case of type .

All rules in Def. 1.1 are totally standard, save our particular syntax of the let-construct. Two administrative rules are introduced in dvp96 . The combination of and splits the ordinary -rule after Plotkin pag41 into two steps. The combination is found in the core scheme of Flanagan et al. wmx35 . Also the call-by-value -calculus by Curien and Herbelin qoq47 have similar rules, though the syntax is quite different. Rule and are standard in the -calculus. Rule is also standard in the call-by-value lambda calculus. Rule is found in dvp96 as well as in wmx35 in the context of the optimization transforming to tail recursion. Rule exists in zfk00 . These data are by no means exhaustive.

The smallest congruence relation containing the reduction rules in Def. 1.1 is denoted by , and referred as the CCV equality.

Many complete systems in the literature vyh68 yrs06 iba58 gnj37 vtp88 mhx11 contain the axiom

where is the evaluation context of the call-by-value calculus (see Def. 2.3). Understanding the equality to be , we can derive this axiom. If is the void context , the equality is derivable by reduction only, as , where we assume that is a non-value (it is easy if is a value). The general case is derived from that is verified by induction on the construction of .

Let us consider two typical examples in the following. We use them as milestones to check the behavior of the calculus throughout the paper.

As the fixed-point combinator suitable for the call-by-value calculus, we suggest to use

.

The difference from the ordinary fixed-point combinator à la Curry is that our is fully -expanded. Hasegawa and Kakutani propose three axioms that the fixed-point combinator in the call-by-value calculus should satisfy, in the simply typed setting dhx18 . Among the three, the first two are equational axioms, while the last axiom has a denotational feature, stated in a conditional phrase. So here we consider the first two axioms: the fixed-point axiom , and the stability axiom , in both of which is supposed to be a value. We do not mind types here. The encoded above satisfies the fixed-point axiom, as , where the equality symbol is understood to mean . Also the stability axiom is satisfied since holds for . The -expansion by is needed for the fixed-point axiom, the expansion by for the stability axiom, and the expansion by for both. We comment that Plotkin pag41 suggests the version where only is -expanded. We return to this example in 2.3 and 3.1.

As an example that uses control operators, we take cooperative multitasking. We consider the case where two agents work in a cooperative manner. The coding below is essentially simplification of the implementation of coroutine in (pea10, , §17.1).

The following computation demonstrates that Felleisen’s -operator krj20 plays the role of the yield command switching live processes. Let be a fixed continuation variable, representing the topmost continuation point. Let us define

.

We understand to mean that the current agent runs while the other agent is idle waiting for a chance to run that is encapsulated in a closure. Let us say that is active.

Operator is used to insert a break-point to switch the active agent. In the -calculus, we can encode the operator as where is a dummy continuation variable. We have the following reduction sequence:

 [^τ]M↾q:=Cq⊳qrN \vboxto0.0pt\vss∗⟶  [^τ]M↾q:=μk.[^τ](λrμδ.[^τ]N)(λqμδ.[k]q) \vboxto0.0pt\vss∗⟶  [^τ](λrμδ.[^τ]N)(λqμδ.[^τ]M) \vboxto0.0pt\vss∗⟶  [^τ]N⊳rqM

Note that becomes active. Two occurrences of in refer distinct variables. So we may write instead. But we use the same variable name deliberately. Intuitively the variable is understood to be the channel that passes information from one agent to the other. The variable is the channel in the reverse direction.

We can interpret the use of as inserting a break-point in a process. Namely plays the role of the yield command in the terminology of multitasking. At the break-point, the current agent pauses and the rest of computation is preserved in the closure . The right of execution is conceded to the other agent who starts . If a break-point has been built in , it may be executed eventually. Then . Namely, the right of execution is returned to the first agent who restarts the stopped computation from .

For example, is a program doing nothing whenever invoked and pauses immediately conceding the right of execution to the other agent. Namely .

The implementation of multitasking is well-behaved under the condition that there is at most one occurrence of free in of . It is the programmer’s task to fulfill this constraint. In certain cases, it will be useful to use multiple occurrences of . For example, if we implement a board game where players can retract their moves, we may reinstall the same continuation more than once.

Since our calculus has less features than the SML programming language, we adopt several modifications and simplifications from the original. Since we consider only two agents, we do not need a queue to record the processes waiting for restart. Our calculus does not have mutable stores. So we must pass continuation explicitly in the yield command . We return to this example in Rem. 2.3 to discuss the call-by-value evaluation using evaluation contexts and in Rem. 3.1 for typeability.

### 1.2 CPS translation

In this subsection, we define the continuation-passing style translation of the CCV -calculus and verify its soundness. It follows the idea of the colon translation to save redundant -redices pag41 ndy68 . For readability, we use the notation instead of . At this stage, we understand to be an arbitrary lambda term. However, as we do later, we can restrict the range of to the terms of particular forms. Namely, it is a term of sort given in Def. 1.3.

We define a new CPS translation . It depends on an auxiliary translations , , and .

 (|V|)[K] := KV∗ (|V1V2|)[K] := V∗1V∗2K (|VN|)[K] := (|N|)[λy.V∗yK] (|NV|)[K] := (|N|)[λx.xV∗K] (|N1N2|)[K] (|L↾x:=M|)[K] := (|M|)[λx.(|L|)[K]] (|μk.J|)[K] := (λk.(|J|))K (|[k]M|) := (|M|)[k] (|J↾x:=M|) := (|M|)[λx.(|J|)] x∗ := x (λx.M)∗ := λxk.(|M|)[k] [[M]] := λk.(|M|)[k]

Herein is a value and a non-value. The ordinary variables and for three cases of application are fresh, and the continuation variables in and are fresh. Other occurrences of variables and share common symbols in the source language and the target language.

In case , if contains as a free variable, we must perform -conversion as using fresh . This is a slippery point. The careful reader will find this observation used in proof of Prop. 1.2.

Now setup is finished. We begin with verifying the soundness of the CPS-translation with respect to the CCV equality in the source and the -equality in the target.

###### Lemma 1.1

plus.1

1. We have provided .

2. We have .

Easy by compositionality of the colon translation, Def. 1.2

###### Proposition 1.2

If , then holds with respect to -equality.

We verify . Among the axioms in Def. 1.1, both sides yield the same lambda terms, save the second axiom. For this axiom, the translations of both sides contract to a common term by -reduction (no need of ).

Next we consider reduction rules in Def. 1.1. For two administrative rules, both sides translate into the same terms. For rules , , , , and , we have by -reduction or -reduction. For the remaining two and , we need -expansion as well as -reduction. For example, the left hand side of is translated into while the right hand side into by Lem. 1.1, (2). The former -equals to the latter by reduction followed by expansion. ∎

plus.1

1. A subtle problem is that the equality determined by Def. 1.1 is not strictly respected. As mentioned in the proof of Prop. 1.2, and are not exactly identical, only -equal. Hence is determined only up to -equality. It may cause serious trouble in certain cases. Fortunately the ambiguity does not injure the proof of the main theorem 1.14 and its applications presented in this paper. See an analysis in Rem. 1.4.

We stress that only the second rule is problematic. The remaining two rules are strictly respected by the CPS translation.

2. Suppose . By inspection of the proof of 1.2, we see that -reduction and -expansion are needed to obtain from . We emphasize that -expansion is not needed. This observation is used in Thm. 3.42 later.

### 1.3 Inverse translation

Following the idea of Sabry and Felleisen yrs06 vyh68 , we define the inverse of the CPS translation. Up to equational theories, the inverse translation actually gives the inverse. We prove a sharpened result taking into account the orientation of reduction in Thm. 1.14.

Until now, the target calculus of the CPS translation is the ordinary untyped lambda calculus. To define the inverse translation, however, we regard the target as the sorted lambda calculus.

We prepare four sorts , and . They are called terms, jumps, values, and continuations, respectively. Moreover, the variables are split to the variables of sort and the variables of sort . The former are called ordinary variables and the latter continuation variables. We let itself represent the lambda terms of sort , and likewise for other sorts.

The syntax of the target calculus is defined as follows:

 Term T ::= λk.Q  |  WW Jump Q ::= KW  |  TK Value W ::= x  |  λx.T Continuation K ::= k  |  λx.Q

where ranges over ordinary variables and over continuation variables. We take ordinary -reduction as reduction rules. We comment that each sort is closed under -reduction as is straightforward by definition.

It is easy to see that, according to the translations of Def. 1.2, belongs to sort , both and to sort , and to sort .

The inverse translation is a mapping from the target calculus to the CCV -calculus. The definition is given by induction:

 T−1: (λk.Q)−1 := μk.Q−1 (W1W2)−1 := W−11W−12 Q−1: (KW)−1 := K−1[W−1] (TK)−1 := K−1[T−1] W−1: x−1 := x (λx.T)−1 := λx.T−1 K−1: k−1 := [k]□ (λx.Q)−1 := Q−1↾x:=□.

and are terms of the CCV -calculus, jumps, and jumps with a single hole . The notation signifies to fill the hole of with term .

In view of Def. 1.3, it is clear that application in the translation is restricted to the shape between values. Hence we cannot apply administrative reductions to etc. Moreover, once application is restricted so, reduction steps preserve the shape since they send values to values (note that variables are able to be substituted only with values). So administrative rules can never be applied later on.

Reduction by non-administrative rule is called practical. For technical reasons, we call reduction by rule vertical.

###### Lemma 1.3

Vertical reductions are strongly terminating and confluent.

Easy. ∎

###### Lemma 1.4

Suppose holds where denotes a one-step vertical reduction and a one-step practical reduction. There is a term such that

where the bottom denotes a one-step practical reduction or an equality and the right a finite number of vertical reductions (contrary to the usage in Def. 1.2).

There are only three patterns of overlapping redices yielding critical pairs: and where in either, and where . Proof is easy. ∎

Note that Lem. 1.4 excludes administrative reductions. Indeed it fails, since vertical reductions may create values.

###### Corollary 1.5

Suppose where denotes a finite number of vertical reductions and a finite sequence of practical reductions. There is a term such that

.

We stack the square diagram of Lem. 1.4 vertically to replace with , then horizontally to replace with . (Our specific syntactic design notably simplifies the proof here. We do not have to be bothered by transformation between equivalent terms, as we can identify terms only by ignoring brackets. It enables verification by simply laying square bricks.) ∎

Corollary 1.5 is used later in Thm. 1.14. Next let us prove (a half of) that the inverse translation is actually the inverse of the CPS.

###### Lemma 1.6

Provided , we have by the equality rules of Def. 1.1 (but with no use of the second rule interchanging and let; see 1.4).

Easy. ∎

###### Proposition 1.7

Let be a term of the CCV -calculus. There is a term of the calculus such that (notice the direction). Here denotes a finite number of administrative reductions and a finite number of vertical reductions. As is determined only up to -equality (Rem. 1.2), we choose an arbitrary one among those obtained by bracketing between and let.

For terms of the form of application define we as follows:

 (V1V2)† := V†1V†2 (VN)† := V†y↾y:=N† (NV)† := xV†↾x:=N† (N1N2)† := xy↾y:=N†2↾x:=N†1

where denotes a value and a non-value. For terms of other forms and for jumps, definition of (and ) is simply homomorphic. For example, . By definition, is evident. To verify , we show . Proof is straightforward. To manipulate the case , we need Lem. 1.6. Since the lemma does not depend on the equality interchanging and let-binding, does not change the chosen bracketing structure. This is why we can choose an arbitrary bracketing for . ∎

###### Corollary 1.8

holds for every CCV -term . ∎

plus.1

1. The term is free from administrative redices by Rem. 1.3. Namely, it is fully let-expanded. This property corresponds to the main result related to A-normal forms in Flanagan et al. (wmx35, , §4). In that paper, is defined as , the variable discarded. In our definition, . Hence we need vertical reductions to collapse .

2. Closely related (and often better) results are proved for different systems in previous works. For example, Sabry and Felleisen verify for the call-by-value calculus with no control operators (yrs06, , Thm. 10, p. 310). Fujita verifies for the call-by-name second-order calculus (eiq93, , Thm. 32, p. 204)(pjd29, , Cor. 17, p. 329).

### 1.4 Completeness

By virtue of the inverse translation, we can verify completeness of the CPS translation. The completeness respects reduction, not only equality. The results in this subsection are main vehicles in the rest of this paper. The -redices of the target calculus are manipulated in Lem. 1.9 and 1.10, and the -redices in Lem. 1.11.

###### Lemma 1.9

We have .

First we observe that is syntactically equal to . Proof of the lemma is by case splitting. The case of is easy. If , the left hand side equals , which contracts to as noted in Rem. 1.1, (3). Now we use the observation above. In this proof, we use rule and rule of Def 1.1. ∎

###### Lemma 1.10

plus.1

1. We have .

2. We have .

We show (1). The left hand side equals , which contracts to , then to since is a value. It is easy to show . (2) is similar. In this proof, we use rule and rule of Def. 1.1. ∎

###### Lemma 1.11

plus.1

1. We have .

2. We have .

3. We have .

(1) is an immediate consequence of rule () in Def. 1.1, and (2) of rule (). We show (3). We split cases by the shape of . The case of is easy. If , the left side equals , which contracts to , i.e., . In both cases, we use rule () of Def. 1.1. We note that the equality rules of Def. 1.1 are implicitly used in the proof of (3). However, the interchange law of and let is not used. See 1.4. ∎

###### Proposition 1.12

We have in the CCV -calculus, whenever holds with respect to -reduction in the target calculus. Here and represent lambda terms of all sorts in the target calculus, and denotes one or more practical reductions.

It is a consequence of Lem. 1.9, 1.10, and 1.11. No administrative reductions are used, as pointed out in the proofs of the lemmata. ∎

Similar results are proved by Sabry and Felleisen (yrs06, , Thm. 13, p. 312)(vyh68, , Thm. 3.11, p. 45) and by Fujita (eiq93, , Prop. 27, p. 203)(pjd29, , Lem. 18, p. 330) for different systems with no control operators.

###### Corollary 1.13

If holds up to -equality in the target calculus, then holds.

Applying Prop. 1.12 to a zigzag of -reductions, we have . We have also by Cor. 1.8. ∎

Corollary 1.13 refers only to equality. We show sharpened completeness with regard to reductions in Thm. 1.14.

We let denote the normal form with respect to vertical reductions for each term of the CCV -calculus. Existence of the normal form comes from Lem. 1.3.

Before stating the theorem, we recall ambiguity in definition of the CPS translation discussed in Rem. 1.2, (i). If we choose different bracketing between and let, we obtain different .

###### Theorem 1.14

Let be a term of the CCV -calculus. If with respect to -reduction in the target calculus, holds in the CCV -calculus. Here we understand to mean arbitrarily chosen one among those obtained by bracketing between and let.

By Prop. 1.12 and 1.5, we have satisfying

where is introduced in Prop. 1.7 that is valid irrelevant of the choice of bracketing. We can replace with , performing further vertical reductions if needed. Thence we have . ∎

Similar results are verified by Sabry and Wadler for Moggi’s -calculus (ndy68, , Thm 8.2, p. 130), and by Fujita for the second-order call-by-name -calculus (pjd29, , Thm. 1, p. 330).

The equality axioms in Def. 1.1 are the key for Thm. 1.14. So let us analyze where the axioms are used throughout the proof. They are used in Prop. 1.7 (through Lem. 1.6), Lem. 1.9 (through Rem. 1.1, (3)), and Lem. 1.11. As commented in these parts, only the first and the third axioms are used among three axioms of 1.1. The second axiom interchanging and let is never used.

This is not strange, since the second axiom is derivable from others if the equality is our concern, the orientation of the reduction being ignored. Let us assume that the interchange axiom between jumper and let is valid. Then we derive the second axiom as where three equalities are the reverse of , the interchange law of jumper and let, and , respectively.

As an alternative choice, therefore, we may take the reduction rule

in place of the equality axiom. Here we assume that is not free in . We do -renaming otherwise.

## 2 Proof by Parasitism

The rest of the paper is mostly devoted to the applications of the sharpened completeness theorem 1.14. It succeeds in dealing with reduction, not only with equality.

The target calculus of the CPS translation is just the ordinary lambda calculus except that it is equipped with sorts. We have a stock of the results on the lambda calculus through a long history of research. By the sharpened completeness, we can reflect the properties of the lambda calculus to the CCV -calculus.

We coin the term “proof by parasitism” to describe the technique to obtain syntactic properties through completeness. A parasite (the source calculus) infests a host (the target calculus) to suck the nurture from the latter. The nurture in this case is a desired syntactic property. Through completeness the source calculus can take over the target calclus and make it work hard to provide for him. Fruits are collected by the host and the free-loader robs them at the lowest cost.

In this section, we demonstrate several samples of the results that uses the proof by parasitism. We do not claim that this type of argument is original at all. For instance, de Groote (owr18, , Prop. 3.2,Lem. 4.2), Sabry and Wadler (ndy68, , Prop. 7.1.2, p. 126) Crolard (ltb70, , Thm. 3.5.1), and Fujita (eiq93, , Cor. 34,35)(pjd29, , Cor. 19) use the same approaches to prove some of their results. Here we deploy the outfit systematically.

### 2.1 Proof by parasitism, I: Church-Rosser property

We start with the Church-Rosser property. Its proof is a typical example of an advantage of the technique.

###### Theorem 2.15

The CCV -calculus enjoys the Church-Rosser property.

Suppose . By soundness 1.2 concerning equality, we have up to -equality. Since the lambda calculus fulfills Church-Rosser with respect to -reduction (thus the target calculus does) (zxr70, , Thm. 3.3.9), there is a term such that in the target calculus. Now Thm. 1.14 yields . ∎

The fragment of our system with no -operators is essentially the same as Moggi’s -calculus dvp96 . If we identify with , the reduction rules are quite similar, except that the -calculus has the let-flat rule for associativity of the let-construct, while our calculus has it as one of the equality rules 1.1. This type of relation of the complete call-by-value calculus to the -calculus is first pointed out in vyh68