Zerodimensional, compact space is homeomorphic to spectrum of some ring -- elementary attempt

Try to show that a prime ideal in $R=C(X,\Bbb Z_2)$ corresponds to a unique point in $X$ using compactness. (The sets $\{f^{-1}[\{0\}]: f \in I\}$ form a zero-set filter, when $I$ is an ideal in $R$ etc.)

Then show $\textrm{Spec}(R) \simeq X$ via this correspondence.


Henno Brandsma has given lots of good hints, but let me spell things out a bit more for you.

Let $R = C(X,\mathbb{Z}_2)$. For any $x\in X$, let $\mathfrak{p}_x = \{f\in R\mid f(x) = 0\}$. It is easy to check that this is a prime ideal in $R$. This gives a map $\varphi\colon X\to \text{Spec}(R)$, $x\mapsto \mathfrak{p}_x$. And this map is continuous, since a basic open set in $\text{Spec}(R)$ is given by $D_f = \{\mathfrak{p}\in \text{Spec}(R)\mid f\notin \mathfrak{p}\}$ for $f\in R$, and $$\varphi^{-1}(D_f) = \{x\in X\mid \mathfrak{p}_x\in D_f\} = \{x\in X\mid f\notin \mathfrak{p}_x\} = \{x\in X\mid f(x) \neq 0\} = f^{-1}(\{1\}),$$ which is open in $X$, since $f$ is continuous and $\mathbb{Z}_2$ is discrete.

Now it suffices to check that $\varphi$ has a continuous inverse $\psi\colon \text{Spec}(R)\to X$. For each $f\in R$, let $Z(f) = \{x\in X\mid f(x) = 0\}$. Let $\mathfrak{p}\in \text{Spec}(R)$, and let $Y = \bigcap_{f\in \mathfrak{p}} Z(f)$.

Claim: $Y$ is nonempty.

Since $X$ is compact, and each set $Z(f)$ is closed, it suffices to show that the family $\mathcal{Z} = \{Z(f)\mid f\in \mathfrak{p}\}$ has the finite intersection property. Let $f,g\in \mathfrak{p}$. Then $Z(f)\cap Z(g) = Z(f+g+fg)$, and $f+g+fg\in \mathfrak{p}$, so $\mathcal{Z}$ is actually closed under finite intersections. Suppose for contradiction that $\emptyset\in \mathcal{Z}$, witnessed by $Z(f) = \emptyset$ with $f\in \mathfrak{p}$. Then $f$ is the constant function $1$, contradicting our assumption that $\mathfrak{p}$ is prime. We have shown that $\mathcal{Z}$ is closed under finite intersections and does not contain $\emptyset$, so by compactness its intersection $Y$ is nonempty.

Claim: $Y$ is a singleton.

Suppose for contradiction that $x,y\in Y$ with $x\neq y$. Since $X$ is zero dimensional and Hausdorff, there is some clopen set $C\subseteq X$ with $x\in C$ and $y\notin C$. Let $f$ be the function which sends all points in $C$ to $0$ and all points not in $C$ to $1$ ($f$ is continuous since $C$ is clopen). Then $f(1-f) = 0\in \mathfrak{p}$, and $\mathfrak{p}$ is prime, so either $f\in \mathfrak{p}$ or $(1-f)\in \mathfrak{p}$. In the first case, $y\notin Z(f)$ contradicting $y\in Y$, and in the second case, $x\notin Z(1-f)$, contradicting $x\in Y$.

We have shown that $Y = \{x\}$ is a singleton, and we can define $\psi(\mathfrak{p}) = x$.

It remains to check that $\varphi$ and $\psi$ are inverses and $\psi$ is continuous. I'll leave that to you.