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:
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 135 3 Solution Created 2026-10-03 Updated 2026-10-05
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 satisfyingOn 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 . PutIteration takes to for , proving that encodes the predecessor function and that correctly tests zero.
Use a fixed-point combinator and the strict sequencing operationFor 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 , takeThe 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, useThis 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
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 2 4H a Solution Created 2026-09-24 Updated 2026-10-03
A recursive set has an indicator function computed by a register machine that halts on every input. A recursively enumerable set is the exact halting set of some register machine; equivalently, it is the domain of a partial computable function.
If is recursive, its decider immediately gives machines that halt exactly on and on , so both sets are recursively enumerable. Conversely, suppose machines and recognize the two sets. On input , use dovetailing to run one step of and one step of alternately. Exactly one must eventually halt. Return one if halts first and zero if halts first. This is a total decider for , so is recursive.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 2 4H b Solution Created 2026-09-24 Updated 2026-10-03
Encode each -tuple of nonnegative integers by one nonnegative integer using a computable pairing function. Define a unary partial procedure on input as follows: use dovetailing on the computations of over all encoded -tuples, and halt as soon as one of them halts with output . ThenBy the Church–Turing thesis, this effective procedure is implemented by a register machine with some fixed code , soThus is the domain of a partial computable function and is recursively enumerable.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 3 12H a Solution Created 2026-09-24 Updated 2026-10-03
Fix an acceptable effective enumeration of the -ary partial computable functions. The S-m-n theorem states that for every there is a total computable function such thatwhere means that both sides have the same value when defined and are otherwise both undefined.
The recursion theorem states that every total computable transformation of program indices has a semantic fixed point: there is an such that
Past exam of the mathematics course of the University of Cambridge 2020 ii Paper 1 12F a Solution Created 2026-09-24 Updated 2026-09-29
A register machine has finitely many natural-number registers, a finite set of labelled states, and instructions that increment a register, conditionally decrement and branch according to whether a register is zero, or halt. A program is a finite sequence of such labelled instructions, and a configuration records the current instruction together with every current register value.
Given inputs, place them in designated input registers and initialize the remaining registers to zero. The machine computes a partial computable function when it halts with output in the output register exactly for and runs forever otherwise.
To encode a machine, encode every instruction by a natural number using effective encodings of its opcode, register number, and target labels. Encode the resulting finite sequence by a Gödel numbering, for example through iterated pairing or prime powers. Effective decoding gives an enumeration of machine programs, so the unary function computed by program code may be denoted .
Past exam of the mathematics course of the University of Cambridge 2020 ii Paper 1 12F b Solution Created 2026-09-24 Updated 2026-09-29
The partial recursive functions form the smallest class containing the zero function, successor function, and projection functions and closed under composition, primitive recursion, and unbounded minimization.
Fix a register machine with inputs. By the permitted result, its complete configuration after steps,is a recursive function of the inputs and time. The predicate saying that this configuration is halted is therefore recursive. Its halting time is the partial recursive functionwhere unbounded minimization is undefined when no halting time exists. Extracting the output register from a configuration is recursive, sois partial recursive. Hence every partial computable function is partial recursive.
Past exam of the mathematics course of the University of Cambridge 2020 ii Paper 2 4F i Solution Created 2026-09-24 Updated 2026-09-29
A subset is recursive when its indicator function is a total computable function. It is recursively enumerable when it is the domain of a partial computable function, equivalently when an algorithm can enumerate its members.
If is recursive, its indicator decides both and its complement, so both sets are recursively enumerable. Conversely, suppose programs enumerate and . On input , run the two enumerations in parallel by dovetailing. Exactly one must eventually print ; accept in the first case and reject in the second. This algorithm always halts and decides . Hence
Past exam of the mathematics course of the University of Cambridge 2021 iii Paper 120 3 Solution 2026-09-28
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 byand the appropriate variable in . If represent , thenrepresents their composition.
Church Booleans supply a lazy conditional, andtests whether a Church numeral is zero. A standard predecessor term isLet and represent the base and step functions of a primitive recursion. With a fixed-point combinator , defineNormal-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 defineThen 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.
Past exam of the mathematics course of the University of Cambridge 2023 ii Paper 1 12I iii Solution Created 2026-09-24 Updated 2026-09-25
A set is a Sigma-1 set when it is the domain of a partial computable function: there is a partial computable such thatEquivalently, iff for some computable predicate ; one may take to say that the truncated computation function observes a halt within steps.
Past exam of the mathematics course of the University of Cambridge 2023 ii Paper 2 4I b iii Solution Created 2026-09-24 Updated 2026-09-25
Suppose for a partial computable function . Since , fix . Decode each input as a pair . Using the truncated computation function, defineThis is a total computable function, and every output lies in . Conversely, if , choosing at least the halting time gives an input with . Thus , proving (iii)(iv).
Past exam of the mathematics course of the University of Cambridge 2023 ii Paper 2 4I b ii Solution Created 2026-09-24 Updated 2026-09-25
Suppose for a partial computable function . Defineand leave undefined otherwise. A program computes by running and returning if that computation halts. Hence is partial computable andwhich proves (ii)(iii).
Past exam of the mathematics course of the University of Cambridge 2023 ii Paper 2 4I b i Solution Created 2026-09-24 Updated 2026-09-25
Statement (i) implies (ii) directly from the definition: if is computably enumerable, its semidecision program computes a partial computable function whose domain is exactly ; for example, return the empty word whenever the program halts.
Productive set 2026-10-06
A set is productive when a partial computable function returns an element of outside any computably enumerable subset supplied by its index. The function must halt for every index of a subset of , including finite subsets. Productive sets are not computably enumerable.
Recursively enumerable set Created 2026-09-24 Updated 2026-10-06