<s>
In	O
theoretical	O
computer	O
science	O
,	O
the	O
Krivine	B-Application
machine	I-Application
is	O
an	O
abstract	B-Application
machine	I-Application
(	O
sometimes	O
called	O
virtual	B-Architecture
machine	I-Architecture
)	O
.	O
</s>
<s>
As	O
an	O
abstract	B-Application
machine	I-Application
,	O
it	O
shares	O
features	O
with	O
Turing	B-Architecture
machines	I-Architecture
and	O
the	O
SECD	B-Application
machine	I-Application
.	O
</s>
<s>
The	O
Krivine	B-Application
machine	I-Application
explains	O
how	O
to	O
compute	O
a	O
recursive	O
function	O
.	O
</s>
<s>
More	O
specifically	O
it	O
aims	O
to	O
define	O
rigorously	O
head	B-Application
normal	I-Application
form	I-Application
reduction	O
of	O
a	O
lambda	B-Language
term	I-Language
using	O
call-by-name	O
reduction	O
.	O
</s>
<s>
Thanks	O
to	O
its	O
formalism	O
,	O
it	O
tells	O
in	O
details	O
how	O
a	O
kind	O
of	O
reduction	O
works	O
and	O
sets	O
the	O
theoretical	O
foundation	O
of	O
the	O
operational	O
semantics	B-Application
of	O
functional	B-Language
programming	I-Language
languages	I-Language
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
Krivine	B-Application
machine	I-Application
implements	O
call-by-name	O
because	O
it	O
evaluates	O
the	O
body	O
of	O
a	O
β-redex	O
before	O
it	O
applies	B-Algorithm
the	O
body	O
to	O
its	O
parameter	O
.	O
</s>
<s>
In	O
functional	B-Language
programming	I-Language
,	O
this	O
would	O
mean	O
that	O
in	O
order	O
to	O
evaluate	O
a	O
function	O
applied	O
to	O
a	O
parameter	O
,	O
it	O
evaluates	O
first	O
the	O
function	O
before	O
applying	O
it	O
to	O
the	O
parameter	O
.	O
</s>
<s>
The	O
Krivine	B-Application
machine	I-Application
was	O
designed	O
by	O
the	O
French	O
logician	O
Jean-Louis	O
Krivine	O
at	O
the	O
beginning	O
of	O
the	O
1980s	O
.	O
</s>
<s>
The	O
Krivine	B-Application
machine	I-Application
is	O
based	O
on	O
two	O
concepts	O
related	O
to	O
lambda	B-Language
calculus	I-Language
,	O
namely	O
head	O
reduction	O
and	O
call	O
by	O
name	O
.	O
</s>
<s>
A	O
redex	O
(	O
one	O
says	O
also	O
β-redex	O
)	O
is	O
a	O
term	O
of	O
the	O
lambda	B-Language
calculus	I-Language
of	O
the	O
form	O
( λ	O
x	O
.	O
t	O
)	O
u	O
.	O
</s>
<s>
A	O
head	B-Application
normal	I-Application
form	I-Application
is	O
a	O
term	O
of	O
the	O
lambda	B-Language
calculus	I-Language
which	O
is	O
not	O
a	O
head	O
redex	O
.	O
</s>
<s>
A	O
head	O
reduction	O
of	O
a	O
term	O
t	O
(	O
which	O
is	O
supposed	O
not	O
to	O
be	O
in	O
head	B-Application
normal	I-Application
form	I-Application
)	O
is	O
a	O
head	O
reduction	O
which	O
starts	O
from	O
a	O
term	O
t	O
and	O
ends	O
on	O
a	O
head	B-Application
normal	I-Application
form	I-Application
.	O
</s>
<s>
One	O
of	O
the	O
aims	O
of	O
the	O
Krivine	B-Application
machine	I-Application
is	O
to	O
propose	O
a	O
process	O
to	O
reduct	O
a	O
term	O
in	O
head	B-Application
normal	I-Application
form	I-Application
and	O
to	O
describe	O
formally	O
this	O
process	O
.	O
</s>
<s>
Like	O
Turing	O
used	O
an	O
abstract	B-Application
machine	I-Application
to	O
describe	O
formally	O
the	O
notion	O
of	O
algorithm	O
,	O
Krivine	O
used	O
an	O
abstract	B-Application
machine	I-Application
to	O
describe	O
formally	O
the	O
notion	O
of	O
head	B-Application
normal	I-Application
form	I-Application
reduction	O
.	O
</s>
<s>
The	O
term	O
((λ 0 )	O
( λ	O
0	O
)	O
)	O
( λ	O
0	O
)	O
(	O
which	O
corresponds	O
,	O
if	O
one	O
uses	O
explicit	O
variables	O
,	O
to	O
the	O
term	O
(	O
λx.x	O
)	O
(	O
λy.y	O
)	O
(	O
λz.z	O
)	O
)	O
is	O
not	O
in	O
head	B-Application
normal	I-Application
form	I-Application
because	O
( λ	O
0	O
)	O
( λ	O
0	O
)	O
contracts	O
in	O
( λ	O
0	O
)	O
yielding	O
the	O
head	O
redex	O
( λ	O
0	O
)	O
( λ	O
0	O
)	O
which	O
contracts	O
in	O
( λ	O
0	O
)	O
and	O
which	O
is	O
therefore	O
the	O
head	B-Application
normal	I-Application
form	I-Application
of	O
((λ 0 )	O
( λ	O
0	O
)	O
)	O
( λ	O
0	O
)	O
.	O
</s>
<s>
Said	O
otherwise	O
the	O
head	B-Application
normal	I-Application
form	I-Application
contraction	O
is	O
:	O
</s>
<s>
(	O
λx.x	O
)	O
(	O
λy.y	O
)	O
(	O
λz.z	O
)	O
➝	O
(	O
λy.y	O
)	O
(	O
λz.z	O
)	O
➝	O
λz.z.	O
</s>
<s>
We	O
will	O
see	O
further	O
how	O
the	O
Krivine	B-Application
machine	I-Application
reduces	O
the	O
term	O
((λ 0 )	O
( λ	O
0	O
)	O
)	O
( λ	O
0	O
)	O
.	O
</s>
<s>
The	O
Krivine	B-Application
machine	I-Application
implements	O
call	O
by	O
name	O
.	O
</s>
<s>
The	O
presentation	O
of	O
the	O
Krivine	B-Application
machine	I-Application
given	O
here	O
is	O
based	O
on	O
notations	O
of	O
lambda	O
terms	O
that	O
use	O
de	B-Application
Bruijn	I-Application
indices	I-Application
and	O
assumes	O
that	O
the	O
terms	O
of	O
which	O
it	O
computes	O
the	O
head	B-Application
normal	I-Application
forms	I-Application
are	O
closed	O
.	O
</s>
<s>
It	O
modifies	O
the	O
current	O
state	O
until	O
it	O
cannot	O
do	O
it	O
anymore	O
,	O
in	O
which	O
case	O
it	O
obtains	O
a	O
head	B-Application
normal	I-Application
form	I-Application
.	O
</s>
<s>
This	O
head	B-Application
normal	I-Application
form	I-Application
represents	O
the	O
result	O
of	O
the	O
computation	O
or	O
yields	O
an	O
error	O
,	O
meaning	O
that	O
the	O
term	O
it	O
started	O
from	O
is	O
not	O
correct	O
.	O
</s>
<s>
However	O
,	O
it	O
can	O
enter	O
an	O
infinite	O
sequence	O
of	O
transitions	O
,	O
which	O
means	O
that	O
the	O
term	O
it	O
attempts	O
reducing	O
has	O
no	O
head	B-Application
normal	I-Application
form	I-Application
and	O
corresponds	O
to	O
a	O
non	O
terminating	O
computation	O
.	O
</s>
<s>
It	O
has	O
been	O
proved	O
that	O
the	O
Krivine	B-Application
machine	I-Application
implements	O
correctly	O
the	O
call	O
by	O
name	O
head	B-Application
normal	I-Application
form	I-Application
reduction	O
in	O
the	O
lambda-calculus	B-Language
.	O
</s>
<s>
Moreover	O
,	O
the	O
Krivine	B-Application
machine	I-Application
is	O
deterministic	B-Application
,	O
since	O
each	O
pattern	O
of	O
the	O
state	O
corresponds	O
to	O
at	O
most	O
one	O
machine	O
transition	O
.	O
</s>
<s>
The	O
term	O
is	O
a	O
λ-term	O
with	O
de	B-Application
Bruijn	I-Application
indices	I-Application
.	O
</s>
<s>
The	O
Krivine	B-Application
machine	I-Application
has	O
four	O
transitions	O
:	O
App	O
,	O
Abs	O
,	O
Zero	O
,	O
Succ	O
.	O
</s>
<s>
This	O
closure	O
corresponds	O
to	O
the	O
de	B-Application
Bruijn	I-Application
index	I-Application
0	O
in	O
the	O
new	O
environment	O
.	O
</s>
<s>
The	O
conclusion	O
is	O
that	O
the	O
head	B-Application
normal	I-Application
form	I-Application
of	O
the	O
term	O
( λ	O
0	O
0	O
)	O
( λ	O
0	O
)	O
is	O
λ	O
0	O
.	O
</s>
<s>
This	O
translates	O
with	O
variables	O
in	O
:	O
the	O
head	B-Application
normal	I-Application
form	I-Application
of	O
the	O
term	O
( λ	O
x	O
.	O
x	O
x	O
)	O
( λ	O
x	O
.	O
x	O
)	O
is	O
λ	O
x	O
.	O
x	O
.	O
</s>
<s>
The	O
Krivine	B-Application
machine	I-Application
,	O
like	O
the	O
CEK	O
machine	O
,	O
does	O
not	O
only	O
functionally	O
correspond	O
to	O
a	O
meta-circular	B-Application
evaluator	I-Application
,	O
</s>
<s>
(	O
Also	O
,	O
if	O
the	O
reduction	O
strategy	O
is	O
right-to-left	O
call	O
by	O
value	O
and	O
includes	O
generalized	O
reduction	O
,	O
then	O
the	O
syntactically	O
corresponding	O
machine	O
is	O
Xavier	O
Leroy	O
's	O
ZINC	O
abstract	B-Application
machine	I-Application
,	O
which	O
underlies	O
OCaml	B-Language
.	O
)	O
</s>
