[proofplan]
We first record that the basic definable sets $[\varphi]$ are clopen, because their complements are defined by negated formulas. This immediately gives a clopen basis and will later imply total disconnectedness. Hausdorffness follows from completeness of types: two distinct complete types disagree on some formula, and the corresponding complementary basic opens separate them. Compactness is proved by the finite-intersection property for closed basic sets, using the first-order [compactness theorem](/theorems/2748) for the elementary diagram of $M$ and then extending the realized partial type to a complete type.
[/proofplan]
[step:Show that every basic definable set is clopen]
Let $\mathcal{L}(A)$ denote the language obtained from $\mathcal{L}$ by adding a constant symbol for each element of $A$. For each $\mathcal{L}(A)$-formula $\varphi(x_1,\dots,x_n)$, define
\begin{align*}
[\varphi] := \{p \in S_n(A) : \varphi(x_1,\dots,x_n) \in p\}.
\end{align*}
By definition of the topology on $S_n(A)$, the sets $[\varphi]$ are open and form a basis.
We claim that $[\varphi]$ is also closed. Since every $p \in S_n(A)$ is a complete type over $A$, exactly one of $\varphi$ and $\neg \varphi$ belongs to $p$. Therefore
\begin{align*}
S_n(A) \setminus [\varphi]
&= \{p \in S_n(A) : \varphi \notin p\} \\
&= \{p \in S_n(A) : \neg \varphi \in p\} \\
&= [\neg \varphi].
\end{align*}
The set $[\neg \varphi]$ is open by the definition of the basis, so $[\varphi]$ is closed. Thus the basic sets $[\varphi]$ form a basis of clopen subsets of $S_n(A)$.
[guided]
Let us check carefully why the basic opens are also closed. The topology on $S_n(A)$ is generated by sets of the form
\begin{align*}
[\varphi] := \{p \in S_n(A) : \varphi(x_1,\dots,x_n) \in p\},
\end{align*}
where $\varphi$ is an $\mathcal{L}(A)$-formula in the variables $x_1,\dots,x_n$. These sets are open by definition.
To prove that $[\varphi]$ is closed, we compute its complement. A point of $S_n(A)$ is a complete type over $A$, so for every formula $\varphi$, the type contains exactly one of $\varphi$ and $\neg \varphi$. Hence, for $p \in S_n(A)$,
\begin{align*}
p \notin [\varphi]
\iff \varphi \notin p
\iff \neg \varphi \in p
\iff p \in [\neg \varphi].
\end{align*}
Therefore
\begin{align*}
S_n(A) \setminus [\varphi] = [\neg \varphi].
\end{align*}
Since $[\neg \varphi]$ is another basic [open set](/page/Open%20Set), the complement of $[\varphi]$ is open. Thus $[\varphi]$ is closed. This proves that the basic definable sets are clopen, which is the structural fact behind both Hausdorffness and total disconnectedness.
[/guided]
[/step]
[step:Separate distinct complete types by complementary basic opens]
Let $p,q \in S_n(A)$ with $p \neq q$. Since $p$ and $q$ are distinct sets of $\mathcal{L}(A)$-formulas, there exists an $\mathcal{L}(A)$-formula $\varphi(x_1,\dots,x_n)$ such that $\varphi \in p$ and $\varphi \notin q$. Since $q$ is complete, $\neg \varphi \in q$.
Thus $p \in [\varphi]$ and $q \in [\neg \varphi]$. By the previous step,
\begin{align*}
[\varphi] \cap [\neg \varphi] = \varnothing,
\end{align*}
because no complete type contains both a formula and its negation. The sets $[\varphi]$ and $[\neg \varphi]$ are open neighbourhoods of $p$ and $q$, respectively. Hence $S_n(A)$ is Hausdorff.
[/step]
[step:Prove compactness for covers by basic clopen sets]
We prove that every cover of $S_n(A)$ by basic open sets has a finite subcover. Equivalently, we prove the finite-intersection property for complements of basic open sets.
Let $M_A$ denote the $\mathcal{L}(A)$-structure obtained from $M$ by interpreting each constant symbol named by an element of $A$ as that element, and define
\begin{align*}
\operatorname{Th}_A(M) := \{\sigma : \sigma \text{ is an } \mathcal{L}(A)\text{-sentence and } M_A \models \sigma\}.
\end{align*}
Thus $\operatorname{Th}_A(M)$ is the complete theory of $M$ with parameters from $A$ named.
Let $(\varphi_i)_{i \in I}$ be a family of $\mathcal{L}(A)$-formulas in variables $x_1,\dots,x_n$ such that the family of closed basic sets $([\varphi_i])_{i \in I}$ has the finite-intersection property. That means that for every finite subset $J \subset I$,
\begin{align*}
\bigcap_{j \in J} [\varphi_j] \neq \varnothing.
\end{align*}
We show that
\begin{align*}
\bigcap_{i \in I} [\varphi_i] \neq \varnothing.
\end{align*}
Let $\operatorname{Diag}_{\mathrm{el}}(M)$ denote the elementary diagram of $M$ in the language $\mathcal{L}(M)$, where $\mathcal{L}(M)$ is obtained from $\mathcal{L}$ by adding a constant symbol for every element of $M$. Consider the set of $\mathcal{L}(M)$-sentences
\begin{align*}
\Sigma := \operatorname{Diag}_{\mathrm{el}}(M) \cup \{\varphi_i(c_1,\dots,c_n) : i \in I\},
\end{align*}
where $c_1,\dots,c_n$ are new constant symbols not occurring in $\mathcal{L}(M)$.
We claim that every finite subset of $\Sigma$ is satisfiable. Let $\Sigma_0 \subset \Sigma$ be finite. Then $\Sigma_0$ contains only finitely many formulas among the family $\{\varphi_i(c_1,\dots,c_n) : i \in I\}$, say those indexed by a finite set $J \subset I$, and finitely many sentences from $\operatorname{Diag}_{\mathrm{el}}(M)$. Since $\bigcap_{j \in J} [\varphi_j] \neq \varnothing$, choose $p_J \in \bigcap_{j \in J}[\varphi_j]$. By the definition of $S_n(A)$, the type $p_J$ is consistent with $\operatorname{Th}_A(M)$, so there is an elementary extension $N_J \succ M$ and a tuple $a_J = (a_{J,1},\dots,a_{J,n}) \in N_J^n$ realizing every formula in $p_J$; in particular, $N_J \models \varphi_j(a_J)$ for all $j \in J$. Therefore $N_J$, interpreting $c_k$ as $a_{J,k}$ for $1 \le k \le n$, satisfies $\Sigma_0$.
By the first-order compactness theorem (citing a result not yet in the wiki: First-Order Compactness Theorem), the set $\Sigma$ has a model $N$. Since $N \models \operatorname{Diag}_{\mathrm{el}}(M)$, the interpretation of the constants for $M$ gives an elementary embedding of $M$ into $N$; identifying $M$ with its image, we may regard $N$ as an elementary extension of $M$. Let $a = (a_1,\dots,a_n) \in N^n$ be the tuple interpreting $(c_1,\dots,c_n)$. Then
\begin{align*}
N \models \varphi_i(a_1,\dots,a_n)
\end{align*}
for every $i \in I$.
Define the complete type of $a$ over $A$ by
\begin{align*}
\operatorname{tp}_N(a/A)
:= \{\psi(x_1,\dots,x_n) : \psi \text{ is an } \mathcal{L}(A)\text{-formula and } N \models \psi(a_1,\dots,a_n)\}.
\end{align*}
This is an element of $S_n(A)$, and it contains every $\varphi_i$. Hence
\begin{align*}
\operatorname{tp}_N(a/A) \in \bigcap_{i \in I} [\varphi_i].
\end{align*}
Thus every family of closed basic sets with the finite-intersection property has nonempty intersection, equivalently every cover by basic open sets has a finite subcover.
[guided]
The compactness argument is the main model-theoretic step. We want to prove that a family of closed basic sets with the finite-intersection property has nonempty total intersection. Let $(\varphi_i)_{i \in I}$ be a family of $\mathcal{L}(A)$-formulas in variables $x_1,\dots,x_n$ such that, for every finite subset $J \subset I$,
\begin{align*}
\bigcap_{j \in J} [\varphi_j] \neq \varnothing.
\end{align*}
This means that every finite subfamily of the formulas can be placed simultaneously inside some complete type over $A$.
To turn this topological finite-intersection condition into a model-theoretic satisfiability condition, we introduce constants. Let $\mathcal{L}(M)$ be the language obtained from $\mathcal{L}$ by adding a constant symbol for every element of $M$, and let $\operatorname{Diag}_{\mathrm{el}}(M)$ be the elementary diagram of $M$ in this language. Introduce new constant symbols $c_1,\dots,c_n$ intended to name a realizing tuple. Define
\begin{align*}
\Sigma := \operatorname{Diag}_{\mathrm{el}}(M) \cup \{\varphi_i(c_1,\dots,c_n) : i \in I\}.
\end{align*}
We verify finite satisfiability of $\Sigma$. Let $\Sigma_0 \subset \Sigma$ be finite. Only finitely many formulas from the family $\{\varphi_i(c_1,\dots,c_n) : i \in I\}$ occur in $\Sigma_0$; call their index set $J \subset I$. By the finite-intersection hypothesis,
\begin{align*}
\bigcap_{j \in J} [\varphi_j] \neq \varnothing.
\end{align*}
Choose a type $p_J$ in this intersection. Then each $\varphi_j$ belongs to $p_J$. Since $p_J \in S_n(A)$ is a complete type over $A$, it is consistent with the theory of $M$ over parameters from $A$. Consequently there is an elementary extension $N_J \succ M$ and a tuple
\begin{align*}
a_J = (a_{J,1},\dots,a_{J,n}) \in N_J^n
\end{align*}
realizing $p_J$. In particular,
\begin{align*}
N_J \models \varphi_j(a_J)
\end{align*}
for every $j \in J$. Interpreting each new constant $c_k$ as $a_{J,k}$, the structure $N_J$ satisfies all formulas in $\Sigma_0$: it satisfies the finite part of $\operatorname{Diag}_{\mathrm{el}}(M)$ because $N_J \succ M$, and it satisfies the finitely many required $\varphi_j(c_1,\dots,c_n)$ by construction.
Therefore every finite subset of $\Sigma$ is satisfiable. By the first-order compactness theorem (citing a result not yet in the wiki: First-Order Compactness Theorem), $\Sigma$ itself has a model $N$. Because $N$ satisfies the elementary diagram of $M$, the constants naming elements of $M$ embed $M$ elementarily into $N$. After identifying $M$ with this elementary substructure, we treat $N$ as an elementary extension of $M$.
Let
\begin{align*}
a = (a_1,\dots,a_n) \in N^n
\end{align*}
be the tuple interpreting the constants $c_1,\dots,c_n$. Since $N \models \Sigma$, we have
\begin{align*}
N \models \varphi_i(a_1,\dots,a_n)
\end{align*}
for every $i \in I$. Now define the complete type of this tuple over $A$ by
\begin{align*}
\operatorname{tp}_N(a/A)
:= \{\psi(x_1,\dots,x_n) : \psi \text{ is an } \mathcal{L}(A)\text{-formula and } N \models \psi(a_1,\dots,a_n)\}.
\end{align*}
This is a complete type over $A$, hence an element of $S_n(A)$. It contains every $\varphi_i$, so
\begin{align*}
\operatorname{tp}_N(a/A) \in \bigcap_{i \in I} [\varphi_i].
\end{align*}
Thus the full intersection is nonempty. This proves compactness for basic closed sets, or equivalently that every basic open cover has a finite subcover.
[/guided]
[/step]
[step:Upgrade compactness from basic covers to arbitrary open covers]
Let $(U_i)_{i \in I}$ be an arbitrary open cover of $S_n(A)$. For each $p \in S_n(A)$, choose an index $i(p) \in I$ such that $p \in U_{i(p)}$. Since the sets $[\varphi]$ form a basis, choose an $\mathcal{L}(A)$-formula $\varphi_p(x_1,\dots,x_n)$ such that
\begin{align*}
p \in [\varphi_p] \subset U_{i(p)}.
\end{align*}
Then $([\varphi_p])_{p \in S_n(A)}$ is a cover of $S_n(A)$ by basic open sets. By the previous step, there are $p_1,\dots,p_m \in S_n(A)$ such that
\begin{align*}
S_n(A) = \bigcup_{r=1}^{m} [\varphi_{p_r}].
\end{align*}
Since $[\varphi_{p_r}] \subset U_{i(p_r)}$ for each $1 \le r \le m$, we obtain
\begin{align*}
S_n(A) = \bigcup_{r=1}^{m} U_{i(p_r)}.
\end{align*}
Thus every open cover has a finite subcover, so $S_n(A)$ is compact.
[/step]
[step:Conclude total disconnectedness from the clopen basis]
Let $C \subset S_n(A)$ be a connected subset with at least two distinct points. Choose $p,q \in C$ with $p \neq q$. By the Hausdorff separation step, there is an $\mathcal{L}(A)$-formula $\varphi(x_1,\dots,x_n)$ such that $p \in [\varphi]$, $q \in [\neg \varphi]$, and
\begin{align*}
[\varphi] \cap [\neg \varphi] = \varnothing.
\end{align*}
By the first step, $[\varphi]$ is clopen in $S_n(A)$. Therefore
\begin{align*}
C \cap [\varphi]
\end{align*}
is clopen in the [subspace topology](/page/Subspace%20Topology) on $C$. It is nonempty because it contains $p$, and it is not all of $C$ because $q \notin [\varphi]$. This contradicts connectedness of $C$. Hence every connected subset of $S_n(A)$ has at most one point, so $S_n(A)$ is totally disconnected.
Combining the preceding steps, $S_n(A)$ is compact, Hausdorff, and totally disconnected, and its basic definable sets $[\varphi]$ form a clopen basis.
[/step]