%! TEX root = LST.tex
% vim: tw=50
% 20/02/2024 09AM

\vspace{-4em}
If $S$ is the \gls{theory} of fields, then $A$ is
not a \gls{model}:
\[ 1 + 1 = (1 + 0) + 1 \]
is provable from $S$, but not satisfied in $A$:
\[ (1 + 1)_A = 1 + 1, \qquad ((1 + 0) + 1)_A = (1
+ 0) + 1 .\]
Easy remedy: define $s \sim t$ on $A$ if and only
if $S \ssynentails (s = t)$, and then replace $A$
with $A / \sim$. Two issues remain.

Let $S$ be the \gls{theory} of fields plus the
sentence $(1 + 1 = 0 \por (1 + 1) + 1 = 0)$ (the
\gls{theory} of fields of characteristic $2$ or
$3$). $S \not\ssynentails 1 + 1 = 0$, so in our
new $A$
\[ 1_A +_A 1_A = [1] +_A [1] = [1 + 1] \neq [0]_A
= 0_A .\]
Similarly
\[ (1_A +_A 1_A) +_A 1_A \neq 0_A .\]
So $A$ is not a \gls{model} of $S$. Remedy: extend
$S$ to a \gls{cons} \gls{theory} $\ol{S} \supset
S$ such that for every \gls{sent} $p$, either
$\ol{S} \ssynentails p$ or $\ol{S} \ssynentails
\pnot p$. Such a \gls{theory} is called
\emph{complete}.

Now consider $S$ being the \gls{theory} of fields
plus $((\pexists x)(xx = 1 + 1))$. $A$ is not a
\gls{model} since there's no \gls{closed} \gls{term} $t$ such
that
\[ [t] \cdot [t] = [1] +_A [1] = 1_A +_A 1_A \]
because $S \not\ssynentails (t \cdot  = 1 + 1)$.
We say $S$ has \emph{witnesses} if for every
\gls{sent} of the form $(\pexists p)$, where
$\FV(p) = \{x\}$, such that $S \ssynentails
(\pexists x) p$, there exists a \gls{closed}
\gls{term} $t$ such that $S \ssynentails \subst
p[t/x]$. We will enlarge $S$ to a \gls{cons}
\gls{theory} $\ol{S}$ such that $\ol{S}$ will have
witnesses for $S$.

\begin{proof}[Proof of \cref{fo_model_existence}
  (non-examinable)]
  We start with two observations. Let $S$ be a
  first-order \gls{cons} \gls{theory} in a
  \gls{folang} $L = L(\pOmega, \pPi)$. For any
  \gls{sent} $p$, at least one of $S \cup \{p\}$
  or $S \cup \{\pnot p\}$ is \gls{cons}. Otherwise
  they both $\ssynentails \false$, so by
  \nameref{fo_ded_thm}, $S \ssynentails \pnot p$ and
  $S \ssynentails \pnot \pnot p$. Hence $S
  \ssynentails \false$ by \gls{MP}, contradiction.
  An argument using \nameref{ZL} gives a
  \gls{cons} $\ol{S} \supset S$ such that for
  every \gls{sent} $p$, either $p \in \ol{S}$ or
  $\pnot p \in \ol{S}$. So $\ol{S}$ is complete.

  Now assume $S$ is \gls{cons} and $S \ssynentails
  (\exists x) p$ for some $p$ with $\FV(p) =
  \{x\}$. We add a new constant $c$ to $L$
  ($\pOmega \to \pOmega \cup \{c\}$). Then $S \cup
  \{\subst p[c / x]\}$ is \gls{cons}. If not, then
  $S \cup \{\subst p[c / x]\} \ssynentails
  \false$, so $S \ssynentails \pnot \subst p[c /
  x]$. Since $c$ does not occur in $S$, we get $S
  \ssynentails \pnot p$ (put $x$ back in place of
  $c$ in the \gls{fproof}). So by (Gen), $S
  \ssynentails (\pforall x) \pnot p$. By
  assumption $S \ssynentails \pnot (\pforall
  x)\pnot p$. So $S \ssynentails \false$ by
  \gls{MP}, contradiction. Do this for every
  \gls{sent} $(\pexists p)$ that is
  \glsref[fproof]{provable} from $S$ to get a new
  \gls{folang} $\ol{L} = L(\pOmega \cup C, \pPi)$
  and a \gls{cons} \gls{theory} $\ol{S}$ in
  $\ol{L}$ such that if $p$ is a \gls{form} in $L$
  with $\FV(p) = \{x\}$ and $S \ssynentails
  (\pexists x) p$, then there exists a
  \gls{closed} \gls{term} $t$ in $\ol{L}$ such
  that $\ol{S} \ssynentails \subst p[t / x]$.

  Now start with a \gls{cons} \gls{theory} $S$ in
  $L = L(\pOmega, \pPi)$, we inductively define
  languages $L_n = (\pOmega \cup C_1 \cup \cdots
  \cup C_n, \pPi)$, each $C_k$ is a new set of
  constants, and \glspl{theory}
  \[ S = S_0 \subset S_1 \subset T_1 \subset S_2
  \subset T_2 \subset \cdots \]
  such that $\forall n \in \NN$, $S_n$ is a
  complete \gls{cons} \gls{theory} in $L_{n - 1}$
  and $T_n$ is a \gls{cons} \gls{theory} in $L_n$
  which has witnesses for $S_n$. Let $L^* =
  \bigcup_n L_n$, $S^* = \bigcup_n S_n$.

  It's straightforward to check that $S^*$ is a
  \gls{cons} \gls{theory} in $L^*$ and $S^*$ is
  complete and has witnesses.

  A \gls{model} for $S^*$ in the \gls{folang}
  $L^*$ will be a \gls{model} of $S$ when
  viewed as a \gls{struc} in the \gls{folang} $L$.
  So without loss of generality, $S$ is \gls{cons}
  in $L$ and has witnesses and is complete.

  Let $A$ be the set of equivalence classes of
  \gls{closed} \glspl{term} in $L$ where $s \sim t
  \iff S \ssynentails (s = t)$. For $\omega \in
  \pOmega$ with $\arity(\omega) = n$, define
  \[ \omega_A : A^n \to A, \omega_A([t_1], \ldots,
  [t_n]) = [\omega t_1 \ldots t_n] .\]
  For $\varphi \in \pPi$ with $\arity(\varphi) =
  n$, define
  \[ \varphi_A : A^n \to \{0\}, \varphi_A([t_1],
  \ldots, [t_n]) = 1 \iff S \ssynentails \varphi
  t_1 \ldots t_n .\]
  An easy induction shows that for a \gls{closed}
  \gls{term} $s$, $s_A = [s]$. Next, for a
  \gls{sent} $p$, $S \ssynentails p \iff p_A = 1$
  (i.e. $p$ holds in $A$). To prove this, use
  induction on the \gls{folang}. Then $A$ is a
  \gls{model} of $S$.
