Solution (source code)

= Solution

Use the convention that a <multiplicative subset> contains $1$ and is closed under multiplication. Usually $0$ is excluded; allowing it gives the harmless zero-ring localization. A <prime ideal> disjoint from $S$ is mapped to
$$
S^{-1}P=\{a/s:a\in P,\ s\in S\}
$$
in the <localization of a ring>. This <ideal> is proper, and
$$
(S^{-1}R)/(S^{-1}P)\cong S^{-1}(R/P)
$$
is an <integral domain>, since the denominators are nonzero in the <integral domain> $R/P$. Thus $S^{-1}P$ is a <prime ideal>.

Conversely, for a <prime ideal> $Q$ in $S^{-1}R$, its contraction
$$
P=\{a\in R:a/1\in Q\}
$$
is a <prime ideal> disjoint from $S$: each $s/1$ is a unit and cannot belong to a proper <ideal>. Membership in $Q$ is equivalent to numerator membership in $P$, since $a/s=(a/1)(s/1)^{-1}$. Hence $Q=S^{-1}P$.

To check the other composite, $a/1\in S^{-1}P$ implies $sa\in P$ for some $s\in S$, by the equality criterion for fractions in a <localization of a ring>. Since $s\notin P$, primality gives $a\in P$. Therefore \b[extension and contraction are mutually inverse:]
$$
\boxed{\{P\in\operatorname{Spec}R:P\cap S=\varnothing\}
\ \longleftrightarrow\ \operatorname{Spec}(S^{-1}R),\qquad P\mapsto S^{-1}P.}
$$
If $0\in S$, both sets are empty. This is the <prime ideal correspondence for localization>.