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

    \item $(\pnot\pnot p \impl p)$ for any $p \in
      \propL$. This can also be written as
      $(((p \impl \false) \impl \false) \impl p)$,
      and this can also be rewritten as $\pnot p
      \por p$. This is called `law of excluded
      middle'.
      \begin{center}
        \begin{tabular}{c|c|c|c}
          $\propv(p)$
          & $\propv(p \impl \false)$
          & $\propv((p \impl \false) \impl
          \false)$
          & $\propv(((p \impl \false) \impl
          \false) \impl p)$ \\
          \hline
          $0$ & $1$ & $0$ & $1$ \\
          $1$ & $0$ & $1$ & $1$ \\
        \end{tabular}
      \end{center}
    \item $(p \impl (q \impl r)) \impl ((p \impl
      q) \impl (p \impl r))$ ($p, q, r \in
      \propL$). If not a \gls{taut}, then there
      exists a \gls{vtion} $\propv$ such that
      $\propv(p \impl (q \impl r)) = 1$,
      $\propv((p \impl q) \impl (p \impl r)) = 0$.
      So $\propv(p \impl q) = 1$, $\propv(p \impl
      r) = 0$. Hence $\propv(p) = 1$, $\propv(r) =
      0$ and $\propv(q) = 1$. Then $\propv(p \impl
      (q \impl r)) = 0$ \contradiction.
  \end{enumerate}
\end{example*}

\begin{flashcard}[semantic-entailment-defn]
\begin{definition*}[Semantic entailment]
  \glsverbdefn{psement}{semantically
  entails}{semantically entails}
  \glssymboldefn{pentails}{$\models$}{$\models$}
  \cloze{Let $S \subset L$, $t \in L$. Say \emph{$S$
  entails $t$} (or \emph{$S$ semantically entails
  $t$}), written $S \models t$, if for every
  \gls{vtion} $\propv$ on $\propL$, $\propv(s) =
  1 ~\forall s \in S$ implies $\propv(t) = 1$.}
\end{definition*}
\end{flashcard}

\begin{example*}
  \phantom{}
  \begin{enumerate}[(1)]
    \item $\{p, p \impl q\} \sementails q$.
    \item $\{p \impl q, q \impl r\} \sementails (p
      \impl r)$. If $\propv(p \impl r) = 0$ then
      $\propv(p) = 1$, $\propv(r) = 0$. Then
      either $\propv(q) = 0$ and $\propv(p \impl
      q) = 0$ or $\propv(q) = 1$ and $\propv(q
      \impl r) = 0$.
  \end{enumerate}
\end{example*}

\begin{note*}
  \glssymboldefn{ptaut}{$\models$}{$\models$}
  $t$ is a \gls{taut} if and only if $\emptyset
  \sementails t$. We write this as $\taut t$.
\end{note*}

\begin{flashcard}[model-defn]
\begin{definition*}[Model]
  \glsnoundefn{pmodel}{model}{models}
  \cloze{Given $t \in \propL$, say a \gls{vtion} \emph{is
  a model for $t$} (or $t$ \emph{is true in
  $\propv$}) if $\propv(t) = 1$. Given $S \subset
  L$, say a \gls{vtion} $\propv$ \emph{is a model
  of $S$} if $\propv(s) = 1$ for all $s \in S$.}
\end{definition*}
\end{flashcard}

\begin{remark*}
  So $S \sementails t$ says that $t$ is true in every
  model of $S$.
\end{remark*}

\vspace{-1em}
\glsnoundefn{MP}{MP}{MP}
We will have one rule of deduction called
\emph{modus ponens} (MP): from $p$ and $p \impl q$
we can deduce $q$.

\begin{flashcard}[axiom-defn]
\begin{definition*}[Axiom]
  \glsnoundefn{axiom}{axiom}{axioms}
  The axioms we will use for proofs in
  proprositional logic are the following:
  \begin{enumerate}[(A1)]
    \item \cloze{$(p \impl (q \impl p))$}
    \item \cloze{$(\pnot\pnot p \impl p)$}
    \item \cloze{$(p \impl (q \impl r)) \impl ((p \impl
      q) \impl (p \impl r))$}
  \end{enumerate}
\end{definition*}
\end{flashcard}

\begin{flashcard}[prop-proof-defn]
\begin{definition*}[Proof]
  \glsnoundefn{pproof}{proof}{proofs}
  \cloze{Given $S \subset \propL$, $t \in \propL$, a
  \emph{proof of $t$ from $S$} is a finite
  sequence $t_1, t_2, \ldots, t_n$ of \glspl{prop}
  such that $t_n = t$ and for every $i$ either
  $t_i$ is an axiom or $t_i$ is a member of $S$
  ($t_i$ is a premise or hypothesis) or $t_i$
  follows by \gls{MP} from earlier lines: $\exists j, k
  < i$ such that $t_k = (t_j \impl t_i)$.

  \glssymboldefn{psynentails}{$\vdash$}{$\vdash$}
  \glssymboldefn{ptheorem}{$\vdash$}{$\vdash$}
  \glsnoundefn{ptheorem}{theorem}{theorems}
  Say $S$ \emph{proves $t$} or $S$
  \emph{syntactically entails $t$} if there's a
  proof of $t$ from $S$. We denote this by $S
  \vdash t$. Say $t$ is a theorem if
  $\emptyset \synentails t$, which we denote
  $\ptheorem t$.}
\end{definition*}
\end{flashcard}

\begin{example*}
  \phantom{}
  \begin{enumerate}[(1)]
    \item $\{p \impl q, q \impl r\} \synentails (p
      \impl r)$.
      \begin{align*}
        &(p \impl (q \impl r)) \impl (p \impl q)
        \impl (p \impl r))
        &&\text{(A2)} \\
        &(q \impl r) \impl (p \impl (q \impl r))
        &&\text{(A1)} \\
        &(q \impl r)
        &&\text{(premise)} \\
        &p \impl (q \impl r)
        &&\text{(MP)} \\
        &(p \impl q) \impl (p \impl r)
        &&\text{(MP)} \\
        &p \impl q
        &&\text{(premise)} \\
        &p \impl r
        &&\text{(MP)}
      \end{align*}
    \item $\ptheorem (p \impl p)$.
      \begin{align*}
        &p \impl ((p \impl p) \impl p)
        &&\text{(A1)} \\
        &(p \impl ((p \impl p) \impl p)) \impl ((p
        \impl (p \impl p)) \impl (p \impl p))
        &&\text{(A2)} \\
        &(p \impl (p \impl p)) \impl (p \impl p)
        &&\text{(MP)} \\
        &p \impl (p \impl p)
        &&\text{(A1)} \\
        &p \impl p
        &&\text{(MP)}
      \end{align*}
  \end{enumerate}
\end{example*}

\begin{flashcard}[deduction-thm]
\begin{proposition}[Deduction Theorem]
  \label{ded_thm}
  Given $S \subset \propL$, $p, q \in \propL$, we
  have
  \[ S \synentails (p \impl q) \qquad \text{iff}
  \qquad S \cup \{p\} \synentails q .\]
\end{proposition}

\fcscrap{
\begin{note*}
  This shows `$\impl$' really does behave like
  implication in formal proofs.
