\documentclass{report}

\input{../../preamble}
\makecode{../..}

\begin{document}

\header{A Mathematical Introduction to Logic}{Herbert B. Enderton}

\tableofcontents

\begingroup
\renewcommand\thechapter{R}

\chapter{Reference}%
\hyperlabel{chap:reference}

\section{\defined{Construction Sequence}}%
\hyperlabel{ref:construction-sequence}

  A \textbf{construction sequence} is a \nameref{ref:finite-sequence}
    $\ltuple{\epsilon_1}{\epsilon_n}$ of \nameref{ref:expression}s such that for
    each $i \leq n$ we have at least one of
    \begin{align*}
      & \epsilon_i \text{ is a sentence symbol} \\
      & \epsilon_i = \mathcal{E}_\neg(\epsilon_j) \text{ for some } j < i \\
      & \epsilon_i = \mathcal{E}_\square(\epsilon_j, \epsilon_k)
        \text{ for some } j < i, k < i
    \end{align*}
    where $\square$ is one of the binary connectives $\land$, $\lor$,
      $\Rightarrow$, $\Leftrightarrow$.

\section{\defined{Expression}}%
\hyperlabel{ref:expression}

  An \textbf{expression} is a \nameref{ref:finite-sequence} of symbols.

\section{\defined{Finite Sequence}}%
\hyperlabel{ref:finite-sequence}

  $S$ is a \textbf{finite sequence} (or \textbf{string}) of members of set $A$
    if and only if, for some positive integer $n$, we have
    $S = \ltuple{x_1}{x_n}$, where each $x_i \in A$.

\section{\defined{\texorpdfstring{$n$}{n}-tuple}}%
\hyperlabel{ref:n-tuple}

An \textbf{$n$-tuple} is recursively defined as
  $$\ltuple{x_1}{x_{n+1}} = \tuple{\ltuple{x_1}{x_n}, x_{n+1}}$$
  for $n > 1$.
We also define $\tuple{x} = x$.

\section{\defined{Well-Formed Formula}}%
\hyperlabel{ref:well-formed-formula}

  A \textbf{well-formed formula} (wff) is an \nameref{ref:expression} that can
    be built up from the sentence symbols by applying some finite number of
    times the \textbf{formula-building operations} (on expressions) defined by
    the equations:
    \begin{align*}
      \mathcal{E}_{\neg}(\alpha)
        & = (\neg \alpha) \\
      \mathcal{E}_{\land}(\alpha, \beta)
        & = (\alpha \land \beta) \\
      \mathcal{E}_{\lor}(\alpha, \beta)
        & = (\alpha \lor \beta) \\
      \mathcal{E}_{\Rightarrow}(\alpha, \beta)
        & = (\alpha \Rightarrow \beta) \\
      \mathcal{E}_{\Leftrightarrow}(\alpha, \beta)
        & = (\alpha \Leftrightarrow \beta)
    \end{align*}

\endgroup

% Reset counter to mirror Enderton's book.
\setcounter{chapter}{0}
\addtocounter{chapter}{-1}
\chapter{Useful Facts About Sets}%
\hyperlabel{chap:useful-facts-about-sets}

