This is the statement of the mod $p$ irreducibility theorem.
Let $p$ be a prime and suppose that $f(x) \in \Bbb Z[x]$ with deg $f(x) \ge 1$. Let $f'(x)$ be the polynomial in $\Bbb Z_p[x]$ obtained from $f(x)$ by reducing all the coefficients of $f(x)$ modulo $p$. If $f'(x)$ is irreducible over $\Bbb Z_p$ and deg $f (x) =$ deg $f'(x)$, then $f(x)$ is irreducible over $\Bbb Q$.
I'm confused about the proof of this theorem at the bolded text.
If $f(x)$ is reducible over $\Bbb Q$, then $f(x) = g(x)h(x)$ with $g(x), h(x) \in \Bbb Z[x]$, and both $g(x)$ and $h(x)$ have degree less than that of $f(x)$. Let $f'(x),g'(x)$ , and $h'(x)$ be the polynomials obtained from $f(x), g(x)$, and $h(x)$ by reducing all the coefficients modulo $p$. Since $deg f(x) = degf'(x)$ , we have deg $g'(x) \le$ deg $g(x) \lt$ deg$f'(x)$ and deg $h'(x) \le $ deg $h(x) \lt$ deg $f'(x)$. But $f'(x) = g'(x)h'(x)$, and this contradicts our assumption that $f'(x)$ is irreducible over $\Bbb Z_p$.
Where is the contradiction here?
The theorem says that:
The proof goes by contradiction, by assuming there exists a reducible $f(x)\in\Bbb{Z}[x]$ such that $\deg f'(x)=\deg f(x)$ and $f'(x)$ is irreducible in $\Bbb{Z}_p[x]$. The proof shows that then necessarily $f'(x)$ is reducible in $\Bbb{Z}_p[x]$, because $f'(x)=g'(x)h'(x)$, a contradiction.
Note that if $\deg f'(x)=\deg f(x)$ and $f(x)=g(x)h(x)$, then $\deg g'(x)=\deg g(x)$ and $\deg h'(x)=\deg h(x)$. So $g'(x)$ and $h'(x)$ are not units in $\Bbb{Z}_p[x]$ because $g(x)$ and $h(x)$ are not units in $\Bbb{Z}[x]$.