encyclopegia.org

Lambda calculus definition

The lambda calculus is a formal mathematical system consisting of constructing lambda terms and performing reduction operations on them. The definition of a lambda term is simply a variable, a lambda abstraction, or a function application, but a formal presentation can be somewhat lengthy. The focus of this article is to present a full and complete definition of the lambda calculus, specifically the pure untyped lambda calculus without extensions, although a lambda calculus extended with numbers and arithmetic is used for explanatory purposes.

The lambda calculus is a formal mathematical system consisting of constructing lambda terms and performing reduction operations on them. The definition of a lambda term is simply a variable, a lambda abstraction, or a function application, but a formal presentation can be somewhat lengthy. The focus of this article is to present a full and complete definition of the lambda calculus, specifically the pure untyped lambda calculus without extensions, although a lambda calculus extended with numbers and arithmetic is used for explanatory purposes. A variable x is a character or string representing a parameter, itself a valid lambda term. A lambda abstraction (\lambda x.M) is a function definition, taking as input the bound variable x (between the λ and the punctum/dot .) and returning the body M . The definition of a function with an abstraction merely "sets up" the function but does not invoke it. An abstraction denotes an anonymous function that takes a single input and returns . The syntax (\lambda x.M) binds the variable in the term . For example, \lambda x.(x^2+2) is an abstraction representing the anonymous function x \mapsto x^2+2 . More concretely, we might give this function the name f , and then we could write f(x) = x^2 + 2, , although this name f is superfluous when using the lambda calculus. An application (M\ N) represents the application of a function M to an argument N . Both M and N are lambda terms. The application represents the act of calling function on input to produce M(N) . In Extended Backus-Naur Form, this might be summarized as e ::= v \mid (\lambda v.e) \mid (e \, e) , where the variables v come from an infinite set v_{1}, v_{2}, v_{3}, \ldots , and the other symbols consist of lambda ' \lambda ', dot '.', and parentheses '(' and ')'. A more formal and permissive presentation of the grammar might be as follows: The set of lambda expressions is defined inductively, for example as a set , where the results of applying rules 1-3 are all and only the elements of . In the strictest sense, nothing else is a lambda term. That is, a lambda term is valid if and only if it can be obtained by repeated application of these three rules. Formally: If x is a variable, then If x is a variable and then If then Instances of rule 2 are known as abstractions and instances of rule 3 are known as applications. It is also common to extend the syntax presented here with additional operations, for example introducing terms for mathematical constants and operations, which allows making sense of terms such as \lambda x.x^2. The untyped lambda calculus is flexible in that it does not distinguish between different kinds of data. For instance, there may be a function intended to operate on numbers. However, in the untyped lambda calculus, there is no way to prevent a function from being applied to truth values, strings, or other non-number objects. Depending on the encoding of the data, this may lead to nonsensical results, or work as intended. Following the mathematical concepts of free variables and bound variables, the abstraction operator, \lambda , is said to bind its variable wherever it occurs in the body of the abstraction. Variables that fall within the scope of an abstraction are said to be bound, and the part λx is often called the binder of x. Variables that are not bound are called free. For example, the function definition f(x) = x + y could be represented as the lambda term \lambda x.(x+y) , which contains two variables, and . The variable is bound by the lambda abstraction, while is free. The free variable has not been defined and is considered an unknown. The abstraction \lambda x.(x+y) is a syntactically valid term and represents a function that adds its input to the yet-unknown . Also note that a variable is bound by its "nearest" abstraction. In the following example the single occurrence of x in the expression is bound by the second lambda: \lambda x . y (\lambda x . z \ x) A variable may occur both free and bound in a term; for example y in y (\lambda y. y) . More formally, the sets of free variables and bound variables of a lambda expression, M , are denoted as \operatorname{FV}(M) and \operatorname{BV}(M) and can be defined by recursion on the structure of the terms, as follows: An expression that contains no free variables is said to be closed. Closed lambda expressions are also known as combinators and are equivalent to terms in combinatory logic. It is common to restrict discussion to only closed terms, and some presentations of the lambda calculus only consider closed terms. For example, the lambda term representing the identity \lambda x.x has no free variables and is closed. The term redex, short for reducible expression, refers to subterms that can be reduced by one of the reduction rules. For example, (\lambda x . M) \ N is a β-redex in expressing the substitution of N for x in M ; if x is not free in M , \lambda x . M \ x is an η-redex. The expression to which a redex reduces is called its reduct; using the previous example, the reducts of these expressions are respectively M[x := N] and M . Substitution, written E[V := R] , is the process of replacing all free occurrences of the variable V in the expression E with expression R . Substitution on terms of the lambda calculus is defined by recursion on the structure of terms, as follows (note: x and y are variables while M and N are any λ expression). x[x := N] = N ; with N substituted for x , x becomes N y[x := N] = y if x \neq y ; with N substituted for x , y (which is not x ) remains y (M_1 \ M_2)[x := N] = (M_1[x := N])(M_2[x := N]) ; substitution distributes to both sides of an application (\lambda x.M)[x := N] = \lambda x.M ; a variable bound by an abstraction is not subject to substitution; substituting such a variable leaves the abstraction unchanged (\lambda y.M)[x := N] = \lambda y.(M[x := N]) if x \neq y and y \notin FV(N) ; substituting a variable which is not bound by an abstraction proceeds in the abstraction's body, provided that the abstracted variable y is "fresh" for the substitution term N , meaning it does not appear among the free variables of N. For example, (\lambda x.x)[y := y] = \lambda x.(x[y := y]) = \lambda x.x , and ((\lambda x.y)x)[x := y] = ((\lambda x.y)[x := y])(x[x := y]) = (\lambda x.y)y . The freshness condition (requiring that y is not in the free variables of N ) is crucial in order to ensure that substitution does not change the meaning of functions. The situation where the substituted x was supposed to be free but ended up being bound is a situation known as capturing x . To substitute into a lambda abstraction, it is sometimes necessary to α-convert the expression. For example, this substitution (\lambda x.y)[y := x] \neq \lambda x.(y[y := x]) = \lambda x.x is erroneous because it would turn the constant function \lambda x.y into the identity \lambda x.x . The correct substitution is to rename the bound variable using α-equivalence, in this case (\lambda x.y)[y := x] = (\lambda z.y)[y := x] = \lambda z.(y[y := x]) = \lambda z.x . In general, failure to meet the freshness condition can be remedied by alpha-renaming first, with a suitable fresh variable. Substitution is defined uniquely up to α-equivalence. Most implementations of substitution use alpha-conversion automatically to avoid capture during substitution, an operation called capture-avoiding substitution. In programming languages with static scope, capture-avoiding substitution can be used to implement name resolution by carefully handling variable shadowing in containing scopes. Another strategy is to require alpha renaming in the source program to make name resolution trivial. If De Bruijn indexing is used, then α-conversion is no longer required, as there will be no name collisions. Variable names are also not needed if a universal function is used, such as in Iota and Jot. β-reduction (beta reduction) captures the idea of function application. β-reduction is defined in terms of substitution: the β-reduction of ((\lambda V . E) \ E') is E[V := E'] . The β-reduction rule states that an application of the form ( \lambda x . t) s reduces to the term t [ x := s] . The notation ( \lambda x . t ) s \to t [ x := s ] is used to indicate that ( \lambda x .t ) s β-reduces to t [ x := s ] . β-reduction captures the idea of function application (also called a function call), and implements the substitution of the actual parameter expression for the formal parameter variable. β-reduction can be seen to be the same as the concept of local reducibility in natural deduction, via the Curry–Howard isomorphism. For example, for every s , ( \lambda x . x ) s \to x[ x := s ] = s . This demonstrates that \lambda x . x really is the identity. Similarly, ( \lambda x . y ) s \to y [ x := s ] = y , which demonstrates that \lambda x . y is a constant function. Assuming some encoding of 2, 7, \times , we have the following β-reduction: ((\lambda n . \ n \times 2) \ 7) \rightarrow 7 \times 2 . More formally, β-reduction may be performed on the lambda abstraction without alpha renaming only if no variable names are free in the actual parameter and bound in the body: FV(y) \cap BV(b) = \{\} \to (\lambda x.b) \ y = b[x:=y] Alpha renaming may be used on b to rename names that are free in y but bound in b , to meet the pre-condition for this transformation. See example: Looking closer, the key substitutions are \begin{array}{r} ((\lambda x.z \ x)(\lambda y.z \ y))[z := (x \ y)] \text{(blocked - will capture)} \\ ((\lambda a.z \ a)(\lambda b.z \ b))[z := (x \ y)] \text{(allowed - no capture)} \end{array} In this example, In the β-redex, The free variables are, \operatorname{FV}(x \ y) = \{x, y\} The bound variables are, \operatorname{BV}((\lambda x.z \ x)(\lambda y.z \ y)) = \{x, y\} The naive β-reduction changed the meaning of the expression because x and y from the actual parameter became captured when the expressions were substituted in the inner abstractions. The alpha renaming removed the problem by changing the names of x and y in the inner abstraction so that they are distinct from the names of x and y in the actual parameter. The free variables are, \operatorname{FV}(x \ y) = \{x, y\} The bound variables are, \operatorname{BV}((\lambda a.z \ a)(\lambda b.z \ b)) = \{a, b\} The β-reduction then proceeded with the intended meaning. However, not all lambda expressions have a normal form. For example, consider the term \Omega = (\lambda x . xx)( \lambda x . xx ) . Here ( \lambda x . xx)( \lambda x . xx) \to ( xx )[ x := \lambda x . xx ] = ( x [ x := \lambda x . xx ] )( x [ x := \lambda x . xx ] ) = ( \lambda x . xx)( \lambda x . xx ) . That is, the term reduces to itself in a single β-reduction, and therefore the reduction process will never terminate. Typed lambda calculi, such as the simply typed lambda calculus, do not allow the construction of terms like \Omega , and therefore all well-typed terms in these systems have a normal form.

References

No reference rows published for this article.

Cite this article

MLA

"Lambda calculus definition." encyclopegia.org, 2026, https://encyclopegia.org/wiki/lambda-calculus-definition. Accessed 24 November 2026.

Chicago

"Lambda calculus definition." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/lambda-calculus-definition.

APA

encyclopegia.org. (2026). Lambda calculus definition. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/lambda-calculus-definition

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Sérgio Meira

enwiki · references available

Gerald McCann (disambiguation)

enwiki · references available

2015–16 FC Bayern Munich season

enwiki · references available

1977–78 FC Bayern Munich season

enwiki · references available

1978–79 FC Bayern Munich season

enwiki · references available

1979–80 FC Bayern Munich season

enwiki · references available

Ezekiel Elliott

enwiki · references available

Hafiz Hamdullah

enwiki · references available

Janet Arceo

enwiki · references available

Eleanor Fitzgerald

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1368939669 · 0.5 · snapshot enwiki-001368939669

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.