Prove that $f^{-1}:\mathbb{N} \rightarrow \mathbb{N}$ is partial recursive I'm stuck on this problem:

Given $f:\mathbb{N} \rightarrow \mathbb{N}$ a partial recursive function that is also injective and total. Prove that the function $f^{-1}:\mathbb{N} \rightarrow \mathbb{N}$ $$f^{-1} = \left\{\begin{array}{rcl} x &amp; \mbox{if} &amp; f(x) = y \\ \uparrow &amp; \mbox{otherwise}\end{array}\right.$$ is partial recursive.

So to prove that a function is partial recursive I have to show that I can build it from basic recursive functions (successor, projection and constant) by applying composition, primitive recursion and then minimization.

I don't know what form $f$ has, but I think I can use it to construct $f^{-1}$. The only problem is that I don't know what to write...
You can partially compute $f^{-1}(y)$ as follows:


  for $x$ from $0$ to $\infty$:
  
  &emsp; if $f(x) = y$ then return $x$


If you don't like for loops, you can use the following implementation:


  
  $x \gets 0$
  if $f(x) = y$ then return $x$
  $x \gets x + 1$
  goto step 2