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:
Past exam of the mathematics course of the University of Cambridge 2023 ii Paper 1 12I v Solution Created 2026-09-24 Updated 2026-10-03
For hardness, let . Choose a partial computable function withFor each fixed , define a unary program as follows: on any input , simulate ; if that simulation halts, halt and output , and otherwise run forever. The S-m-n theorem gives a total computable function that maps to a code for . Its accepted language isIn particular,Thus is a many-one reduction . Since was arbitrary, is -hard; together with membership this proves the many-one completeness of the halting problem.