Arity problem while showing factorial is primitive recursive.

263 Views Asked by At

So i have been recently introduced to computability and recursion. And we are doing everything very formally. That is why when forming a primitive recursion we need g,h to be computable and then f is when $f(x_1,x_2...x_n,0)=g(x_1,x_2...x_n)$ and $f(x_1,x_2...x_n,y+1)=h(x_1,x_2...x_n,f(x_1,x_2...x_n,y))$. Where arity is important so f has n+1 arity, g has n arity and h has n+1 arity. Now i was tasked with showing factorial is computable. It is obvious that (we will call factorial n) $n(0)=1$ (we know 1 is primitive and can have any arity, even 0?). Now $n(y+1)=S(y)*n(y)$ but clearly multiplication is of arity 2 so i have an arity problem. How do i remedy it?

Thank you

1

There are 1 best solutions below

8
On

Your current proof is fine, there is no arity problem. Currently you have $g \equiv 0$ of arity 0 and $h(x, y) = S(x) \cdot y$ of arity 2. Applying recursion using these two functions gives you the factorial function $n$ which has arity 1. Although multiplication has arity 2, you've composed multiplication with other functions so the function overall has arity 1.