Need clarification on recursive functions.

64 Views Asked by At

Given any function $f: \mathbb{N}_0 \rightarrow \mathbb{N}_0$ and a recursive $h:\mathbb{N}_0 \rightarrow \mathbb{N}_0$ , I know that to prove $h\circ f$ is recursive I only need to prove that $f$ is recursive.

What if I define $$ f(n) = \begin{cases} h(f(i)), & \text{if there exists $i<n$ s.t. $P(i)$} \\ 1, & \text{otherwise}, \end{cases}$$ for some recursive predicate P? Is $f$ recursive?

I think $f$ is recursive, and here's my reasoning:

I can rewrite the condition "if there exists unique $i<n$ s.t. $P(i)$" into a predicate $Q$,and so $Q$ is recursive. "Otherwise" in this case would be $\lnot Q$, which is also recursive. I can now write $f = h(f(i))\cdot \mathbb{1}_Q + 1\cdot \mathbb{1}_{\lnot Q} $ and so $f$ is recursive.

Am I right? I'm not sure how to handle $f(i)$ in the argument of $h$, but I think that since previous computations of $f(n)$ would have produced a sequence of numbers, I should treat $f(i)$ as a constant instead of as an unknown function.

Any insight is much appreciated! Thanks!