0% found this document useful (0 votes)
24 views2 pages

Some Notes On Untyped Lambda Calculus

The document defines the basics of the untyped lambda calculus including booleans and natural numbers. Booleans true and false are defined as functions that return their first or second parameter. Natural numbers are defined recursively where 0 returns its second parameter and k+1 returns s applied to k times then the second parameter. Arithmetic operations like addition and multiplication are defined using these number representations and behave as expected.

Uploaded by

Iso Morphism
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Some Notes On Untyped Lambda Calculus

The document defines the basics of the untyped lambda calculus including booleans and natural numbers. Booleans true and false are defined as functions that return their first or second parameter. Natural numbers are defined recursively where 0 returns its second parameter and k+1 returns s applied to k times then the second parameter. Arithmetic operations like addition and multiplication are defined using these number representations and behave as expected.

Uploaded by

Iso Morphism
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Ch 4.

Untyped Lambda-Calculus
Abstract grammar of lambda calculus:
lambda-term ::= x
x.lambda-term
lambda-term lambda-term

(variable)
(abstraction)
(abstraction)

Everything is defined as a function.

4.1

Booleans

Boolean true/false:
tru = t.f.t,
fls = t.f.f.
So, tru is a function taking two parameters and returning the first one; fls is a
function taking two parameters and returning the second one. More operators:
not = f.a.b.f b a,
or = f.g.f tru g,
and = f.g.f g fls .
Helper function to implement if t then x else y:
test = t.x.y.t x y.
When t is tru, test returns x; if it is fls, test returns y.

4.2

Natural Numbers
0N = s.z.z,
1N = s.z.s z,
2N = s.z.s s z,
...

Or, in math language, natural number k is defined as function


kN (s, z) = s(k) (z).
More operators:
(+) = a.b.s.z.a s (b s z),
() = a.b.s.z.a (b s) z.
1

Then,


iN + jN = s.z.s(i) s(j) (z) = s.z.s(i+j) (z) = (i + j)N ,
iN jN = s.z.(s(j) )(i) (z) = s.z.s(ij) (z) = (i j)N .

You might also like