Every partial computable function is represented on Church numerals by a closed untyped lambda calculus term. First represent all primitive recursive functions using zero, successor, projections, composition and lambda definition of primitive recursion by pair iteration. Apply the Kleene normal form theorem and search successive history codes with a fixed-point combinator. Test the represented total predicate using a Church numeral zero test; return the decoded output only on the true branch. If no history passes, normal-order head reduction continues the search indefinitely and the term has no head normal form, so cannot be in beta equivalence with a Church numeral. This avoids the incorrect assumption that a lazy outer function must evaluate a divergent argument in an unguarded composition.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 135 6 Solution Created 2026-10-03 Updated 2026-10-05
Use untyped lambda calculus and normal-order beta reduction. Write for the Church numeral of . We will construct a closed term such thatwhen is defined, and with no head normal form otherwise. The latter condition implies that the result is not in beta equivalence with any Church numeral, so both definedness and the output are represented.
First represent all total primitive recursive functions. The zero function is , the successor function isand the th projection function is . Function composition in recursion theory is represented by . This composition claim is used here for total functions, whose inner terms all reduce to numerals.
For primitive recursion use Church pairs and iteration. PutSuppose represent the total constituents of and . DefineAfter iterations the pair reduces to , by mathematical induction on . Its second projection is the required result. This lambda definition of primitive recursion by pair iteration and structural induction on the primitive recursive construction give terms for all primitive recursive functions.
For an arbitrary partial computable function use the Kleene normal form theorem with its program index fixed. There are total primitive recursive functions and such that is zero exactly when codes a valid halting computation history on , and extracts that history's output. Checking finite coded configurations and each transition is primitive recursive. Determinism ensures that every accepted history on an input has the same output. HenceIf the input computation never halts, no history is accepted. Let be the total numeral-representing terms already obtained. The Church numeral zero test is , returning exactly on zero. A Church Boolean applied to two arguments selects the appropriate branch without evaluating the other.
Take the fixed-point combinator . For the input tuple defineExpanding the displayed abbreviations gives a genuine finite combinator. At a numeral code , the total predicate computation terminates. If it returns a positive numeral, the false Church Boolean selects the next search code. If it returns zero, the true Church Boolean selects , which reduces to the output numeral. If the least accepted code is , a finite sequence of these tests reaches it and then produces .
If there is no accepted code, every test is false and head reduction moves through codes forever. At no finite point can a head variable or an outer numeral abstraction be produced: the applied search term must first unfold the fixed point and evaluate the next total test, and the decoder branch is always discarded. Thus it has no head normal form. The standard head-normalization property, or the Church-Rosser theorem together with normalization of normal-order reduction, rules out beta equivalence to a numeral. In particular, we have avoided a lazy-composition pitfall: an outer function that discards an argument need not force a divergent inner computation. The decoder is reached only after the guarded search succeeds. This proves lambda representation of partial computable functions: