Many-one completeness of the halting problem Created 2026-09-24 Updated 2026-09-24
Every recursively enumerable set many-one reduces to the diagonal halting set. If a program halts exactly on , the S-m-n theorem produces from an index for a unary program that ignores its input and performs that computation on . ThenConversely, a computable preimage of a recursively enumerable set is recursively enumerable.
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 2017 ii Paper 3 11H b Solution Created 2026-09-24 Updated 2026-10-05
The S-m-n theorem says that parameters can be compiled effectively into program indices: for a standard effective numbering, there is a total computable function with for partial computable functions of arguments.
Write , a recursively enumerable halting problem. If is recursively enumerable, make a program with parameter which ignores its input and runs a semidecision procedure for , halting when that procedure halts. By the S-m-n theorem its index is total computable and . Conversely, implies that is recursively enumerable by the previous construction. Thus .
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 3 11H c Solution Created 2026-09-24 Updated 2026-10-05
Use uniform finite-stage enumerations and . Define a uniformly recursively enumerable setThe S-m-n theorem supplies a total computable index function with . If is finite of size , then , so is recursive. If is infinite, then for every a sufficiently late stage has both and , while no is ever enumerated. Hence , which is not recursive. Therefore . As usual the effective numbering indexes all programs; if malformed codes are included, send them to a fixed index of .
Past exam of the mathematics course of the University of Cambridge 2018 ii Paper 4 4G a Solution Created 2026-09-24 Updated 2026-10-03
The S-m-n theorem says that program inputs can be compiled into an index: for every there is a total recursive such thatHere means that either both sides are undefined or both are defined and equal.
The recursion theorem says that every total recursive transformation of program indices has a semantic fixed point: some satisfies
The Rice theorem says that every nontrivial extensional property of programs computed by partial recursive functions is undecidable.
Past exam of the mathematics course of the University of Cambridge 2018 ii Paper 4 4G b Solution Created 2026-09-24 Updated 2026-10-03
By the S-m-n theorem, there is a total recursive function such thatfor all . Apply the recursion theorem to . It supplies an index for whichConsequently
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 2019 ii Paper 3 12H b Solution Created 2026-09-24 Updated 2026-10-03
Rice theorem says that every nontrivial extensional property of programs computing partial functions is undecidable. Equivalently, a nontrivial index set cannot be a computable set.
Let be such an index set. Replacing by its complement if necessary, assume that the nowhere-defined function has no index in . Since the property is nontrivial, choose an index . If membership in were decidable, we could decide the diagonal halting problem as follows. For each , defineBy the S-m-n theorem, a total computable function produces an index for . If diverges, then is nowhere defined and . If it halts, then and extensionality gives . A decider for would therefore decide whether halts, a contradiction. Hence is undecidable.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 3 12H c Solution Created 2026-09-24 Updated 2026-10-03
Apply the S-m-n theorem to . It gives a total computable function such thatThe recursion theorem supplies an index satisfying . Consequently
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 3 12H d Solution Created 2026-09-24 Updated 2026-10-03
For each , let be an effectively obtained index of the partial functionThe existence of the total computable index transformation follows from the S-m-n theorem. By the recursion theorem, some satisfies . Therefore its domain isand hence
Past exam of the mathematics course of the University of Cambridge 2021 ii Paper 1 4F Solution Created 2026-09-24 Updated 2026-09-25
The S-m-n theorem states that for every there is a total computable function satisfyingwhenever either side is defined.
Suppose first that is recursively enumerable. Choose a program that halts exactly on inputs in , and let index a two-variable program that, on , ignores and runs that program on . By the S-m-n theorem,is total computable and indexes the unary functionThereforeThus .
Conversely, suppose through a total computable . On input , compute and simulate machine on its own code. This procedure halts exactly when , equivalently exactly when . Hence is recursively enumerable. We have proved the many-one completeness of the halting problem: