a proof in the book by Irving Kaplansky

Theorem 179 in the book Commutative Rings by Kaplansky states that:

Let $$R$$ be an integral domain. The following conditions are necessary and sufficient for $$R$$ to be a UFD.

(1) $$R$$ satisfies the ascending condition on principal ideals

(2) In the polynomial ring $$R[x]$$ all minimal prime ideals are finitely generated.

(3) For any prime ideal $$P$$ of grade one in $$R$$, $$R_P$$ is a UFD.

(4) In any localization of $$R[x]$$ all invertible ideals are principal.

I have a problem with his proof and I retype it here for more clearance.

proof

Sufficiency. We shall actually prove that $$R[x]$$ is a UFD; it is standard and easy that then $$R$$ is a UFD. We abbreviate $$R[X]$$ to $$T$$. It is also easy that the ascending chain condition on principal ideals is inherited by T.

Let $$S$$ be the set of all finite products of principals prime in $$R$$. By Theorem 177 (He means Nagata's theorem) it suffices to prove that $$T_S=U$$ is a UFD.

He then uses three conditions in Theorem 178 to prove $$U$$ is a UFD. Hence he reduces to the case prove $$U_M$$ is a UFD for all maximal idel $$M$$ in $$U$$.

Note that $$M$$ has the form $$Q_S$$ for suitable prime ideal in $$T$$ disjoint from $$S$$. Let $$P=Q\cap R$$. We claim that $$P=0$$ or has grade 1.

The problem is that he does not treat the case $$P=0$$. I think it's not trivial.

Here is my approach.

If $$Q=0$$ because $$Q$$ is maximal ideal such that disjoint from $$S$$ so every principal ideal $$(a)$$ does not disjoint from $$S$$ where $$a$$ is non-zero, non-unit, and since $$S$$ is saturated so $$R[X]$$ is a UFD . We therefore can assume $$Q\neq 0$$. As $$Q\cap R=0$$ and from the fact that is we can not have a chain of three distinct prime ideals in $$R[X]$$ with the same contraction in $$R$$. Hence ht $$Q=1$$, from hypothesis (ii) $$Q$$ is finitely generated. Also we have $$R[X]_Q\cong U_M$$ so $$U_M$$ is a Noetherian domain with a unique non-zero prime ideal but from my previous question, it's still not enough to deduce $$U_M$$ is a UFD.

So I decide to post this question for the case $$Q\cap R=0$$.

Suppose $P = Q \cap R = 0$, or in other words if we consider $R \setminus \{0\}$ (which is a multiplicatively closed system, as $R$ is an integral domain), then we have that $Q \cap (R \setminus \{0\}) = \varnothing$, so $R \setminus \{0\} \subset T \setminus Q$
This means if we consider $K= (R \setminus\{0\})^{-1} R$ the quotient field of $R$, we get that since $(R \setminus \{0\})^{-1}T=K[X]$ and $R \setminus \{0\} \subset T \setminus Q$, $T_Q$ (and hence also $U_M$) are localizations of $K[X]$. So since $K[X]$ is a PID, $T_Q$ and $U_M$ are PIDs, being localizations of a PID and thus they are UFDs.