I've been trying to understand the recursion theorem for quite a while now and I still don't think I understand it 100%, I've checked multiple books and pdfs and I've noticed that this theorem is often stated in two different ways
Let $A$ be a set, $a ∈ A$, and $r : N × A → A$ any function. Then there exists a function $f : N → A$ such that (i) $f(0) = a$, and (ii) $f(n + 1) = r(n, f(n))$ for all $n ∈ N$.
Let $X$ be a set, $a ∈ X$, and $f : X → X$. Then there exists a function $u : ω → X$ such that $u(0) = a$ and $u(n^ +) = f(u(n))$ for all $n ∈ ω$
Why sometimes $N×A$ is used as domain for the function $r$ in the first case and $f$ in the second case, and sometimes just $X$ is used? What is the difference?
At first glance, it seems that the first variant is more general (to compute the next term, you can use the previous term - but also the current index). More formally, if the first version holds and you are given $X,a,f$ as in the second, then apply the first to $A:=X$, $r(n,a):=f(a)$. Then the $f$ (in the notation of 1) is a valid $u$ (in the notation of 2).
Interestingly, however, we can also infer the first variant from the second: Assume we are given $A,a,r$ as in the first. Let $X=N\times A$ and define $f\colon X\to X$ as $f(\langle n,a\rangle) = \langle n^+,r(n,a)\rangle$. Then the existing $u$, composed with the projection $N\times A\to A$ is a valid solution for the first variant.