Beta normal form explained

In the lambda calculus, a term is in beta normal form if no beta reduction is possible.[1] A term is in beta-eta normal form if neither a beta reduction nor an eta reduction is possible. A term is in head normal form if there is no beta-redex in head position. The normal form of a term, if one exists, is unique (as a corollary of the Church–Rosser theorem).[2] However, a term may have more than one head normal form.

Beta reduction

In the lambda calculus, a beta redex is a term of the form:[3] [4]

(λx.A)M

.

A redex

r

is in head position in a term

t

, if

t

has the following shape (note that application has higher priority than abstraction, and that the formula below is meant to be a lambda-abstraction, not an application):

λx1\ldotsλxn.\underbrace{(λx.A)M1}theredexrM2\ldotsMm

, where

n\geq0

and

m\geq1

.

A beta reduction is an application of the following rewrite rule to a beta redex contained in a term:

(λx.A)M\longrightarrowA[x:=M]

where

A[x:=M]

is the result of substituting the term

M

for the variable

x

in the term

A

.

A head beta reduction is a beta reduction applied in head position, that is, of the following form:

λx1\ldotsλxn.(λx.A)M1M2\ldotsMm\longrightarrow λx1\ldotsλxn.A[x:=M1]M2\ldotsMm

, where

n\geq0

and

m\geq1

.

Any other reduction is an internal beta reduction.

A normal form is a term that does not contain any beta redex,[5] i.e. that cannot be further reduced. A head normal form is a term that does not contain a beta redex in head position, i.e. that cannot be further reduced by a head reduction. When considering the simple lambda calculus (viz. without the addition of constant or function symbols, meant to be reduced by additional delta rule), head normal forms are the terms of the following shape:

λx1\ldotsλxn.xM1M2\ldotsMm

, where

x

is a variable,

n\geq0

and

m\geq0

.

A head normal form is not always a normal form, because the applied arguments

Mj

need not be normal. However, the converse is true: any normal form is also a head normal form. In fact, the normal forms are exactly the head normal forms in which the subterms

Mj

are themselves normal forms. This gives an inductive syntactic description of normal forms.

There is also the notion of weak head normal form: a term in weak head normal form is either a term in head normal form or a lambda abstraction.[6] This means a redex may appear inside a lambda body.

Reduction strategies

In general, a given term can contain several redexes, hence several different beta reductions could be applied. We may specify a strategy to choose which redex to reduce.

Mj

, from left to right. Stated otherwise, normal‐order reduction is the strategy that always reduces the left‐most outer‐most redex first.

Normal-order reduction is complete, in the sense that if a term has a head normal form, then normal‐order reduction will eventually reach it. By the syntactic description of normal forms above, this entails the same statement for a “fully” normal form (this is the standardization theorem). By contrast, applicative order reduction may not terminate, even when the term has a normal form. For example, using applicative order reduction, the following sequence of reductions is possible:

\begin{align} &(λx.z)((λw.www)(λw.www))\\ &(λx.z)((λw.www)(λw.www)(λw.www))\\ &(λx.z)((λw.www)(λw.www)(λw.www)(λw.www))\\ &(λx.z)((λw.www)(λw.www)(λw.www)(λw.www)(λw.www))\\ &\ldots \end{align}

But using normal-order reduction, the same starting point reduces quickly to normal form:

(λx.z)((λw.www)(λw.www))

z

Sinot's director strings is one method by which the computational complexity of beta reduction can be optimized.

See also

Notes and References

  1. Encyclopedia: Beta normal form . Encyclopedia . . 18 November 2013 .
  2. Book: Thompson, Simon . Type theory and functional programming . 1991 . Addison-Wesley . 0-201-41667-0 . Wokingham, England . 38 . 23287456.
  3. Book: Barendregt, Henk P. . Introduction to Lambda Calculus . 1984 . Revised . 24.
  4. Book: Thompson, Simon . Type theory and functional programming . 1991 . Addison-Wesley . 0-201-41667-0 . Wokingham, England . 35 . 23287456.
  5. Book: Thompson, Simon . Type theory and functional programming . 1991 . Addison-Wesley . 0-201-41667-0 . Wokingham, England . 36 . 23287456.
  6. Encyclopedia: Weak Head Normal Form . Encyclopedia . . 30 April 2021 .