Solution (source code)

= Solution

An <integral extension> $R\subseteq T$ means every $t\in T$ satisfies a <monic polynomial>
$$
t^d+a_{d-1}t^{d-1}+\cdots+a_0=0,\qquad a_j\in R.
$$
To prove the <Lying-over theorem>, localize at $S=R\setminus P$. The injection $R_P\hookrightarrow S^{-1}T$ remains injective, and $S^{-1}T$ is integral over $R_P$: a monic relation for $t$ divided by suitable powers of $s$ gives one for $t/s$. This is a nonzero ring, so choose a <maximal ideal> $M$ of it.

The contraction of $M$ to $R_P$ is maximal. To see this directly, a <field> integral over a subring forces that subring to be a <field>. For nonzero $a$ in the subring, $a^{-1}$ is integral; multiply its monic equation of degree $d$ by $a^{d-1}$ to express $a^{-1}$ as a polynomial in $a$ with coefficients in the subring. Apply this to the <integral extension>
$$
R_P/(M\cap R_P)\ \subseteq\ (S^{-1}T)/M.
$$
Since $R_P$ is a <local ring> with unique <maximal ideal> $PR_P$, we obtain $M\cap R_P=PR_P$.

Contract $M$ to $T$, obtaining a <prime ideal> $Q$. Its contraction to $R$ is the contraction of $PR_P$, namely $P$. \b[Thus]
$$
\boxed{\text{there exists }Q\in\operatorname{Spec}T\text{ with }Q\cap R=P.}
$$