HAL Id: hal-00384683
https://hal.archives-ouvertes.fr/hal-00384683
Submitted on 15 May 2009
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entic research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diusion de documents
scientiques de niveau recherche, publiés ou non,
émanant des établissements d’enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.
A lambda-calculus with explicit weakening and explicit
substitution
René David, Bruno Guillaume
To cite this version:
René David, Bruno Guillaume. A lambda-calculus with explicit weakening and explicit substitution.
Mathematical Structures in Computer Science, Cambridge University Press (CUP), 2001, 11 (1),
pp.169-206. �10.1017/S0960129500003224�. �hal-00384683�
Under consideration for publication in Math. Struct. in Comp. Science
A
-calculus with explicit weakening and
explicit substitution
R E N
E D A V I D
1
and B R U N O G U I L L A U M E
1
;
2
y
1
Laboratoire de Mathematiques
Universite de Savoie
F-73376 Le Bourget du Lac Cedex
2
Laboratoire de Recherche en Informatique
B^at. 490 - Universite Paris SUD
F-91405 Orsay Cedex
Received 3 April 2000
Since Mellies has shown that
(a calculus of explicit substitutions) does not preserve
the strong normalization of the
-reduction, it b ecame a challenge to nd a calculus
satisfying the following prop erties: step by step simulation of the
-reduction, conuence
on terms with metavariables, strong normalization of the calculus of substitutions and
preservation of the strong normalization of the
-calculus. We present here such a
calculus. The main novelty of the calculus (given with de Bruijn indices) is the use of
labels
that represent updating functions and corresp ond to explicit weakening. A typed
version is also presented.
Contents
1 Introduction 2
2 Preliminaries 4
2.1 Rewriting 4
2.2 The
-calculus with de Bruijn indices: the
db
-calculus 6
2.3 The
s
-calculus and the
s
e
-calculus 7
3 The calculus with explicit weakening:
w
9
3.1 Terms with lab els 9
3.2 The
w
-calculus 10
3.3 Simply typed
w
-calculus 10
3.4
w
versus
db
11
3.5 Conclusion:
w
versus
db
13
4 The
ws
-calculus 14
4.1 Syntax and reduction rules for the
ws
-calculus 14
4.2 Typing rules for the
ws
-calculus 16
4.3 Link with the
s
e
-calculus 17
y
This work was done at Universite de Savoie and was nished in Universite Paris SUD.
Rene
David
, Bruno
Guillaume
2
5 Strong normalization of the calculus of substitutions 17
5.1 The substitutive contexts 17
5.2 Simulation of the
ws
-calculus in the
p
2
-calculus 19
5.3 Strong normalization of the
p
2
-calculus 20
6 Conuence on open terms 22
6.1 The calculus with metavariables 22
6.2 Conuence of the
ws
o
-calculus 22
6.3 Conuence of the
ws
o
-calculus 22
7 Simulation of the
-reduction 28
8 Preservation of strong normalization 29
8.1 Sketch of the pro of 30
8.2 Denitions 30
8.3 Preservation of innite reductions by propagation 32
8.4 Proof of the key lemma 37
9 Conclusion 38
References 39
1. Introduction
Calculi of explicit substitutions are useful tools that ll the gap b etween the meta op-
eration of substitution app earing in the
-reduction of the
-calculus and its concrete
implementation.
The most natural property such calculi have to satisfy is the simulation of the
-
reduction (SIM): every
-reduction can be done in the new calculus and conversely this
calculus do es not introduce other reductions.
To have a go od implementation of the
-calculus, it is also natural to ask that no innite
reductions are created by the use of explicit substitutions. This is called the preservation
of strong normalization (PSN). Mellies gave in (Mellies, 1995) a simply typed term with
an innite reduction in
. This counter-example shows that
has not PSN.
Another important property is to have the conuence on terms with metavariables
(MC): in proof assistants or theorem provers one has to consider pro of trees with some
unknown subtrees. To represent these pro of trees,
-terms with metavariables (corre-
sponding to unknown parts of the tree) are necessary. The conuence on usual (closed)
terms is easy to obtain but MC is much more dicult.
Since Mellies gave his counter-example, many calculi have b een prop osed but none of
them satises simultaneously SIM, PSN and MC. Figure 1 gives some of them and their
properties.
In order to satisfy b oth SIM and MC, rules for the interaction b etween substitutions
are necessary. These rules are resp onsible for the lack of PSN in
and
s
e
. In
d
and
n
, a weaker notion of composition is used and thus PSN is satised, but these rules
are not strong enough to get MC.
The
s
-calculus is the most natural calculus of explicit substitutions: it is the
-calculus
(with de Bruijn indices) where the substitution (
i
) and the updating (
k
j
) have b een
A
-calculus with explicit weakening and explicit substitution
3
SIM PSN MC
without
(Benaissa et al., 1996) Yes Yes No
interaction
s
(Kamareddine and Ros, 1995b) Yes Yes No
(Mu~noz, 1996; Mu~noz, 1997) Big step Yes Yes
(Abadi et al., 1991) Yes No Yes
with
s
e
(Kamareddine and Ros, 1997) Yes No Yes
interaction
d
(Ferreira et al., 1996) Yes Yes No
S K I nT
(Goguen and Goubault-Larrecq, 1999) Yes Yes Yes
Fig. 1. Calculi of explicit substitutions and their prop erties
internalized. The
s
e
-calculus is obtained by adding new rules for the interaction of
substitutions. This set of rules is the minimal one to get MC but unfortunately,
s
e
does
not satisfy PSN (Guillaume, 1999a).
In the following example, the
-reduction is done in two steps: rst, the reduction of
the
-redex and the propagation of the substitution and then, the propagation of the
updating function. The
h
1
i
in the middle term means that the free indices in the term
below must b e increased by 1. This corresponds to the function
1
0
in
s
e
.
Example 1.1.
@
@
@
@
@
0
1
@
@
2
@
@
1
0
-
@
@
1
@
@
h
1
i
@
@
0
1
0
-
@
@
1
@
@
@
@
0
2
0
The rules for the propagation of the updating functions are resp onsible for the lack of
PSN in
s
e
(Guillaume, 1999a). The key idea of our calculus is to keep the information
about up dating in terms rather than to move it down. In others words, we decide that
(in the example ab ove) the \right" reduct of the term is the second rather than the third
one.
Recently, another solution which relies on a translation of
-terms into sequent combi-
nators has been proposed (Goguen and Goubault-Larrecq, 1999). Goguen and Goubault
introduce a rst order calculus (named
S K I n
) on the set of terms dened by:
t
::=
x
j
I
m
j
K
m
(
t
)
j
S
m
(
t; t
)
where
I
m
,
k
m
and
S
m
are generalizations of the usual combinators
I
,
K
and
S
. The
translation of the
-term
t
in
S K I n
is written
t
and the reverse one [[
u
]] for any
S K I n
-
term u. They show that
t
!
u
implies
t
!
+
S K I n
u
but conversely, they only have
that
t
!
S K I n
u
implies [[
t
]]
!
[[
u
]]. Unfortunately, with an example a la Mellies,
Rene
David
, Bruno
Guillaume
4
they show that
S K I n
is not strongly normalizing in the typed case and thus that it do es
not have PSN.
To recover the PSN, they dene the
S K I nT
-calculus on the same syntax but with
less permissive rules. This second calculus has the exp ected properties (including PSN)
but the relation with the
-calculus is more complicated than for
S K I n
. The logic
behind
S K I nT
is a fragment of the mo dal logic S4 called
near-intuitionistic logic
. The
corresponding notion of \
-calculus" is a closure calculus (named
clos
) which is an
extension of call-by-value (CBV)
-calculus. The
-calculus is translated in
S K I nT
in
the following way: rst, encode the
-calculus in the CBV
-calculus (using for example
a continuation passing style (CPS) transformation), then use a translation from
clos
to
S K I nT
. Denoting by
L
(
t
) the translation of the
-term
t
in
S K I nT
, they prove:
|
if
t
!
u
then
L
(
t
)
!
S K I nT
L
(
u
);
|
t
and
u
are convertible if and only if
L
(
t
) and
L
(
u
) are convertible in
S K I nT
.
The pap er is organized as follow: we rst introduce the
w
-calculus (section 3)which
is the usual
-calculus (with de Bruijn indices) where terms may contain lab els
h
k
i
, then
we give the
ws
-calculus (section 4) which is obtained from the
w
-calculus by making
the substitutions explicit and by adding rules for interaction b etween substitutions.
The sections from 5 to 8 are devoted to the pro ofs of the main prop erties of the
ws
-calculus. The most innovative section is the last one where the PSN is proved.
Warning:
This pap er is the complete version of the extended abstract presented in
WESTAPP'99 (David and Guillaume, 1999). There, the
ws
-calculus was called
l
(
l
for
label).
2. Preliminaries
We give here some denitions and useful lemmas ab out rewriting systems. We also recall
the rules for the usual
-reduction on
-terms with de Bruijn indices and the explicit
substitution calculus
s
e
.
2.1.
Rewriting
Denition 2.1 (Abstract rewriting systems).
Let
E
be a set of terms and
R
be
a set of rewriting rules. We denote by
!
R
the binary relation on
E
dened by the
contextual closure of the set of rules.
We also write
!
R
(resp.
!
+
R
) for the transitive and reexive closure, (resp. transitive
closure) of
!
R
.
Denition 2.2 (Normal form).
We say that
t
2
E
is an
R
-normal form if there are
no terms
u
such that
t
!
R
u
. The set of
R
-normal forms is denoted by
NF
(
R
).
Denition 2.3 (Normalization).
|
A term
t
2
E
is strongly normalizable if there is no innite
R
-reduction of
t
, i.e.
if every sequence
t
!
R
t
1
!
R
t
2
: : :
is nite. The set of
R
-strongly normalizable
terms is denoted by
SN
(
R
). If
SN
(
R
) =
E
, we say that the reduction
R
is strongly
normalizing.