Sudan function

In the theory of computation, the Sudan function is an example of a function that is recursive, but not primitive recursive. This is also true of the better-known Ackermann function.

In 1926, David Hilbert conjectured that every computable function was primitive recursive. This was refuted by Gabriel Sudan and Wilhelm Ackermann — both his students — using different functions that were published in quick succession: Sudan in 1927, Ackermann in 1928.

The Sudan function is the earliest published example of a recursive function that is not primitive recursive.

Definition

 * $$\begin{array}{lll}

F_0 (x, y) & = x+y \\ F_{n+1} (x, 0) & = x & \text{if } n \ge 0 \\ F_{n+1} (x, y+1) & = F_n (F_{n+1} (x, y), F_{n+1} (x, y) + y + 1) & \text{if } n\ge 0 \\ \end{array}$$ The last equation can be equivalently written as
 * $$\begin{array}{lll}

F_{n+1} (x, y+1) & = F_n(F_{n+1} (x, y), F_0(F_{n+1}(x, y), y + 1) \\ \end{array}$$.

Computation
These equations can be used as rules of a term rewriting system (TRS).

The generalized function $$F(x,y,n) \stackrel{\mathrm{def}}{=} F_n(x,y)$$ leads to the rewrite rules
 * $$\begin{array}{lll}

\text{(r1)} & F(x, y, 0) & \rightarrow x+y \\ \text{(r2)} & F(x, 0, n+1) & \rightarrow x \\ \text{(r3)} & F(x, y+1, n+1) & \rightarrow F(F(x, y, n+1), F(F(x, y, n+1), y + 1,0), n) \\ \end{array}$$

At each reduction step the rightmost innermost occurrence of F is rewritten, by application of one of the rules (r1) - (r3).

Calude (1988) gives an example: compute $$F(2,2,1) \rightarrow_{*} 12$$.

The reduction sequence is


 * $$\underline$$
 * $$\rightarrow_{r3} F(F(2,1,1),F(\underline,2,0),0)$$
 * $$\rightarrow_{r3} F(F(2,1,1),F(F(F(2,0,1),F(\underline,1,0),0),2,0),0)$$
 * $$\rightarrow_{r2} F(F(2,1,1),F(F(F(2,0,1),\underline,0),2,0),0)$$
 * $$\rightarrow_{r1} F(F(2,1,1),F(F(\underline,3,0),2,0),0)$$
 * $$\rightarrow_{r2} F(F(2,1,1),F(\underline,2,0),0)$$
 * $$\rightarrow_{r1} F(F(2,1,1),\underline,0)$$
 * $$\rightarrow_{r1} F(\underline,7,0)$$
 * $$\rightarrow_{r3} F(F(F(2,0,1),F(\underline,1,0),0),7,0)$$
 * $$\rightarrow_{r2} F(F(F(2,0,1),\underline,0),7,0)$$
 * $$\rightarrow_{r1} F(F(\underline,3,0),7,0)$$
 * $$\rightarrow_{r2} F(\underline,7,0)$$
 * $$\rightarrow_{r1} \underline$$
 * $$\rightarrow_{r1} 12$$
 * }
 * $$\rightarrow_{r1} F(\underline,7,0)$$
 * $$\rightarrow_{r3} F(F(F(2,0,1),F(\underline,1,0),0),7,0)$$
 * $$\rightarrow_{r2} F(F(F(2,0,1),\underline,0),7,0)$$
 * $$\rightarrow_{r1} F(F(\underline,3,0),7,0)$$
 * $$\rightarrow_{r2} F(\underline,7,0)$$
 * $$\rightarrow_{r1} \underline$$
 * $$\rightarrow_{r1} 12$$
 * }
 * $$\rightarrow_{r2} F(\underline,7,0)$$
 * $$\rightarrow_{r1} \underline$$
 * $$\rightarrow_{r1} 12$$
 * }
 * $$\rightarrow_{r1} 12$$
 * }

Concrete implementations can be found on Rosetta Code.

Values of F0
F0(x, y) = x + y

Values of F1
F1(x, y) = 2y · (x + 2) − y − 2