lambda calculus code

Lambda calculus (also written as λ-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation that can be used to simulate any Turing machine. It was introduced by the mathematician Alonzo Church in the 1930s as part of his research into the foundations of mathematics.
Lambda calculus consists of constructing lambda terms and performing reduction operations on them. In the simplest form of lambda calculus, terms are built using only the following rules:




x


{\textstyle x}
: A variable is a character or string representing a parameter.




(
λ
x
.
M
)


{\textstyle (\lambda x.M)}
: A lambda abstraction is a function definition, taking as input the bound variable



x


{\displaystyle x}
(between the λ and the punctum/dot .) and returning the body



M


{\textstyle M}
.




(
M

N
)


{\textstyle (M\ N)}
: An application, applying a function



M


{\textstyle M}
to an argument



N


{\textstyle N}
. Both



M


{\textstyle M}
and



N


{\textstyle N}
are lambda terms.The reduction operations include:




(
λ
x
.
M
[
x
]
)

(
λ
y
.
M
[
y
]
)


{\textstyle (\lambda x.M[x])\rightarrow (\lambda y.M[y])}
: α-conversion, renaming the bound variables in the expression. Used to avoid name collisions.




(
(
λ
x
.
M
)

N
)

(
M
[
x
:=
N
]
)


{\textstyle ((\lambda x.M)\ N)\rightarrow (M[x:=N])}
: β-reduction, replacing the bound variables with the argument expression in the body of the abstraction.If De Bruijn indexing is used, then α-conversion is no longer required as there will be no name collisions. If repeated application of the reduction steps eventually terminates, then by the Church–Rosser theorem it will produce a β-normal form.
Variable names are not needed if using a universal lambda function, such as Iota and Jot, which can create any function behavior by calling it on itself in various combinations.

You do not have permission to view the full content of this post. Log in or register now.
  1. W

    Help Sample lambda calculus programming

    Sample lambda calculus programming or code in C/C++, Visual Basic, C#, PHP, Java, Python
Back
Top