I want to show that subtraction is primitive recursive: $subtract(x,y)=x-y$.
To do this, I must first show that pred function: $pred(x)=x-1$ is also primitive recursive.
So, let's do that!
First, we start with function $f'$ that accepts two arguments and mimics pred function:
$f'(x,0)=g'(x)=Z(x)=0$ where $g'$ is primitive recursive by zero rule.
$f'(x,n+1)=h'(x,n,f(x,n))=\pi_2 (x,n,f(x,n))=n$ where $h'$ is primitive recursive by projection rule.
Hence, we've shown that $f'$ is primitive recursive (by recursion rule).
Then, we devise function pred such that: $pred(x)=f'(\pi_1 (x), \pi_1 (x))$ which is primitive recursive by composition rule (and $\pi_1 (x)$ by projection rule). Let's now see if our pred function works as it should:
$pred(0)=f'(\pi_1 (0), \pi_1(0))=f'(0,0)=g'(0)=Z(0)=0$ so zero case works.
And, for $n \ge 0$: $pred(n+1)=f'(\pi_1 (n+1), \pi_1(n+1))=f'(n+1,n+1)=h'(n+1,n,f(n+1,n))=\pi_2 (n+1,n,f(n+1,n))=n$
So, we have shown that pred function is primitive recursive. Now, let's go on to prove that subtract function is primitive recursive.
We can derive subtract function $f$ by incremental minus.
$f(x,0)=x$
$f(x,n+1)=f(x,n)-1$
Then we devise $g,h$ such that:
$g(x)=\pi_1 (x)=x$
$h(x,y,z)=pred \ (\pi_3 (x,y,z)) = pred \ z = z-1$
$g$ is primitive recursive by projection rule, and $h$ is primitive recursive by composition rule (and $\pi_3 (x,y,z)$ by projection rule).
To satisfy recursion rule:
$f(x,0)=g(x)=\pi_1 (x)=x$
$f(x,n+1)=h(x,n,f(x,n))=pred \ (\pi_3 (x,n,f(x,n)))=pred \ (f(x,n))=f(x,n)-1$
Hence, we have shown that subtract function is primitive recursive.
$\square$
Are the steps correct and reasonable? Thanks a bunch!