The course on models of computation ends with an enumeration of all partial computable functions: machines are coded by integers, and the function computed by the machine of code is obtained from by a single unbounded search (Kleene's normal form). The whole of computability theory is built on this enumeration. This lesson fixes it once and for all, together with its approximation by stages, and sets up the notions of computable set and computable relation. From now on, algorithms are described in words or pseudo-code, following the practice explained in The Church–Turing thesis.
1.1 The enumeration
Recall that is the primitive recursive predicate ” codes the complete computation of the machine of code on input ”, that for given and at most one satisfies it, and that is the primitive recursive function reading the output on the last configuration of the computation coded by . Integers that do not code a machine are treated as coding a fixed machine that never halts, so that every integer is the code of a machine.
For and , is the -ary partial function
computed by the machine of code . The integer is an index of . The superscript is omitted when the number of arguments is clear, and stands for . For an input :
- means that the computation halts in a standard configuration, so that is defined; means that it is undefined;
- means that it is defined, with value .
By Universal function, the sequence contains every unary partial computable function, and the map is itself partial computable. These two facts — every partial computable function has an index, and the enumeration is computable — are the only properties of the enumeration used in most of the theory. The next lesson adds a third one, the SMN theorem.
As in the course on models of computation (Notation 1.2 of “Algorithms and partial functions”), between two expressions denoting possibly undefined values means: either both are defined and equal, or both are undefined. For partial functions, means for every : the two functions have the same domain and agree on it.
The domain of a partial function is , and its graph is . A partial function is total if its domain is the set of all inputs.
1.2 Approximation by stages
The computation of can be followed for a while. The following definition makes this precise, with conventions that make the approximations finite objects.
For , let
We say that converges at stage when . The same notation is used for several arguments, with in place of .
Since a computation of steps has a code larger than , convergence at stage implies that the computation halts in fewer than steps. The precise relation between stages and steps is irrelevant: what matters is the following.
- The relation , of the variables , is primitive recursive. In particular, given , and , one can decide whether , and compute its value if so.
- If and , then .
- if and only if for some .
- holds if and only if . This is obtained from primitive recursive predicates by Boolean operations and a bounded quantifier, hence it is primitive recursive (Corollary 5.10 of “Primitive recursive functions”). The value, when defined, is , a bounded minimization.
- The witness is also smaller than , and the conditions are preserved.
- If , let be the code of the computation; then and , so for . Conversely, if with witness , then is the unique with , so and .
The contrast between items 1 and 3 is the central phenomenon of the theory. Convergence at a given stage is decidable; convergence is the existence of a stage, a question with an unbounded quantifier, and it is not decidable, as the lesson on the halting problem shows. Divergence is never confirmed at a finite stage: means for every .
1.3 Computable sets and relations
A relation is computable (or decidable) if its characteristic function, equal to on and outside, is computable: there is an such that is total and if , otherwise. For one speaks of computable sets.
Computable sets were called recursive in older texts, after the partial recursive functions, and the expressions recursion theory and recursive set are still used. We freely identify a relation with the set , obtained through the pairing function; one is computable if and only if the other is.
- The computable relations are closed under complement, finite union and finite intersection, and under substitution of total computable functions: if is computable and are total computable, then is computable.
- They are closed under bounded quantification: if is computable, so are and .
- Definition by cases: if are computable relations partitioning and are partial computable, then for defines a partial computable function.
- Unbounded search: if is computable, then is partial computable, and total if for every there is some with .
By Equivalence of the models, the computable partial functions are the partial recursive functions, which contain the primitive recursive functions and are closed under composition, primitive recursion and minimization. Let denote the characteristic function of .
- , , and unions are complements of intersections of complements. Substitution is composition: the characteristic function of the new relation is , which is total.
- The function is defined by primitive recursion from , hence computable, and holds exactly when it is non-zero. The bounded universal quantifier is the complement of a bounded existential quantifier applied to the complement.
- On input , compute , which are all defined, find the unique with , and compute . Only the branch that applies is evaluated, so the result is undefined exactly when is.
- is a minimization of a total computable function. It is defined exactly when some satisfies .
In item 3, the evaluation of only one branch matters: in the primitive recursive definition by cases of the course on models of computation, all branches are computed, which is harmless for total functions but not for partial ones.
1.4 Uniformity
A typical statement of computability theory asserts that some object is obtained uniformly from others: for instance, “the set is computable, uniformly in ” means that the relation is computable, and not only that each is computable. The difference is essential. Let be the halting set, which is not computable (Theorem 3.2, in the lesson on the halting problem). Each set if and otherwise is finite, hence computable; but the relation is not, since if and only if . Similarly, an index “obtained uniformly in ” is the value of a total computable function of .
1.5 Exercises
Let be total. Show that is computable if and only if its graph is computable.
Solution
If is computable, is decided by computing and comparing with . Conversely, if the graph is computable, then , a search that terminates since is total; it is computable by Proposition 1.6.
Show that the set is computable, and that the function is total computable.
Solution
Both follow from item 1 of Proposition 1.4. The first set is defined by substituting in a primitive recursive relation. The function is , where is the characteristic function of the primitive recursive relation ; it is primitive recursive.
Show that a partial computable function with a computable domain has a total computable extension. Show by an example that a partial computable function may have a total computable extension and a non-computable domain.
Solution
If is computable, let for and for , a definition by cases (Proposition 1.6); is total since for . For the converse, consider the partial function defined by if , undefined otherwise. It is partial computable, its domain is not computable (Theorem 3.2), and the constant function is a total computable extension.
1.6 Notes and references
The enumeration of the partial recursive functions by indices, and the normal form theorem on which it rests, are due to Kleene (1936, 1938). The notation follows Soare’s textbook; Rogers writes . The approximation by stages and its conventions are standard in modern texts, where they are the basis of all constructions by stages.
- S. C. Kleene, General recursive functions of natural numbers, Mathematische Annalen 112 (1936), 727–742.
- S. C. Kleene, On notation for ordinal numbers, Journal of Symbolic Logic 3 (1938), 150–155.
- H. Rogers, Theory of Recursive Functions and Effective Computability, McGraw-Hill, 1967.
- R. I. Soare, Turing Computability: Theory and Applications, Springer, 2016.