\end{proof}

\begin{corollary}[Compactness]
  \label{fo_compactness}
  Let $S$ be a first-order \gls{theory}. If every
  finite subset of $S$ has a \gls{model}, then $S$
  has a \gls{model}.
\end{corollary}

\begin{proof}
  If $S \ssementails \false$, then $S \ssynentails
  \false$. \glsref[fproof]{Proofs} are finite, so there exists
  finite $S' \subset S$ such that $S' \ssynentails
  \false$. Hence $S' \ssementails \false$,
  contradiction.
\end{proof}

\subsubsection*{Applications}

Can we axiomatise finite groups? In other words,
does there exist a \gls{theory} $T$ whose
\glspl{model} are the finite groups?

For $n \in \NN$, let
\[ t_n = (\pexists x_1) \cdots (\pexists x_n)
(\pforall x)(x = x_1 \por x = x_2 \por \cdots \por
x = x_n) .\]
So $t_n$ means ``contains at most $n$ elements''.
Want
\[ T = \text{\gls{theory} of groups} \cup \{t_1
\por t_2 \por t_3 \por \cdots \} .\]
But $t_1 \por t_2 \por t_3 \por \cdots$ is not a
\gls{sent} (because it is not finite).

\begin{flashcard}[finite-groups-not-axiomatisable-coro]
\begin{corollary}
  Finite groups are not axiomatisable as a
  first-order \gls{theory}.
\end{corollary}
  
\begin{proof}
  \cloze{Assume it is, and let $T$ be such a
  \gls{theory}. Consider $T' = T \cup \{\pnot t_1,
  \pnot t_2, \pnot t_3, \ldots\}$ where $t_n$ are
  defined by
  \[ t_n = (\pexists x_1) \cdots (\pexists x_n)
  (\pforall x)(x = x_1 \por x = x_2 \por \cdots \por
  x = x_n) .\]
  Every finite subset of $T'$ has a \gls{model}:
  $C_N$ for some large $N$ (cyclic group of order
  $N$). By \cref{fo_compactness}, $T'$ has a
  \gls{model}, but this model must be infinite,
  hence not a finite group.}
\end{proof}
\end{flashcard}

\begin{flashcard}[arbitrarily-large-models-infinite-models-coro]
\begin{corollary}
  If a first-order \gls{theory} $T$ has
  arbitrarilty large finite \glspl{model}, then it
  has infinite \glspl{model}.
\end{corollary}

\begin{proof}
  \cloze{Consider
  \[ T' = T \cup \{(\pexists x_1)(\pexists
  x_2)(x_1 \neq x_2), (\pexists x_1)(\pexists
  x_2)(\pexists x_3)(x_1 \neq x_2 \pand x_2 \pand
  x_3 \pand x_1 \neq x_2), \ldots\} .\]
  By assumption, every finite subset of $T'$ has a
  \gls{model}, so $T'$ has a \gls{model}. A
  \gls{model} of $T'$ is just an infinite
  \gls{model}.}
\end{proof}
\end{flashcard}
