Let $R = k[X_1, ... , X_n]$, $Y$ an affine variety in $k^n$ of dimension $r$, and $H$ a hypersurface in $k^n$, with $Y \cap H \subsetneq Y$. I am trying to understand why every irreducible component of $Y \cap H$ must have dimension $r-1$. I have looked up some solutions online, but they seem to be glossing over some details I am not comfortable with.
We can write $Y$ as the zero set of a prime ideal $\mathfrak p$ of $R$, with $r$ the Krull dimension of $R/\mathfrak p$. We can also write $H$ as $Z(p)$, where $p$ is an irreducible polynomial in $R$. Necessarily $n-1$ is the dimension of $R/(p)$, and since $Y \cap H \subsetneq Y$, we have $p \not\in \mathfrak p$.
Now $Y \cap H$ is closed in $k^n$, and if $E$ is an irreducible component of $Y \cap H$, then $E = Z(\mathfrak q)$, where $\mathfrak q$ is a prime ideal of $R$ which is minimal with respect to containing $\mathfrak p$ and $p$. I need to argue that in fact $\mathfrak q$ is minimal with respect to properly containing $\mathfrak p$. Since $R$ is catenary, it will follow that the dimension of $R/\mathfrak q$, i.e. the dimension of $E$, is exactly $r-1$.
Now suppose $\mathfrak q_0$ is a prime ideal satisfying $\mathfrak p \subseteq \mathfrak q_0 \subsetneq \mathfrak q$. Then necessarily $p \not\in \mathfrak q_0$. I want to argue that $\mathfrak p = \mathfrak q_0$, but I don't know where to go with this.