Show multiply function is primitive recursive

40 Views Asked by At

I'm trying to answer the following question:

Show that $f(x,y)=xy$ is primitive recursive.

Basically, multiply function.

Here's my try:

To start with, we try to define it in terms of itself:

$$ f(x,0)=0, \ f(x,1)=f(x,0)+x, \ f(x,2)=f(x,1)+x, \ ... , \ f(x,n+1)=f(x,n)+x $$

Now I'll try to show that it is indeed primitive recursive.

By zero rule: $g(x)=0$ is primitive recursive.

Then we devise $h$ such that $h(x,y,z)=S^x (\pi_3 (x,y,z))=z+x$.

Here, $S$ is primitive recursive by successor rule, $\pi_3$ is primitive recursive by projection rule, and $S^x (\pi_3 (x,y,z))$ is primitive recursive by composition rule and composing $S^x$ and $\pi_3$.

Then, we try to show that $f$ is primitive recursive by recursion rule.

$f(x,0)=g(x)=0$

$f(x,n+1)=h(x,n,f(x,n))=S^x (\pi_3 (x,n,f(x,n)))=S^x (f(x,n))=f(x,n)+x$

$\square$

Are the steps correct and reasonable? Thanks a bunch!