\section{\unverified{Lemma 0A}}%
\hyperlabel{sec:lemma-0a}

  \begin{lemma}[0A]
    Assume that $\ltuple{x_1}{x_m} = \ltuple{y_1, \ldots, y_m}{y_{m+k}}$.
    Then $x_1 = \ltuple{y_1}{y_{k+1}}$.
  \end{lemma}

  \begin{proof}

    For natural number $m$, let $P(m)$ be the statement:
      \begin{induction}
        \hyperlabel{sec:lemma-0a-ih}
        If $\ltuple{x_1}{x_m} = \ltuple{y_1, \ldots, y_m}{y_{m+k}}$
          then $x_1 = \ltuple{y_1}{y_{k+1}}$.
      \end{induction}
    \noindent
    We proceed by induction on $m$.

    \paragraph{Base Case}%

      Suppose $\tuple{x_1} = \ltuple{y_1}{y_{1 + k}}$.
      By definition of an \nameref{ref:n-tuple}, $\tuple{x_1} = x_1$.
      Thus $x_1 = \ltuple{y_1}{y_{k + 1}}$.
      Hence $P(1)$ holds true.

    \paragraph{Inductive Step}%

      Suppose for $m \geq 1$ that $P(m)$ is true and assume
        \begin{equation}
          \hyperlabel{sec:lemma-0a-eq1}
          \ltuple{x_1}{x_{m+1}} = \ltuple{y_1, \ldots, y_{m+1}}{y_{m+1+k}}.
        \end{equation}
      By definition of an \nameref{ref:n-tuple}, we can decompose
        \eqref{sec:lemma-0a-eq1} into the following two identities
        \begin{align*}
          x_{m+1} & = y_{m+1+k} \\
          \ltuple{x_1}{x_m} & = \ltuple{y_1}{y_{m+k}}.
        \end{align*}
      By \ihref{sec:lemma-0a-ih}, $P(m)$ implies $x_1 = \ltuple{y_1}{y_{k+1}}$.
      Hence $P(m+1)$ holds true.

    \paragraph{Conclusion}%

      By induction, $P(m)$ holds true for all $m \geq 1$.

  \end{proof}

\chapter{Sentential Logic}%
\hyperlabel{chap:sentential-logic}

\section{The Language of Sentential Logic}%
\hyperlabel{sec:language-sentential-logic}

\subsection{\unverified{Induction Principle}}%
\hyperlabel{sub:induction-principle-1}

  \begin{theorem}
    If $S$ is a set of wffs containing all the sentence symbols and closed under
      all five formula-building operations, then $S$ is the set of \textit{all}
      wffs.
  \end{theorem}

  \begin{proof}
    We note every \nameref{ref:well-formed-formula} can be characterized by a
      \nameref{ref:construction-sequence}.
    For natural number $m$, let $P(m)$ be the statement:
      \begin{induction}
        \hyperlabel{sub:induction-principle-1-ih}
        Every wff characterized by a construction sequence of length $m$ is in
          $S$.
      \end{induction}
    \noindent
    We proceed by strong induction on $m$.

    \paragraph{Base Case}%

      Let $\phi$ denote a wff characterized by a construction sequence of length
        $1$.
      Then it must be that $\phi$ is a single sentence symbol.
      By hypothesis, $S$ contains all the sentence symbols.
      Thus $P(1)$ holds true.

    \paragraph{Inductive Step}%

      Suppose $P(0)$, $P(1)$, $\ldots$, $P(m)$ holds true and let $\phi$ denote
        a wff characterized by a construction sequence of length $m + 1$.
      By definition of a construction sequence, one of the following holds:
        \begin{align}
          & \phi \text{ is a sentence symbol}
            & \label{sub:induction-principle-1-eq1} \\
          & \phi = \mathcal{E}_\neg(\epsilon_j)
            \text{ for some } j < m + 1
            & \label{sub:induction-principle-1-eq2} \\
          & \phi = \mathcal{E}_\square(\epsilon_j, \epsilon_k)
            \text{ for some } j < m + 1, k < m + 1
            & \label{sub:induction-principle-1-eq3}
        \end{align}
        where $\square$ is one of the binary connectives $\land$, $\lor$,
          $\Rightarrow$, $\Leftrightarrow$.
      We consider each case in turn.

      \subparagraph{\eqref{sub:induction-principle-1-eq1}}%

        By hypothesis, all sentence symbols are in $S$.
        Thus $\phi \in S$.

      \subparagraph{\eqref{sub:induction-principle-1-eq2}}%

        Suppose $\phi = \mathcal{E}_\neg(\epsilon_j)$ for some $j < m + 1$.
        By \ihref{sub:induction-principle-1-ih}, $\epsilon_j$ is in $S$.
        By hypothesis, $S$ is closed under $\mathcal{E}_\neg$.
        Thus $\phi \in S$.

      \subparagraph{\eqref{sub:induction-principle-1-eq3}}%

        Suppose $\phi = \mathcal{E}_\square(\epsilon_j, \epsilon_k)$ for some
          $j < m + 1, k < m + 1$,
        By \ihref{sub:induction-principle-1-ih}, $\epsilon_j$ and $\epsilon_k$
          is in $S$.
        By hypothesis, $S$ is closed under $\mathcal{E}_\square$ for all
          possible candidates of $\square$.
        Thus $\phi \in S$.

      \subparagraph{Subconclusion}%

        Since the above three cases are exhaustive, $P(m + 1)$ holds.

    \paragraph{Conclusion}%

      By strong induction, $P(m)$ holds true for all natural numbers $m \geq 1$.
      Since every well-formed formula is characterized by a construction
        sequence, the set of all wffs is a subset of $S$.
      Likewise, it obviously holds that $S$ is a subset of all wffs.
      Thus $S$ is precisely the set of all wffs.

  \end{proof}

