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

\begin{flashcard}[soundness-thm]
\begin{proposition}[Soundness theorem]
  \label{soundness}
  \cloze{Given $S \subset \propL$, $t \in \propL$, if $S
  \synentails t$, then $S \sementails t$.}
\end{proposition}

\begin{proof}
  \cloze{Let $t_1, t_2, \ldots, t_n = t$ be a
  \gls{pproof} of $t$ from $S$. Let $\propv$ be a
  \gls{pmodel} of $S$. We need: $\propv(t) = 1$. We
  prove by induction that $\propv(t_i) = 1$ for
  all $i$.
  \begin{enumerate}[\textbf{Case }\bfseries 1:]
    \item $t_i$ is an \gls{axiom}. Then
      $\propv(t_i) = 1$ since \glspl{axiom} are
      \glspl{taut}.
    \item $t_i$ is a premise. Then $\propv(t_i) =
      1$ since $\propv$ is a \gls{pmodel} of $S$.
    \item $\exists j, k < i$ such that $t_k = (t_j
      \impl t_i)$. Then, by the induction
      hypothesis, $\propv(t_j) = \propv(t_j \impl
      t_i) = 1$ and hence $\propv(t_i) = 1$.
  \end{enumerate}
  }
\end{proof}
\end{flashcard}

\begin{flashcard}[consistent-set-defn]
\begin{definition*}[Consistent]
  \glsadjdefn{cons}{consistent}{set}%
  \glsadjdefn{incons}{inconsistent}{set}
  \cloze{Given $S \subset \propL$, say $S$ is
  \emph{inconsistent} if $S \synentails \false$
  and $S$ is \emph{consistent} if $S
  \not\synentails \false$.}
\end{definition*}
\end{flashcard}

\vspace{-1em}
Special case of adequacy: if $S \sementails
\false$ then $S \synentails \false$, i.e. if $S$
has no \gls{pmodel}, then $S$ is \gls{incons}, or
equivalently, if $S$ is \gls{cons}, then $S$ has a
\gls{pmodel}.

\begin{flashcard}[model-existence-lemma]
\begin{theorem}[Model Existence Lemma]
  \label{model_existence_lemma}
  \cloze{Let $S \subset \propL$. If $S$ is \gls{cons},
  then $S$ has a \gls{pmodel}.}
\end{theorem}

\cloze{\textbf{Idea:} If $S \synentails t$, then $S
\sementails t$ by \nameref{soundness}. So try
\[ \propv(t) = \begin{cases}
  1 & \text{if $S \synentails t$} \\
  0 & \text{otherwise}
\end{cases} \]
This doesn't work because it's possible to have $t
\in \propL$ such that $S \not\synentails t$ and $S
\not\synentails \pnot t$. For example, $S =
\emptyset$, $t = (p_1 \impl \false)$.

We try to enlarge $S$ to $\ol{S}$ such that
$\ol{S}$ is \gls{cons} and $\forall t \in
\propL$, $t$ or $\pnot t$ is in $\ol{S}$.}

\begin{proof}
  \cloze{We assume $\propP$ is countable (we'll do the
  general case in \cref{sec3}). Then $\propLnum{1}$ is
  countable and hence each $\propLnum{n}$ is
  countable by induction. Thus $\propL$ is
  countable. Enumerate $\propL$: $t_1, t_2, t_3,
  \ldots$.

  Note: if $S \subset \propL$ is \gls{cons} and
  $t \in L$, then one of $S \cup \{t\}$ or $S \cup
  \{\pnot t\}$ is \gls{cons}. If not, then $S \cup
  \{t\} \synentails \false$ and $S \cup \{\pnot
  t\} \synentails \false$. By the
  \nameref{ded_thm}, $S \synentails \pnot t$, and
  so $S \synentails \false$ \contradiction.

  So now start with a \gls{cons} $S \subset
  \propL$. Set $S_0 = S$.
  Using the comment above, we let $S_1$ be either
  $S_1$ be either $S_0 \cup \{t_1\}$ or $S_1 \cup
  \{\pnot t_2\}$, where we pick one such that
  $S_1$ is \gls{cons}. Similarly, let $S_2$ be
  either $S_1 \cup \{t_2\}$ or $S_1 \cup \{\pnot
  t_2\}$, where we pick one such that $S_2$ is
  \gls{cons}.

  Continue inductively and set $\ol{S} =
  \bigcup_{n = 0}^\infty S_n$. Then $\forall t \in
  \propL$, either $t \in \ol{S}$ or $\pnot t \in
  \ol{S}$. Also, $\ol{S}$ is \gls{cons} since
  \glspl{pproof} are finite, so if $\ol{S}
  \synentails \false$, then $\exists n$ such that
  $S_n \synentails \false$ \contradiction.

  It
  follows that $\ol{S}$ is \emph{deductively
  closed}: if $\ol{S} \synentails t$, then $t \in
  \ol{S}$. If not, then $\pnot t \in \ol{S}$, so
  $\ol{S} \synentails \pnot t$ and also $\ol{S}
  \synentails t$ and hence $\ol{S} \synentails
  \false$ (\gls{MP}) \contradiction.

  We now define $\propv : \propL \to \{0, 1\}$ by
  \[ \propv(t) = \begin{cases}
    1 & t \in \ol{S} \\
    0 & t \notin \ol{S}
  \end{cases} \]
  \textbf{Claim:} $\propv$ is a \gls{vtion}. Then
  $\propv$ is a \gls{pmodel} of $S$, and we are
  done.

  Firstly: $\propv(\false) = 0$ since $\propv
  \notin \ol{S}$ s $\ol{S}$ is \gls{cons}. Now we
  check $\propv(p \impl q)$ for $p, q \in \propL$.
  \begin{enumerate}[\textbf{Case }\bfseries 1:]
    \item $\propv(p) = 1$, $\propv(q) = 0$. We
      need $(p \impl q) \notin \ol{S}$. By
      assumption, $p \in \ol{S}$, $q \notin
      \ol{S}$, so $\pnot q \in \ol{S}$. If $(p
      \impl q) \in \ol{S}$, then by (\gls{MP}),
      $\ol{S} \synentails q$ and hence $q \in
      \ol{S}$ ($\ol{S}$ deductively closed)
      \contradiction (as $\pnot q \in \ol{S}$, so
      $\ol{S} \synentails \false$).
    \item $\propv(q) = 1$. We need $(p \impl q)
      \in \ol{S}$. We have $q \in \ol{S}$. Write
      down
      \begin{align*}
        &q
        &&\text{(premise)} \\
        &q \impl (p \impl q)
        &&\text{(A1)} \\
        &(p \impl q)
        &&\text{(\gls{MP})}
      \end{align*}
      so $\ol{S} \synentails (p \impl q)$ and
      hence $(p \impl q) \in \ol{S}$.
    \item $\propv(p) = 0$. We need $(p \impl q)
      \in \ol{S}$, or equivalently $\ol{S}
      \synentails (p \impl q)$ (since $\ol{S}$ is
      deductively closed). Enough to show that
      $\ol{S} \cup \{p\} \synentails q$ (by
      \nameref{ded_thm}). Since $\propv(p) = 0$, $p
      \notin \ol{S}$, and hence $\pnot p \in
      \ol{S}$. Now obtain a proof of $q$ from
      $\ol{S} \cup \{p\}$ as follows:
      \begin{align*}
        &p
        &&\text{(premise)} \\
        &\pnot p
        &&\text{(premise)} \\
        &\false
        &&\text{(\gls{MP})} \\
        &\false \impl (\pnot q \impl \false)
        &&\text{(A1)} \\
        &\pnot \pnot q
        &&\text{(\gls{MP})} \\
        &\pnot q \pnot q \impl q
        &&\text{(A3)} \\
        &q
        &&\text{(\gls{MP})}
      \end{align*}
  \end{enumerate}
  }
