Two properties of the enumeration make it the right framework for computability theory. The first is that it is itself computable: a single algorithm evaluates from and . The second is that indices can be manipulated computably: from an index of a function of two arguments and a value of the first argument, one can compute an index of the function of the second argument obtained by fixing . The first property is the universal function theorem, the second is the SMN theorem. Together they allow one to treat programs as data, which is what the rest of the course does.
2.1 The universal function
For every , there is an index such that for all and ,
By Universal function, the function is partial computable. Any of its indices is suitable.
A machine of index is an interpreter: it receives the code of a machine and an input, decodes the machine, and simulates it step by step. The theorem justifies definitions such as
which are partial computable as compositions of the universal function with computable functions. By contrast, no total computable function enumerates the total computable functions (Theorem 6.4 of “Diagonalization and computation”): the universal function is necessarily partial.
2.2 The SMN theorem
For all , there is a primitive recursive function such that for all , and ,
The name comes from Kleene’s notation . The function does not run the machine : it transforms its code into the code of another machine, which first writes on the tape in front of its input, then behaves as the machine . Computing this new code is a finite manipulation of a finite table.
We treat ; the general case is identical, with blocks to write in front of blocks. Recall the input convention (Definition 2.4 of “Turing machines”): the input is the block written from cell , and the input is .
For , let be a machine which, started on the tape with the head on cell , halts with the tape written from some cell , with the head on cell and in its halting state. For instance, moves left from cell , writes a blank separator on cell (already blank), then writes ones on the cells , moving left after each of them, and finally moves one cell back to the right, halting on cell . This takes states, and the transition table of is obtained from by a primitive recursive function: it is a fixed table with a chain of writing states inserted.
Let be the machine of code . The machine is obtained by renaming the states of so that they are distinct from those of , and by identifying the halting state of with the initial state of . Started on , it runs , reaching the configuration in the initial state of with tape written from cell and head on . This is the initial configuration of on input , translated by . By Lemma 3.2 of “Programming Turing machines”, the subsequent computation is the translate of the computation of on : it halts in a standard final configuration with output if and only if . Hence computes .
Let be the code of . Renaming states and merging two tables are operations on finite sequences of integers, and with the coding of machines by sequence codes they are primitive recursive (Proposition 6.2 of “Coding finite sequences”). So is primitive recursive.
The SMN theorem is mostly used in the following form, which states that a family of partial computable functions, defined uniformly from a parameter, has indices computable from the parameter.
Let be partial computable. There is a primitive recursive function such that for all and ,
Let be an index of , and let .
In proofs, the corollary is invoked by sentences such as: “for every , let be an index of the program which, on input , does … (something depending on and )”, it being understood that the description defines a partial computable function of , and that is then total computable. We also say that is obtained uniformly in .
- Composition of indices. There is a total computable with for all : apply the corollary to , which is partial computable by the universal function, and compose with the pairing function.
- Constant functions. There is a total computable such that is the constant function with value .
- Programs that ignore their input. There is a total computable such that for all : the program ignores its input and runs on . So is total if , and nowhere defined otherwise. This construction is used in many reductions.
2.3 The padding lemma
Every partial computable function has infinitely many indices: adding to a machine states that are never entered does not change what it computes. The indices can moreover be found computably, and above any given bound.
There is a primitive recursive function such that for all and , and for every .
Let be the machine of code (the fixed never-halting machine if is not a code). For , let be with additional states, which are never entered and whose transitions are arbitrary, say “write a blank, move right, stay in the same state”. Its computations are those of , so it computes the same functions. The machines have different numbers of states, so their codes are pairwise distinct, and is primitive recursive. Among the distinct values , at most lie below , so one of them is at least . Let for the least with , a bounded search.
Every partial computable function has infinitely many indices. Consequently, the set of indices of a given partial computable function is never finite, and for every the function enumerates infinitely many of the indices of .
If , the indices , for , are unbounded since , hence infinitely many.
2.4 Acceptable numberings
The results of this course depend on the enumeration only through a few properties. It is useful to know which ones.
A numbering of the unary partial computable functions is a sequence in which every unary partial computable function appears. It is acceptable if
- the function is partial computable, and
- there is a total computable with for every .
The numbering is acceptable. If is acceptable, there is a total computable with for every , and satisfies the SMN theorem: there is a total computable such that .
For , take the universal function and the identity. Let be acceptable. By Corollary 2.3 applied to , there is a total computable with . For SMN, apply Corollary 2.3 to , giving a total computable with , and let .
Rogers proved that any two acceptable numberings differ by a computable permutation of the indices: if is acceptable, there is a computable bijection with . We admit this isomorphism theorem, proved in Rogers’ paper of 1958 cited below; its proof is a computable back-and-forth argument using the padding lemma. It shows that every result of this course that is stated in terms of indices holds for every acceptable numbering. Not every numbering is acceptable: Friedberg constructed a numbering satisfying the first condition in which each partial computable function appears exactly once. Such a numbering cannot be acceptable: by the isomorphism theorem, the indices of a function in an acceptable numbering are in bijection with its indices in , which are infinitely many by Corollary 2.6.
2.5 Exercises
Show that there is a total computable function such that for all and , and that can be chosen injective.
Solution
Apply Corollary 2.3 to , to get with . To make it injective, let and , where is the padding function. Then , so is strictly increasing, hence injective, and .
Show that there is no total computable function such that, for every , is total, and whenever is total.
Solution
Suppose exists. Then is a sequence of total functions, uniformly computable since is partial computable and total. It contains every total computable function , as . This contradicts Theorem 6.4 of “Diagonalization and computation”.
2.6 Notes and references
The universal function is Turing’s universal machine (1936), and the SMN theorem is due to Kleene (1938). Acceptable numberings and the isomorphism theorem are due to Rogers (1958); Friedberg’s numbering without repetitions appeared the same year.
- A. M. Turing, On computable numbers, with an application to the Entscheidungsproblem, Proceedings of the London Mathematical Society (2) 42 (1936), 230–265.
- S. C. Kleene, On notation for ordinal numbers, Journal of Symbolic Logic 3 (1938), 150–155.
- H. Rogers, Gödel numberings of partial recursive functions, Journal of Symbolic Logic 23 (1958), 331–341.
- R. M. Friedberg, Three theorems on recursive enumeration, Journal of Symbolic Logic 23 (1958), 309–316.