\end{note*}

\begin{note*}
  To show $\{p \impl q, q \impl r\} \synentails (p
  \impl r)$, by \cref{ded_thm}, enough to show
  $\{p \impl q, q \impl r, p\} \synentails r$.
  This is easy: write down all premises and use
  (\gls{MP}) twice.
\end{note*}
}

\begin{proof}
  \cloze{If $S \synentails (p \impl q)$, then write down
  this \gls{pproof} and add two lines:
  \begin{align*}
    &p
    &&\text{(premise in $S \cup \{p\}$)} \\
    &q
    &&\text{(MP)}
  \end{align*}
  to get a \gls{pproof} of $q$ from $S \cup \{p\}$.

  Now assume $S \cup \{p\} \synentails q$. Let
  $t_1, t_2, \ldots, t_n = q$ be a \gls{pproof} of $q$
  from $S \cup \{p\}$. We show by induction that
  $S \synentails (p \impl t_i)$. Then done. If
  $t_i$ is an axiom or $t_i \in S$, then write
  \begin{align*}
    &t_i
    &&\text{(axiom or premise in $S$)} \\
    &t_i \impl (p \impl t_i)
    &&\text{(A1)} \\
    &p \impl t_i
    &&\text{(\gls{MP})}
  \end{align*}
  to get a \gls{pproof} of $p \impl t_i$ from $S$. If
  $t_i = p$ then $S \synentails (p \impl p)$ since
  $\ptheorem (p \impl p)$.

  Finally, assume there exists $j, k < i$ such
  that $t_k = (t_j \impl t_i)$. By induction we
  can write down \glspl{pproof} of $(p \impl t_j)$, $(p
  \impl (t_j \impl t_i))$ from $S$. Now just add
  \begin{align*}
    &(p \impl (t_j \impl t_i)) \impl ((p \impl
    t_j) \impl (p \impl t_i))
    &&\text{(A2)} \\
    &(p \impl t_j) \impl (p \impl t_i)
    &&\text{(\gls{MP})} \\
    &p \impl t_i
    &&\text{(\gls{MP})}
  \end{align*}
  }
\end{proof}
\end{flashcard}

\textbf{Aim:} $\sementails$ and $\synentails$ are
the same.

This has two parts: \emph{soundness} (if $S
\synentails t$, then $S \sementails t$)
and
\emph{adequacy} (if $S
\sementails t$, then $S \synentails t$)