\end{proof}
\end{flashcard}

\begin{flashcard}[adequacy-thm]
\begin{corollary}[Adequacy]
  \label{adeq}
  \cloze{Let $S \subset \propL$, $t \in \propL$. If $S
  \sementails t$ then $S \synentails t$.}
\end{corollary}

\begin{proof}
  \cloze{$S \cup \{\pnot t\} \sementails \false$, so by
  \cref{model_existence_lemma}, $S \cup \{\pnot
  t\} \synentails \false$. Then by the
  \nameref{ded_thm}, $S \synentails \pnot \pnot
  t$. Take a \gls{pproof} of this, and add the
  lines:
  \begin{align*}
    &\pnot \pnot t \implies t
    &&\text{(A3)} \\
    &t
    &&\text{(\gls{MP})}
  \end{align*}
  So $S \synentails t$.}
\end{proof}
\end{flashcard}

\begin{flashcard}[completeness-thm]
\begin{theorem}[Completeness Theorem]
  \label{pcompleteness}
  \cloze{Let $S \subset \propL$, $t \in \propL$. Then $S
  \sementails t$ if and only if $S \synentails
  t$.}
\end{theorem}

\begin{proof}
  \cloze{
  \phantom{}
  \begin{enumerate}
    \item[$\Rightarrow$] \nameref{soundness}
    \item[$\Leftarrow$] \nameref{adeq} \qedhere
  \end{enumerate}
  }
\end{proof}
\end{flashcard}

\begin{corollary}[Compactness Theorem]
  \label{comp_thm}
  Let $S \subset \propL$, $t \in \propL$. If $S
  \sementails t$ then $\exists$ finite $S' \subset
  S$ such that $S' \sementails t$.
\end{corollary}

\begin{proof}
  Trivial for $\synentails$ as \glspl{pproof} are
  finite.
\end{proof}

Special case:

\begin{corollary}
  \label{alt_comp_thm}
  Let $S \subset \propL$. If every finite subset
  of $S$ has a \gls{pmodel}, then $S$ has a
  \gls{pmodel}.
\end{corollary}

\begin{proof}
  If not, then $S \sementails \false$, so by
  \cref{comp_thm} there exists finite $S' \subset
  S$ with $S' \sementails \false$, contradiction.
\end{proof}

\begin{remark*}
  \cref{alt_comp_thm} implies \cref{comp_thm}. If
  $S \sementails t$ then $S \cup \{\pnot t\}
  \sementails t$, so by \cref{alt_comp_thm} there
  exists finite $S' \subset S$ such that $S' \cup
  \{\pnot t\} \sementails \false$. So $S' \sementails
  t$.
\end{remark*}

\begin{note*}
  The use of the word `compactness' is more than a
  fancified analogy (see \es{1}).
\end{note*}

\begin{corollary}[Decidability Theorem]
  Let $S \subset \propL$, $S$ finite and $t \in
  \propL$. Then there's an algorithm that can
  decide in finite time whether $S \synentails t$
  or not.
\end{corollary}

\begin{proof}
  Easy to decide if $S \sementails t$. Just write
  out a truth table.
\end{proof}
