though semantically correct ). The intuition should be clear: since the shared ..... implementation of (a vari- ant of). Lamping's algorithm: the. Bologna. Optimal.
On the
complexity Andrea Dipartimento
P.zza di Porta
Abstract We
that
the
reduction
ponential
complexity
technique
in
the
from
of
for
number
this
sure for what plexity”
5, Bologna,
the
of
Lamping’s
as “the
Lamping’s
a new mea-
intrinsic
sified
com-
graph
in two
1. the
of A-terms.
rules
nodes
Twenty
years
redez
famikj
sharing
the
provide
of A-term
a lower
1990,
resentation,
and
step).
However,
plexity
relation
the
reduced tradict
along
family
neither in view
of fact,
the
exponential, with
family
to the propose
more
“intrinsic
comof
fact
does not
(as a mat-
the
that
~opyright
is
by
permission
of
and
ACM,
[GAL92a,
each other
just
Inc.
copy
brackets
required
for
requires
interaction
of this
between
appealing
proposed
in
the
As94,
since
literature
As95]
the oracle perform
a
can be seen as
oracle.
particularly
GAL92b,
an “oracle”
rule
set of rules
the
all after
differ
from
is implemented exactly
the
(in
same
set
we shall
prove
that
exponential
considering
the
Lamping’s
technique
its
abstract
algorithm,
work
required
by the
in
extra
or-
acle. For this nique
reason,
without
we shall
introduce
mentioning
the
implementation
Initial
2.1 Initially, A-term
To
~-
group
reductions).
already
without
(square
set of rules
all of them
paper,
be
nodes
set of rules.
in the way
the sense that
this
here possible
of the
Lamping’s solution
techto
the
oracle.
of
we shall
measure.
the
Lamping
effective
bound
Permission to make digital/hard copies of all or part of ttda material for peraoml or classroom use is granted without fee provided that the copies are not made or dtatributed for profit or commercial advantage, the copYright notice, the title of the publication and its date appear, and notice is given
translations
for
of the first
second
looks
call
are merely
implementation
distinction
In this
control
correct
the
and
responsible
techlenght
lower
of J-terms,
is
better
implementation that
its
algorithm
the
different
can
con-
nor
it works
a reasonable
complexity
families
algorithm,
where
we claim
is not
can be
of redex
Lamping’s
traditional
This
clas-
abstraction
are
(we shall
wh~ch
the first
of fan-nodes;
of abstract
implementation
complexity”
a different
atomical
the lenght
precisely,
be naturally
algorithm);
application
an effective
rep-
any
technique
of the
where
contrary,
reduction
and
This
optimality
examples
the
graphical
a single
to the number
of an actual
to
On
graph
abstract involving
discriminate
pair
L&Ty ’s sense
establish
Lamping’s
are also the examples
respect
niques).
in
not
computation.
the
to
reduction. that
respect
the
in
his algorithm
we prove with
relevance
the
between
paper,
exponential
be reduced did
More
complexity
that
duplication
croissants),
correct
As
reduction
a complex
optimal
had a unique
Lamping
corresponding
In this
ter
redexes
AL93]).
the
rules
and
implementation.
discovered was
2. some
of
of optimal
intrinsic
any possible
that
could
[Le80,
notion
of the family
to the
[Lam90]
is, all sharable
idea
also
length
bound
technique
the
intuitive
(see
in
Lamping
introduced
the
the
reduction,
reduction
[Le78]
J-calculus
consequence,
would
(that
L&Jy
formalize
to
in
a main
In
ago,
can
application,
(fan),
and
of rules
rules
groups:
involving
sharing
Introduction
rewriting
main
reduction
1
reduction
technique
optimal
reductions.
we propose
be considered
graph
can be ex-
L6vy ’s family
consideration,
could
Lamping’s
A-calculus
Italy
unibo.it
2
prove
Starting
Asperti di Matematica
S. Donato
asperti@cs.
graph
of beta-reduction
orheruk%
to republish, to post on servers or to redistribute to lists, requires apecitic permission andlor fee. POPL ’96, St. Petersburg FLA USA @ 1996 ACM @89791 _769-3195\Ol ..$3 .5(3
tree main
in
the
optimal
is essentially
(like
2. we shall nected
graph
reduction
represented
in ordinary
differences,
1. we shall
110
translation
graph
by its
reduction).
technique, abstract There
a
syntax are
two
however:
introduce suppose to their
an explicit that
node
variables
respective
binders.
are
for
sharing;
explicitly
con-
For
instance,
the
representation two=
Jz.Ay.
The
All
variables
(we shall
the connection of a same edge
node
in the
to
respective
Since
fans, its
fan)
the
binders
on the left
multiple
by
where
where
to express
connection
shared
(ports)
initial
6),
of a same variable.
their
this
(Cl, J and
sites
is used
a J towards
graph
tinguished other
are
leaving
(two
z).
it fun)
to the body).
is the
=
occurrences
represent
variable
single
call
connected
always
l.(l)
M
and6=Az.(m
different
are
Figure
A-term
(we shall
between
in
the
(z(zg))
triangle
sharing
graph
of
we shall
have
variables.
a
So, each
has exactly
it will
of
occurrences
three
dis-
be connected
with
ports. (1)
(3)
(2)
k 2.2
I
Reduction
We
shall
now
optimal simplified
term
comes not ing’s
@.
algorithm
As
unresolved.
in:
however,
necessary algorithm,
ideas
of
by
showing
would
we shall
see,
This
is exactly
the
complexity
since
to prove
main
technique
of the
(two
remain
the
reduction
version
sample will
illustrate
graph
the
we shall
issue
the oracle
of the
this
A
a
on our
a crucial
nature
discuss
how
work
where
exponential
not
Lamping’s
oracle
is
of Lamp-
complex
topic
here. Lamping’s
algorithm
rewriting
rules.
we can
usually
consists
At
of
a set
a given
stage
several
reducible
have
of
of the
local
~
graph
(6)
(5)
(4)
computation,
I
configurations
in
!“ /
the
graph.
In
ply
is made
ter
that
this
the
choice
non-deterministically.
much,
Interaction
since
Net
fies a one-step confluence
case,
in
the
but
This
graph
Lafont’s
diamond also
sense
rule
does
rewriting (that
if a term
not
ap-
/1
matis an
and
satis-
it
implies
has
to
system
[Laf90],
property
that,
of next
not
,, ,,, ;,
only
a normal
.. . .
$
/“ ..
~,,
‘/ . . . . . .Y’
f ,,,’
all
normalizing
particular, example (and
derivations
we shall of reduction
sometimes
The
most
ously
redex
is fired
in the
this
local
link
graph shared
in
graph
rewriting the
Figure
~-expression,
duplication
of 6.
1.(2).
rules
In graph
Y
t ,,?’ %.. .
J
term
the
application) function. and
in Figure /3-redex
we must
the
N.
(7)
More-
Figure
1: Graph
reduction
becomes do not
by the
the play
to the@ completely
2.
in
(two
next
eventually graph
(9)
(8)
the
Since
corresponding
be expressed
Since
N
!!?
re-
before
of the M
is obvi-
iV amounts
application
M
In ordinary
; :b: :, .,
criterion
rewriting
above
rule
outermost
In in our
M [N/z].
to the
by the
reduction can
rule
z for a term
representing
reduction
graph firing
+
the variable
body
of graph
role
rule, By
(the
(instantiated)
portions
N)
returned
length).
next
A
~, $,,
convenience).
a variable
connect value
same
the
to a didactical
of the graph (ku.itf
substituting the
any
graphical
important
to explicitly over, the
for
the
choose
according
/3-reduction:
duction,
have
usually
7
.. .. .
form,
6),
redex
we get involves
proceede
reduction,
the a
to the this
Figure
du-
111
2: the @-rule
of (two
6)
plication
would
on the
shared
timal
piece
graph
lazy
way,
body.
from
binder
works
as an
picted
upside-down
fan(-in) body
the
since
the
function
reduction,
it
still
step
point
op-
shall
the in
its
able
against
the
must
the
ure
of the
functionl.
does
not
Since
play
any
the
fans
is to be “paired”
role
have
duplicate 5.(2).
interaction 3. Let
can
between
us now
be formally
expressed
in the
analysis
in
fans
nothing
of the shared
according
we have
#b
.’.
cd
cd
cd
in Figure
of our
example.
d
(2)
Figure interaction
in front case,
By
applying
the fan-a
in Figure and
1.(3).
by
their
1.(5).
We
no fan-a cation
interaction
Now,
firing have
two
more
interactions, process,
particular,
lead
have
,@redexes
we must
following
in
been in
the
graph,
4: not
forbidden, though
optimal
in the
optimal
semantically
carefully
clear:
since
the
some
redex,
its
cution
of the
The
only
fans
inside
shared
).
of the
The
would
possible
the
dotted
Figure rule
such
of two After
application (al-
should
be
could
be involved a double
is between
from
unshakable
and
there
is no
their
intutive
a fan-out,
ular,
keep
in
with
some
fan-in
ing is
its
definition
formal
lar,
is solved
definition obscure the
obvious
the
graph, The
a crucial by of of
the the the
intuitive and
naive
distinction
semantics
a fan-out
the
effect.
determined
precise
that in
sharing
technique,
just
mind
operational
in
case, both
long
to the
now
(locally)
ure
two
is always
the
point
of
“oracle”.
oracle, natnre idea
different;
supposed
delimiting
way
abstract
is quite
its
correct the
optimal
Obviously,
that of
is the
of labeling
to
scope
and
pairing
algorithm
a fan-in
we very abstract fans
paired
to
and In not
the
of fans
paired
they
l.(7).
both
that
obvious
fans,
application.
in Figure
process”, So, the
the
the
are paired:
“duplication
completed.
for
graph
existence
has
rule,
according
be~ been
in
this
to Fig-
problem meet
of deciding
each
other
is established)
a double
in Figure
application that
rule
is the
is the
technique
1.(9),
which
(that
crucial (solved
of this
to apply
question point
is in normal
oracle).
we get
form
two theii
of the optimal
by the rule,
when
of how
the
graph
w.r. t. Lamping’s
algorithm.
fans
give
provide
rules.
redexes
sharing
the
reduction
order
complex
does
be
ween
graph
should
partic-
annihilat-
bet
in
in
of)
of optimal
implies
5.(l).
fans
By
of view
we get
pairs
same
The
pairing
crucial
between
rule,
interaction
already
(class
this
implementation 1 Although
the point
case, is to annihilate
exe-
the
is another
6: fan-@
a configuration
firing
In this
technique
This
is correct
since
imply
interaction region.
this
In
redex.
other
In this
Intuitively,
is strictly
intuition
application
duplication
application.
rule:
dupli-
here.
rule
imlementation
correct
of the following
and
in the
rewriting
duplication
the
Figure
x-w Figure
function-port apply
rule
created,
graph
proceede
be very
graph
of the
we can
5: fan-annihilation
we get the graph
to the
so we must
but
the
/?-redexes
we are
no
rule,
they in Fig-
a fan-out
sb
[1)
3: Fan-A
Since
other,
to the rule
l.(6)),
shared
6.
each
are vari-
of the
of duplicating
to do with
(see Figure
1. (’7).
1.(5)
in
e
Figure
Figure
is a residual
process
we
a differ-
in Figure
is a residual
fan-out
As
in
as a local
a fan and a }, as described
proceede
two
each other,
Now
technique.
be handled
interactions the
in the
ab
this
similar that
of 6, while
two
reduction must
the fan-in
of two,
the
Ax .M
the
variable
de-
body
form
fan
usually
graph
interaction
“paire&:
(fan-out,
operator
optimal
in particular
not
edge leadthis
way
Note
duplicated,
In a sense,
of the see, this
ent
a more
sharing
been
fan on the
variable.
), that
sharing
has
another
%nsharing)’
contrary,
A but
binder
to the
of the
the
global
proceedes
external
the
to introduce
the
On
technique
duplicating
However,
as a umque,
of graph.
reduction
we are forced ing
be performed
a
3
complexity
the would
Before
discussing
the
stract”
algorithm,
we should
complexity
of
Larnping’s
“ah:
particuwork
(see
liminary
[Lam89]).
112
assumptions.
First
start of
by fixing all,
a typical
a few
pre-
feature
of optimal could
techniques
become
A reasonable is that mal
way
obviously
term
P =
M “cost”
the
size
convincing, its
in Lamping’s redexes),
in
would
Our
of the
duplicated, proportional does
we
and to
not
also
seem
duplicated
prerequisite
chains,
(whenever
belong
assumption
~-I
turned
to distinguished
work
will
calculus.
handling
The
that
is still
Lamping’s
be to
reason,
of garbage
techniques lar,
fully
which
anticipated
instance
P to a closed
had
Figure
to
7: two’:
a representation
of Church’s
integer
fam-
to be done
casez.
second
rect
for
a
some
seem
(its
nor-
prefer,
us to avoid
M
nodes
eventually
you
reasoning
duplicating
terminology),
So, we just
in any
gets
work
whose
Consider
this
application
if
allows
would
However,
“extra”
If we apply
M
@redex
since
A and
ilies!
form,
of the of M.
also
(y z z).
this
(or,
that
computation.
to A-terms
examples.
Az.Ay.
in normal
the
account
analysis
hypothesis
work
on in the
constant
degene~ate
term
into
the
atomic
This
of anticipating
later
to take
is an
variable).
all
only
of restricting
form
the
is that
usefull
consider here,
collection
a subject
approach
only
is that
in optimal
cor-
reduction
of investigation
does not seem
terms
the
(in
particu-
to be completely
satisfactory). We shall
now
provide
our
assumptions,
out
considering
exponential
the
Let
a few
us start
sible ing
of the
obtained
(h.(z(z
y))
(n m)
of two
integer
mn,
of)
church
the
in Figure After
these
subterm
2 steps
of fans After ure
where
dence.
Firing
uration
in
2 The
idea
in
evidence
predictable all
copies
not
fired
ently)
of
of
useless
the
=
the
the
The
the
reduction steps with
Jy. (z(z fan
church
is shown
the
term
y))
is shared
in Fig-
“ a“.
process
effacing
by
Now,
requires:
the application; for
(3)
(2)
are ,d-redex.
marked
This
(1)
application
2 steps
all residuals
“ a“. left we
only
fans chains
computation,
inside
rules
a
which
“virtual”
could
by
put final
in
Fig-
in
evi-
config-
we executed
problems
generated we
the up,
some
graph
been
obtain
those
gives
the
has
Summing
redexes of
with
~-redex
redex,
considering
prerequisite
along
two’
consider
is (a representaion
3 steps
8.(5).
disposition
that
reduction
we are
this
new
in shar-
l-term
m gives
of the
a new
Figure
two’
7 is a postwo
result
the A and
with
two’
by con-
n and
duplicated.
7 steps
8.(4),
put
copies
the fans;
marked
Recall
sub term
is fully
these
Let
we are left
the
Figure
Integer
us now
first
for duplicating
for duplicating
In
w)).
four.
two
two
//&~
Since
proceede
the
integers
reductions
of the
with-
is already
reductions.
reducing
expected
integer
where
case.
to itself.
church
8. The
8.(3),
means
~w.(z
so the
oracle)
we shall
Church
by
of two’
(i.e.
terms.
representation
application
this
auxiliary
a simple
kc.~y.
of the
complex,
satisfying
reduction
of family
with
graphs,
ure
cost
number
is quite
of a A-term
“abstract”
extra
in the
the example sidering
an example
whose
are due
needed to
redex: the
perform
3
duplication some
the
(4)
(5)
to
Figure
un-
again,
if are
(appar-
work.
113
8: the
reduction
of (two’
two’)
two
/3-reductions
(actually,
interactions.
Note
has the
shape
Let
same
us now
be clear, graph
the church
Figure
of length
out
of the
Let
us now
outermost
same
fans
example.
As should
2n can be represented we have
marked
plication
with
exactly
effacing
by the
a sequence
ure
2 steps
2n steps fans.
After
of
“ a“ is now
requires:
application;
9: a representation
n and
7 fan-
configuration
one.
previous
integer
and
the final
initial
the
9, where
reductions), that
of the
generalize
in Figure
fan-in
family
moreover
these
This
duplicated.
duplicating
for duplicating
gives
a total
reductions,
the
fans;
n+2
This
du-
A and
the
steps
for
of 4 + 3n operations.
we get the
11. A new fl-redex
has been
configuration created.
in Fig-
13y firing
this
of 2n
a corresponding
sequence
of fan-
length.
apply
this
~-redexes
term we get
to itself.
By
the
in Figure
term
firing
the 10.
two As
Figure
redex
11: the
we obtain
has the
same
can iterate 3* (2n)
our
we shall
quences Summing
case of two,
the
reduction
portion
of (2n 2n)
of graph
inside
given the
two
4n (this
process),
is decremented up,
the
the
this
require same
sequences
is doubled
at every
of the
4 +
/3-redex,
innermost length
we
duplication
a new
of the
graph
10, and
shape of fans
iteration
outermost
se-
by one.
total
number
of fan-interactions
by.
({4+3n)+(4+3*(2n)
114
length
while
now
have
get a graph
the
the
will
we shall
where
length
12. Now, in Figure
of the graph
Then,
and by its firing, 12 but
graph
In particular,
of Figure have
10: the
part
of (2n 2n)
in Figure
of the
reasoning.
operations.
of the
Figure
reduction
the graph shape
of the innermost
in the
fully
for
)+(4+3
*(4n))+.
. .+(4+3
*(2n-’n)))
is
the
term
(g n)
is n-1
f(rl)=9+3*n+~bi i=o Finally,
let
For each teractions in the
us consider
application
the
for duplicating
reduction
Moreover,
bn final
operations
for
1 + 4 + 3 * bi in-
bi + 3 * b,+l
(recall
one single
5 * (n – 1] operations
of fan-interactions.
we have
a,, plus
of (a~ ai)
we have
external
number
of (6 ai),
that
operation
creating
all
of fan-effacement
operations
b~+l
=
bi * 2b~).
internal
to two’,
copies
of 6, and
when
we apply
the
parameters.
Summing
up,
the
n > 0) is given
number
by the
c(n)
of fan-interactions
n-1
c(n)=
(for
formula n
10*n–4+4*~bi+
3*~bi+bn i=O
i=l
n—1
= 10*n+7* Figure
12: the
reduction
~bi+4*b.
>4
*b.
2=1
of (2n 2n) Note
now
2~::01
that
b’ = b..
So,
n-1 =
4n+3n*~2i
=4n+3n*(2”–1)=
n*(3*2n+l)
i=o In contrast, main
we have
loop,
plus
n + 2 family Our
executed
two
at the
just
very
problem
on the
above
mentioned
in which
mal
form
is an atomic
constant).
The
term
we consider
is:
be a term
two’
kz.Ag,
Az.(fiz),
teger,
and
in the
succession Let When
we perform
9 family for the
compute the
puted that
for
each
ao =
to the
2; ai+l
=
consider
application
(one
the
cost
number
for
each
succession
as b. =
l; bi+l
Summing
up,
= bi*2b; the
reductions
section, b~ =
number
function
Jog(u,
namely ) can
n z 3)
also
O%
side we have
;ne
~i~O
hi
5
easily
h.
prove
and
c(n)
For
that,
2ff”l
for
any
n, c(n)
> 29* b~. On the
obviously
n s b.,
s
2f(n~.
other
side,
so
< 21 *bn
< 29 *b~
< 2f(n)
instance, The
g. Let of (6 ai).
ant
of)
a simple
are
This
lists
2 + log(ai).
is
and
com-
tension
Note
tially
defined ~(n)
based
3 BOHM
for
tar
115
basic
format).
asperti.
anonymous the
file
source
with
ftp BOHMI
Optimal [AGN95]
is
language
is
booleans, data
to this
and Laneve’s
Get
of (a vari-
BOHM
on these
technique
by
experimentally
Bologna
in C. Its
enriched
operations
is available
also
the
written
on Asperti
/pub/
been
(BOHM)3.
A-calculus
of Lamping’s
directory
reductions
Higher-order
implementation
algorithm:
Machine
interpreter
a sugared
have
prototype
Lamping’s
us now
(ai ai)
Optimal
formulas
by our
Higher-Order
to two’,
operations
Bologna
previous
confirmed
O,
application
be equally
The
Machine
of family integer
the
3.1
. of family
any
We can
in-
integer
for
(for
I is
of view.
internal
These
application
of family
where
point
Church for
c(n)z.
(n 6 two’)
number
of O, three
n of the
1 q),
nor-
church
a~i.
the
g to the
reductions
in the previous the
complexity
Hence:
section
whose
term
b: < 24*
< 2s*bn.
auxiliary
Aw. (m w)),
to q. The
we apply
input
y))
< 28*
29+3”
of
If n is a church
for the extra-identities).
constant 1 plus
(Az. (z(z
the
us now
our
An. (n 6 two’
constant.
from
reductions.
and three
2f(nJ
that
example
of this
J-I-calculus,
of n, it corresponds
a3 = 256256.
of g, two
g =
reduces
“monster”,
As a function an,
=
satisfies
of the
q is some
(g n) obviously
is a real
a total
an
beginning
it should
identity
providing
at the
(i.e.
the
in the
for
and finally
consists
terms
assumptions
6 =
n @-reductions
beginning,
reductions.
final
based
For n z 3, it is easy to show
types.
The
language
work at
integers,
ftp
ex-
is essen-
on Interaction .cs.unibo.it,
.O.tar.Z
in
(compressed
the
Systems tors
[AL93b].
In
are represented
are
divided
duction ing)
into
BOHM
is,
of the
it
stops
graph
lazy
Due
to
cially tal
(in
the
sense
as soon
total
number
of the
vious
a large
garbage
section
been
espe-
the
of
collection, 13.
The
are
so on).
The
The
g of the
pre-
of the
with
the
Input
user
tot.
inter.
fam.
fan-inter.
the
0.00
s.
38
9
2
(g one)
0.00
s.
64
13
18
(g two)
0.00
s.
200
18
66
(g three)
15.90
s.
2642966
29
looks
function
g
bad times
in the the
table
are,
respectively,
computation
(on
ber of interactions of the the It
family
total is also
the
to
find to
reductions.
prove
that,
ductions
of
for
~(n)
total
“oracle”),
by num-
and
defined
Jn.(n the
this
= 9 + 3 * n),
c(n)
is given
case 1 q).
linearly while
by the
of the
two’
function,
grows
~(n)
of exponential grow
interesting two’
previous
section,
the number
ex-
the
tion
Using of family
to
We
proved
any
table
results ison
with
two
standard
implementations CamlLight tion
such
[LM92]
of a dialect
you
In this
will
find
(respectively, as CamI-Light
is a bytecoded,
of the ML
the experimental
case, we also make
language
strict and
portable (about
a comparand
Yale
lazy)
Haskell.
of the
Haskell
the
In
ten
and
it
compder.
As
experimental
Fibonacci
this
re-
function,
case,
number
Haskell,
as
to
interpreter,
of the
total
is not five
Haskell
the total
number
ing’s
abstract
result
looks
about
the
is not
clear
However,
116
nature.
also
what if
for
ent
for the
of
precisely,
100K
complexity
the
number
of constructor-
the fibonacci
func-
Lamping’s
algo-
that,
how
to
the
number
the
of
term,
a constant),
prove,
of graphs
bound
family
less
reductions
than
that
by Lamp2f.
nothing
along
the
algorithm.
required
since
this to
we conjecture
rules
re-
assumptions
abstract
is alwasy to
our
an upper
called
~ is the
of family
a reduction
This
is known (so,
to use induction).
our In
reducing
we
algorithm
number
under
of reductions
structure
of
the
provide
normalizing
difficult
in
in
M-calculus also
required
implementa-
the
conjecture
should
complexity
n,
of Figure14,
in BOHM.
is always
For
be exponential We
(terms
2+4*2’
More
In the
performance
compiled.
that
can
value for
of families.
its
way.
Lamping’s
number
n (in particular,
of fan-interactions
ductions.
In particular,
implemen-
are when
Discussion
4
re-
rithm
12*n–
to convential
the Yale
are is so
the
is easy
formula
c(n)=
algorithm
of BOHM
in the
a in
reductions
BOHM
is the
interactions.
has been
Lamping’s
in
of sharing
of family
15 we give
obvious
rules
reductions
where
computation
reductions
destructor
number
Figure
power
is provided it
number
in its input
the
in
of family
examples
in the
Haskell
of the
amount
Yale
with
compiled
Yale
a gist
to the
cases,
the
Haskell
17f.
performance
expect:
similar
Lisp.
of fan-interaction
respect
in these than
about
the
of The
dialect
then
of family
is /znear
comparable
an example, sults
SML-NJ.
technique.
cases for BOHM
could
better
is often
the length
interactions),
a /inear
An
h =
technique
required
5), the
the
(app-lambda
respect
J-term
same
time
of fan-interactions.
possible
of family by
reduction
whith
user
a Spare-station
(comprising
number
plosion
the
also
as one
give
number
with
worse
and Lisp
amount
cases
algorithm
However, 13: The
should
the
better The
abstract Figure
the
where
tations.
per-
University.
We used
Common
related
also
amazingly
8292
than
Lisp
Lisp,
number
in
cases
are
a bytecoded
of Common
reduction
is exponential the
the
implementation
in a small
into
test
the
So,
slower
Compiler.
relative
to
term.
for PC
the
for
at Yale
on top
graph
respect
times
a complete
on CMU
computation (g zero)
runs
of the
In general,
columns
is
Lisp
optimal
IBM
dimensions, good
developed
translated
built
results
five
and
INRIA-Rocquencourt
limited
is written
which
underlying
Y2 .3b-v2
four
[Ya94] language
programs
of bytecode
v. O.5.
compiler
interactions,
and
function
in figure
Haskell
the
is quite
about
Haskell
by the
system
at
of its
CamlLight
to Scheme
of experimenand
spite
100K
Macintosh
developed
In
Haskell
(user
kinds
of the
are shown
Yale
the sup-
has
number
different
computation
in
as streams.
computation
of
allocation,
results
node BOHM
the
of CamlLight
We used
(that
another
for
implementation:
the
weak
top
BOHM
available)
(France).
rewrit-
reduces
and
as the
such
to each
also
re-
and
versions
formance
it always redex)
nature,
to provide
and
(graph
As a consequence,
structures,
relative
storage
that
computing
designed
time,
destructors,
system,
compiler,
nodes
pairs.
outermost
prototyping
runtime
opera-
These
interaction
leftmost
data
its
data
and
as a local
is a constructor).
ports
syntactical
constructor-destructor
is lazy
fumily
all
in a graph.
constructors
is expressed
between
particular, as nodes
opinion,
particular,
the
real
the
number
issue
is of
a differ-
of family
reduc-
it
Input
BOHM tot.
user (h one)
0.00
s.
fam. 12
67
s.
119
15
38
0.00 s.
0.02 s.
204
18
66
0.00 s.
0.18
S.
(h four)
0.00
s.
414
21
110
51.04
(h five)
0.00
s.
1054
24
186
1.02 s. ??
s. ??
326
(h six)
0.02
s.
3274
27
0.07
s.
11534
30
594
(h eight)
0.26
S.
43394
33
1118
1.01 s.
168534
36
2154
4.04
664554
39
4214
s.
14: The
useless
fam.
tions, measure
of the
precisely,
75
190
0.00 s.
0.00
(fib
8)
0.02
s.
1991
506
1485
0.00 s.
0.01
s.
12)
0.13
s.
13822
3462
10360
0.01 s.
0.06
S.
0.03 s.
0.38
S.
0.23
S.
3.63
S.
can
be assimilated
(fib
16)
0.80
S.
94913
23723
71190
(fib
20)
4.78
S.
650719
162594
488125
hilation
rules
the
term
and ~ nodes precisely, M
reduces
of the
to perform
tween
of fans.
number
seem
is that
(plus
above
turn
number
to
all soon
rules, fan
~
total in M.
amount
of a possible
number
in other
subject eve.
First
of
all,
as it
was
remarked
support in
our
[GAL92a],
of an applica-
from
the
(that
the loop.
essentially
information
situation),
such
an extra
to choose
back
operation
return
for
have
amounts
in presence
can be easily
implementation
proof
Not
e that, to
relevant
in
different
paths
J
than
117
the
recognised
techniques,
bijective
such
directly
correspondence
discriminants
of a forthcoming
claim. and
of and
teraction)
So, e+j=d+~. to
looping
kterm4.
is a particular
we also
coming
extra
number
the
a discriminant
that
when
the
in
argument
is shared),
this
with
it
between
as en-
Then,
@fl+2*d–2*e-2*~=()
motivations
be-
semantics,
a @-cycle the
operation
typical
4 The
several
the
rule
is no clear
rules
@-cycles
we have
cycle
[DR95],
annihilations
are
time
the
context
annihilation
inside
to save a suitable
number
obviously,
There
the
Rouglhy,
discriminant
Following
and
to /?-redexes.
Using
different
path
unavoidable
proper
derivation,
e be the
nodes
and
fans,
there
correspondence
for
every
(i.e.
respect,
status
that
bijective
Now,
this
is subtler.
to prove in
From
a special
point
ADLR94].
a cycle
More
Let
giving
of looping
tion.
for a term
the
Iikf I be the
and
[AL93, kind
application
or later).
are
to
can be seen as an annihilation
of discriminants
the two
to a constant. in
fans
More
of family
computation
for
second
is possible
be equivalent
fan,
a pair
reason The
of anni-
number
out
reduces
and
numbreduc-
interesting
assumptions,
reductions
abstraction
and
the
our
of duplication rules,
total
of a A-term.
to a constant,
that
the
of family
the total
under
of family
of fan-annihilation of application,
does not
a normalizing
M-calculus
number
d be the
rule
have to be annihilated,
consider
be the
nodes
reasonable
fans
measures
application ~-reduction
complexity
that,
bound
Intuitively,
claim
to count
lower
s.
15: Fibonacci
of a A-term.
of the number
“intrinsic”
Note
complexity
a reasonable
a more
between
reductions). (if
Our
instead
we propose
user
265
algorithm
provide
user
s.
operation.
would
fan-inter.
0.00
complexity
rules,
Haskell
Carol-Light
inter.
4)
does not seem to provide
of these
h
BOHM tot.
Figure
er
function
(fib
- (fib
any
0.00 s.
s.
user
abstract
user
s.
0.00
Input
Lamping’s
0.00
0.00
Figure
“intrinsic”
18
(h two)
(h ten)
tions
user
(h three)
(h nine)
to the
fan-inter.
‘ (h seven)
-
Haskell
Carol-Light
inter.
in
paper this
a static
view
of of
for in
way,
one
we
computing
kind
relate
the
not
number
with
result
notion looks
computing
easy, of
but
will
it
fan-armihilat
the Lan-
(an
in-
particularly
the still
fanbe
Cosimo
a dynamic
This
issues: is
between @l-cycles
collaboration
(et path),
complexity this
different
number
looks ions.
simpler
of
vironment
retical
machines.
Our
complexity
the
tests
measure
we made
of functional
has been
on many
confirmed
available
Computer
RTA’93,
so far by all
[AL93b]
languages.
A. Asperti, practice
port
ical are
a lot
of interesting
optimal
reductions.
provide
a definite
Lamping’s
part
all the for
reduction
quite
sophisticated
of the
oracle
technique. w.r. t.
the
number
have
found
sion
of its
Finally,
of the
so far
(that
the
issues
is to could
A.
Asperti,
Paths
in
munications
of
[DR95]
in
understand
if and
how
Computer
Sci-
To appear
in Theoret-
Danos,
C.
A-calculus:
wzthoui
Laneve,
three
L.
years
understandings.
Reg-
of com-
Proceedings
1994.
of optimal
Symposium guages
we
Reversible GOI
the
big
on
G.
Logic
M. Abadi,
lambda
and
92).
and
ir-
J-machines.
on
of
M.
boxes. Logic
L&ry.
The geom-
Proc.
of the
Programming
19th Lan-
1992.
Gonthier,
without
J.J.
reduction.
Principles
(POPL
[GAL92b]
explo-
Lamping’s
Regnier.
G. Gonthier,
etry
linear
rules,
view,
L.
Computations:
1995.
posium of
V.
the
Danos,
[GAL92a]
of Lamping’s not
V.
Draft.
complexity
of abstract
point
for
II: Re-
As
is now
of an exponential
implentative
Laboratory
Paris.
reversible
complexity. the
Systems Technical
Science.
of LICS’94.
(see [As95]
it is clearly
so far
to
complex-
of research.
respect),
of applications
of
different
in BOHM
crucial
devoted
Interaction
reductions.
of Bologna.
Computer
nier.
re-
opitmal
University
[ADLR94]
to
complexity
a subject
in BOHM,
no evidence
from
problem rithm
is one
Although,
the
The
proposed
this
to
of family
very
examples
from
complexity
understand
it is still
can see by the few
the terms
is actually
techniques and
important
“oracle”.
algorithm
related
looks
to in
we should
a discussion),
you
bound
the
problems it
algorithm
we called of the
of all,
upper
Secondly,
of what
this
First
“abstract”
ductions. ity
open
issue
1993.
C. Laneve. of
UBLCS-93-12,
ence,
Conclusions
There
Special
June
implementations the
5
Science,
Montreal.
Abadi,
Proc.
in
J.J.
of the
Computer
L4vy.
7th
Linear
Annual
Science
Sym-
(LICS
‘92).
1992.
algo-
be compiled.
[Laf90]
Y.
Lafont.
Interaction
Symposium guages
on
Nets.
Principles
(POPL
90).
of
Proc.
of the
Programming
San Francisco.
17th Lan-
1990.
Acknowledgements [Lam89] We
would
teresting
like
to
thank
discussions
Cosimo
on the
Laneve
subject
for
of this
many
J. Lamping.
calculus
in-
mal
Linear
Reductions.
Vol. [As95]
on
Asperti.
Issue
devoted
Conf.
Categories
pp.3-22.
Asperti.
J-calculus
Logic,
Cornonads,
Fundamental to
22, n.1,
A.
J. Lamping.
calculus
References A.
60!E
=
Rewriting
(RTA’95),
Special
Computer
[Le78]
Science,
@timzzinO Proc.
Techniques
Kaiserlautern,
San
of
and
Germany.
OPtimal the
J.J.Levy.
[Le80]
A.
Asperti,
Bologna
Opt imal
cal Report Science, Journal
C.
Applications,
J. To
J.
A.
Hzgher-order
UBLCS-95-9, University
Machine.
Laboratory
of Bologna.
of Functional
Naletto. for
To
[LM92]
Techni-
in
A. and
Asperti, Labels
in
C. the
X.
release RIA
the
lambda
Symposium
Languages
(POPL
et opttmales
de doctorat
duns
d’&at,
Univer-
m
lambda-
1978.
Optzmal J.P.
optimal 17th
reductions
Seldin
Curry,
and
Essays
Calculus
and
Press.
J.R.
on
the
Hindley,
editors,
Combmatory
Formalism,
pages
Logic, 159-191.
1980.
Leroy, 0.5.
M. Mauny.
The
Documentaiton
Technical
Report.
Carol
and September
Light
user’s
system,
manual.
IN-
1992.
Programming. [Ya94]
[AL93]
lambda Report.
The
Computer
appear
VII.
In
H.B.
for
of the
correctes
Th&se
L&y.
Lambda
1995.
Giovannetti,
optimal Internal
1990.
Reductions
de Paris
calculus.
Sixth
algordhm Proc.
Francisco.
Academic [AGN95]
for
PARC
of Programming
le lambda-calcv,l. sit~
1:
An
reductions.
Principles
90).
Opii-
1995.
implementations.
on
and
In formaticae, in
algorithm Xerox
1989.
paper.
[Lam90]
[As94]
An
reductions.
Laneve.
Paths,
J-calculus.
To
Computations appear
in
The
Manual.
Theo-
118
Yale Yale
Haskell
Group.
University.
The October
Yale Haskel/ 1994.
Users