Past exam of the mathematics course of the University of Cambridge 2012 iii Paper 24 1 Solution Created 2026-10-03 Updated 2026-10-07
Take and fix a standard effective enumeration of the unary partial computable functions by program texts. WriteThe diagonal halting set is not a computable set: a supposed decision procedure would give a program that halts on input exactly when , contradicting its own index. Each is finite and uniformly decidable by bounded simulation of a computation, and with union .
For , define the computable colouringThis is a two-part decidable set partition on three-element subsets: sort the three inputs and perform the two finite simulations. Here . The halting-stage colouring of triples cannot have an infinite homogeneous set for a colouring of colour . Indeed, fix its least element . The finitely many bits of eventually stabilize. Choose two later elements of the putative homogeneous set for a colouring beyond that stabilization stage; the corresponding triple has colour .
Now suppose is an infinite homogeneous set for a colouring of colour . Its membership oracle computes : to decide whether , search for with , and return whether . For every above , homogeneity gives . Since is unbounded, taking such arbitrarily large proves that this common finite set is . ThusIf were a computable set, the displayed Turing reduction would decide , a contradiction. The displayed decidable two-colouring has no infinite decidable homogeneous set.
For the second construction, let be the finite binary strings, with coordinates starting at , and define the computable binary treeMembership is decided by finitely many tests using bounded simulation of a computation. It is a binary tree of finite strings: if a string satisfies the tests, each prefix satisfies its shorter and fewer tests. The infinite paths through a binary tree are exactlyThis set is nonempty: at a coordinate whose diagonal computation halts with a binary value choose the other value, and choose either bit elsewhere. This is an existence argument, not a proposed computable decision procedure for convergence. No member is a total computable function. If were a total binary-valued function, the condition at would say . Thus each member is a binary diagonally noncomputable function.
Moreover, has no isolated point. There are arbitrarily large indices of programs that never halt: for example, distinct program texts with successively more unused instructions followed by an infinite loop provide infinitely many such indices in the usual syntactic program coding. At every one of these coordinates the bit is unrestricted. Given any and any prefix length , change its bit at one such index and leave all other bits unchanged. The resulting different path still belongs to and has the same length- prefix. Since a path space is closed in Cantor space, is decidable, is nonempty and perfect, and no infinite path is computable.
There is a definition issue with the adjective “perfect”. The preceding conclusion uses perfect path space, allowing finite dead ends in the decidable presentation. If “perfect tree” instead requires every node to have two incompatible extensions in the tree, the requested combination is impossible. Such a nonempty tree has no terminal nodes. Starting at the empty string, test the two immediate successors and choose the first that belongs to the tree; one always exists. This constructs a total computable function whose successive prefixes remain in the tree. Thus computable pruned binary trees have computable paths. Our necessarily has dead ends; its subtree consisting only of prefixes of infinite paths is perfect in the pruned sense but is not decidable. The construction therefore supplies the intended perfect closed path space and also resolves the stronger, inconsistent interpretation.
Past exam of the mathematics course of the University of Cambridge 2012 iii Paper 24 2 Solution Created 2026-10-03 Updated 2026-10-07
A function in intension is a finite description of a computation, such as a program or a formal construction expression. A function in extension is the resulting input-output map, including its domain if it is partial. Different descriptions may have the same extension: the programs that return directly and that compute describe the same function. Finite descriptions have Gödel numbers; equality of the resulting partial computable functions is a separate semantic question.
The primitive recursive functions are the smallest class of numerical functions containing the zero functions, the successor function and all projection functions, and closed under function composition in recursion theory and primitive recursion. More explicitly, from and the latter operation formsFor function composition in recursion theory, an -ary and -ary give . Zero functions of all allowed arities can be included, with nullary zero included if arity is part of the coding convention. Every resulting function is total: the initial functions are total, function composition in recursion theory preserves totality, and mathematical induction on verifies totality of primitive recursion. Applying structural induction for primitive recursive functions then covers all construction expressions.
Use a fixed effective Gödel numbering of finite tagged construction trees with decidable decoding. A node is tagged as zero, successor, projection, composition, or recursion. The primitive recursive syntax and arity checking algorithm first checks that the input decodes as a finite tree, then works upwards from its leaves. A projection tag is legal exactly when , with output arity . A composition node declares its output arity and is legal when its outer child has arity , there are exactly inner children, and each has arity ; its arity is . The declared arity also handles the case . A recursion node is legal when its base child has arity and its step child has arity ; its arity is . Zero and successor tags have their declared arities. Ill-formed nodes are rejected. The process terminates because there are only finitely many nodes. Thus, for each fixed ,This is a syntactic assertion about functions in intension. It does not assert that arbitrary machine indices computing primitive recursive functions form a decidable set. That extensional property is nontrivial, hence undecidable by Rice theorem. For an explicit reduction, given a program construct a program that, on every input, waits for to halt and then returns . Its extension is a primitive recursive function if , and otherwise is nowhere defined and so is not a primitive recursive function. A decision procedure for this latter semantic set would decide the diagonal halting set.
Enumerate the decidable syntax set in increasing code order as . There are infinitely many such descriptions; iterating successor after a unary zero expression already supplies infinitely many. Let be the extension of a valid construction and defineTo compute , find by the syntax test and interpret its finite construction tree. Evaluate function composition in recursion theory by evaluating the children, and evaluate primitive recursion by the prescribed finite loop of length equal to its final input. Termination follows from the totality argument above, so and are total computable functions.
If were a unary primitive recursive function, some construction would have extension . Then the diagonal argument giveswhich is impossible. The displayed is total and computable but not primitive recursive. Repetitions of extensions in the enumeration cause no problem: every possible extension is represented, which is all the diagonal argument needs. The same argument shows that the two-variable interpreter cannot itself be primitive recursive.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 20 2 i Solution Created 2026-10-03 Updated 2026-10-07
If halts on every input, simulate on input while counting its steps, and output that count when it halts. The resulting function is a total computable function. Consequently yes: one may take the exact running time,This construction does not promise a simple closed expression or a bound of any particular complexity class; it uses the promised totality of this particular machine.
For a machine computing a partial computable function, its exact halting-time function is still a partial computable function, with the same domain. A finite bound cannot cover a genuinely infinite computation. Even restricting attention to inputs on which halts, a total computable function bounding all halting times need not exist. In fact the precise characterization is the computable bound on halting time criterion:For the forward implication, compute and simulate for that many steps. If it has not halted, the proposed bound ensures that it never will. This decides the domain. Conversely, first decide whether is in the domain; return zero outside it and the simulated halting time inside it. This defines a total computable function satisfying the bound. The time needed to compute the bound itself is irrelevant to this argument.
A universal halting recognizer has undecidable domain by the halting problem, so it has no such total bound. On the other hand, a machine that immediately halts on even inputs and loops on odd inputs computes a nontotal partial computable function but has a constant bound on its halting times. Thus nontotality alone does not decide whether a total bound exists.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 20 4 Solution Created 2026-10-03 Updated 2026-10-07
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 areThe 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 iswhere means repetitions of application. At base type , it has type . The following Church numeral arithmetic terms use left-associated application:Their concise conclusions areFor 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 combinatorFor , 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 , defineUse 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.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 21 1 Solution Created 2026-10-03 Updated 2026-10-06
There is no computable presentation of a Nonstandard model of Peano arithmetic. We prove Tennenbaum theorem by obtaining a computable set separating two recursively inseparable sets.
Fix an effective enumeration of partial computable functions, implemented by deterministic machines, and putThese are disjoint computably enumerable sets. To see that they are recursively inseparable sets, suppose a computable set contains and avoids . Its indicator function has some index . If , then , contradicting that output. If , then , contradicting . Thus neither output is possible.
Let be a Nonstandard model of Peano arithmetic. A recursive presentation of a structure here means a presentation on in which its arithmetic operations are total computable functions; equality of presentation codes is ordinary equality. Write for the element represented by the standard numeral . The presentation codes of are fixed constants, so is a total computable function obtained by repeated addition. Presentation codes and the arithmetic values they name must be kept distinct.
Use bounded simulation of a computation predicates saying that machine , on input , has halted by time with output . We can choose these as primitive recursive predicates represented in Peano arithmetic. Determinism and induction on the computation length give, provably in Peano arithmetic, monotonicity in andA genuine standard halting computation has a finite certificate which Peano arithmetic verifies. Consequently, if or , the corresponding holds in for some standard .
Choose a nonstandard element of . It exceeds every standard numeral. Let be the th prime number, starting with . Peano arithmetic proves the prime-divisibility coding of a finite set needed here: for each , an element can be formed as the product of precisely those with for which holds. Formally,This is an internally finite product, not a claim that its externally observed index set is finite. Its existence follows by mathematical induction on the cutoff: start with , multiply by the next distinct prime number when its predicate holds, and otherwise retain the product. Unique prime factorization ensures that earlier divisibility decisions are preserved. The standard prime enumeration and these finite-product constructions are provably total in Peano arithmetic.
Define the external subset . If , its standard halting time is below , and monotonicity gives , so . If , its output-one certificate and the provable incompatibility above exclude , so . Hence separates and .
Finally is a computable set. Given standard , compute the ordinary integer and its numeral in the presentation. Enumerate all presentation codes , and for each test the finitely many standard remainders forEach test is decidable using the assumed total computable functions. The division theorem of Peano arithmetic guarantees a quotient and a remainder below the standard numeral . Every element below that numeral is one of , so the search terminates; the remainder is unique. Return yes exactly when . This makes a computable set, contradicting the recursively inseparable sets construction. Therefore
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 25 4 Solution Created 2026-10-03 Updated 2026-10-06
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 byComposition is obtained by substitution of representing terms. For primitive recursion use Church pairs:If represent the total functions in and , defineAfter 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 areThe 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 combinatorputNormal-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 provedConfluence 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.
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 25 6 Solution Created 2026-10-03 Updated 2026-10-06
A theory is recursively axiomatizable when it has an effective enumeration of axioms, equivalently when its deductive closure is computably enumerable. If the definition requires a decidable axiom set, the equivalent formulation is obtained by replacing an axiom enumerated at stage by a fixed left-associated logical conjunction of copies of it. To recognize a proposed padded axiom, inspect its finitely many possible decompositions into repeated conjuncts and check the corresponding finite enumeration stages. The padding preserves logical equivalence, so the resulting decidable axiom set generates the same theory. In either convention, enumerate formal proofs using the finite sets of axioms seen so far. This effectively enumerates every theorem.
Let be a sound arithmetic theory of the standard natural numbers, sufficiently strong to encode finite computations, proofs and substitution and to establish the Diagonal lemma; an extension of Robinson arithmetic suffices. With a semidecidable axiomatization, the arithmetical provability predicate expresses that a proof of the sentence with code exists. A proof certificate can include enumeration stages for its axioms, so this predicate is arithmetically expressible even when the given axiom set is only computably enumerable.
The Diagonal lemma produces a sentence such thatHere is the mechanism, including its effectiveness. For the computable substitution function taking a one-variable formula code to the code of that formula with the numeral substituted, let represent its graph. Given , form and let be the code of . The sentence has code . Numeralwise correctness and uniqueness of the represented substitution computation prove . This constructs a fixed point effectively from the code of . Applying it to gives .
If proved , arithmetic soundness would make true, while the existence of that proof would make true. The displayed equivalence would then make false, a contradiction. Thus does not prove . In the standard natural numbers its arithmetical provability predicate is therefore false at this code, so is true. Arithmetic soundness now rules out a proof of as well. Hence is incomplete: neither nor is a theorem, and is true.
For a fixed effective enumeration of computably enumerable sets, a productive set has a partial computable function such thatThe condition applies to every computably enumerable subset, including finite subsets. No condition is imposed on when the inclusion fails.
Let be the set of codes of true arithmetic sentences; numbers which are not sentence codes are excluded. Uniformly in , there is an arithmetic formula expressing : it says that a finite enumeration computation outputs . Apply the effective diagonal lemma to obtain withThe operation producing this sentence code is total computable. Suppose . If , the subset assumption says that is true, while its fixed-point equivalence says it is false, a contradiction. Thus . The same equivalence now says is true, so . We have provedTherefore arithmetic truth is a productive set. This proves productivity of arithmetic truth. It cannot itself be computably enumerable, since taking would contradict the defining property. Applying the productive procedure to the enumerable theorem set of a sound arithmetic theory also gives a true sentence outside that theory. The productive construction does not require the enumerable subset of truths to be a theory or to be deductively closed.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 120 3 Solution Created 2026-10-03 Updated 2026-10-06
Rice theorem: every nontrivial extensional property of programs computing partial computable functions has an undecidable index set. More precisely, take an acceptable effective enumeration of the unary partial computable functions. If contains some but not all of these functions, then“Extensional” means that equality of partial functions, including their domains, preserves membership; no syntactic restriction on program codes is being considered.
We use two standard facts, stated explicitly. The diagonal halting set is undecidable. For the associated acceptable enumerations of -ary partial computable functions, with , the S-m-n theorem says that for every there is a total computable function such thatwhere means equality of defined values and equality of undefinedness. Thus fixed parameters in a program can be compiled into its index effectively.
Let be the nowhere-defined partial computable function. Choose a partial computable function whose membership in is opposite to that of ; this is possible by nontriviality. For each , construct the programThis is a uniform partial computation. Take an index for the binary partial computable function . The S-m-n theorem gives the total computable function with . Crucially,Even when itself is undefined, the equality of partial functions remains correct. If , this gives a many-one reduction of to ; if , it gives a many-one reduction of to the complement of . A decision procedure for would therefore decide in either case, a contradiction.
The equivalent language formulation says that every nontrivial property of computably enumerable languages depending only on the recognized language has an undecidable index set. Apply the function formulation to the property of a partial computable function that its domain has the specified language property: every computably enumerable language occurs as such a domain.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 120 6 Solution Created 2026-10-03 Updated 2026-10-06
Represent a nonnegative integer by the Church numeralA 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 byFor 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, putandAfter 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 thatwith 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 areDefine the search lambda termAll 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: