Lambda Mu Calculus and Duality: Call-by-Name and Call-by-Value
J\'er\^ome Rocheteau (PPS)

TL;DR
This paper explores the computational equivalence of Lambda Mu Calculus and Lambda Bar Mu Mu Tidle Calculus under classical logic, providing translations and simulation theorems for different evaluation strategies.
Contribution
It establishes formal translations and proves simulation theorems demonstrating the computational equivalence of the two calculi.
Findings
Translations between Lambda Mu and Lambda Bar Mu Mu Tidle Calculus are defined.
Simulation theorems are proved for undirected, call-by-name, and call-by-value evaluations.
The calculi are shown to be computationally equivalent under these translations.
Abstract
Under the extension of Curry-Howard's correspondence to classical logic, Gentzen's NK and LK systems can be seen as syntax-directed systems of simple types respectively for Parigot's Lambda Mu Calculus and Curien-Herbelin's Lambda Bar Mu Mu Tidle Calculus. We aim at showing their computational equivalence. We define translations between these calculi. We prove simulation theorems for an undirected evaluation as well as for call-by-name and call-by-value evaluations.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Advanced Algebra and Logic · Logic, Reasoning, and Knowledge
11institutetext:
ESTAS – INRETS 20 rue Élisée Reclus – BP 317 F-59666 Villeneuve d’Ascq Cedex [email protected]
Preuves, Programmes et Systèmes CNRS – Université de Paris VII UMR 7126 – Case 7014 175 rue du Chevaleret – 75013 Paris – France
-calculus and duality:
call-by-name and call-by-value
Jérôme Rocheteau
Abstract
Under the extension of Curry-Howard’s correspondence to classical logic, Gentzen’s and systems can be seen as syntax-directed systems of simple types respectively for Parigot’s -calculus and Curien-Herbelin’s -calculus. We aim at showing their computational equivalence. We define translations between these calculi. We prove simulation theorems for an undirected evaluation as well as for call-by-name and call-by-value evaluations.
Abstract
Under the extension of Curry-Howard’s correspondence to classical logic, Gentzen’s and systems can be seen as syntax-directed systems of simple types respectively for Parigot’s -calculus and Curien-Herbelin’s -calculus. We aim at showing their computational equivalence. We define translations between these calculi. We prove simulation theorems for an undirected evaluation as well as for call-by-name and call-by-value evaluations.
7 Introduction
Key systems for classical logic in proof theory are Gentzen’s and . The logical equivalence between the latter was proved in [[@@bibref{}{Gentzen34}{}{}], cite]. We deal with the extension of Curry-Howard’s correspondence between proofs and programs through the systems of simple types for the and -calculi. This extension concerns some other calculi. It is initially Felleisen’s -calculus. Its type system is the intuitionistic natural deduction with the double negation axiom. Griffin proposed this axiom as the type for the -operator in [[@@bibref{}{Griffin90}{}{}], cite]. However, we focus on calculi that correspond closer to Gentzen’s systems. The -calculus was defined for in [[@@bibref{}{Parigot92}{}{}], cite]. The -calculus was designed for in [[@@bibref{}{CurienHerbelin00}{}{}], cite]. In the general case, these two calculi are not deterministic. There exists critical pairs. The -calculus admits two deterministic projections depending on choosing one of the two possible symmetric orientations of a critical pair. They correspond to the call-by-name/call-by-value duality.
We aim at proving the computational equivalence between and -calculi. A major step was reached with the proof of the simulation of the -calculus by the -calculus in [[@@bibref{}{CurienHerbelin00}{}{}], cite]. It holds both for call-by-name and call-by-value evaluations. We present the call-by-name/call-by-value projections of the -calculus in the same way as for the in [[@@bibref{}{CurienHerbelin00}{}{}], cite] . It consists of choosing one of the two possible orientations of a critical pair. We prove that the -calculus simulates backwards the -calculus in such a way that we obtain easily the same result for the call-by-name, for the call-by-value and for the simple type case. The -calculus is composed of three syntactic categories: terms, contexts (or environments) and commands. The -calculus is basically composed of terms and commands. We add contexts to the -calculus. It eases mappings between the and -calculi. We extend the translation from the -calculus to the -calculus defined in [[@@bibref{}{CurienHerbelin00}{}{}], cite] over the -contexts. We define backwards a translation from the -calculus to the -calculus.
In section LABEL:sec:lm-calculus we present the -calculus. In section LABEL:sec:lmm-calculus we present the -calculus. In section LABEL:sec:translations-lm-lmm-calculi we define translations between these two calculi. In section LABEL:sec:simulations-lm-lmm-calculi we prove simulation theorems that hold for call-by-name and call-by-value.
8 -calculus
We follow the definition given in [[@@bibref{}{Parigot92}{}{}], cite]. Firstly, we present the grammar of terms and commands. Secondly, we present the system of simple types. Thirdly, we present generic reductions and their call-by-name and call-by-value projections. Fourthly, we extend both the grammar and the type system to the contexts.
Basically, the -calculus is composed of terms and commands. They are defined by mutual induction:
[TABLE]
Symbols range over -variables, symbols range over -variables. We note or the fact that or has a free occurrence in . Symbols and are binders. Two terms are equal modulo -equivalence.
The system of simple types for the -calculus is based on two kinds of sequents. The first concerns the terms and the second concerns the commands in which is a simple type obtained by the grammar , is a finite domain application from -variables to simple types and is a finite domain application from -variables to simple types. denotes the union of the applications and . System rules are:
The restriction requires that and match each other on the intersection of their domains. This holds for and too.
The category of contexts is introduced in order to ease comparisons with the homonymous category of the -calculus. -contexts are defined by mutual induction with the terms:
[TABLE]
We can see contexts as commands with a hole to fill. The first construction expects a term in order to provide the command . The second expects a term in order to provide the command . The last puts the term on a stack and expects another term to fill the hole.
Definition 5
Let a term and a context. The command is defined by induction on :
[TABLE]
The type system is extended to another kind of sequents . The typing rules give the context the type of the term that fills the hole of :
A sequent calculus like cut-rule can then be derived in this system as a term against context application.
Lemma 13
*The rule
holds in .*
Proof
By induction on .
- •
if then and
- •
if then and
- •
if then and
ind. hyp.
Definition 6
Let a term, a context and a -variable, The term – the substitution of by in – is defined by induction on :
[TABLE]
[TABLE]
The computation notion is based on reductions. We remind one-step reduction rules:
[TABLE]
The reduction stands for the reflexive and transitive closure of and the reduction stands for the union of for .
Some of these reductions are linear. Both of the and -reductions are linear because they correspond to the identity in . The -reduction from the term is linear because it consists of replacing a variable by another variable inside a term. It corresponds to a normalisation against an axiom rule in . The -reduction from the term where has a single free occurrence in is linear too because it consists either of substituting a single variable occurrence by any term. It corresponds either to a normalisation without a proof-tree branch duplication.
Reductions \ \mathop{\leadsto_{\gamma}}\, \ \mathop{{\overset{*}{\leadsto}}_{\gamma}}\ and \ \mathop{{\overset{*}{\leadsto}}}\ have the same meanings as in the general case. The relation is defined as the reflexive, transitive and symmetric closure of \ \mathop{{\overset{*}{\leadsto}}}\.
There exists a critical pair for computation determinism. Applicative terms and can be or -rewritten in the first case and or -rewritten in the second case. We can see the call-by-name and call-by-value disciplines as restrictions of the generic reductions.
The call-by-name evaluation consists of allowing every reduction but the -rule. The -reduction holds in the first case and the -reduction in the second. Formally the call-by-name reduction is .
The call-by-value evaluation consists of prohibiting and -reductions in which the argument is a -abstraction. Formally we define a subset of terms called values by this grammar: . and -reductions are defined instead of generic and ones:
[TABLE]
The call-by-value reduction is the union of for . Critical pairs are then -rewritten.
There is another way to define call-by-value into the -calculus. The solution is detailed in [[@@bibref{}{OngStewart97}{}{}], cite]. It consists of restricting the -rule to values instead of the :
[TABLE]
Formally becomes the union of for . In fact terms and are respectively and -reduced because is not a value in these cases. However, we follow Curien-Herbelin’s call-by-value definition.
We finish this section by a lemma. It is useful for the section LABEL:sec:simulations-lm-lmm-calculi simulation theorems. Any command of the form is a redex. However, some can not be reduced in call-by-name nor in call-by-value.
Lemma 14
**
Proof
By induction on .
- •
if then
- •
if then
[TABLE]
- •
if then
[TABLE]
This lemma does not hold in call-by-name for the induction case because no -rule is allowed. It holds in call-by-value if is a value for the induction case.
9 -calculus
The -calculus has the same relation against as the -calculus against . Reductions of -calculus correspond to the cut elimination steps in as well as the -reductions correspond to the -normalisation. We follow the definition given in [[@@bibref{}{CurienHerbelin00}{}{}], cite]. Firstly, we present the grammar of the -calculus. Secondly, we present the simple type system. Thirdly, we present generic reductions and their call-by-name and call-by-value projections.
The -calculus is basically composed of terms, commands and contexts. They are defined by mutual induction:
[TABLE]
As in the , symbols range over -variables, symbols range over -variables and symbols , and are binders. Terms are equal modulo -equivalence.
This calculus symmetry looks like ’s left/right symmetry. It is confirmed by its system of simple types. This system shares types with the -calculus. It shares the same kinds of sequents too. Its rules are:
The restriction is the same as that of .
We present one-step reduction rules. Substitutions inside the -calculus are supposed to be known. Each rule concerns a command but the -rule:
[TABLE]
and -reductions are duals of each other. They correspond to the structural rules in . Reductions and \ \mathop{{\overset{*}{\leadsto}}_{\gamma}}\ have the same meanings as in the -calculus. The -rule is a mere term modification without term duplication. It is therefore a linear reduction. The -reduction is linear too. There is no -reduction. It is a -rule particular case in which .
This system is not deterministic. There is a single critical pair . It can be both or -rewritten so that Church-Rosser’s property does not hold. In fact is -rewritten as and is -rewritten as . These are two different normal forms.
Call-by-name and call-by-value disciplines still deal with this problem. They both consist of restricting the context construction. The first new grammar is called and the second is called .
The call-by-name evaluation consists of restricting the -rule to a subset of contexts that are called stacks. -grammar is:
[TABLE]
The -rule is restricted to the stacks:
[TABLE]
Call-by-name reduction is the union of for . The critical pair can then only be -rewritten. This reduction was proved confluent and stable in the -calculus in [[@@bibref{}{CurienHerbelin00}{}{}], cite].
The call-by-value oriented grammar consists of allowing the context construction only for values. -grammar is:
[TABLE]
The -rule is restricted to values:
[TABLE]
Call-by-value reduction is the union of for . The command can then only be -rewritten. This reduction was proved confluent and stable in the -calculus in [[@@bibref{}{CurienHerbelin00}{}{}], cite].
The -rule contracts as shortcut for both a linear -rule and a -rule:
[TABLE]
This -rule is obviously compatible with the call-by-name evaluation. It is also compatible with the call-by-value because is a value by definition of .
10 Translations between and -calculi
We define a translation from to . It extends that of Curien-Herbelin to the -contexts. We define backwards a translation from to . We prove properties about their compatibilities with the simple type system and about their compositions.
Definition 7
Application maps any -term , command and context respectively to a -term, command and context. is defined by induction on , and :
[TABLE]
[TABLE]
[TABLE]
Condition requires that variables and have no free occurrence in neither in . Condition requires that . A straightforward induction leads us to state that and have the same free variables set.
It seems more natural to translate by . This shorter term corresponds in to the arrow elimination rule in too. But it would not be compatible with the call-by-value evaluation. For example, would be translated as in this case. It can not be reduced by any rule in the -calculus. However, can be -reduced in the -calculus.
should be translated as with Ong and Stewart’s call-by-value definition in [[@@bibref{}{OngStewart97}{}{}], cite].
We show that translation is compatible with the type system. If a typing environment for a term exists, it holds for .
Lemma 15
**
Proof
By a straightforward induction on . We show the less than obvious cases.
- •
if then and
- •
if then and
Definition 8
Application maps backwards any -term to a -term. Definition LABEL:def:lm-term-context-cut is used to translate any -command . Definition of the -contexts is used to map the -contexts as well. is built by induction on , and :
[TABLE]
[TABLE]
[TABLE]
Condition requires that . and have the same free variables set. Application is compatible with the type system too.
Lemma 16
**
Proof
By a straightforward induction on . We give two cases.
- •
if then and
\scriptstyle{\ignorespaces\ignorespaces\ignorespaces\leavevmode\lower 26.0pt\hbox{\vbox{\hbox{\hbox{\hskip 4.0pt\hbox{\scriptstyle\Gamma\vdash t:A~{}{}|{}{}\Delta}\hskip 4.0pt}\hbox{\hskip 14.45377pt}\hbox{\hskip 4.0pt\hbox{\scriptstyle\Gamma^{\prime}{}{}|~{}{}e:A\vdash\Delta^{\prime}}\hskip 4.0pt}}\vskip 2.0pt\nointerlineskip\hbox{\hskip 0.0pt\lower-0.2pt\hbox{}\hbox to94.31291pt{\xleaders\hrule\hfill}\lower-0.2pt\hbox{}}\vskip 2.0pt\nointerlineskip\hbox{\hskip 19.31236pt\hbox{\hbox{\hskip 4.0pt\hbox{\scriptstyle{\langle t,|,e\rangle}:(\Gamma,\Gamma^{\prime}\vdash\Delta,\Delta^{\prime})}\hskip 4.0pt}}}}}\ignorespaces}^{\circ}
lem. LABEL:thm:nk-cut-rule
- •
if then and
\scriptstyle{\ignorespaces\ignorespaces\leavevmode\lower 26.0pt\hbox{\vbox{\hbox{\hskip 20.45438pt\hbox{\hskip 4.0pt\hbox{\scriptstyle c:(\Gamma\vdash\Delta)}\hskip 4.0pt}}\vskip 2.0pt\nointerlineskip\hbox{\hskip 0.0pt\lower-0.2pt\hbox{}\hbox to74.11945pt{\xleaders\hrule\hfill}\lower-0.2pt\hbox{}}\vskip 2.0pt\nointerlineskip\hbox{\hbox{\hskip 4.0pt\hbox{\scriptstyle\Gamma\setminus{x:A}{}{}|{}{}{{\tilde{\mu}}x.c}:A\vdash\Delta}\hskip 4.0pt}}}}\ignorespaces}^{\circ}
We focus on properties about the composition of and . We want to state that and that for any term. But it is not the case, these results hold modulo linear reductions.
Theorem 10.1
**
Proof
By a straightforward induction on . Every cases is obtained successively by expanding definitions LABEL:def:dag-translation, LABEL:def:lm-term-context-cut, LABEL:def:circ-translation and by applying the induction hypothesis. We give the case which uses linear reductions additionally.
- •
if then
[TABLE]
We prove two lemmas before stating backwards that is the identity modulo linear reductions. The first lemma is useful to prove the second.
Lemma 17
**
Proof
By induction on .
- •
if then it is obvious
- •
if then
[TABLE]
The second lemma shows how to map a definition LABEL:def:lm-term-context-cut command.
Lemma 18
**
Proof
By induction on .
- •
if then it is obvious by definitions LABEL:def:lm-term-context-cut and LABEL:def:dag-translation
- •
if then
[TABLE]
- •
if then
[TABLE]
Theorem 10.2
**
Proof
By induction on . We apply definitions LABEL:def:dag-translation, LABEL:def:circ-translation successively and the induction hypothesis. We give a typical case and another which needs either the previous lemma or linear reductions.
- •
if then
[TABLE]
- •
if then
[TABLE]
11 Simulations between and -calculi
We want to prove that the -calculus simulates and is simulated backwards by the -calculus. We focus on the undirected evaluation. Call-by-name and call-by-value are drawn from this.
We begin with the simulation of the by the . The next four lemmas show results of a -substitution after a , , and -reduction. Each proof consists successively of
- •
expanding the -substitution
- •
expanding the definition of
- •
applying the induction hypothesis if necessary
- •
factorising the -substitution
- •
factorising the definition of
We give basic cases and those which use lemmas additionally for any proof.
Lemma 19
**
Proof
By induction on .
- •
if then
- •
if then
- •
if then
[TABLE]
Lemma 20
**
Proof
By induction on .
- •
if then
[TABLE]
- •
if then
[TABLE]
Lemma 21
**
Proof
By induction on .
- •
if then
[TABLE]
- •
if then
[TABLE]
Lemma 22
**
Proof
By induction on .
- •
if then
[TABLE]
Theorem 11.1 (simulation of the -calculus by the -calculus)
[TABLE]
Proof
By cases on .
- •
if then
[TABLE]
- •
if then
[TABLE]
- •
if then
[TABLE]
- •
if then
[TABLE]
- •
if then
Corollary 5 (call-by-name case)
**
Proof
By cases on and -rules.
is -reduced in call-by-name without any restriction. It is simulated in the -calculus by a -reduction. The latter is in call-by-name without any restriction too.
is -reduced in call-by-name without any restriction. It is simulated in the -calculus by a -reduction. The latter is in call-by-name if is a stack. It is the case by definition LABEL:def:dag-translation.
Corollary 6 (call-by-value case)
**
Proof
By cases on , and -rules.
is -reduced in call-by-value if is a value. It is simulated in the -calculus by a -reduction. The latter is in call-by-value if is a value. It is the case by the definition of .
is -reduced in call-by-value if is a value. It is simulated in the -calculus by a -reduction. The latter is in call-by-value without any restriction.
is -reduced in call-by-value without any restriction. It is simulated in the -calculus by a -reduction. The latter is in call-by-value without any restriction as well.
The -simulation by the -calculus requires preliminary lemmas showing that commutes over and -substitutions. Each proof consists of
- •
expanding the -substitution
- •
expanding the definition of
- •
applying the induction hypothesis if necessary
- •
factorising the -substitution
- •
factorising the definition of
Lemma 23
**
Proof
By induction on .
- •
if then
- •
if then
- •
if then
[TABLE]
Lemma 24
**
Proof
By induction on .
- •
if then
[TABLE]
- •
if then
- •
if then
Theorem 11.2 (simulation of the -calculus by the -calculus)
[TABLE]
Proof
By cases on .
- •
if then
[TABLE]
- •
if then
[TABLE]
- •
if then
[TABLE]
- •
if then
Corollary 7 (call-by-name case)
**
Proof
By cases on , and -rules.
is -reduced in call-by-name without any restriction. It is simulated in the -calculus by a -reduction. The latter is in call-by-name without any restriction too.
is -reduced in call-by-name if else it were -reduced. It is simulated in the -calculus with the help of lemma LABEL:thm:lm-cut-subst. The latter is in call-by-name if i.e. if . It is the case by definition LABEL:def:circ-translation.
is -reduced in call-by-name without any restriction. It is simulated in the -calculus by a -reduction. The latter is in call-by-name without any restriction as well.
Corollary 8 (call-by-value case)
**
Proof
By cases on , and -rules.
is -reduced in call-by-value if is a value. It is simulated in the -calculus by a -reduction. The latter is in call-by-value if is a value. It is the case by definition LABEL:def:circ-translation.
is -reduced in call-by-value if is either a -variable or a context of the form where is a value or a -abstraction by the definition of . It is simulated in the -calculus with the help of lemma LABEL:thm:lm-cut-subst. The latter is in call-by-value if is a value in a context of the form i.e. if is a value in a context. It is the case by definition LABEL:def:circ-translation.
is -reduced in call-by-value if is a value. It is simulated in the -calculus by a -reduction. The latter is in call-by-value if is a value. It is the case by definition LABEL:def:circ-translation.
12 Conclusion
Analysis of the and -calculi has shown their computational equivalence. It holds for undirected evaluations of pure calculi (see theorems LABEL:thm:lm-lmm-simulation and LABEL:thm:lmm-lm-simulation). This result is then easily obtained for call-by-name and call-by-value evaluations (see corollaries LABEL:thm:cbn-lm-lmm-simulation, LABEL:thm:cbv-lm-lmm-simulation, LABEL:thm:cbn-lmm-lm-simulation and LABEL:thm:cbv-lmm-lm-simulation). It concerns the simple type system too (see lemmas LABEL:thm:dag-type-compatible and LABEL:thm:circ-type-compatible).
The simulation of the -calculus by the -calculus is smoother than the simulation of the -calculus by the -calculus. The first is obtained with the help of linear reductions whereas the second is obtained with the help of linear expansions.
This work can be extended in three ways. The first consists of proving the same results for the call-by-value evaluation of the -calculus defined in [[@@bibref{}{OngStewart97}{}{}], cite]. The second consists of defining CPS translations to -calculus in order to complete [[@@bibref{}{CurienHerbelin00}{}{}], cite]. The third consists of extending the type system to the other logical constants.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[Curien and Herbelin, 2000] Curien, P.-L. and Herbelin, H. (2000). The Duality of Computation. In Proceedings of the International Conference on Functional Programming .
- 2[1]
- 3[Dougherty et al., 2004] Dougherty, D. J., Ghilezan, S., and Lescanne, P. (2004). Characterizing strong normalization in a language with control operators. In Proceedings of the 6th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming , pages 155–166.
- 4[2]
- 5[Gentzen, 1934] Gentzen, G. (1934). Investigations into Logical Deduction. In Szabo, M., editor, Collected Papers of Gerhard Gentzen . North Holland.
- 6[3]
- 7[Griffin, 1990] Griffin, T. G. (1990). The Formulae-as-Types Notion of Control. In Proceedings of the 17th ACM Symposium on Principles of Programming Languages , pages 47–57. ACM Press.
- 8[4]
