Let's define a recursively enumerable set as the domain of some program $p$, i.e., $\{x:\phi_p(x)\downarrow\}$.
There is another definition of a recursively enumerable set: it is either the empty set or the range of a computable function $f: \mathbb N\to \mathbb N$.
I'm trying to understand their equivalence.
One direction: suppose the second definition holds. Then define the program $p$ by the following conditions. The program $p$ takes an input $x$ and checks if $x\in f(\mathbb N)$: since $f$ is computable (say via $e$), the program $p$ can use $e$ to see, for each $n=0,1,\dots$, whether $f(n)=x$. If $x\in f(\mathbb N)$, then such $n$ will be found, and in this case we force $p$ to halt. Otherwise the program will work forever. For this program $p$, the domain of $\phi_p$ is $f(\mathbb N)$, q.e.d. Is this proof correct?
The other direction: This seems to be more difficult. I found this answer (which is supposedly what I need), from which the proof appears to be relatively easy, but I don't understand that proof. For example, I don't understand what $\Phi_{e,s}$ is.