In mathematical logic, the lambda calculus (also written as
lλbmdλ cλlculus?
λ-calculus consists of constructing lambda terms and performing reduction operations on them. A term is defined as any valid lambda calculus expression. In the simplest form of lambda calculus, terms are built using only the rules below.
This is just about the untyped λ-calculus.
Lambda calculus is Turing complete, that is, it is a universal model of computation that can be used to simulate any Turing machine. Its namesake, the Greek letter lambda (λ), is used in lambda expressions and lambda terms to denote binding a variable in a function.
TRUE=λx.λy.x
FALSE=λx.λy.y
AND=λx.λy.((x y) (λx.λy.y))
OR=λx.λy.((x λx.λy.x) y)
NOT=λx.(x λx.λy.y) λx.λy.x
0=λf.λx.x
1=λf.λx.f x
2=λf.λx.f(f x)
3=λf.λx.f(f(f x))
...
SUCC=λn.λf.λx.(f ((n f) x))
PRED=λn.λf.λx.n(λg.λh.h(g f))(λu.x)(λu.u)
+=λm.λn.λf.λx.m f (n f x)
-=λm.λn.(m PRED) n
*=λm.λn.λf.m (n f)
^=λm.λn.m n
!=λn.λf.n(λf.λn.n(f(λf.λx.n f(f x))))(λx.f)(λx.x)
Ω=(λx.x x)(λx.x x)
Because there are too many formulas, I did not use LaTeX formatting.
Just like this:
(((λx.λy.x y) 1) 2)
=β=> 1 2
=β=> (λf.λx.f x (λf.λx.f(f x)))
=β=> (λf.λx.f(f x)) x
=β=> λf.λx.f(f x)
FINAL: λf.λx.f(f x) => 2
But when it's Ω:
(λx.x x)(λx.x x)
=β=>(λx.x x)(λx.x x)
=β=>(λx.x x)(λx.x x)
=β=>(λx.x x)(λx.x x)
=β=>(λx.x x)(λx.x x)
...
Quine?
A Fibbonacci program can be this:
λn.λf.n(λc.λa.λb.c b(λx.a (b x)))(λx.λy.x)(λx.x)f.
That's weird...
IF condition:
f(x)
ELSE:
g(x)
Represented as
Only the selection properties of True and False were used.
So you can use those expressions to write anything.
Yes,
You can also use$\lambda$ to write a $\lambda$ -interpreter.
For example, @tromp 's Binary Lambda Calculus Interpreter(IOCCC-2012/Most functional):
Also have BLC version: