[proofplan]
We reduce to the Lying Over theorem by passing to the quotient. Since $\mathfrak{q}_1 \cap A = \mathfrak{p}_1$, we obtain an integral extension $A/\mathfrak{p}_1 \hookrightarrow B/\mathfrak{q}_1$. Applying Lying Over to this extension and the prime $\mathfrak{p}_2/\mathfrak{p}_1$ produces a prime of $B/\mathfrak{q}_1$ whose preimage in $B$ is the desired $\mathfrak{q}_2$.
[/proofplan]
[step:Pass to the quotient and verify the induced extension is integral]
Since $\mathfrak{q}_1 \cap A = \mathfrak{p}_1$, the inclusion $A \hookrightarrow B$ composed with the projection $B \twoheadrightarrow B/\mathfrak{q}_1$ has kernel $\{a \in A : a \in \mathfrak{q}_1\} = \mathfrak{q}_1 \cap A = \mathfrak{p}_1$. By the first isomorphism theorem, this induces an injective ring homomorphism
\begin{align*}
\iota: A/\mathfrak{p}_1 &\hookrightarrow B/\mathfrak{q}_1.
\end{align*}
We identify $A/\mathfrak{p}_1$ with its image in $B/\mathfrak{q}_1$ under $\iota$. By [Stability Under Quotients and Localisation](/theorems/2867), part (1a), applied to the integral extension $A \subset B$ and the ideal $\mathfrak{q}_1$ of $B$ (with contraction $\mathfrak{q}_1 \cap A = \mathfrak{p}_1$), the extension $A/\mathfrak{p}_1 \subset B/\mathfrak{q}_1$ is integral.
[guided]
The idea is to reduce the problem to one where Lying Over applies directly. Since $\mathfrak{q}_1$ lies over $\mathfrak{p}_1$, taking quotients by $\mathfrak{q}_1$ (in $B$) and by $\mathfrak{p}_1$ (in $A$) produces a compatible pair of quotient rings.
We need to verify that $A/\mathfrak{p}_1$ embeds into $B/\mathfrak{q}_1$. The composite $A \hookrightarrow B \twoheadrightarrow B/\mathfrak{q}_1$ has kernel $\mathfrak{q}_1 \cap A = \mathfrak{p}_1$ (since $\mathfrak{q}_1 \cap A = \mathfrak{p}_1$ by hypothesis). The first isomorphism theorem then gives an injection $A/\mathfrak{p}_1 \hookrightarrow B/\mathfrak{q}_1$.
Why is this extension integral? [Stability Under Quotients and Localisation](/theorems/2867), part (1a), states: if $B$ is integral over $A$ and $\mathfrak{b}$ is an ideal of $B$, then $B/\mathfrak{b}$ is integral over $A/(\mathfrak{b} \cap A)$. Applying this with $\mathfrak{b} = \mathfrak{q}_1$ gives that $B/\mathfrak{q}_1$ is integral over $A/\mathfrak{p}_1$.
[/guided]
[/step]
[step:Verify that $\mathfrak{p}_2/\mathfrak{p}_1$ is a prime ideal of $A/\mathfrak{p}_1$]
Since $\mathfrak{p}_1 \subset \mathfrak{p}_2$ and both are prime ideals of $A$, the quotient $\mathfrak{p}_2/\mathfrak{p}_1 := \{a + \mathfrak{p}_1 : a \in \mathfrak{p}_2\}$ is an ideal of $A/\mathfrak{p}_1$. To see it is prime: $(A/\mathfrak{p}_1)/(\mathfrak{p}_2/\mathfrak{p}_1) \cong A/\mathfrak{p}_2$ by the third isomorphism theorem, and $A/\mathfrak{p}_2$ is an integral domain since $\mathfrak{p}_2$ is prime. Hence $\mathfrak{p}_2/\mathfrak{p}_1 \in \operatorname{Spec}(A/\mathfrak{p}_1)$.
[/step]
[step:Apply Lying Over in the quotient extension to find $\mathfrak{q}_2$]
We have an integral extension $A/\mathfrak{p}_1 \subset B/\mathfrak{q}_1$ and a prime $\mathfrak{p}_2/\mathfrak{p}_1 \in \operatorname{Spec}(A/\mathfrak{p}_1)$. By [Lying Over](/theorems/2944), there exists a prime ideal $\overline{\mathfrak{q}}_2 \in \operatorname{Spec}(B/\mathfrak{q}_1)$ such that
\begin{align*}
\overline{\mathfrak{q}}_2 \cap (A/\mathfrak{p}_1) = \mathfrak{p}_2/\mathfrak{p}_1.
\end{align*}
[guided]
This is the core of the argument: we apply [Lying Over](/theorems/2944) to the integral extension $A/\mathfrak{p}_1 \subset B/\mathfrak{q}_1$ and the prime ideal $\mathfrak{p}_2/\mathfrak{p}_1$ of $A/\mathfrak{p}_1$. Lying Over requires an integral extension of rings and a prime ideal of the smaller ring. We verified integrality in the first step, and primality of $\mathfrak{p}_2/\mathfrak{p}_1$ in the second step. The conclusion gives a prime $\overline{\mathfrak{q}}_2$ of $B/\mathfrak{q}_1$ contracting to $\mathfrak{p}_2/\mathfrak{p}_1$ in $A/\mathfrak{p}_1$.
[/guided]
[/step]
[step:Lift $\overline{\mathfrak{q}}_2$ to a prime of $B$ and verify both conditions]
Let $\pi: B \twoheadrightarrow B/\mathfrak{q}_1$ be the canonical projection. Define $\mathfrak{q}_2 := \pi^{-1}(\overline{\mathfrak{q}}_2)$. By the correspondence between ideals of $B/\mathfrak{q}_1$ and ideals of $B$ containing $\mathfrak{q}_1$, $\mathfrak{q}_2$ is an ideal of $B$ with $\mathfrak{q}_1 \subset \mathfrak{q}_2$ and $\mathfrak{q}_2/\mathfrak{q}_1 = \overline{\mathfrak{q}}_2$. Since $\overline{\mathfrak{q}}_2$ is prime, $\mathfrak{q}_2$ is prime: $B/\mathfrak{q}_2 \cong (B/\mathfrak{q}_1)/(\mathfrak{q}_2/\mathfrak{q}_1)$ is an integral domain.
We verify $\mathfrak{q}_2 \cap A = \mathfrak{p}_2$. Let $a \in A$. Then:
\begin{align*}
a \in \mathfrak{q}_2 \cap A &\iff a + \mathfrak{q}_1 \in \overline{\mathfrak{q}}_2 \text{ and } a \in A \\
&\iff (a + \mathfrak{p}_1) \in \overline{\mathfrak{q}}_2 \cap (A/\mathfrak{p}_1) = \mathfrak{p}_2/\mathfrak{p}_1 \\
&\iff a \in \mathfrak{p}_2.
\end{align*}
The second equivalence uses the identification of $a + \mathfrak{p}_1 \in A/\mathfrak{p}_1$ with $a + \mathfrak{q}_1 \in B/\mathfrak{q}_1$ under the injection $\iota$. Therefore $\mathfrak{q}_1 \subset \mathfrak{q}_2$ and $\mathfrak{q}_2 \cap A = \mathfrak{p}_2$.
[guided]
We lift the prime $\overline{\mathfrak{q}}_2$ of $B/\mathfrak{q}_1$ back to $B$. The standard ideal correspondence for quotient rings gives: ideals of $B/\mathfrak{q}_1$ are in bijection with ideals of $B$ containing $\mathfrak{q}_1$, via $J \mapsto \pi^{-1}(J)$. So $\mathfrak{q}_2 := \pi^{-1}(\overline{\mathfrak{q}}_2)$ is an ideal of $B$ containing $\mathfrak{q}_1$, i.e., $\mathfrak{q}_1 \subset \mathfrak{q}_2$.
Primality: $B/\mathfrak{q}_2 \cong (B/\mathfrak{q}_1)/\overline{\mathfrak{q}}_2$ by the third isomorphism theorem. Since $\overline{\mathfrak{q}}_2$ is prime in $B/\mathfrak{q}_1$, the quotient $(B/\mathfrak{q}_1)/\overline{\mathfrak{q}}_2$ is an integral domain, so $\mathfrak{q}_2$ is prime.
For the contraction: $a \in \mathfrak{q}_2 \cap A$ means $a \in A$ and $\pi(a) = a + \mathfrak{q}_1 \in \overline{\mathfrak{q}}_2$. Under the injection $\iota: A/\mathfrak{p}_1 \hookrightarrow B/\mathfrak{q}_1$, the element $a + \mathfrak{p}_1$ maps to $a + \mathfrak{q}_1$. So $a + \mathfrak{q}_1 \in \overline{\mathfrak{q}}_2$ if and only if $a + \mathfrak{p}_1 \in \overline{\mathfrak{q}}_2 \cap (A/\mathfrak{p}_1) = \mathfrak{p}_2/\mathfrak{p}_1$, which holds if and only if $a \in \mathfrak{p}_2$. This confirms $\mathfrak{q}_2 \cap A = \mathfrak{p}_2$.
[/guided]
[/step]