Recursive function $f$ with $\operatorname{range}(f) = \{x\mid \phi_{x}\text{ is total}\}$ I don't understand how the proof for this exercise (and this kind of exercises in general) holds:

There is no recursive function $f$ with $\operatorname{range}(f) = \{x\mid \phi_{x}\text{ is total}\}$
Proof: Let $g = \lambda x .\phi_{f(x)} + 1$; $g$ is recursive, so $g = \phi_{k}$.
$$g(k) = \phi_{f(k)}(k) + 1 = g(k) + 1,$$
a contradiction.


This proof does not in fact work as written - at the last "=," it assumes that $f(k)=k$, or at least that $\varphi_{f(k)}$ and $\varphi_k$ are the same function. In general, there's no reason to believe that $k$ is a fixed point of $f$.
(Of course, the statement is true, it's just that the proof needs work . . .)

Here's a hint at a correct proof: suppose such an $f$ existed. What can you say about the function $$g(x)=1+\sum_{y<x}\varphi_{f(y)}(x)?$$
