I have encountered the following exercise in Chapter II of Hartshorne's Algebraic Geometry:
Let $X$ be an integral scheme of finite type over a field $k$. Use appropriate results from (I, $\S1$) to prove the following:
(a) For any closed point $P\in X$, $\dim X=\dim \mathcal{O}_{X,P}$, where for rings, we always mean the Krull dimension.
...
(e) If $U$ is a nonempty open subset of $X$, then $\dim U=\dim X$.
I have proved (a), and my proof using all the hypothesis, include the quasi-compactness of $X$. Indeed, I prove that for $P,Q$ are closed points of $X$, then $\dim \mathcal{O}_{X,P}=\dim \mathcal{O}_{X,Q}$. Now take a maximal chain of irreducible closed subset of $X$ $$X=Z_0\supsetneq \ldots \supsetneq Z_d$$ then $Z_d$ must be a closed point $P$ (here I use the fact that for a quasi-compact scheme, every point has a closed point in its closure). Let $U$ be an affine neighborhood of $P$, then $\dim \mathcal{O}_{X,P}=\dim U\leq \dim X$. But $Z_i\cap U\supsetneq Z_{i+1}\cap U\supset \{P\}$ hence $\dim U\geq \dim X$, we are done.
My first question is, whether there exists a counterexample of this claim when $X$ is not quasi-compact (i.e. just locally of finite type)?
My second question is to verify the following counterexample for part (e):
Let $\mathfrak{p}=(x)$ in $k[x]$, and $X=\operatorname{Spec }k[x]_{\mathfrak{p}}$. Hence $X$ is integral and of finite type. Moreover, $X$ contains only two points, corresponding to $(0)$ and $\mathfrak{p}$. It is easy to see that $\mathfrak{p}$ is a closed point, so $U=\{(0)\}$ is open. But now $\dim U=0\neq 1=\dim X$.
Is my counterexample correct? Here I choose $U$ such that it doesn't contain any closed points. If $U$ contain a closed point $P$ of $X$, then there is some $V=\operatorname{Spec }A\subseteq U$ that contains $P$. By part (a), $$\dim X=\dim \mathcal{O}_{X,P}=\dim V\leq \dim U\leq \dim X$$ and we have the desired result. So part (e) must be stated for $U$ contains some closed points of $X$.
My question is quite long, so I will be very appreciated if someone take a look at it. Any hint, book or reference are welcome. Thanks in advance.
It seems that (a) holds without the quasicompactness assumption, the following is Vakil's FOAG Exercise $11.2$.I:
Your counterexample for (e) is incorrect because $k[x]_{(x)}$ is not finitely generated as a $k$-algebra, in fact it's not finitely generated as a $k[x]$-algebra.