Use Church numerals
Explicit lambda terms for the successor and zero test are
Direct beta reduction gives , and the Church numeral zero test returns exactly at zero. For the predecessor, use the Church pair operations
and set
After iterations this pair holds : the initial pair gives the case , and one step moves the old first coordinate into the second and increments the first. This proves the predecessor equation, including .
A total function is a lambda-definable function when a closed lambda term sends each tuple of numerals to the numeral of its value. Suppose represent total , and
For lambda definition of primitive recursion by pair iteration, put
On numeral inputs, induction gives the pair after iterations. The base case is the equation for , and the induction step is exactly the equation for . Hence represents , proving closure of total lambda-definable functions under primitive recursion.
For unbounded minimization, the careful closure statement is partial: if total is lambda-definable, then
is a lambda-definable partial function, defined when a zero exists and otherwise undefined. It need not be total. With representing , use a fixed-point combinator to define
Each test terminates because is total. Normal-order beta reduction chooses the return branch at the first zero and does not evaluate the discarded branch. If there is no zero, the required head computation passes through tests for all , never exposing a numeral; standardization theorem for beta reduction rules out a hidden numeral reduct. For partial , the usual mu operator is defined only if all earlier tests terminate and the successful test is zero. This stronger partial closure requires representatives that diverge on undefined inputs, or an explicit strict evaluator; the weaker condition of producing no numeral on undefined inputs alone must not be used as a test for convergence.
The zero function, successor, and projections have immediate numeral representations; function composition in recursion theory is implemented by substitution on total inputs. Thus every primitive recursive function is lambda-definable. The Kleene normal form theorem writes every partial recursive function as a total primitive-recursive decoding after a single minimization of a total primitive-recursive computation-history predicate. The search above consequently represents every partial recursive function, diverging when no successful history exists. Conversely a machine can effectively enumerate the beta reductions of a fixed representing lambda term on numeral inputs until it finds a Church numeral; distinct numerals cannot be beta-equivalent by the Church-Rosser theorem. It computes exactly the represented partial function. Therefore lambda-definable partial functions are precisely partial computable functions, and the total ones are precisely total computable functions.
This also gives the full partial minimization closure without assuming that an arbitrary weak representative diverges on every undefined input. Run its effective numeral evaluator successively at ; stop at the first zero, and run forever if an earlier evaluation fails to terminate or no zero is found. This is exactly the sequential-domain convention for the mu operator. The resulting partial computable function has a lambda representation by the construction just proved. Thus partial lambda-definable functions are closed under partial minimization; a minimized function belongs to the total family only when the required successful search exists for every input.
The machine characterization is computation by a Turing machine: the machine halts with exactly on inputs in the domain of a partial function and does not halt elsewhere. The syntactic characterization is the least class containing the initial functions of recursion theory and closed under composition of partial functions, primitive recursion and unbounded minimization. Such functions are the partial recursive functions, equivalently the partial computable functions.
For clarity, composition here is strict: is defined only when every inner value is defined and is defined on the resulting tuple. Likewise primitive recursion requires all preceding recursive values. The partial minimization is defined when such a exists and all earlier values are defined and nonzero; an undefined earlier value blocks the search.
A lambda-definable partial function is represented by a closed untyped lambda calculus term satisfying
On an input outside its domain there must be no Church numeral beta-equivalent to the result. A stronger representation can be arranged: undefined inputs have no head normal form.
Here are the components for proving that every partial recursive function is lambda-definable. Zero and projections are immediate; lambda definition of the successor function uses . Church Booleans encode a conditional by , with and . Put
Iteration takes to for , proving that encodes the predecessor function and that correctly tests zero.
Use a fixed-point combinator and the strict sequencing operation
For any numeral , reduces to . If the first argument has no head normal form, neither does the whole expression. Thus composition is implemented by nesting on every inner result before applying the outer representing term. This guard is important: an unguarded projection could discard an undefined inner computation.
For lambda definition of primitive recursion, with already represented by , take
The tuple notation abbreviates successive abstractions and applications. On numeral inputs, induction on proves the required recursion equations, including strict propagation of undefined preceding values. The beta reduction follows the selected conditional branch only.
For lambda definition of unbounded minimization, use
This searches in increasing order. An undefined value blocks the zero test; an infinite sequence of nonzero values continues forever; the first zero returns its numeral. Under normal-order beta reduction, both failure cases have no head normal form. Structural induction on partial-recursive declarations now supplies the stronger representation claimed above.
Conversely, beta reduction is an effective operation on finitely encoded lambda terms. Enumerate all finite reduction sequences from , stopping when a result is a Church numeral in beta-normal form. If , the Church-Rosser theorem gives a reduction to that numeral. It also makes the output unique. The enumeration therefore computes exactly the represented partial function; by the equivalence of the first two characterizations it is partial recursive. Hence
A partial function is lambda-definable when a lambda term sends the corresponding Church numerals to the numeral for whenever the value is defined and produces no numeral otherwise; in other words, it is a lambda-definable partial function. The initial functions are represented by
and the appropriate variable in . If represent , then
represents their composition.
Church Booleans supply a lazy conditional, and
tests whether a Church numeral is zero. A standard predecessor term is
Let and represent the base and step functions of a primitive recursion. With a fixed-point combinator , define
Normal-order beta reduction evaluates only the selected branch. Induction on the input numeral gives the two recursion equations, so this is the lambda definition of primitive recursion.
For unbounded minimization, let represent and define
Then tests in order and returns the least zero of . If no zero is reached, or a required earlier computation is undefined, reduction never produces a Church numeral. This is the lambda definition of unbounded minimization. Since the partial recursive functions are generated from the initial functions by composition, primitive recursion, and minimization, every partial computable function is represented by a lambda term on Church numerals.
A partial function is lambda-definable if there is a lambda term such that
whenever the value is defined, while outside the domain the application reduces to no Church numeral.