A question about removing equality in predicate logic
I'm currently taking a course on Mathematical Modelling, more specifically Advanced Predicate Logic, and we were talking about predicate logic when I was introduced to these 2 rules: $$\frac{}{t = t}[=i]\qquad\frac{t_1=t_2\quad[x\Rightarrow t_1]\phi}{[x\Rightarrow t_2]\phi}[=e]$$
Then, when we went to apply it to prove $$f(x) = g(x)\vdash h(g(x)) = h(f(x)),$$ we were given a solution that looked like this: \begin{align*} 1.\quad &f(x) = g(x)\qquad&\text{premise}\\ 2.\quad &h(f(x)) = h(f(x))\qquad&=i\\ 3.\quad &h(g(x)) = h(f(x))\qquad&=e\ 1,2 \end{align*}
I want to ask about the third line of the solution, specifically how ${=e}$ can be used with lines 1 & 2 to create line 3.
For context, the professor who gave this assignment gave an answer that went something like this:
${f(x) = g(x)}$ because of the premise.
Let ${\phi}$ be ${h(y) = h(y)}$ for all $y$, then $h(f(x)) = h(f(x))$ is from substituing $y = f(x)$ into $\phi$. (i.e. $[y\Rightarrow f(x)]\phi$).
From the first two lines, we can see that $[y\Rightarrow g(x)]\phi$, but we only need to substitute 1 side of $\phi$, leaving us with $h(g(x))=h(f(x))$.
We haven't learned about anything relating to ${\forall}$ & ${\exists}$ yet so don't worry about ${h(y) = h(y)}$ for all $y$.
Thanks for your answers!
Solution 1:
Set $t_1 := f(x)$, $t_2 := g(x)$, and put $\phi$ as $h(y) = h(f(x))$, then rule $[=e]$ says $$\frac{f(x) = g(x)\quad h(f(x))=h(f(x))}{h(g(x))=h(f(x))}$$