Is this double recursion necessarily primitive recursive

ackermann-functioncomputabilityrecursion

Suppose $f,g,h : \mathbb{N} \rightarrow \mathbb{N}$ are primitive recursive functions. Consider the function $\phi : \mathbb{N}^2 \rightarrow \mathbb{N}$ recursively defined as follows.

$$
\phi(0,n) = f(n) \\
\phi(m+1,0) = g(m) \\
\phi(m+1,n+1) = h(\phi(m,n))
$$

Question: is $\phi$ necessarily primitive recursive?

My guess is that this is not necessarily true: I haven't been able to construct such a $\phi$ with the usual primitive recursion rule, and double recursion seems to be what allows one to construct non-PR functions like the Ackermann function. However, the recursion that defines the Ackermann function $A$ involves nesting $A$ in itself: $A(m+1,n+1) = A(m,A(m+1,n))$ (going by the Wikipedia definition). This doesn't seem possible with my above rule, so I can't figure out how I could use it to construct $A$ or other non-PR functions.

Best Answer

This can be written as $$\phi(m,n)=\begin{cases} h^{\circ n}(g(m-n))&m>n\\ h^{\circ m}(f(n-m))&m\le n \end{cases}$$ so in terms of (positive) difference, case distinction, and simple recursion.

Related Question