\section{Exercises 1}%
\hyperlabel{sec:exercises-1}

\subsection{\sorry{Exercise 1.1.1}}%
\hyperlabel{sub:exercise-1.1.1}

  Give three sentences in English together with translations into our formal
    language.
  The sentences shoudl be chosen so as to have an interesting structure, and the
    translations should each contain 15 or more symbols.

  \begin{answer}
    TODO
  \end{answer}

\subsection{\sorry{Exercise 1.1.2}}%
\hyperlabel{sub:exercise-1.1.2}

  Show that there are no wffs of length 2, 3, or 6, but that any other positive
    length is possible.

  \begin{proof}
    TODO
  \end{proof}

\subsection{\sorry{Exercise 1.1.3}}%
\hyperlabel{sub:exercise-1.1.3}

  Let $\alpha$ be a wff; let $c$ be the number of places at which binary
    connective symbols $(\land, \lor, \Rightarrow, \Leftrightarrow)$ occur in
    $\alpha$; let $s$ be the number of places at which sentence symbols occur in
    $\alpha$.
  (For example, if $\alpha$ is $(A \Rightarrow (\neg A))$ then $c = 1$ and
    $s = 2$.)
  Show by using the induction principle that $s = c + 1$.

  \begin{proof}
    TODO
  \end{proof}

\subsection{\sorry{Exercise 1.1.4}}%
\hyperlabel{sub:exercise-1.1.4}

  Assume we have a construction sequence ending in $\phi$, where $\phi$ does not
    contain the symbol $A_4$.
  Suppose we delete all the expressions in the construction sequence that
    contain $A_4$.
  Show that the result is still a legal construction sequence.

  \begin{proof}
    TODO
  \end{proof}

\subsection{\sorry{Exercise 1.1.5}}%
\hyperlabel{sub:exercise-1.1.5}

  Suppose that $\alpha$ is a wff not containing the negation symbol $\neg$.
  \begin{enumerate}[(a)]
    \item Show that the length of $\alpha$ (i.e., the number of symbols in the
      string) is odd.
    \item Show that more than a quarter of the symbols are sentence symbols.
  \end{enumerate}
  \textit{Suggestion}: Apply induction to show that the length is of the form
    $4k + 1$ and the number of sentence symbols is $k + 1$.

  \begin{proof}
    TODO
  \end{proof}

\subsection{\sorry{Exercise 1.1.6}}%
\hyperlabel{sub:exercise-1.1.6}

  Suppose that $\alpha$ is a wff not containing the negation symbol $\neg$.
  \begin{enumerate}[(a)]
    \item Show that the length of $\alpha$ (i.e., the number of symbols in the
      string) is odd.
    \item Show that more than a quarter of the symbols are sentence symbols.
  \end{enumerate}

  \begin{proof}
    TODO
  \end{proof}

\end{document}
