\setlength\subproofhorizspace{1em}
\begin{logicproof}{1}
  \forall x \; (z=x) \land (f(x) = f(z))   & prem.\\
  (z=y) \land f(y) = f(z)                  & $\forall \mathrm{e}$ 1\\
  \begin{subproof}
    y=z                                    & ass.\\
    f(y) = f(z)                            & $\land \mathrm{e}_2$2\\
    \exists x \; f(y) = f(x)               & $\exists \mathrm{i}$ 4
  \end{subproof}
  y = z \imp \exists x (f(y) = f(x))       & $\imp \mathrm{i}$ 3-5
\end{logicproof}