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 2018 ii Paper 4 4G c Solution Created 2026-09-24 Updated 2026-10-03
Choose a fixed positive capacity and represent the abstract state by a finite partial function . Its domain of a partial function has at most members; each belongs to and is a fixed point:The blocks of a set partition are the nonempty fibres of
rep, and their shared values are their disjoint-set representatives. Initially , so . Representatives need not be the minimum members of their blocks.trait DisjointSets {
val capacity: Int
// State: rep is a finite idempotent map, |dom rep| <= capacity.
// Initially: rep is empty; capacity is fixed and positive.
// Pre: x is absent and |dom rep| < capacity.
// Post: add x -> x; leave every old mapping unchanged.
def makeSet(x: Int): Unit
// Pre: x belongs to dom rep.
// Post: state unchanged; return rep(x).
def find(x: Int): Int
// Pre: x and y belong to dom rep.
// Post: merge their blocks, retaining old rep(x).
def union(x: Int, y: Int): Unit
}Precisely,
makeSet(x) extends the domain of a partial function by with . For union(x,y), snapshot and , keep unchanged, and setThis merges the two blocks and keeps the representative of the first argument's block. If , it is an identity operation. This deterministic design choice satisfies disjoint set union without imposing minimum-element representatives. The capacity bound is explicit in the abstract data type so that the bounded implementation does not silently strengthen makeSet's precondition.