Spectrum of a ring homeomorphic to a compact, totally disconnected space Let $X$ be a compact, totally disconnected space.
It must be shown that $X$ is homeomorphic to $\mathrm{Spec}(A)$, where
$$ A:=C(X, \mathbb{Z}_2), $$
and $\mathbb{Z}_2$ is endowed with the discrete topology.
At first, it is easy to see that $A=\{ \chi_S: S\; \mathrm{is\,open\,and\,closed\,in\;}X \}$ (no matter how ugly or cool $X$ is)[further, such $A$ is a boolean ring]
And, naturally, there is a correspondence $$\{ \chi_S: S\; \mathrm{is\,open\,and\,closed\,in\;}X \} \rightleftarrows  \{ S\subseteq X: S\; \mathrm{is\,open\,and\,closed\,in\;}X \}=:\Gamma_X $$
I think I've read somewhere (sorry, I forgot where), that if $B$ is a boolean ring, then $B$ is isomorphic to $\Gamma_{\mathrm{Spec}(B)}$. Let us denote this result by $(*)$.
I think that, under the assumption of $(*)$, $A\cong \Gamma_{\mathrm{Spec}(A)}$, but if $X$ is totally disconnected,  then  $\Gamma_{\mathrm{Spec}(A)}=\mathrm{Spec}(A)$, is this right ?
Also, $X$ is in a one-to-one correspondence with $\{ \chi_{\{x \} }: x\in X \}$, which gives us
$$ X\cong A\cong\Gamma_{\mathrm{Spec}(A)}=\mathrm{Spec}(A). $$
I've not checked continuity yet, which shouldn't be too complicated. I'm stuck at this point because $A\cong \mathrm{Spec}(A)$ shocks me.
Can you help me, please? 
Is my reasoning right?
 A: I consider directly $Y=\operatorname{Spec}(A)$: since $A$ is a Boolean $\mathbb{Z}_2$-algebra, the unique clopen subsets of $Y$ are
\begin{equation*}
Y_f=\{\mathfrak{p}\in Y\mid f\notin\mathfrak{p}\},\,f\in A
\end{equation*}
(cfr. [AM] chapter 1, exercises 23.(i) and 23.(iii)); every prime ideal $\mathfrak{p}$ of $A$ is maximal and $A_{\displaystyle/\mathfrak{p}}\cong\mathbb{Z}_2$ (cfr. [AM] chapter 1, exercise 11.(ii)).
SInce $A$ is the ring of regular morphisms on $Y$, that is
\begin{gather*}
\forall f\in A,\,f^{*}:Y\to\coprod_{\mathfrak{q}\in Y} A_{\displaystyle/\mathfrak{q}},\\
f^{*}(\mathfrak{p})=[f]_{\mathfrak{p}}\in A_{\displaystyle/\mathfrak{p}}\cong\mathbb{Z}_2,
\end{gather*}
then
\begin{equation*}
Y_f=\{\mathfrak{p}\in Y\mid f^{*}(\mathfrak{p})=1\in\mathbb{Z}_2\}.
\end{equation*}
Analogously, one can define
\begin{equation*}
\forall f\in A,\,X_f=\{x\in X\mid f(x)=1\in\mathbb{Z}_2\};
\end{equation*}
easily one can prove that $\{X_f\subseteqq X\}_{f\in A}$ is an open covering of $X$ and
\begin{equation*}
\forall f,g\in A,\,X_f\cap X_g=X_{fg},
\end{equation*}
that is $\{X_f\subseteqq X\}_{f\in A}$ is a topological base for $X$.
It is an exercise to prove that
\begin{equation*}
\forall x\in X,\,\mathfrak{p}_x=\{f\in A\mid f(x)=0\in\mathbb{Z}_2\}
\end{equation*}
is a prime ideal of $A$; since $X$ is totally disconnected, it is a Fréchet space and
\begin{equation*}
\forall x\neq y\in X,\,\exists f\neq g\in A\mid x\in X_f,y\in X_g,x\notin X_g,y\notin X_f\Rightarrow\mathfrak{p}_x\neq\mathfrak{p}_y\in Y.
\end{equation*}
By previous reasoning, the map
\begin{equation*}
\varphi:x\in X\to\mathfrak{p}_x\in Y
\end{equation*}
is injective and continuous because:
\begin{equation*}
\forall f\in A,\,\varphi^{-1}(Y_f)=X_f.
\end{equation*}
Because $Y$ with the Zariski topology is a compact Hausdorff space (cfr. [AM], chapter 1, exercise 23.(iv)) and, in general, $X$ is not Hausdorff: one can disprove that $\varphi$ is a homeomorphism.

[AM] M. F. Atiyah, I. G. MacDonald - Introduction to Commutative Algebra, Addison-Wesley Publishing Company (1969)
