Let contain all free variables of . The lambda term is a solvable lambda term if there are closed lambda terms such that
Additional arguments beyond the first are allowed. A head normal form is a term with a variable at the head; its arguments need not be beta-normal.
If reduces to this head normal form, close its free variables and supply every resulting initial binder with the same closed projection
(take when ). The head variable becomes and discards all argument terms, even divergent ones, leaving . Thus a head normal form implies solvability.
Conversely suppose a closure and applications of yield . The standardization theorem for beta reduction supplies a finite successful head-reduction sequence. Until exposes a head variable, its head contractions lie within : a closing substitution cannot create a new head redex there, and supplied arguments cannot be used until an initial abstraction is exposed. Each such contraction commutes with the closing capture-avoiding substitution. Project the successful head computation back onto , ignoring contractions in supplied arguments and the consumption of its initial binders. If this projected head computation did not reach a variable-headed spine, the full computation could not reach either. It therefore gives a finite head reduction of to a head normal form. Consequently
The same head-trace argument shows that an unsolvable lambda term stays unsolvable under substitution and application. This also justifies the unsolvability conclusion in the preceding solution.
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.
Choose fresh for and put , . The preceding coding equations give
Consequently
This self-quoting fixed point is valid even if has free variables, since the effective Gödel numbering codes open lambda terms too. Freshness of prevents variable capture.
The two different term letters in the printed implication must be made consistent; write the indexed step as . An indexed lambda term in is a finite lambda term with a bottom constant , together with a natural-number index at every subterm occurrence. Equal-looking subterms at different occurrences can have different indices. Bottom here is a constant, not an abbreviation for the divergent Omega combinator.
For , write ; in particular can contain zero. Use the graph model of lambda calculus and its pairing code from the preceding solution. If the root index is , interpretation is recursive:
Thus every constructor is clipped at its own occurrence index, not merely at the overall root.
Here are the indexed beta reduction rules. In , substitute a copy of at each free occurrence with that copy's root index lowered to . Lower the substituted body's root index further by taking its minimum with ; other inherited indices remain unchanged. If the entire body is , this retains the root bound of the inserted argument as well. For an abstraction with index zero, substitute for instead and lower the resulting body root index to zero. The previous root index on the redex application need not be retained. Reduction is allowed in all contexts. Bottom reduction additionally collapses and to ; one can collapse the whole maximal abstraction/left-application context in which an occurrence of bottom is at the head. These rules are sensitive to the pairing and cutoff conventions just specified.
To prove semantic monotonicity, first check the finite-witness bounds, writing for graph application:
For the first bound, a witness has . If , the pairing code is strictly larger than ; for the assertion is automatic. Also every member of satisfies , hence . So the same witness uses only . For the zero-index case the sole possible graph entry is , whose finite-input witness is .
Let and . A syntax induction gives the indexed substitution equality: replacing by a copy of with root interprets that occurrence as , exactly its value when the bound variable receives . The body-root change to clips the resulting body value at . Hence the positive-index contractum has interpretation , while the redex before contraction is included in that set by the finite-witness bound. In the zero-index case the contractum interprets as , equal to the un-clipped application of the zero-indexed abstraction. The old application-root cutoff can only decrease the redex value. Bottom contractions preserve the empty interpretation: the empty graph applied to anything is empty, and abstraction with an everywhere-empty body has empty graph. All surrounding interpretation constructors are monotone. Therefore
For the unindexed erasures, indexed positive contractions are ordinary beta contractions, whereas zero-index contractions first discard their argument by replacing it with bottom. Consequently the result contains no new Böhm information:
where permits replacement of subtrees by bottom and identifies bound names. To justify this syntactically, replacement of subterms by bottom commutes monotonically with substitution. A contraction in a partially erased term can be lifted to the corresponding contraction in the original term; if an erased function-head prevents matching a contraction, its result is bottom and is still below the original subtree. Induction over a finite reduction sequence therefore exhibits the erasure of as a partial reduct of a beta-equivalent version of . Bottom contractions only prune this partial tree. Ordinary beta contractions alone preserve the Böhm tree; the extra pruning explains why semantic inclusion here has the opposite orientation to the tree comparison.
Let be the finite Böhm approximants of . Their grammar is
Equivalently, they are finite beta-bottom normal forms obtained from a term beta-equivalent to by replacing subterms by bottom. The approximation theorem for the graph model is
Here is a full proof. First, every indexed interpretation lies below the unindexed one. Increasing any occurrence index can only increase it, so the indexed interpretations form a directed family. Their union is the unindexed interpretation:
Prove this by structural induction. It is immediate for variables and bottom. At application, membership of an output has one finite-input witness in the graph; structural induction captures its graph entry and the finitely many required argument entries at finite child indices, and a root index at least the output captures it. At abstraction, a graph entry is determined by one body membership in the finite-input environment ; structural induction captures that membership at finite body indices, and a root index at least captures the entry. This proves both inclusions in the union identity without assuming the approximation theorem.
Now fix and reduce the fully indexed term to its normal form , using the permitted normalization hypothesis. Its erasure has neither a beta redex nor a bottom-headed abstraction/application, so has the displayed approximant grammar. The lifting and pruning argument above gives . The semantic inequality along its finite reduction sequence gives
Taking the union over proves inclusion of the left side of the approximation theorem in the right. For the reverse inclusion, choose and a beta-equivalent term from which it is obtained by erasing subterms. Beta soundness gives that term the same interpretation as ; erasure replaces interpretations by the least element, and every semantic constructor is monotone. Thus . Taking the union finishes the proof. In particular an unsolvable lambda term has only the bottom approximant and therefore has empty interpretation in .
A lambda term is built recursively as a variable , an application , or a lambda abstraction . Application associates to the left and abstraction binds occurrences of its variable. We identify consistent renamings of bound variables by alpha equivalence. A beta reduction contracts to the capture-avoiding substitution , at any subterm. Write for finitely many such steps, including none. Beta equivalence is the reflexive, symmetric, transitive closure of reduction, so it is represented by a finite zigzag of forward and backward steps.
To prove the Church-Rosser theorem, introduce parallel beta reduction by the four rules
By structural induction every term parallel-reduces to itself. Each ordinary step is a parallel step. Conversely, each parallel step can be performed by an ordinary finite sequence: reduce the displayed subterms recursively, and in the fourth rule contract the root last. Hence and are the same relation.
The substitution lemma is
Prove it by induction on the parallel-reduction derivation for . The variable case separates from other variables; application and abstraction follow from their inductive hypotheses. For abstraction, rename its binder fresh for before substituting. For a contracted redex, choose its binder distinct from and fresh for . The substitution identity follows by structural induction with fresh binders; the variable cases use , and application and abstraction preserve the identity. Apply the hypotheses to the body and argument, then the parallel contraction rule and this identity. This proves the lemma for every derivation, including simultaneous contractions inside a redex.
Define the complete development of a lambda term by
Only a root redex already present in the source application is contracted by this clause; a newly created root redex need not be contracted.
We claim that implies . Induct on the derivation. The variable and abstraction cases are immediate. In the ordinary application rule, use the inductive developments of both components. If its original function is an abstraction, also contract the resulting root redex by the parallel contraction rule; otherwise just use the application rule, even if the reduct has acquired a new root redex. In the contraction rule, the reduct has form , and the substitution lemma with , gives . This establishes the claim.
Consequently, any two parallel reducts of each parallel-reduce to . Thus parallel reduction has the one-step diamond property. Its finite transitive closure is confluent: fill a finite grid of elementary diamonds to join two finite reduction paths from the same term. Since its closure equals ordinary finite beta reduction,
A finite conversion zigzag now also has a common reduct, by induction along it. If the next zigzag step points forward from a term already having a common reduct, join its two outgoing paths by confluence; if it points backward, compose the new forward path to that common reduct. The reverse implication is immediate because two paths to a common reduct form a conversion zigzag. This proves
A beta-normal form contains no beta-redex, so its only finite reduct is itself. If two normal forms are beta-equivalent, their common reduct must equal both. Hence a term has at most one beta-normal form up to alpha equivalence. The qualification about bound-variable names is essential.
For an example without normal form, take the Omega combinator
Its only redex is the root, and contracting it reproduces . Every finite reduct is therefore , which is not a beta-normal form. By the theorem it cannot even be beta-equivalent to any normal form.
A combinatory logic term over free variables is formed from variables in , the constants , and application, with no abstraction binder. We may regard as primitive, or as the abbreviation . Application associates to the left. Weak combinatory reduction contracts
in any application context. Weak equivalence is the equivalence relation generated by these reductions. There is no additional rule identifying terms merely because they behave alike after application to a fresh argument.
Define bracket abstraction on combinatory terms by the following ordered clauses:
They cover every term: after excluding the variable case and the case with no free , the term must be an application. Induction gives ; no other variable is introduced or removed. For every argument , the same induction gives : the three cases use respectively the , , and reductions.
The required translation is
It has exactly the same set of free variables as the original lambda term, by the bracket-abstraction identity.
To compare the two reductions, expand the constants into lambda terms:
and expand variables and applications homomorphically. Every weak combinatory contraction becomes a finite sequence of beta reductions, so weakly equivalent terms have beta-equivalent lambda expansions. We also have
For , this is the expansion of . For , the expansion of beta-reduces to , after choosing the binder fresh. For an application, expanding gives
by induction and beta contraction. Thus, induction on the lambda syntax gives . Combining these facts proves
The reverse implication fails for this intensional translation. The beta-equivalent lambda terms and translate respectively to
Both are weak normal forms: has no argument, has too few arguments to contract, and the outer has only two arguments. They are syntactically distinct. By the assumed Church–Rosser property of weak combinatory reduction, two distinct weak normal forms cannot be weakly equivalent. The same argument works with , because both fully expanded terms remain distinct weak normal forms. Hence beta-equivalent lambda terms need not have weakly equivalent combinatory translations.
In the simply typed lambda calculus, types are generated from atomic types by the arrow constructor . A typed lambda term is a lambda term equipped with a derivation of a judgement , where the context assigns types to its free variables. The basic typing rules are
The Implicational Curry-Howard correspondence reads atomic types as propositions and as logical implication. A typed variable is an assumption, abstraction is the implication introduction rule discharging that assumption, and application is the implication elimination rule. Consequently a typed lambda term is a proof in implicational Intuitionistic propositional logic, and a natural deduction proof recursively supplies such a term. For example, expresses implication reflexivity. Products, sums, and the empty type extend the correspondence to conjunction, disjunction, and falsity; pure arrow types give precisely the implicational fragment. Beta reduction removes an introduction followed immediately by its elimination, matching proof simplification.
A Church numeral is
where means repetitions of application. At base type , it has type . The following Church numeral arithmetic terms use left-associated application:
Their concise conclusions are
For successor, the initial adds one application. For addition, the inner supplies applications and supplies more. For multiplication, the repeated operation applies times, and repetitions give . For exponentiation, iterates the operation on : each iteration replaces a function by its -fold iterate, yielding . Zero iterations give , so this encoding takes , including . The explicit outer abstractions make the result the standard Church numeral even at exponent zero, without needing eta equivalence.
Successor, addition, and multiplication operate on the same . The displayed exponentiation term has type : its exponent iterates an operation on functions. Thus the numeral syntax admits several type instances; one should not force every occurrence into one fixed monomorphic Church type.
The Y combinator is the fixed-point combinator
For , beta reduction gives . Since , we obtain . This allows a recursive program body to receive a representation of itself.
Here the computation is in the untyped lambda calculus. The self-application would require a simple type satisfying , impossible for finite simple types. Accordingly is not a typed lambda term of the simply typed system. The Strong normalization theorem for simply typed lambda calculus also rules out a universal divergent fixed-point operator there.
To obtain a lambda representation of partial computable functions, encode machine configurations as finite data using Church numerals, Church pairs, and Church Booleans. Initial configuration, one transition, the halting test, and output extraction are primitive recursive functions, represented by lambda terms through the initial functions, composition, and lambda definition of primitive recursion by pair iteration. If these representations are , , , and , define
Use normal-order beta reduction so the Church Boolean halting test selects one branch without evaluating the unused recursive branch. A halting computation follows finitely many transitions and returns the Church numeral of the output. A nonhalting computation forces successive tests forever and has no head normal form; by normal-order normalization theorem, it cannot be beta equivalent to a Church numeral. Thus every partial computable function is represented, with divergence preserved; every total computable function is the halting special case. This explains the role of in computational universality while keeping the typed proof interpretation precise.
Write and . The displayed formula is . A proof of logical implication may use its temporary assumption more than once; this is ordinary natural deduction, not a linear proof system.
Assume , then , then , then . The identity weakening rule derives from the hypotheses and . Discharging by the implication introduction rule gives . Applying by the implication elimination rule gives . Discharge to obtain . Applying gives an ; discharge to obtain a ; apply once more to obtain , and finally discharge .
Here is the complete decorated natural deduction derivation, split at its intermediate conclusion to keep the tree readable. Superscript labels mark which assumption occurrences are discharged; both occurrences labelled are discharged together.
To avoid an excessively wide final tree, continue the same derivation as follows, using the right-hand derived premise above:
followed by
Thus the concise lambda term, with bound-variable types determined by the displayed tree, is
Under the Curry-Howard correspondence, implication introduction rules correspond to lambda abstractions, implication elimination rules to applications, and the identity weakening rule retains the first term while allowing an unused second hypothesis. No other inference rule or classical axiom is required.
We use untyped lambda calculus and normal-order beta reduction. The Church numeral for is . A lambda term represents a partial function if on numeral inputs it has the correct numeral normal form exactly when the function is defined. We use a lambda simulation of a Turing machine; this also ensures that undefined computations do not accidentally produce an output through an ignored argument.
First all total primitive recursive functions are lambda-definable. The initial functions of recursion theory are represented by
Composition is obtained by substitution of representing terms. For primitive recursion use Church pairs:
If represent the total functions in and , define
After iterations the pair has components . Thus the Church numeral executes exactly the required recursion steps. Since these functions are total on numeral inputs, substitution for composition causes no undefined-argument issue.
Now fix a deterministic Turing machine computing the given partial computable function. Encode a configuration by its finite control state and two natural numbers for the tape portions on the two sides of the head, allowing blank bits beyond the finite nonblank tape. For the two-stack encoding of a Turing tape with a binary alphabet, let have the immediately-left cell as its low bit and have the current cell as its low bit. Reading and removing a bit use remainder and quotient by two. If the machine writes , the updates are
The new state is obtained from a finite transition table. These operations, the initial configuration, the halting test, and output decoding are total primitive recursive functions on configuration codes. For instance parity alternates by primitive recursion, and the quotient by two satisfies , . A fixed finite alphabet can be handled by the same stack construction in a larger base. Choose a standard delimited input and output convention, for example unary words in a finite tape alphabet with a distinct blank symbol. Initialization is primitive recursive. On a halting configuration the output is a finite word; decoding can be implemented by a bounded scan of the encoded tape, with a default output for malformed words. This is total primitive recursive and introduces no additional unbounded search. Use nested Church pairs to carry the three fields, and the preceding primitive recursive representations to obtain lambda terms .
Represent Church Booleans by and . A Church numeral zero test is . Use a numerical test equal to zero on halting configurations and one otherwise; applying this zero test gives the required Boolean halting test. With the fixed-point combinator
put
Normal-order reduction evaluates the halting test on the current configuration. If it is true, it selects the output branch without evaluating the recursive branch. Otherwise it advances the configuration and repeats. Induction on the number of machine steps shows that a computation halting with output makes reduce to .
If the machine never halts, the normal-order beta reduction repeatedly takes the recursive branch. Each individual configuration transition and test terminates, but there is always another required transition; hence the reduction never reaches a normal form. The normal-order normalization theorem says that a lambda term with a beta-normal form is normalized by normal-order beta reduction. Therefore in the nonhalting case there is no numeral normal form at all. We have proved
Confluence of beta reduction ensures uniqueness of the resulting numeral. This handles genuinely partial computations. Simply composing terms for partial subcomputations would need extra care, because lambda reduction can discard an unevaluated argument.
Represent a nonnegative integer by the Church numeral
A closed lambda term represents a partial computable function if, on inputs in its domain, reduces to the Church numeral of the value, and on other inputs it produces no Church numeral. We use untyped lambda calculus and normal-order beta reduction.
First every primitive recursive function has such a representation on all inputs. The zero function is represented by a constant , the projection functions by , and the successor function by
For function composition in recursion theory, substitute the represented inner functions into the represented outer function:
These constituent functions are total, so there is no undefined argument to be discarded.
For primitive recursion, use Church Booleans and Church pairs:
If represent the total functions defining a recursion, put
and
After iterations the Church pair contains the counter and the recursively computed value at , by mathematical induction. Thus this lambda definition of primitive recursion by pair iteration represents the recursion. A structural induction for primitive recursive functions now represents every primitive recursive function.
To pass to arbitrary partial computable functions, use the Kleene normal form theorem in the following form: for every , there are total primitive recursive functions such that
with undefined precisely when no such exists. The predicate checks codes of valid finite halting histories for the chosen program; extracts their common output. This expresses unbounded minimization of a total predicate, so no earlier undefined test can interfere with the search.
Let be the represented total functions. The Church numeral zero test and a fixed-point combinator are
Define the search lambda term
All displayed abbreviations expand to finite closed lambda terms; stands for the fixed finite tuple of input variables. Because , normal-order beta reduction tests . At the first successful test the Church Boolean selects , which reduces to the correct Church numeral. The unused recursive branch is discarded.
If no test succeeds, every finite search step returns to another head search, never exposing a numeral. The term has no head normal form and hence cannot be beta equivalent to a Church numeral. This last point is why the output operation occurs inside the successful branch: simply applying a possibly argument-discarding outer function to a divergent search would not justify undefinedness. Therefore every computable function is representable, including partial computable functions with their correct undefined inputs: