\setlength\subproofhorizspace{1em}
\begin{logicproof}{0}
  x = g(y)      & prem.\\
  f(g(y)) = z   & prem.\\
  f(x) = y      & prem.\\
  f(x) = z      & $= \mathrm{e}$ 2,1\\
  y = z         & $= \mathrm{e}$ 4,3
\end{logicproof}