<s>
In	O
computer	O
science	O
,	O
a	O
"	O
let	O
"	O
expression	O
associates	O
a	O
function	O
definition	O
with	O
a	O
restricted	O
scope	B-Language
.	O
</s>
<s>
The	O
"	O
let	O
"	O
expression	O
may	O
also	O
be	O
defined	O
in	O
mathematics	O
,	O
where	O
it	O
associates	O
a	O
Boolean	O
condition	O
with	O
a	O
restricted	O
scope	B-Language
.	O
</s>
<s>
The	O
"	O
let	O
"	O
expression	O
may	O
be	O
considered	O
as	O
a	O
lambda	B-Language
abstraction	I-Language
applied	O
to	O
a	O
value	O
.	O
</s>
<s>
Within	O
mathematics	O
,	O
a	O
let	B-Application
expression	I-Application
may	O
also	O
be	O
considered	O
as	O
a	O
conjunction	O
of	O
expressions	O
,	O
within	O
an	O
existential	O
quantifier	O
which	O
restricts	O
the	O
scope	B-Language
of	O
the	O
variable	O
.	O
</s>
<s>
The	O
let	B-Application
expression	I-Application
is	O
present	O
in	O
many	O
functional	O
languages	O
to	O
allow	O
the	O
local	O
definition	O
of	O
expression	O
,	O
for	O
use	O
in	O
defining	O
another	O
expression	O
.	O
</s>
<s>
Let	O
rec	O
is	O
an	O
extension	O
of	O
the	O
simple	O
let	B-Application
expression	I-Application
which	O
uses	O
the	O
fixed-point	B-Application
combinator	I-Application
to	O
implement	O
recursion	O
.	O
</s>
<s>
Dana	O
Scott	O
's	O
LCF	B-Language
language	I-Language
was	O
a	O
stage	O
in	O
the	O
evolution	O
of	O
lambda	B-Language
calculus	I-Language
into	O
modern	O
functional	O
languages	O
.	O
</s>
<s>
This	O
language	O
introduced	O
the	O
let	B-Application
expression	I-Application
,	O
which	O
has	O
appeared	O
in	O
most	O
functional	O
languages	O
since	O
that	O
time	O
.	O
</s>
<s>
The	O
languages	O
Scheme	B-Language
,	O
ML	B-Language
,	O
and	O
more	O
recently	O
Haskell	B-Language
have	O
inherited	O
let	B-Application
expressions	I-Application
from	O
LCF	O
.	O
</s>
<s>
Stateful	O
imperative	O
languages	O
such	O
as	O
ALGOL	B-Language
and	O
Pascal	B-Application
essentially	O
implement	O
a	O
let	B-Application
expression	I-Application
,	O
to	O
implement	O
restricted	O
scope	B-Language
of	O
functions	O
,	O
in	O
block	O
structures	O
.	O
</s>
<s>
Like	O
the	O
if-then-else	B-Language
the	O
type	O
returned	O
by	O
the	O
expression	O
is	O
not	O
necessarily	O
Boolean	O
.	O
</s>
<s>
A	O
let	B-Application
expression	I-Application
comes	O
in	O
4	O
main	O
forms	O
,	O
</s>
<s>
Recursive	O
Definition	O
Recursive	O
function	O
definition	O
(	O
implemented	O
using	O
the	O
Y	B-Application
combinator	I-Application
)	O
.	O
</s>
<s>
In	O
functional	O
languages	O
the	O
let	B-Application
expression	I-Application
defines	O
functions	O
which	O
may	O
be	O
called	O
in	O
the	O
expression	O
.	O
</s>
<s>
The	O
scope	B-Language
of	O
the	O
function	O
name	O
is	O
limited	O
to	O
the	O
let	B-Application
expression	I-Application
structure	O
.	O
</s>
<s>
In	O
mathematics	O
,	O
the	O
let	B-Application
expression	I-Application
defines	O
a	O
condition	O
,	O
which	O
is	O
a	O
constraint	O
on	O
the	O
expression	O
.	O
</s>
<s>
The	O
syntax	O
may	O
also	O
support	O
the	O
declaration	O
of	O
existentially	O
quantified	O
variables	O
local	O
to	O
the	O
let	B-Application
expression	I-Application
.	O
</s>
<s>
In	O
Scheme	B-Language
,	O
let	O
is	O
used	O
for	O
the	O
simple	O
form	O
and	O
let	O
rec	O
for	O
the	O
recursive	O
form	O
.	O
</s>
<s>
In	O
ML	B-Language
let	O
marks	O
only	O
the	O
start	O
of	O
a	O
block	O
of	O
declarations	O
with	O
fun	O
marking	O
the	O
start	O
of	O
the	O
function	O
definition	O
.	O
</s>
<s>
In	O
Haskell	B-Language
,	O
let	O
may	O
be	O
mutually	O
recursive	O
,	O
with	O
the	O
compiler	O
figuring	O
out	O
what	O
is	O
needed	O
.	O
</s>
<s>
A	O
lambda	B-Language
abstraction	I-Language
represents	O
a	O
function	O
without	O
a	O
name	O
.	O
</s>
<s>
This	O
is	O
a	O
source	O
of	O
the	O
inconsistency	O
in	O
the	O
definition	O
of	O
a	O
lambda	B-Language
abstraction	I-Language
.	O
</s>
<s>
However	O
lambda	B-Language
abstractions	I-Language
may	O
be	O
composed	O
to	O
represent	O
a	O
function	O
with	O
a	O
name	O
.	O
</s>
<s>
is	O
equivalent	O
to	O
defining	O
the	O
function	O
by	O
in	O
the	O
expression	O
,	O
which	O
may	O
be	O
written	O
as	O
the	O
let	B-Application
expression	I-Application
;	O
</s>
<s>
The	O
let	B-Application
expression	I-Application
is	O
understandable	O
as	O
a	O
natural	O
language	O
expression	O
.	O
</s>
<s>
The	O
let	B-Application
expression	I-Application
represents	O
the	O
substitution	O
of	O
a	O
variable	O
for	O
a	O
value	O
.	O
</s>
<s>
In	O
mathematics	O
the	O
let	B-Application
expression	I-Application
is	O
described	O
as	O
the	O
conjunction	O
of	O
expressions	O
.	O
</s>
<s>
In	O
functional	O
languages	O
the	O
let	B-Application
expression	I-Application
is	O
also	O
used	O
to	O
limit	O
scope	B-Language
.	O
</s>
<s>
In	O
mathematics	O
scope	B-Language
is	O
described	O
by	O
quantifiers	O
.	O
</s>
<s>
The	O
let	B-Application
expression	I-Application
is	O
a	O
conjunction	O
within	O
an	O
existential	O
quantifier	O
.	O
</s>
<s>
The	O
let	B-Application
expression	I-Application
allows	O
the	O
substitution	O
to	O
be	O
applied	O
to	O
another	O
expression	O
.	O
</s>
<s>
This	O
substitution	O
may	O
be	O
applied	O
within	O
a	O
restricted	O
scope	B-Language
,	O
to	O
a	O
sub	O
expression	O
.	O
</s>
<s>
The	O
natural	O
use	O
of	O
the	O
let	B-Application
expression	I-Application
is	O
in	O
application	O
to	O
a	O
restricted	O
scope	B-Language
(	O
called	O
lambda	O
dropping	O
)	O
.	O
</s>
<s>
These	O
rules	O
define	O
how	O
the	O
scope	B-Language
may	O
be	O
restricted	O
;	O
</s>
<s>
From	O
this	O
definition	O
the	O
following	O
standard	O
definition	O
of	O
a	O
let	B-Application
expression	I-Application
,	O
as	O
used	O
in	O
a	O
functional	O
language	O
may	O
be	O
derived	O
.	O
</s>
<s>
Let	B-Application
expressions	I-Application
may	O
be	O
defined	O
with	O
multiple	O
variables	O
,	O
</s>
<s>
The	O
Eta	O
reduction	O
gives	O
a	O
rule	O
for	O
describing	O
lambda	B-Language
abstractions	I-Language
.	O
</s>
<s>
This	O
rule	O
along	O
with	O
the	O
two	O
laws	O
derived	O
above	O
define	O
the	O
relationship	O
between	O
lambda	B-Language
calculus	I-Language
and	O
let	B-Application
expressions	I-Application
.	O
</s>
<s>
To	O
avoid	O
the	O
potential	O
problems	O
associated	O
with	O
the	O
mathematical	O
definition	O
,	O
Dana	O
Scott	O
originally	O
defined	O
the	O
let	B-Application
expression	I-Application
from	O
lambda	B-Language
calculus	I-Language
.	O
</s>
<s>
This	O
may	O
be	O
considered	O
as	O
the	O
bottom	O
up	O
,	O
or	O
constructive	O
,	O
definition	O
of	O
the	O
let	B-Application
expression	I-Application
,	O
in	O
contrast	O
to	O
the	O
top	O
down	O
,	O
or	O
axiomatic	O
mathematical	O
definition	O
.	O
</s>
<s>
The	O
simple	O
,	O
non	O
recursive	O
let	B-Application
expression	I-Application
was	O
defined	O
as	O
being	O
syntactic	O
sugar	O
for	O
the	O
lambda	B-Language
abstraction	I-Language
applied	O
to	O
a	O
term	O
.	O
</s>
<s>
The	O
simple	O
let	B-Application
expression	I-Application
definition	O
was	O
then	O
extended	O
to	O
allow	O
recursion	O
using	O
the	O
fixed-point	B-Application
combinator	I-Application
.	O
</s>
<s>
The	O
fixed-point	B-Application
combinator	I-Application
may	O
be	O
represented	O
by	O
the	O
expression	O
,	O
</s>
<s>
A	O
lambda	B-Language
abstraction	I-Language
does	O
not	O
support	O
reference	O
to	O
the	O
variable	O
name	O
,	O
in	O
the	O
applied	O
expression	O
,	O
so	O
x	O
must	O
be	O
passed	O
in	O
as	O
a	O
parameter	O
to	O
x	O
.	O
</s>
<s>
A	O
let	B-Application
expression	I-Application
may	O
be	O
expressed	O
as	O
a	O
lambda	B-Language
abstraction	I-Language
using	O
,	O
</s>
<s>
This	O
is	O
possibly	O
the	O
simplest	O
implementation	O
of	O
a	O
fixed	B-Application
point	I-Application
combinator	I-Application
in	O
lambda	B-Language
calculus	I-Language
.	O
</s>
<s>
However	O
one	O
beta	O
reduction	O
gives	O
the	O
more	O
symmetrical	O
form	O
of	O
Curry	O
's	O
Y	B-Application
combinator	I-Application
.	O
</s>
<s>
The	O
recursive	O
let	B-Application
expression	I-Application
called	O
"	O
let	O
rec	O
"	O
is	O
defined	O
using	O
the	O
Y	B-Application
combinator	I-Application
for	O
recursive	O
let	B-Application
expressions	I-Application
.	O
</s>
<s>
A	O
mutually	O
recursive	O
let	B-Application
expression	I-Application
may	O
be	O
composed	O
by	O
rearranging	O
the	O
expression	O
to	O
remove	O
any	O
and	O
conditions	O
.	O
</s>
<s>
The	O
result	O
is	O
a	O
mutually	O
recursive	O
implementation	O
of	O
the	O
let	B-Application
expression	I-Application
.	O
</s>
<s>
A	O
let	B-Application
expression	I-Application
may	O
be	O
used	O
to	O
represent	O
a	O
value	O
that	O
is	O
a	O
member	O
of	O
a	O
set	O
,	O
</s>
<s>
Under	O
function	O
application	O
,	O
of	O
one	O
let	B-Application
expression	I-Application
to	O
another	O
,	O
</s>
<s>
But	O
a	O
different	O
rule	O
applies	O
for	O
applying	O
the	O
let	B-Application
expression	I-Application
to	O
itself	O
.	O
</s>
<s>
See	O
narrowing	B-Application
of	I-Application
algebraic	I-Application
value	I-Application
sets	I-Application
.	O
</s>
<s>
Meta-functions	B-Application
will	O
be	O
given	O
that	O
describe	O
the	O
conversion	O
between	O
lambda	O
and	O
let	B-Application
expressions	I-Application
.	O
</s>
<s>
The	O
rules	O
also	O
assume	O
that	O
the	O
lambda	O
expressions	O
have	O
been	O
pre-processed	O
so	O
that	O
each	O
lambda	B-Language
abstraction	I-Language
has	O
a	O
unique	O
name	O
.	O
</s>
<s>
The	O
definition	O
used	O
is	O
extended	O
to	O
cover	O
the	O
substitution	O
of	O
expressions	O
,	O
from	O
the	O
definition	O
given	O
on	O
the	O
Lambda	B-Language
calculus	I-Language
page	O
.	O
</s>
<s>
The	O
following	O
rules	O
describe	O
how	O
to	O
convert	O
from	O
a	O
lambda	O
expression	O
to	O
a	O
let	B-Application
expression	I-Application
,	O
without	O
altering	O
the	O
structure	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
Y	B-Application
combinator	I-Application
,	O
</s>
<s>
They	O
convert	O
from	O
a	O
let	B-Application
expression	I-Application
to	O
a	O
lambda	O
expression	O
,	O
without	O
altering	O
the	O
structure	O
.	O
</s>
<s>
Not	O
all	O
let	B-Application
expressions	I-Application
may	O
be	O
converted	O
using	O
these	O
rules	O
.	O
</s>
<s>
There	O
is	O
no	O
exact	O
structural	O
equivalent	O
in	O
lambda	B-Language
calculus	I-Language
for	O
let	B-Application
expressions	I-Application
that	O
have	O
free	O
variables	O
that	O
are	O
used	O
recursively	O
.	O
</s>
<s>
Rules	O
8	O
and	O
10	O
are	O
sufficient	O
for	O
two	O
mutually	O
recursive	O
equations	O
in	O
the	O
let	B-Application
expression	I-Application
.	O
</s>
<s>
lift-vars	O
-	O
Get	O
the	O
set	O
of	O
variables	O
that	O
need	O
X	O
as	O
a	O
parameter	O
,	O
because	O
the	O
expression	O
has	O
X	O
as	O
a	O
free	O
variable	O
.	O
</s>
<s>
de-let	O
-	O
Lift	B-Application
each	O
condition	O
in	O
E	O
so	O
that	O
X	O
is	O
not	O
a	O
free	O
variable	O
on	O
the	O
right	O
hand	O
side	O
of	O
the	O
equation	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
let	B-Application
expression	I-Application
obtained	O
from	O
the	O
Y	B-Application
combinator	I-Application
,	O
</s>
<s>
For	O
a	O
second	O
example	O
take	O
the	O
lifted	O
version	O
of	O
the	O
Y	B-Application
combinator	I-Application
,	O
</s>
<s>
which	O
is	O
the	O
famous	O
y	B-Application
combinator	I-Application
.	O
</s>
