Lambda calculus

In mathematical logic and computer science, lambda calculus, also λ-calculus, is a formal system (a system that can be used to figure out different logical theories and ideas). It was made to explore different ways of creating and using mathematical functions, and it lays out rules for doing this. It is also a tool for exploring recursion, and it has been used to explain what a computable function is. It was made by Alonzo Church and Stephen Cole Kleene in the 1930s. In 1936, Church used lambda calculus to show that there is no solution to the Entscheidungsproblem.

Lambda calculus can be called the smallest universal programming language. At its core, lambda calculus is made up of just one transformation rule (something called variable substitution) and just one way to define a function. Each function definition has a list of the function's parameters, which are all of the variables that can be used in that function. Variable substitution is where specific variables in a function are replaced by other values (for example, the value 2 could take the place of every spot in a function where the variable x appears). This is called a transformation rule because it can be used to transform lambda expressions by changing around their values.

Lambda calculus is considered "universal" because it can be used to both create and find the answer to any computable function. This is exactly what a Turing machine can do, so lambda calculus and Turing machines are said to be equivalent. However, lambda calculus focuses more on the use of transformation rules. It does not care about the actual machine that puts those rules into place. It is an approach more related to software than to hardware.

There is no way to answer the question of whether two lambda calculus expressions are the same as each other (in more specific words, there is no general algorithm that can show that two lambda expressions are equivalent). This was the first problem where the idea of undecidability could be proven. Later, undecidability was also proven for the halting problem, where it was shown that there is no general way to show whether or not a program will keep running forever. Lambda calculus has had large effects on lots of functional programming languages, such as LISP, ML, and Haskell.

Syntax

Lambda calculus has simple syntax (rules). Every program is made of lambda terms which are as follows:

For the application and abstraction examples, x+2 and 5 were used. This is not valid lambda calculus, as the only valid syntax are the lambda terms shown above. There are ways to emulate addition, numerals, strings (words), and any other mathematical concept in lambda calculus.

Reduction and Conversion

There are three types of reduction: α-conversion, β-reduction, and η-conversion.

You perform each type or reduction if you can. Once it can no longer be simplified, the program has halted (stopped).

Common mistakes

λx.y⇏λz.z this is incorrect because λx is using the variable y. If it was λx.x, conversion could be done.

((λx.λy.(x y)  FUNCTION) 5)⇏FUNCTION it should equal FUNCTION 5.

λx.λy.x⇏λy.x you cannot get rid of the λx. This is because

Encoding and Datatypes

Because of the limited syntax, it may seem impossible to make numbers or strings or anything else that many programming languages have, but it's a matter of encoding. Lambda calculus compensates for this by using the methods demonstrated in the sections below.

Church numerals

Church numerals use the following encoding standards (rules):

0=λf.λx.x1=λf.λx.f x2=λf.λx.f (f x)3=λf.λx.f (f (f x))n=λf.λx.f (f (⋯(f x)⏟nNote: Church numerals are made for whole numbers. There are other standards for encoding for all rational numbers.

Because of the syntax of lambda calculus, numbers are also functions, and can take in inputs; all functions can output another function as a result. Numeral n applies x to f, n-times. This allows you to repeat a function n times. Repetition is the core of performing arithmetic on numbers in lambda calculus.

In order to increment a number n, you can use the "successor" function, which allows you to get the next natural number.

SUCC=λn.λf.λx f (n f x)

This function repeats f n times, applies that to x, then applies f again. In other words, it repeats f n+1 times.

By repeating the successor function, addition can be achieved. Adding x to y really just means incrementing y x times in a row.

We define the plus function as

PLUS=λm.λn.m SUCC n

This function simply repeats the successor function m times, then applies that function to n. We can verify that, for example, PLUS23 reduces to the same expression as 5. It's typically written like this

PLUS=λm.λn.λf.λx.m f (n f x)

And we can continue like this, multiplication is simply repeated addition, and exponentiation is simply repeated multiplication.

MULT=λm.λn.m PLUS nPOW=λm.λn.m MULT n Note: Remember that these are not normal operators, but functions. m PLUS n does not mean m+n, it means a function repeatedly applying PLUS to m n times in a row.

Booleans and Logic Gates

Booleans can be thought of as a lightbulb: they can be on or off (true or false). Typically, you use church booleans for representing these.

  • λx.λy.x (a function that takes in two values and returns the first one) for true.
  • λx.λy.y (a function that takes in two values and returns the second one) for false.

From these, you can make logic gates and conditionals.

The AND logic gate takes in two inputs and returns true if both of them are true. It is defined as

AND=λp.λq.p q p

The other gates — OR, XOR, and NOT — are below.

OR=λp.λq.p (p q)

NOT=λp.p (FALSE  TRUE)

XOR=λp.λq.p (NOT q) q

NAND, NOR, and XNOR can be made by combining these gates.

Pairs

A pair is a way of storing two things together. You can put anything in a pair, including Church numerals, booleans, and other pairs.

A pair looks like this: λf.fxy, where x and y are the two things in the pair. Pairs are also functions that take in a function and apply it to both things in the pair.

You can make a pair from two inputs with this function:

PAIR=λx.λy.λf.fxy

If you want to get the first or second thing in the pair, you can put the pair in these functions:

FIRST=λp.p TRUE

SECOND=λp.p FALSE

References

  1. ↑ "Artificial intelligence programming language | Benefits, Challenges & Applications | Britannica". Encyclopedia Britannica. Retrieved 2026-03-01.
  2. 1 2 "Lecture 28: Introduction to the λ-Calculus". www.cs.cornell.edu. Retrieved 2026-03-01.
  3. ↑ "To Dissect a Mockingbird: A Graphical Notation for the Lambda Calculus with Animated Reduction". dkeenan.com. Retrieved 2026-02-27.
  4. ↑ "lambdacalculus". cs.lmu.edu. Retrieved 2026-02-28.
  5. 1 2 3 "3.8. Church Numerals and Booleans — Programming Languages". opendsa.cs.vt.edu. Archived from the original on 2025-12-06. Retrieved 2026-02-27.