The primitive recursive functions are total and computable. They are not all the total computable functions: in 1928 Ackermann, a student of Hilbert, exhibited a function defined by a nested recursion on two variables, which grows faster than every primitive recursive function. We use the two-argument version introduced by Rózsa Péter (1935), in the simplified form given by Raphael Robinson (1948).
7.1 Definition and computability
The Ackermann–Péter function is defined by
These equations define a unique total function. Indeed, order lexicographically: if , or and . This is a well-order. In each equation, the right-hand side only involves values of at pairs lexicographically smaller than the left-hand side: , , and whatever is. By well-founded induction along , is defined for all .
The first rows are easy to compute (see the exercises):
and is a tower of twos: .
is computable. The equations can be used as rewriting rules. Represent the current state of the computation by a stack of integers , standing for the expression . Start with and, while the stack has at least two elements, rewrite its last two elements :
- if , replace them by ;
- if and , replace them by ;
- if and , replace them by .
Each step preserves the value of the represented expression. For termination, we show by induction along that for every pair and every list , the algorithm transforms the stack into in finitely many steps, without touching before that. If , one step suffices. If and , one step gives , and the induction hypothesis applies to . If , one step gives ; the induction hypothesis for , with the list , leads to , and the induction hypothesis for leads to . With empty, the algorithm started on stops with the single element . Using the coding of the previous lesson, the stack is a single integer and each step is a primitive recursive operation on it; only the number of steps is not bounded in advance.
7.2 Monotonicity
For all :
- ;
- ;
- ;
- .
Consequently is strictly increasing in each argument.
- By induction on , and for each by induction on . For , . Suppose the claim holds for . Then , and if , then , so .
- For this is clear. For : by 1.
- By induction on . For both sides are equal to . Suppose . By 1, , hence , and by 2 (applied repeatedly), .
- By 3 and 2: .
For all : .
Let . By monotonicity,
using successively monotonicity in both arguments, item 4 inside item 2 of Lemma 7.2, the definition of , item 3, and .
7.3 Majorization
For we write , with for the empty tuple ().
For every primitive recursive function there is such that for all .
By induction on a derivation of . Say that is bounded by if for all . Since is increasing in its first argument, a function bounded by is bounded by every .
Basic functions. ; ; and .
Composition. Let , where are all bounded by . Then , hence by monotonicity and Lemma 7.3,
Primitive recursion. Let and , with and bounded by . When is empty (), is replaced by a constant , and we choose such that moreover ; this is possible since by item 4 of Lemma 7.2. We first show by induction on that
For : . Suppose holds for , and let . By Lemma 7.2 (1), , and by induction hypothesis ; so . Hence
Now let . Then , and by and Lemma 7.3,
So is bounded by .
The function is total and computable, but not primitive recursive. Hence is not primitive recursive either.
If were primitive recursive, by Theorem 7.4 there would be such that for all . For , this gives , a contradiction. If were primitive recursive, so would be .
The argument is a diagonalization: escapes each function at the point . The majorization theorem says more: every unary primitive recursive function is eventually dominated by , since for .
7.4 A diagonal argument
The same conclusion can be obtained without any growth estimate, by a direct diagonalization over derivations. Derivations of unary primitive recursive functions are finite objects; fix a computable coding of them by integers, and let be the list of the functions they define (the integers that do not code derivations being assigned the zero function, say).
The function is total and computable, but not primitive recursive.
To compute , decode the derivation coded by and evaluate it on following Proposition 5.4; this always terminates. If were primitive recursive, it would be for some , and then .
Thus unbounded loops are necessary to compute all total computable functions — and with unbounded loops comes the possibility of non-termination. The next lesson adds unbounded search to the primitive recursive functions.
7.5 Exercises
Prove that , and .
Solution
By induction on in each case. and . Then and . Finally and .
For each , show that the function is primitive recursive. Why does this not contradict Corollary 7.5?
Solution
By induction on . is the successor. If is primitive recursive, then satisfies and , a primitive recursion. Each row is primitive recursive, but each requires a derivation of its own, and the length of these derivations grows with . A single derivation cannot handle all rows, which is what Corollary 7.5 says: the diagonal uses rows of every level.
Show that the graph of the Ackermann function is a primitive recursive predicate.
Hint
A computation of can be recorded as a finite set of triples , all of whose values are bounded by .
Solution
Call a finite set of triples closed if for each , the equations defining are witnessed in : if then ; if , then ; if then there is with and . By induction along , every triple in a closed set is in ; conversely, the set of triples occurring in the evaluation of is closed and contains . All triples occurring in that evaluation have components at most . Indeed, the evaluation of only calls , and , whose values are at most by the defining equations and Lemma 7.2; so all values occurring are at most . For a triple , by item 1, and by item 4 applied times. Coding as a sequence of triples without repetition, its length is at most and its entries are codes of triples with components at most , so the code is bounded by a primitive recursive function of , and holds iff there is a closed with code below this bound containing : a bounded search over a primitive recursive predicate.
7.6 Notes and references
Ackermann’s original function had three arguments; the two-argument version used here is due to Péter, in the form given by Robinson. The majorization argument follows the standard textbook proof. The stratification of the primitive recursive functions by growth rate leads to the Grzegorczyk hierarchy.
- W. Ackermann, Zum Hilbertschen Aufbau der reellen Zahlen, Mathematische Annalen 99 (1928), 118–133.
- R. Péter, Konstruktion nichtrekursiver Funktionen, Mathematische Annalen 111 (1935), 42–60.
- R. M. Robinson, Recursion and double recursion, Bulletin of the American Mathematical Society 54 (1948), 987–993.
- A. Grzegorczyk, Some classes of recursive functions, Rozprawy Matematyczne 4 (1953).