Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 25 3 Solution Created 2026-10-03 Updated 2026-10-06
We prove closure under the defining schemes for primitive recursive functions, keeping all unbounded existential variables outside a bounded arithmetic formula. A bounded quantifier means or , where does not contain . All formulas are interpreted in the standard natural numbers.
First we need a finite sequence code using only the permitted language of ordered rings. Define the bounded arithmetic formulaFor given , it specifies the unique remainder of modulo . In particular the quotient and remainder variables are bounded by arithmetic terms; division is not a new language symbol.
Every finite list can be coded by some pair . Choose larger than every list entry and divisible by every integer from to . The moduli are pairwise coprime. Indeed a prime dividing both cannot divide , but then divides ; since and is divisible by that integer, this is impossible. The Chinese remainder theorem gives with for every . Since , each holds. This is Gödel beta-function sequence coding. The external choice of a divisible proves that codes exist; factorial and exponentiation do not occur in the existential bounded representation of a primitive recursive function.
For the zero function, successor function and projections use , and . These formulas need no auxiliary variables. For function composition in recursion theory, suppose have representations with bounded arithmetic formulas . A bounded arithmetic formula for isTreat every as an auxiliary variable in the outer existential block. The logical conjunction is true for some such variables exactly when is the desired output.
Now supposeBy structural induction for primitive recursive functions, assume and are bounded arithmetic formulas representing . We code the values with . For finite witness array coding, give each component of the step witness another code pair , so that the witness at step is the remainder specified by .
With these code pairs and as free auxiliary variables, take the following bounded arithmetic formula:The displayed line breaks are only for readability: the bounded quantifiers on the last three lines bind the entire bracket. If , their empty block and logical conjunction are omitted. Expanding every occurrence of leaves only bounded quantifiers, logical conjunctions, the bounded arithmetic formulas already obtained, and the symbols .
If , take the actual finite computation values and select witnesses for the finitely many true instances of , together with witnesses for . The Gödel beta-function sequence coding provides and the finitely many . These make true. Conversely, suppose some code pairs and initial witnesses make true. The unique remainders of give values . The initial clause makes . Every step clause makes , since its coded witnesses satisfy the representing matrix for . Induction on gives , and the final remainder clause gives . This argument includes , when the step condition is empty.
Closure under the initial functions of recursion theory, composition and primitive recursion provesCoding the step witnesses is essential: leaving an unrestricted existential witness block inside would not give the required syntactic form.
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 2016 iii Paper 120 4 Solution Created 2026-10-03 Updated 2026-10-06
For (1)(a), a primitive recursive function is obtained by a finite construction from the zero function, successor function and projection functions, using function composition in recursion theory and primitive recursion. The recursion rule, with parameters , isHere have already been constructed. All these functions are total on nonnegative integers: the initial functions are total, composition preserves totality, and ordinary mathematical induction proves totality of each recursion.
For (1)(b), use a shifted hyperoperation sequence, beginning with addition. Defineand, for each fixed , defineThe first three members are therefore addition, multiplication and exponentiation:The exponentiation convention includes , hence . The next member iterates exponentiation, with ; there is no need for an exceptional domain restriction at .
For (1)(c), is a primitive recursive function by its displayed recursion. If is a primitive recursive function, thenare primitive recursive functions, using constants, projection functions and function composition in recursion theory. Primitive recursion applied to gives . Mathematical induction on the fixed rank proves every member of the sequence is primitive recursive. This does not assert that the joint three-variable evaluator is a primitive recursive function.
For (2), as written, the answer is no: the empty set is semidecidable, whereas a total computable function from to always has a nonempty range. This is the only obstruction. To prove the stronger useful statement, suppose is a nonempty computably enumerable set and choose . Fix a Turing machine which halts exactly on the inputs in . Its bounded halting predicateis primitive recursive: encode configurations arithmetically, iterate its total single-step operation times by primitive recursion, and check the halt state. A halted configuration is kept fixed. This is a bounded simulation, not unbounded waiting.
Fix a primitive recursive pairing function with primitive recursive inverse coordinate functions. For example, the Cantor pairing function has inverses obtained by bounded minimization. DefineThe two coordinate functions, the bounded predicate, and the finite case distinction are primitive recursive functions, so is a primitive recursive function. Its values always lie in . Conversely, if , its computation halts within some finite , and . ThusThe range need not be a computable set; deciding whether a value occurs anywhere in this total enumeration is an unbounded search.
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:
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 ii Paper 1 12G c Solution Created 2026-09-24 Updated 2026-10-03
Let be the successor function. Define by primitive recursionInduction gives . Then defineby composition. Initial functions, composition, and primitive recursion produce primitive recursive functions, so and are partial recursive functions and are visibly defined for every . Both functions are total.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 2 4H c Solution Created 2026-09-24 Updated 2026-10-03
The function is the predecessor function. It has the primitive recursion definitionThe initial function is the zero function and the recursion step is a projection function, both of which are primitive recursive functions. Closure under primitive recursion therefore proves that is primitive recursive.
Past exam of the mathematics course of the University of Cambridge 2021 iii Paper 120 4 a Solution 2026-09-28
The structural induction principle says that a property holds for every primitive recursive function if it holds for every initial function of recursion theory and is preserved by function composition in recursion theory and primitive recursion. This is justified because primitive recursive functions are, by definition, the smallest class closed under those constructors; equivalently, every such function has a finite construction tree, and ordinary induction on its height proves .
Take to mean that is total. The zero, successor, and projection functions are total. A composition of total functions is total. Finally, suppose and are total and is defined from them by primitive recursion. For fixed , induction on proves that exists: the value at zero is , and from the existing value at , totality of gives the value at . Therefore every primitive recursive function is total.
Past exam of the mathematics course of the University of Cambridge 2021 ii Paper 1 12F i Solution Created 2026-09-24 Updated 2026-09-25
A partial recursive function is obtained from the three kinds of initial function of recursion theory—
the zero function, successor function, and projection function—by finitely many applications of function composition in recursion theory, primitive recursion, and unbounded minimization. Explicitly, primitive recursion has the formwhile minimization takes the least for which and is undefined if no such is found.
the zero function, successor function, and projection function—by finitely many applications of function composition in recursion theory, primitive recursion, and unbounded minimization. Explicitly, primitive recursion has the formwhile minimization takes the least for which and is undefined if no such is found.
For the function in part (i), defineThe initial value and the identically zero recursion step are primitive recursive, so this is a primitive-recursive definition of the required zero test. It uses no minimization.