Source and provenance

All 10 authority files and all 1,380 lines are shown exactly and copied byte-for-byte. Reader corrections and all twenty-one bounded reader normalizations are disclosures only; the accepted projected text and authority source below are not altered. Open the exact accepted projected chapter transcript (SHA-256 b91e037b6b987f24a9ad518796ca475b936c645d3773c88af483d0d933524eac).

content/first-order-logic/syntax-and-semantics/syntax.tex

30 lines; SHA-256 75c0e56b3d2f9557e39b9006855f371e6c8f04e8ef9817affd70a793613930ab. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax
  3. \documentclass[../../../include/open-logic-chapter]{subfiles}
  4. \begin{document}
  5. \olchapter{fol}{syn}{Syntax of First-Order Logic}
  6. \olimport{intro-syntax}
  7. \olimport{first-order-languages}
  8. \olimport{terms-formulas}
  9. \olimport{unique-readability}
  10. \olimport{main-operator}
  11. \olimport{subformulas}
  12. \olimport{formation-sequences}
  13. \olimport{free-vars-sentences}
  14. \olimport{substitution}
  15. \OLEndChapterHook
  16. \end{document}

content/first-order-logic/syntax-and-semantics/intro-syntax.tex

33 lines; SHA-256 ba7dcce5f1e3340374ff693a1c22c5bf4ccb0c2709cd8c6d50474d4982f7cdfc. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax
  3. % Section: intro-syntax
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{fol}{syn}{itx}
  7. \olsection{Introduction}
  8. In order to develop the theory and metatheory of first-order logic, we
  9. must first define the syntax and semantics of its expressions. The
  10. expressions of first-order logic are terms and !!{formula}s. Terms
  11. are formed from !!{variable}s, !!{constant}s, and !!{function}s.
  12. !!^{formula}s, in turn, are formed from !!{predicate}s together with
  13. terms (these form the smallest, ``atomic'' !!{formula}s), and then
  14. from atomic !!{formula}s we can form more complex ones using logical
  15. connectives and quantifiers. There are many different ways to set
  16. down the formation rules; we give just one possible one. Other systems
  17. will chose different symbols, will select different sets of
  18. connectives as primitive, will use parentheses differently (or even not
  19. at all, as in the case of so-called Polish notation). What all
  20. approaches have in common, though, is that the formation rules define
  21. the set of terms and !!{formula}s \emph{inductively}. If done
  22. properly, every expression can result essentially in only one way
  23. according to the formation rules. The inductive definition resulting
  24. in expressions that are \emph{uniquely readable} means we can give
  25. meanings to these expressions using the same method---inductive
  26. definition.
  27. \end{document}

content/first-order-logic/syntax-and-semantics/first-order-languages.tex

159 lines; SHA-256 582ea4b3b243fe2ee4eb627630172f77f014d4f7d7c93cd13fdb2bb70844c447. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax-and-semantics
  3. % Section: first-order-languages
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{fol}{syn}{fol}
  7. \olsection{First-Order Languages}
  8. Expressions of first-order logic are built up from a basic vocabulary
  9. containing \emph{!!{variable}s}, \emph{!!{constant}s},
  10. \emph{!!{predicate}s} and sometimes \emph{!!{function}s}. From them,
  11. together with logical connectives, quantifiers, and punctuation
  12. symbols such as parentheses and commas, \emph{terms} and
  13. \emph{!!{formula}s} are formed.
  14. \begin{explain}
  15. Informally, !!{predicate}s are names for properties and relations,
  16. !!{constant}s are names for individual objects, and !!{function}s are
  17. names for mappings. These, except for the !!{identity}~$\eq$, are the
  18. \emph{non-logical symbols} and together make up a language. Any
  19. first-order language~$\Lang L$ is determined by its non-logical
  20. symbols. In the most general case, $\Lang L$ contains infinitely many
  21. symbols of each kind.
  22. \end{explain}
  23. In the general case, we make use of the following symbols in
  24. first-order logic:
  25. \begin{enumerate}
  26. \item Logical symbols
  27. \begin{enumerate}
  28. \item Logical connectives:
  29. \startycommalist
  30. \iftag{prvNot}{\ycomma $\lnot$ (negation)}{}%
  31. \iftag{prvAnd}{\ycomma $\land$ (conjunction)}{}%
  32. \iftag{prvOr}{\ycomma $\lor$ (disjunction)}{}%
  33. \iftag{prvIf}{\ycomma $\lif$ (!!{conditional})}{}%
  34. \iftag{prvIff}{\ycomma $\liff$ (!!{biconditional})}{}%
  35. \iftag{prvAll}{\ycomma $\lforall$ (universal quantifier)}{}%
  36. \iftag{prvEx}{\ycomma $\lexists$ (existential quantifier)}{}.
  37. \tagitem{prvFalse}{The propositional constant for !!{falsity}~$\lfalse$.}{}
  38. \tagitem{prvTrue}{The propositional constant for !!{truth}~$\ltrue$.}{}
  39. \item The two-place !!{identity}~$\eq$.
  40. \item A !!{denumerable}s set of !!{variable}s: $\Obj v_0$, $\Obj v_1$, $\Obj
  41. v_2$, \dots
  42. \end{enumerate}
  43. \item Non-logical symbols, making up the \emph{standard
  44. language} of first-order logic
  45. \begin{enumerate}
  46. \item A !!{denumerable}s set of $n$-place !!{predicate}s for each $n>0$: $\Obj
  47. A^n_0$, $\Obj A^n_1$, $\Obj A^n_2$, \dots
  48. \item A !!{denumerable}s set of !!{constant}s: $\Obj c_0$, $\Obj c_1$, $\Obj
  49. c_2$, \dots.
  50. \item A !!{denumerable}s set of $n$-place !!{function}s for each $n>0$:
  51. $\Obj f^n_0$, $\Obj f^n_1$, $\Obj f^n_2$, \dots
  52. \end{enumerate}
  53. \item Punctuation marks: (, ), and the comma.
  54. \end{enumerate}
  55. Most of our definitions and results will be formulated for the full
  56. standard language of first-order logic. However, depending on the
  57. application, we may also restrict the language to only a few
  58. !!{predicate}s, !!{constant}s, and !!{function}s.
  59. \begin{ex}
  60. The language~$\Lang L_A$ of arithmetic contains a single two-place
  61. !!{predicate}~$<$, a single !!{constant}~$\Obj 0$, one one-place
  62. !!{function}~$\prime$, and two two-place !!{function}s~$+$ and~$\times$.
  63. \end{ex}
  64. \begin{ex}
  65. The language of set theory~$\Lang L_Z$ contains only the single
  66. two-place !!{predicate}~$\in$.
  67. \end{ex}
  68. \begin{ex}
  69. The language of orders~$\Lang L_\le$ contains only the two-place
  70. !!{predicate}~$\le$.
  71. \end{ex}
  72. Again, these are conventions: officially, these are just aliases,
  73. e.g., $<$, $\in$, and $\le$ are aliases for $\Obj A^2_0$, $\Obj 0$ for
  74. $\Obj c_0$, $\prime$ for $\Obj f^1_0$, $+$ for $\Obj f^2_0$, $\times$ for
  75. $\Obj f^2_1$.
  76. \iftag{defNot,defOr,defAnd,defIf,defIff,defTrue,defFalse,defEx,defAll}{%
  77. In addition to the primitive connectives and
  78. \iftag{notprvEx,notprvAll}{quantifier}{quantifiers} introduced
  79. above, we also use the following \emph{defined} symbols:
  80. \startycommalist
  81. \iftag{defNot}{\ycomma $\lnot$ (negation)}{}%
  82. \iftag{defAnd}{\ycomma $\land$ (conjunction)}{}%
  83. \iftag{defOr}{\ycomma $\lor$ (disjunction)}{}%
  84. \iftag{defIf}{\ycomma $\lif$ (!!{conditional})}{}%
  85. \iftag{defIff}{\ycomma $\liff$ (!!{biconditional})}{}%
  86. \iftag{defAll}{\ycomma $\lforall$ (universal quantifier)}{}%
  87. \iftag{defEx}{\ycomma $\lexists$ (existential quantifier)}{}%
  88. \iftag{defFalse}{\ycomma !!{falsity}~$\lfalse$}{}%
  89. \iftag{defTrue}{\ycomma !!{truth}~$\ltrue$}}{}.
  90. \begin{tagblock}{defNot,defOr,defAnd,defIf,defIff,defTrue,defFalse,defEx,defAll}
  91. \begin{explain}
  92. A defined symbol is not officially part of the language, but is
  93. introduced as an informal abbreviation: it allows us to abbreviate
  94. formulas which would, if we only used primitive symbols, get quite
  95. long. This is obviously an advantage. The bigger advantage, however,
  96. is that proofs become shorter. If a symbol is primitive, it has to be
  97. treated separately in proofs. The more primitive symbols, therefore,
  98. the longer our proofs.
  99. \end{explain}
  100. \end{tagblock}
  101. % Alternate symbols
  102. \begin{intro}
  103. You may be familiar with different terminology and symbols than the
  104. ones we use above. Logic texts (and teachers) commonly use
  105. $\sim$, $\neg$, or~!\ for ``negation'', $\wedge$, $\cdot$, or $\&$
  106. for ``conjunction''. Commonly used symbols for the ``conditional'' or
  107. ``implication'' are $\rightarrow$, $\Rightarrow$, and $\supset$.
  108. \iftag{prvIff,defIff}{Symbols for ``biconditional,'' ``bi-implication,''
  109. or ``(material) equivalence'' are $\leftrightarrow$,
  110. $\Leftrightarrow$, and $\equiv$.}{}
  111. \iftag{prvFalse,defFalse}{The $\lfalse$ symbol is variously called
  112. ``falsity,'' ``falsum,'', ``absurdity,'' or ``bottom.''}{}
  113. \iftag{prvTrue,defTrue}{The $\ltrue$ symbol is variously called
  114. ``truth,'' ``verum,'' or ``top.''}{}
  115. It is conventional to use lower case letters (e.g., $a$, $b$, $c$) from
  116. the beginning of the Latin alphabet for !!{constant}s (sometimes called
  117. names), and lower case letters from the end (e.g., $x$, $y$, $z$) for
  118. !!{variable}s. Quantifiers combine with !!{variable}s, e.g., $x$;
  119. notational variations include $\forall x$, $(\forall x)$, $(x)$, $\Pi x$,
  120. $\bigwedge_x$ for the universal quantifier and $\exists x$, $(\exists
  121. x)$, $(Ex)$, $\Sigma x$, $\bigvee_x$ for the existential quantifier.
  122. \end{intro}
  123. \begin{explain}
  124. We might treat all the propositional operators and both quantifiers as
  125. primitive symbols of the language. We might instead choose a smaller
  126. stock of primitive symbols and treat the other !!{operator}s as
  127. defined. ``Truth functionally complete'' sets of Boolean operators
  128. include $\{ \lnot, \lor \}$, $\{ \lnot, \land \}$, and $\{ \lnot,
  129. \lif\}$---these can be combined with either quantifier for an
  130. expressively complete first-order language.
  131. You may be familiar with two other !!{operator}s: the Sheffer
  132. stroke~$|$ (named after Henry Sheffer), and Peirce's
  133. arrow~$\downarrow$, also known as Quine's dagger. When given their
  134. usual readings of ``nand'' and ``nor'' (respectively), these operators
  135. are truth functionally complete by themselves.
  136. \end{explain}
  137. \end{document}

content/first-order-logic/syntax-and-semantics/terms-formulas.tex

237 lines; SHA-256 0b607ce2324ca66b23b164684f4f35b127107b903bbbd567eb25e94c2ce70210. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax-and-semantics
  3. % Section: terms-formulas
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{fol}{syn}{frm}
  7. \olsection{Terms and \printtoken{P}{formula}}
  8. Once a first-order language~$\Lang L$ is given, we can define
  9. expressions built up from the basic vocabulary of~$\Lang L$. These
  10. include in particular \emph{terms} and \emph{!!{formula}s}.
  11. \begin{defn}[Terms]
  12. \ollabel{defn:terms}
  13. The set of \emph{terms}~$\Trm[L]$ of~$\Lang L$ is
  14. defined inductively by:
  15. \begin{enumerate}
  16. \item Every !!{variable} is a term.
  17. \item Every !!{constant} of~$\Lang L$ is a term.
  18. \item If $f$ is an $n$-place !!{function} and $t_1$, \dots, $t_n$
  19. are terms, then $\Atom{f}{t_1, \ldots, t_n}$ is a term.
  20. \tagitem{limitClause}{
  21. Nothing else is a term.}{}
  22. \end{enumerate}
  23. A term containing no !!{variable}s is a \emph{closed term}.
  24. \end{defn}
  25. \begin{explain}
  26. The !!{constant}s appear in our specification of the language and the
  27. terms as a separate category of symbols, but they could instead have
  28. been included as zero-place !!{function}s. We could then do without
  29. the second clause in the definition of terms. We just have to
  30. understand $\Atom{f}{t_1, \ldots, t_n}$ as just $f$ by itself if $n =
  31. 0$.
  32. \end{explain}
  33. \begin{defn}[Formulas]
  34. \ollabel{defn:formulas}
  35. The set of \emph{!!{formula}s}~$\Frm[L]$ of the language~$\Lang L$
  36. is defined inductively as follows:
  37. \begin{enumerate}
  38. \tagitem{prvFalse}{$\lfalse$ is an atomic !!{formula}.}{}
  39. \tagitem{prvTrue}{$\ltrue$ is an atomic !!{formula}.}{}
  40. \item If $R$ is an $n$-place !!{predicate} of~$\Lang L$ and $t_1$, \dots,
  41. $t_n$ are terms of~$\Lang L$, then $\Atom{R}{t_1,\ldots, t_n}$ is an
  42. atomic !!{formula}.
  43. \item If $t_1$ and $t_2$ are terms of~$\Lang L$, then $\Atom{\eq}{t_1, t_2}$
  44. is an atomic !!{formula}.
  45. \tagitem{prvNot}{If $!A$ is !!a{formula}, then $\lnot !A$ is
  46. !!a{formula}.}{}
  47. \tagitem{prvAnd}{If $!A$ and $!B$ are !!{formula}s, then $(!A \land
  48. !B)$ is !!a{formula}.}{}
  49. \tagitem{prvOr}{If $!A$ and $!B$ are !!{formula}s, then $(!A \lor !B)$
  50. is !!a{formula}.}{}
  51. \tagitem{prvIf}{If $!A$ and $!B$ are !!{formula}s, then $(!A \lif !B)$
  52. is !!a{formula}.}{}
  53. \tagitem{prvIff}{If $!A$ and $!B$ are !!{formula}s, then $(!A \liff !B)$
  54. is !!a{formula}.}{}
  55. \tagitem{prvAll}{If $!A$ is !!a{formula} and $x$ is !!a{variable},
  56. then $\lforall[x][!A]$ is !!a{formula}.}{}
  57. \tagitem{prvEx}{If $!A$ is !!a{formula} and $x$ is !!a{variable},
  58. then $\lexists[x][!A]$ is !!a{formula}.}{}
  59. \tagitem{limitClause}{Nothing else is !!a{formula}.}{}
  60. \end{enumerate}
  61. \end{defn}
  62. \begin{explain}
  63. The definitions of the set of terms and that of !!{formula}s are
  64. \emph{inductive definitions}. Essentially, we construct the set of
  65. !!{formula}s in infinitely many stages. In the initial stage, we
  66. pronounce all atomic formulas to be formulas; this corresponds to the
  67. first few cases of the definition, i.e., the cases for
  68. \iftag{prvTrue}{$\ltrue$, }{}%
  69. \iftag{prvFalse}{$\lfalse$, }{}%
  70. $\Atom{R}{t_1,\dots,t_n}$ and $\Atom{\eq}{t_1,t_2}$. ``Atomic
  71. !!{formula}'' thus means any !!{formula} of this form.
  72. The other cases of the definition give rules for constructing new
  73. !!{formula}s out of !!{formula}s already constructed. At the second
  74. stage, we can use them to construct !!{formula}s out of atomic
  75. !!{formula}s. At the third stage, we construct new formulas from the
  76. atomic formulas and those obtained in the second stage, and so on. A
  77. !!{formula} is anything that is eventually constructed at such a
  78. stage, and nothing else.
  79. \end{explain}
  80. By convention, we write $\eq$ between its arguments and leave out the
  81. parentheses: $\eq[t_1][t_2]$ is an abbreviation for
  82. $\Atom{\eq}{t_1,t_2}$. Moreover, $\lnot \Atom{\eq}{t_1,t_2}$ is
  83. abbreviated as $\eq/[t_1][t_2]$. When writing a formula $(!B \ast !C)$
  84. constructed from $!B$, $!C$ using a two-place connective~$\ast$, we
  85. will often leave out the outermost pair of parentheses and write
  86. simply~$!B \ast !C$.
  87. \begin{intro}
  88. Some logic texts require that the !!{variable}~$x$ must occur in~$!A$
  89. in order for
  90. \iftag{prvEx}{$\lexists[x][!A]$ }{}%
  91. \iftag{notprvEx,notprvAll}{}{and }%
  92. \iftag{prvAll}{$\lforall[x][!A]$ }{}%
  93. to count as
  94. \iftag{notprvEx,notprvAll}{!!a{formula}}{!!{formula}s}.
  95. Nothing bad happens if you don't require this, and it makes things
  96. easier.
  97. \end{intro}
  98. \begin{tagblock}{defNot,defOr,defAnd,defIf,defIff,defTrue,defFalse,defEx,defAll}
  99. \begin{defn}
  100. Formulas constructed using the defined operators are to be understood
  101. as follows:
  102. \begin{tagenumerate}{defTrue,defFalse,defNot,defOr,defAnd,defIf,defIff,defEx,defAll}
  103. \tagitem{defTrue}{$\ltrue$ abbreviates
  104. \iftag{prvFalse}{$\lnot\lfalse$}{$(!A \lor \lnot !A)$ for some
  105. fixed atomic !!{formula}~$!A$}.}{}
  106. \tagitem{defFalse}{$\lfalse$ abbreviates
  107. \iftag{prvTrue}{$\lnot\ltrue$}{$(!A \land \lnot !A)$ for some
  108. fixed atomic !!{formula}~$!A$}.}{}
  109. \tagitem{defNot}{$\lnot !A$ abbreviates $!A \lif \lfalse$.}{}
  110. \tagitem{defOr}{$!A \lor !B$ abbreviates
  111. \iftag{prvAnd}{$\lnot(\lnot !A \land \lnot !B)$}{$\lnot !A \lif
  112. !B$}.}{}
  113. \tagitem{defAnd}{$!A \land !B$ abbreviates
  114. \iftag{prvOr}{$\lnot(\lnot !A \lor \lnot !B)$}{$\lnot (!A \lif
  115. \lnot !B)$}.}{}
  116. \tagitem{defIf}{$!A \lif !B$ abbreviates
  117. \iftag{prvOr}{$\lnot !A \lor !B)$}{$\lnot (!A \land \lnot !B)$}.}{}
  118. \tagitem{defIff}{$!A \liff !B$ abbreviates $(!A \lif !B) \land (!B
  119. \lif !A)$.}{}
  120. \tagitem{defAll}{$\lforall[x][!A]$ abbreviates $\lnot\lexists[x][\lnot !A]$.}{}
  121. \tagitem{defEx}{$\lexists[x][!A]$ abbreviates $\lnot\lforall[x][\lnot !A]$.}{}
  122. \end{tagenumerate}
  123. \end{defn}
  124. \end{tagblock}
  125. If we work in a language for a specific application, we will often
  126. write two-place !!{predicate}s and !!{function}s between the
  127. respective terms, e.g., $t_1 < t_2$ and $(t_1 + t_2)$ in the language
  128. of arithmetic and $t_1 \in t_2$ in the language of set theory. The
  129. successor function in the language of arithmetic is even written
  130. conventionally \emph{after} its argument:~$t'$. Officially, however,
  131. these are just conventional abbreviations for $\Atom{\Obj A^2_0}{t_1, t_2}$,
  132. $\Obj f^2_0(t_1, t_2)$, $\Atom{\Obj A^2_0}{t_1, t_2}$ and $f^1_0(t)$,
  133. respectively.
  134. \begin{defn}[Syntactic identity]
  135. The symbol $\ident$ expresses syntactic identity between strings of
  136. symbols, i.e., $!A \ident !B$ iff $!A$ and $!B$ are strings of symbols
  137. of the same length and which contain the same symbol in each place.
  138. \end{defn}
  139. The $\ident$ symbol may be flanked by strings obtained by
  140. concatenation, e.g., $!A \ident (!B \lor !C)$ means: the string of
  141. symbols~$!A$ is the same string as the one obtained by concatenating
  142. an opening parenthesis, the string $!B$, the $\lor$ symbol, the
  143. string~$!C$, and a closing parenthesis, in this order. If this is the
  144. case, then we know that the first symbol of~$!A$ is an opening
  145. parenthesis, $!A$ contains $!B$ as a substring (starting at the second
  146. symbol), that substring is followed by~$\lor$, etc.
  147. As terms and !!{formula}s are built up from basic elements via inductive
  148. definitions, we can use the following induction principles to prove
  149. things about them.
  150. \begin{lem}[\emph{Principle of induction on terms}]
  151. \ollabel{lem:trmind}
  152. Let $\Lang L$ be a first-order language.
  153. If some property~$P$ is such that
  154. %
  155. \begin{enumerate}
  156. \item it holds for every !!{variable}~$v$,
  157. %
  158. \item it holds for every !!{constant}~$a$ of~$\Lang L$, and
  159. %
  160. \item it holds for $f(t_1,\dotsc,t_n)$ whenever it holds for
  161. $t_1$,~\dots, $t_n$ and $f$~is an $n$-place
  162. !!{function} of~$\Lang L$
  163. \end{enumerate}
  164. (assuming $t_1$,~\dots, $t_n$ are terms of~$\Lang{L}$),
  165. then $P$ holds for every term in~$\Trm[L]$.
  166. \end{lem}
  167. \begin{prob}
  168. Prove \olref[fol][syn][frm]{lem:trmind}.
  169. \end{prob}
  170. \begin{lem}[\emph{Principle of induction on !!{formula}s}]
  171. \ollabel{thm:frmind}
  172. Let $\Lang L$ be a first-order language.
  173. If some property~$P$ holds for all the atomic !!{formula}s
  174. and is such that
  175. %
  176. \begin{enumerate}
  177. \tagitem{prvNot}{it holds for $\lnot !A$ whenever it
  178. holds for~$!A$;}{}
  179. \tagitem{prvAnd}{it holds for $(!A \land !B)$
  180. whenever it holds for $!A$ and~$!B$;}{}
  181. \tagitem{prvOr}{it holds for $(!A \lor !B)$
  182. whenever it holds for $!A$ and~$!B$;}{}
  183. \tagitem{prvIf}{it holds for $(!A \lif !B)$
  184. whenever it holds for $!A$ and~$!B$;}{}
  185. \tagitem{prvIff}{it holds for $(!A \liff !B)$
  186. whenever it holds for $!A$ and~$!B$;}{}
  187. \tagitem{prvEx}{it holds for $\lexists[x][!A]$
  188. whenever it holds for~$!A$;}{}
  189. \tagitem{prvAll}{it holds for $\lforall[x][!A]$
  190. whenever it holds for~$!A$;}{}
  191. \end{enumerate}
  192. (assuming $!A$ and $!B$ are !!{formula}s of~$\Lang{L}$),
  193. then $P$ holds for all formulas in~$\Frm[L]$.
  194. \end{lem}
  195. \end{document}

content/first-order-logic/syntax-and-semantics/unique-readability.tex

203 lines; SHA-256 f2ad2961312808ef6c8dedc884c9f8e00a2be9ef993cfb7be748a9d253d84e66. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax-and-semantics
  3. % Section: unique-readability
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{fol}{syn}{unq}
  7. \olsection{Unique Readability}
  8. \begin{explain}
  9. The way we defined !!{formula}s guarantees that every !!{formula} has
  10. a \emph{unique reading}, i.e., there is essentially only one way of
  11. constructing it according to our formation rules for !!{formula}s and
  12. only one way of ``interpreting'' it. If this were not so, we would
  13. have ambiguous !!{formula}s, i.e., !!{formula}s that have more than
  14. one reading or intepretation---and that is clearly something we want
  15. to avoid. But more importantly, without this property, most of the
  16. definitions and proofs we are going to give will not go through.
  17. Perhaps the best way to make this clear is to see what would happen if
  18. we had given bad rules for forming !!{formula}s that would not
  19. guarantee unique readability. For instance, we could have forgotten
  20. the parentheses in the formation rules for connectives, e.g., we might
  21. have allowed this:
  22. \begin{quote}
  23. If $!A$ and $!B$ are !!{formula}s, then so is $!A \lif !B$.
  24. \end{quote}
  25. Starting from an atomic formula $!D$, this would allow us to form $!D
  26. \lif !D$. From this, together with $!D$, we would get $!D \lif !D
  27. \lif !D$. But there are two ways to do this:
  28. \begin{enumerate}
  29. \item We take $!D$ to be $!A$ and $!D \lif !D$ to be $!B$.
  30. \item We take $!A$ to be $!D \lif !D$ and $!B$ is~$!D$.
  31. \end{enumerate}
  32. Correspondingly, there are two ways to
  33. ``read'' the !!{formula}~$!D \lif !D \lif !D$. It is of the form $!B
  34. \lif !C$ where $!B$ is $!D$ and $!C$ is $!D \lif !D$, but \emph{it is
  35. also} of the form $!B \lif !C$ with $!B$ being $!D \lif !D$ and $!C$
  36. being~$!D$.
  37. If this happens, our definitions will not always work. For instance,
  38. when we define the !!{main operator} of a formula, we say: in a
  39. formula of the form $!B \lif !C$, the !!{main operator} is the
  40. indicated occurrence of~$\lif$. But if we can match the formula $!D
  41. \lif !D \lif !D$ with $!B \lif !C$ in the two different ways mentioned
  42. above, then in one case we get the first occurrence of $\lif$ as the
  43. !!{main operator}, and in the second case the second occurrence. But
  44. we intend the !!{main operator} to be a \emph{function} of the
  45. !!{formula}, i.e., every !!{formula} must have exactly one !!{main
  46. operator} occurrence.
  47. \end{explain}
  48. \begin{lem}
  49. The number of left and right parentheses in !!a{formula}~$!A$ are
  50. equal.
  51. \end{lem}
  52. \begin{proof}
  53. We prove this by induction on the way $!A$ is constructed. This
  54. requires two things: (a) We have to prove first that all atomic
  55. formulas have the property in question (the induction basis). (b) Then
  56. we have to prove that when we construct new formulas out of given
  57. formulas, the new formulas have the property provided the old ones do.
  58. Let $l(!A)$ be the number of left parentheses, and $r(!A)$ the number
  59. of right parentheses in~$!A$, and $l(t)$ and $r(t)$ similarly the
  60. number of left and right parentheses in a term~$t$.
  61. \begin{prob}
  62. Prove that for any term~$t$, $l(t) = r(t)$.
  63. \end{prob}
  64. \begin{enumerate}
  65. \tagitem{prvFalse}{\indcase{!A}{\lfalse}{$\indfrm$ has $0$ left and $0$
  66. right parentheses.}}{}
  67. \tagitem{prvTrue}{\indcase{!A}{\ltrue}{$\indfrm$ has $0$ left and $0$
  68. right parentheses.}}{}
  69. \item \indcase{!A}{\Atom{R}{t_1,\dots,t_n}}{$l(\indfrm) = 1 + l(t_1) +
  70. \dots + l(t_n) = 1 + r(t_1) + \dots + r(t_n) = r(\indfrm)$. Here we
  71. make use of the fact, left as an exercise, that $l(t) = r(t)$ for
  72. any term~$t$.}
  73. \item \indcase{!A}{\eq[t_1][t_2]}{$l(\indfrm) = l(t_1) + l(t_2) =
  74. r(t_1) + r(t_2) = r(\indfrm)$.}
  75. \tagitem{prvNot}{\indcase{!A}{\lnot !B}{By induction hypothesis,
  76. $l(!B) = r(!B)$. Thus $l(\indfrm) = l(!B) = r(!B) =
  77. r(\indfrm)$.}}{}
  78. \item \indcase{!A}{(!B \ast !C)}{By induction hypothesis, $l(!B) =
  79. r(!B)$ and $l(!C) = r(!C)$. Thus $l(\indfrm) = 1 + l(!B) + l(!C) =
  80. 1 + r(!B) + r(!C) = r(\indfrm)$.}
  81. \tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{By induction
  82. hypothesis, $l(!B) = r(!B)$. Thus, $l(\indfrm) = l(!B) = r(!B) =
  83. r(\indfrm)$.}}{}
  84. % Print case for \lexists if prvEx and not prvAll
  85. \tagitem{prvAll,notprvEx}{}{\indcase{!A}{\lexists[x][!B]}{By induction
  86. hypothesis, $l(!B) = r(!B)$. Thus, $l(\indfrm) = l(!B) = r(!B) =
  87. r(\indfrm)$.}}
  88. % Just say similarly if prvEx and prvAll
  89. \tagitem{notprvAll,notprvEx}{}{\indcase{!A}{\lexists[x][!B]}{Similarly.}}
  90. \end{enumerate}
  91. \end{proof}
  92. \begin{defn}[Proper prefix]
  93. A string of symbols $!B$ is a \emph{proper prefix} of a string of symbols~$!A$ if
  94. concatenating $!B$ and a non-empty string of symbols yields~$!A$.
  95. \end{defn}
  96. \begin{lem}\ollabel{lem:no-prefix}
  97. If $!A$ is !!a{formula}, and $!B$ is a proper prefix of $!A$, then
  98. $!B$ is not !!a{formula}.
  99. \end{lem}
  100. \begin{proof}
  101. Exercise.
  102. \end{proof}
  103. \begin{prob}
  104. Prove \olref[fol][syn][unq]{lem:no-prefix}.
  105. \end{prob}
  106. \begin{prop}
  107. \ollabel{prop:unique-atomic}
  108. If $!A$ is an atomic !!{formula}, then it satisfies one, and only one
  109. of the following conditions.
  110. \begin{enumerate}
  111. \tagitem{prvFalse}{$!A \ident \lfalse$.}{}
  112. \tagitem{prvTrue}{$!A \ident \ltrue$.}{}
  113. \item $!A \ident \Atom{R}{t_1,\dots,t_n}$ where $R$ is an $n$-place
  114. !!{predicate}, $t_1$, \dots, $t_n$ are terms, and each of $R$,
  115. $t_1$, \dots, $t_n$ is uniquely determined.
  116. \item $!A \ident \eq[t_1][t_2]$ where $t_1$ and $t_2$ are uniquely
  117. determined terms.
  118. \end{enumerate}
  119. \end{prop}
  120. \begin{proof}
  121. Exercise.
  122. \end{proof}
  123. \begin{prob}
  124. Prove \olref[fol][syn][unq]{prop:unique-atomic} (Hint: Formulate and
  125. prove a version of \olref[fol][syn][unq]{lem:no-prefix} for terms.)
  126. \end{prob}
  127. \begin{prop}[Unique Readability]
  128. Every !!{formula} satisfies one, and only one of the following conditions.
  129. \begin{enumerate}
  130. \item $!A$ is atomic.
  131. \tagitem{prvNot}{$!A$ is of the form $\lnot !B$.}{}
  132. \tagitem{prvAnd}{$!A$ is of the form $(!B \land !C)$.}{}
  133. \tagitem{prvOr}{$!A$ is of the form $(!B \lor !C)$.}{}
  134. \tagitem{prvIf}{$!A$ is of the form $(!B \lif !C)$.}{}
  135. \tagitem{prvIff}{$!A$ is of the form $(!B \liff !C)$.}{}
  136. \tagitem{prvAll}{$!A$ is of the form $\lforall[x][!B]$.}{}
  137. \tagitem{prvEx}{$!A$ is of the form $\lexists[x][!B]$.}{}
  138. \end{enumerate}
  139. Moreover, in each case $!B$, or $!B$ and $!C$, are uniquely
  140. determined. This means that, e.g., there are no different pairs $!B$,
  141. $!C$ and $!B'$, $!C'$ so that $!A$ is both of the form
  142. \iftag{prvIf}{$(!B \lif !C)$ and $(!B' \lif !C')$.}{
  143. \iftag{prvOr}{$(!B \lor !C)$ and $(!B' \lor !C')$.}{
  144. \iftag{prvAnd}{$(!B \land !C)$ and $(!B' \land !C')$.}{}}}
  145. \end{prop}
  146. \begin{proof}
  147. The formation rules require that if !!a{formula} is not atomic, it
  148. must start with an opening parenthesis~(, \iftag{prvNot}{$\lnot$,}{}
  149. or a quantifier. On the other hand, every !!{formula} that starts with
  150. one of the following symbols must be atomic: !!a{predicate}, !!a{function}, !!a{constant}\iftag{prvFalse}{, $\lfalse$}{}\iftag{prvTrue}{, $\ltrue$}{}.
  151. So we really only have to show that if $!A$ is of the form $(!B \ast
  152. !C)$ and also of the form $(!B' \mathbin{\ast'} !C')$, then $!B \ident
  153. !B'$, $!C \ident !C'$, and $\ast = {\ast'}$.
  154. So suppose both $!A \ident (!B \ast !C)$ and $!A \ident (!B'
  155. \mathbin{\ast'} !C')$. Then either $!B \ident !B'$ or not. If it is,
  156. clearly $\ast = {\ast'}$ and $!C \ident !C'$, since they then are
  157. substrings of $!A$ that begin in the same place and are of the same
  158. length. The other case is $!B \not\ident !B'$. Since $!B$ and
  159. $!B'$ are both substrings of $!A$ that begin at the same place, one
  160. must be a proper prefix of the other. But this is impossible by
  161. \olref{lem:no-prefix}.
  162. \end{proof}
  163. \end{document}

content/first-order-logic/syntax-and-semantics/main-operator.tex

101 lines; SHA-256 1bc4cc76cc670fdb1069ca53312d13dfcf2ea8444adbb3d9ef4b8d31a5da41fc. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax-and-semantics
  3. % Section: main-operator
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{fol}{syn}{mai}
  7. \olsection{\printtoken{S}{main operator} of a Formula}
  8. \begin{explain}
  9. It is often useful to talk about the last operator used in
  10. constructing !!a{formula}~$!A$. This operator is called the \emph{main
  11. operator} of~$!A$. Intuitively, it is the ``outermost'' operator
  12. of $!A$. For example, the main operator of $\lnot !A$ is $\lnot$,
  13. the main operator of $(!A \lor !B)$ is $\lor$, etc.
  14. \end{explain}
  15. \begin{defn}[!!^{main operator}]
  16. \ollabel{def:main-op}
  17. The \emph{!!{main operator}} of !!a{formula}~$!A$ is
  18. defined as follows:
  19. \begin{enumerate}
  20. \item \indcase*{!A}{!A}{$\indfrm$ has no !!{main operator}.}
  21. \tagitem{prvNot}{\indcase{!A}{\lnot !B}{the !!{main operator} of $\indfrm$
  22. is~$\lnot$.}}{}
  23. \tagitem{prvAnd}{\indcase{!A}{(!B \land !C)}{the !!{main operator} of
  24. $\indfrm$ is~$\land$.}}{}
  25. \tagitem{prvOr}{\indcase{!A}{(!B \lor !C)}{the !!{main operator} of
  26. $\indfrm$ is~$\lor$.}}{}
  27. \tagitem{prvIf}{\indcase{!A}{(!B \lif !C)}{the !!{main operator} of
  28. $\indfrm$ is~$\lif$.}}{}
  29. \tagitem{prvIff}{\indcase{!A}{(!B \liff !C)}{the !!{main operator} of
  30. $\indfrm$ is~$\liff$.}}{}
  31. \tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{the !!{main operator}
  32. of $\indfrm$ is~$\lforall$.}}{}
  33. \tagitem{prvEx}{\indcase{!A}{\lexists[x][!B]}{the !!{main operator} of
  34. $\indfrm$ is~$\lexists$.}}{}
  35. \end{enumerate}
  36. \end{defn}
  37. In each case, we intend the specific indicated \emph{occurrence} of
  38. the !!{main operator} in the formula. For instance, since the formula
  39. $((!D \lif !E) \lif (!E \lif !D))$ is of the form $(!B \lif !C)$ where
  40. $!B$ is $(!D \lif !E)$ and $!C$ is $(!E \lif !D)$, the second
  41. occurrence of $\lif$ is the !!{main operator}.
  42. \begin{explain}
  43. This is a \emph{recursive} definition of a function which maps all
  44. non-atomic !!{formula}s to their !!{main operator} occurrence. Because
  45. of the way !!{formula}s are defined inductively, every
  46. !!{formula}~$!A$ satisfies one of the cases in \olref{def:main-op}.
  47. This guarantees that for each non-atomic !!{formula}~$!A$ !!a{main
  48. operator} exists. Because each !!{formula} satisfies only one of these
  49. conditions, and because the smaller !!{formula}s from which $!A$ is
  50. constructed are uniquely determined in each case, the !!{main
  51. operator} occurrence of~$!A$ is unique, and so we have defined a
  52. function.
  53. \end{explain}
  54. We call !!{formula}s by the names in \olref{tab:main-op} depending on
  55. which symbol their !!{main operator}
  56. is.\iftag{defNot,defOr,defAnd,defIf,defIff,defTrue,defFalse,defEx,defAll}
  57. { Recall, however, that defined operators do not officially appear in
  58. !!{formula}s. They are just abbreviations, so officially they cannot
  59. be the main operator of a formula. In proofs about all !!{formula}s
  60. they therefore do not have to be treated separately.}
  61. \begin{table}[!h]
  62. \centering
  63. \begin{tabular}{c | c | c}
  64. !!^{main operator} & Type of !!{formula} & Example\\
  65. \hline
  66. none & atomic (!!{formula}) &
  67. \iftag{prvFalse}{$\lfalse$,}{}
  68. \iftag{prvTrue}{$\ltrue$,}{}
  69. $\Atom{R}{t_1, \dots, t_n}$,
  70. $\eq[t_1][t_2]$\\
  71. $\lnot$ & negation & $\lnot !A$ \\
  72. $\land$ & conjunction & $(!A \land !B$) \\
  73. $\lor$ & disjunction & $(!A \lor !B$) \\
  74. $\lif$ & !!{conditional} & $(!A \lif !B$) \\
  75. $\liff$ & !!{biconditional} & $(!A \liff !B)$ \\
  76. $\lforall[][]$ & universal (!!{formula})& $\lforall[x][!A]$ \\
  77. $\lexists[][]$ & existential (!!{formula})& $\lexists[x][!A]$
  78. \end{tabular}
  79. \caption{Main operator and names of !!{formula}s}
  80. \ollabel{tab:main-op}
  81. \end{table}
  82. \end{document}

content/first-order-logic/syntax-and-semantics/subformulas.tex

111 lines; SHA-256 4c43825e4c236e55d25092ff1f5b68ed38a3f1e9ae8ed12fc2e14f3a03fc6c77. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax-and-semantics
  3. % Section: subformulas
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{fol}{syn}{sbf}
  7. \olsection{\printtoken{P}{subformula}}
  8. \begin{explain}
  9. It is often useful to talk about the !!{formula}s that ``make up'' a
  10. given !!{formula}. We call these its \emph{!!{subformula}s}. Any
  11. !!{formula} counts as !!a{subformula} of itself; a subformula of $!A$
  12. other than $!A$ itself is a \emph{proper !!{subformula}}.
  13. \end{explain}
  14. \begin{defn}[Immediate !!^{subformula}]
  15. If $!A$ is !!a{formula}, the \emph{immediate !!{subformula}s}
  16. of $!A$ are defined inductively as follows:
  17. \begin{enumerate}
  18. \item Atomic !!{formula}s have no immediate !!{subformula}s.
  19. \tagitem{prvNot}{\indcase{!A}{\lnot !B}{The only immediate
  20. !!{subformula} of $\indfrm$ is~$!B$.}}{}
  21. \item \indcase{!A}{(!B \ast !C)}{The immediate !!{subformula}s of
  22. $\indfrm$ are $!B$ and $!C$ ($\ast$ is any one of the two-place
  23. connectives).}
  24. \tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{The only immediate
  25. !!{subformula} of $\indfrm$ is~$!B$.}}{}
  26. \tagitem{prvEx}{\indcase{!A}{\lexists[x][!B]}{The only immediate
  27. !!{subformula} of $\indfrm$ is~$!B$.}}{}
  28. \end{enumerate}
  29. \end{defn}
  30. \begin{defn}[Proper !!^{subformula}]
  31. If $!A$ is !!a{formula}, the \emph{proper !!{subformula}s}
  32. of $!A$ are defined recursively as follows:
  33. \begin{enumerate}
  34. \item Atomic !!{formula}s have no proper !!{subformula}s.
  35. \tagitem{prvNot}{\indcase{!A}{\lnot !B}{The proper !!{subformula}s of
  36. $\indfrm$ are~$!B$ together with all proper !!{subformula}s
  37. of~$!B$.}}{}
  38. \item \indcase{!A}{(!B \ast !C)}{The proper !!{subformula}s of
  39. $\indfrm$ are $!B$, $!C$, together with all proper !!{subformula}s
  40. of $!B$ and those of~$!C$.}
  41. \tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{The proper
  42. !!{subformula}s of $\indfrm$ are~$!B$ together with all proper
  43. !!{subformula}s of~$!B$.}}{}
  44. \tagitem{prvEx}{\indcase{!A}{\lexists[x][!B]}{The proper
  45. !!{subformula}s of $\indfrm$ are~$!B$ together with all proper
  46. !!{subformula}s of~$!B$.}}{}
  47. \end{enumerate}
  48. \end{defn}
  49. \begin{defn}[!!^{subformula}]
  50. The !!{subformula}s of $!A$ are $!A$ itself together with all its
  51. proper !!{subformula}s.
  52. \end{defn}
  53. \begin{explain}
  54. Note the subtle difference in how we have defined immediate
  55. !!{subformula}s and proper !!{subformula}s. In the first case, we
  56. have directly defined the immediate !!{subformula}s of a formula~$!A$
  57. for each possible form of~$!A$. It is an explicit definition by
  58. cases, and the cases mirror the inductive definition of the set of
  59. !!{formula}s. In the second case, we have also mirrored the way the
  60. set of all !!{formula}s is defined, but in each case we have also
  61. included the proper !!{subformula}s of the smaller !!{formula}s $!B$,
  62. $!C$ in addition to these !!{formula}s themselves. This makes the
  63. definition \emph{recursive}. In general, a definition of a function
  64. on an inductively defined set (in our case, !!{formula}s) is recursive
  65. if the cases in the definition of the function make use of
  66. the function itself. To be well defined, we must make sure, however,
  67. that we only ever use the values of the function for arguments that
  68. come ``before'' the one we are defining---in our case, when defining
  69. ``proper !!{subformula}'' for $(!B \ast !C)$ we only use the proper
  70. !!{subformula}s of the ``earlier'' !!{formula}s $!B$ and $!C$.
  71. \end{explain}
  72. \begin{prop}
  73. \ollabel{prop:subfrm-trans}
  74. Suppose $!B$ is a subformula of $!A$ and $!C$ is a subformula of $!B$.
  75. Then $!C$ is a subformula of $!A$. In other words, the subformula
  76. relation is transitive.
  77. \end{prop}
  78. \begin{prob}
  79. Prove \olref[fol][syn][sbf]{prop:subfrm-trans}.
  80. \end{prob}
  81. \begin{prop}
  82. \ollabel{prop:count-subfrms}
  83. Suppose $!A$ is a formula with $n$ connectives and quantifiers.
  84. Then $!A$ has at most $2n+1$ subformulas.
  85. \end{prop}
  86. \begin{prob}
  87. Prove \olref[fol][syn][sbf]{prop:count-subfrms}.
  88. \end{prob}
  89. \end{document}

content/first-order-logic/syntax-and-semantics/formation-sequences.tex

278 lines; SHA-256 dc1735bb077f5086c6fd6e2f968591415a9cba90b65bc0a3d412742cc62bc6ff. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax-and-semantics
  3. % Section: formation-sequences
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{fol}{syn}{fseq}
  7. \olsection{Formation Sequences}
  8. Defining !!{formula}s via an inductive definition, and the
  9. complementary technique of proving properties of !!{formula}s via
  10. induction, is an elegant and efficient approach. However, it can
  11. also be useful to consider a more bottom-up, step-by-step approach
  12. to the construction of !!{formula}s, which we do here using the
  13. notion of a \emph{formation sequence}.
  14. %
  15. To show how terms and !!{formula}s can be introduced in this way
  16. without needing to refer to their inductive definitions, we first
  17. introduce the notion of an arbitrary string of symbols drawn from
  18. some language~$\Lang L$.
  19. \begin{defn}[Strings]
  20. \ollabel{defn:string}
  21. Suppose $\Lang L$ is a first-order language. An \emph{$\Lang
  22. L$-string} is a finite sequence of symbols of~$\Lang L$. Where the
  23. language~$\Lang L$ is clearly fixed by the context, we will often
  24. refer to a $\Lang L$-string simply as a \emph{string}.
  25. \end{defn}
  26. \begin{ex}
  27. For any first-order language $\Lang L$, all
  28. $\Lang L$-!!{formula}s are $\Lang L$-strings, but not
  29. conversely. For example, \[)(\Obj v_0\lif\lexists\] is an
  30. $\Lang L$-string but not an $\Lang L$-!!{formula}.
  31. \end{ex}
  32. \begin{defn}[Formation sequences for terms]
  33. \ollabel{defn:fseq-trm}
  34. A finite sequence of $\Lang L$-strings $\tuple{t_0,\dotsc,t_n}$ is a
  35. \emph{formation sequence} for a term $t$ if $t \ident t_n$ and for all
  36. $i \leq n$, either $t_i$ is !!a{variable} or !!a{constant}, or $\Lang
  37. L$ contains a $k$-ary !!{function}~$f$ and there exist
  38. $m_0,\dotsc,m_k < i$ such that $t_i \ident f(t_{m_0},\dotsc,t_{m_k})$.
  39. When it is necessary to distinguish, we will refer to formation
  40. sequences for terms as \emph{term formation sequences}.
  41. \end{defn}
  42. \begin{ex}
  43. The sequence
  44. \[
  45. \tuple{\Obj c_0, \Obj v_0, \Atom{\Obj f^2_0}{\Obj c_0, \Obj v_0}, \Atom{\Obj f^1_0}{\Atom{\Obj f^2_0}{\Obj c_0, \Obj v_0}}}
  46. \]
  47. is a formation sequence for the term $\Atom{\Obj f^1_0}{\Atom{\Obj
  48. f^2_0}{\Obj c_0, \Obj v_0}}$, as is
  49. \[
  50. \tuple{\Obj v_0, \Obj c_0, \Atom{\Obj f^2_0}{\Obj c_0, \Obj v_0}, \Atom{\Obj f^1_0}{\Atom{\Obj f^2_0}{\Obj c_0, \Obj v_0}}}.
  51. \]
  52. \end{ex}
  53. \begin{defn}[Formation sequences for formulas]
  54. \ollabel{defn:fseq-frm}
  55. A finite sequence of $\Lang L$-strings $\tuple{!A_0,\dotsc,!A_n}$
  56. is a \emph{formation sequence} for~$!A$ if $!A \ident !A_n$ and
  57. for all $i \leq n$, either $!A_i$ is an atomic !!{formula} or there
  58. exist $j,k < i$ and !!a{variable}~$x$ such that one of the following
  59. holds:
  60. \begin{enumerate}
  61. \tagitem{prvNot}{$!A_i \ident \lnot !A_j$.}{}%
  62. \tagitem{prvAnd}{$!A_i \ident (!A_j \land !A_k)$.}{}%
  63. \tagitem{prvOr}{$!A_i \ident (!A_j \lor !A_k)$.}{}%
  64. \tagitem{prvIf}{$!A_i \ident (!A_j \lif !A_k)$.}{}%
  65. \tagitem{prvIff}{$!A_i \ident (!A_j \liff !A_k)$.}{}%
  66. \tagitem{prvAll}{$!A_i \ident \lforall[x][!A_j]$.}{}%
  67. \tagitem{prvEx}{$!A_i \ident \lexists[x][!A_j]$.}{}%
  68. \end{enumerate}
  69. When it is necessary to distinguish, we will refer to formation
  70. sequences for formulas as \emph{formula formation sequences}.
  71. \end{defn}
  72. \begin{ex}
  73. \[
  74. \tuple{
  75. \Atom{\Obj A^1_0}{\Obj v_0},
  76. \Atom{\Obj A^1_1}{\Obj c_1},
  77. (\Atom{\Obj A^1_1}{\Obj c_1} \land \Atom{\Obj A^1_0}{\Obj v_0}),
  78. \lexists[\Obj v_0][(\Atom{\Obj A^1_1}{\Obj c_1} \land \Atom{\Obj A^1_0}{\Obj v_0})]
  79. }
  80. \]
  81. is a formation sequence of $\lexists[\Obj v_0][(\Atom{\Obj A^1_1}{\Obj
  82. c_1} \land \Atom{\Obj A^1_0}{\Obj v_0})]$, as is
  83. \begin{multline*}
  84. \tuple{
  85. \Atom{\Obj A^1_0}{\Obj v_0},
  86. \Atom{\Obj A^1_1}{\Obj c_1},
  87. (\Atom{\Obj A^1_1}{\Obj c_1} \land \Atom{\Obj A^1_0}{\Obj v_0}),
  88. \Atom{\Obj A^1_1}{\Obj c_1},\\
  89. \lforall[\Obj v_1][\Atom{\Obj A^1_0}{\Obj v_0}],
  90. \lexists[\Obj v_0][(\Atom{\Obj A^1_1}{\Obj c_1} \land \Atom{\Obj A^1_0}{\Obj v_0})]
  91. }.
  92. \end{multline*}
  93. %
  94. As can be seen from the second example, formation sequences
  95. may contain ``junk'': !!{formula}s which are redundant or do not
  96. contribute to the construction.
  97. \end{ex}
  98. \begin{prop}\ollabel{prop:formed}
  99. Every !!{formula}~$!A$ in~$\Frm[L]$ has a formation sequence.
  100. \end{prop}
  101. \begin{proof}
  102. Suppose $!A$ is atomic. Then the sequence $\tuple{!A}$ is a
  103. formation sequence for~$!A$.
  104. %
  105. Now suppose that $!B$ and~$!C$ have formation sequences
  106. $\tuple{!B_0,\dotsc,!B_n}$ and $\tuple{!C_0,\dotsc,!C_m}$
  107. respectively.
  108. %
  109. \begin{enumerate}
  110. \tagitem{prvNot}{If $!A \ident \lnot !B$,
  111. then $\tuple{!B_0,\dotsc,!B_n,\lnot !B_n}$
  112. is a formation sequence for~$!A$.}{}
  113. \tagitem{prvAnd}{If $!A \ident (!B \land !C)$,
  114. then $\tuple{!B_0,\dotsc,!B_n,!C_0,\dotsc,!C_m,(!B_n \land !C_m)}$
  115. is a formation sequence for~$!A$.}{}
  116. \tagitem{prvOr}{If $!A \ident (!B \lor !C)$,
  117. then $\tuple{!B_0,\dotsc,!B_n,!C_0,\dotsc,!C_m,(!B_n \lor !C_m)}$
  118. is a formation sequence for~$!A$.}{}
  119. \tagitem{prvIf}{If $!A \ident (!B \lif !C)$,
  120. then $\tuple{!B_0,\dotsc,!B_n,!C_0,\dotsc,!C_m,(!B_n \lif !C_m)}$
  121. is a formation sequence for~$!A$.}{}
  122. \tagitem{prvIff}{If $!A \ident (!B \liff !C)$,
  123. then $\tuple{!B_0,\dotsc,!B_n,!C_0,\dotsc,!C_m,(!B_n \liff !C_m)}$
  124. is a formation sequence for~$!A$.}{}
  125. \tagitem{prvAll}{If $!A \ident \lforall[x][!B]$,
  126. then $\tuple{!B_0,\dotsc,!B_n,\lforall[x][!B_n]}$
  127. is a formation sequence for~$!A$.}{}
  128. \tagitem{prvEx}{If $!A \ident \lexists[x][!B]$,
  129. then $\tuple{!B_0,\dotsc,!B_n,\lexists[x][!B_n]}$
  130. is a formation sequence for~$!A$.}{}
  131. \end{enumerate}
  132. By the principle of induction on !!{formula}s,
  133. every !!{formula} has a formation sequence.
  134. \end{proof}
  135. We can also prove the converse. This is important because it shows
  136. that our two ways of defining formulas are equivalent: they give
  137. the same results. It also means that we can prove theorems about
  138. formulas by using ordinary induction on the length of formation
  139. sequences.
  140. \begin{lem}
  141. \ollabel{lem:fseq-init}
  142. Suppose that $\tuple{!A_0,\dotsc,!A_n}$ is a formation sequence
  143. for~$!A_n$, and that $k \leq n$. Then $\tuple{!A_0,\dotsc,!A_k}$
  144. is a formation sequence for~$!A_k$.
  145. \end{lem}
  146. \begin{proof}
  147. Exercise.
  148. \end{proof}
  149. \begin{prob}
  150. Prove \olref[fol][syn][fseq]{lem:fseq-init}.
  151. \end{prob}
  152. \begin{thm}
  153. \ollabel{thm:fseq-frm-equiv}
  154. $\Frm[L]$ is the set of all $\Lang L$-strings~$!A$ such that
  155. there exists a formula formation sequence for~$!A$.
  156. \end{thm}
  157. \begin{proof}
  158. Let $F$ be the set of all strings of symbols in the language~$\Lang L$
  159. that have a formation sequence. We have seen in
  160. \olref[fol][syn][fseq]{prop:formed} that $\Frm[L] \subseteq F$, so now
  161. we prove the converse.
  162. Suppose $!A$ has a formation sequence $\tuple{!A_0,\dotsc,!A_n}$.
  163. We prove that $!A \in \Frm[L]$ by strong induction on~$n$.
  164. Our induction hypothesis is that every string of symbols with a
  165. formation sequence of length $m < n$ is in $\Frm[L]$.
  166. By the definition of a formation sequence, either $!A \ident !A_n$ is
  167. atomic or there must exist $j,k < n$ such that one of the
  168. following is the case:
  169. \begin{enumerate}
  170. \tagitem{prvNot}{$!A \ident \lnot !A_j$.}{}%
  171. \tagitem{prvAnd}{$!A \ident (!A_j \land !A_k)$.}{}%
  172. \tagitem{prvOr}{$!A \ident (!A_j \lor !A_k)$.}{}%
  173. \tagitem{prvIf}{$!A \ident (!A_j \lif !A_k)$.}{}%
  174. \tagitem{prvIff}{$!A \ident (!A_j \liff !A_k)$.}{}%
  175. \tagitem{prvAll}{$!A \ident \lforall[x][!A_j]$.}{}%
  176. \tagitem{prvEx}{$!A \ident \lexists[x][!A_j]$.}{}%
  177. \end{enumerate}
  178. Now we reason by cases. If $!A$ is atomic then
  179. $!A_n \in \Frm[L_0]$. Suppose instead that
  180. $!A \equiv (!A_j \land !A_k)$. By
  181. \olref[fol][syn][fseq]{lem:fseq-init},
  182. $\tuple{!A_0,\dotsc,!A_j}$ and $\tuple{!A_0,\dotsc,!A_k}$ are
  183. formation sequences for $!A_j$ and~$!A_k$, respectively. Since
  184. these are proper initial subsequences of the formation sequence
  185. for~$!A$, they both have length less than~$n$. Therefore by
  186. the induction hypothesis, $!A_j$ and~$!A_k$ are in~$\Frm[L_0]$,
  187. and by the definition of !!a{formula}, so is
  188. $(!A_j \land !A_k)$. The other cases follow by parallel
  189. reasoning.
  190. \end{proof}
  191. Formation sequences for terms have similar properties to those
  192. for !!{formula}s.
  193. \begin{prop}
  194. \ollabel{prop:fseq-trm-equiv}
  195. $\Trm[L]$ is the set of all $\Lang L$-strings $t$
  196. such that there exists a term formation sequence for~$t$.
  197. \end{prop}
  198. \begin{proof}
  199. Exercise.
  200. \end{proof}
  201. \begin{prob}
  202. Prove \olref[fol][syn][fseq]{prop:fseq-trm-equiv}.
  203. Hint: use a similar strategy to that used in the proof of
  204. \olref[fol][syn][fseq]{thm:fseq-frm-equiv}.
  205. \end{prob}
  206. There are two types of ``junk'' that can appear in formation
  207. sequences: repeated elements, and elements that are irrelevant
  208. to the construction of the formation or term. We can eliminate
  209. both by looking at minimal formation sequences.
  210. \begin{defn}[Minimal formation sequences]
  211. \ollabel{defn:minimal-fseq}
  212. A formation sequence $\tuple{!A_0, \ldots, !A_n}$ for a
  213. formula~$!A$ is a \emph{minimal formation sequence} for~$!A$
  214. if for every other formation sequence~$s$ for~$!A$,
  215. the length of~$s$ is greater than or equal to~$n+1$.
  216. Similarly, a formation sequence $\tuple{t_0, \ldots, t_n}$
  217. for a term~$t$ is a \emph{minimal formation sequence}
  218. for~$t$ if for every other formation sequence~$s$ for~$t$,
  219. the length of~$s$ is greater than or equal to~$n+1$.
  220. \end{defn}
  221. Note that a formula or term can have more than one minimal
  222. formation sequence, but they will contain exactly the same
  223. strings.
  224. \begin{prop}
  225. \ollabel{prop:subformula-equivs}
  226. The following are equivalent:
  227. \begin{enumerate}
  228. \item $!B$ is a sub-!!{formula} of~$!A$.
  229. \item $!B$ occurs in every formation sequence of~$!A$.
  230. \item $!B$ occurs in a minimal formation sequence of~$!A$.
  231. \end{enumerate}
  232. \end{prop}
  233. \begin{proof}
  234. Exercise.
  235. \end{proof}
  236. \begin{prob}
  237. Prove \olref[fol][syn][fseq]{prop:subformula-equivs}.
  238. \end{prob}
  239. \begin{history}
  240. Formation sequences were introduced by Raymond Smullyan in his
  241. textbook \emph{First-Order Logic} \citep{Smullyan1968}.
  242. Additional properties of formation sequences were established by
  243. \citet{Zuckerman1973}.
  244. \end{history}
  245. \end{document}

content/first-order-logic/syntax-and-semantics/free-vars-sentences.tex

102 lines; SHA-256 ea6bea6e587867742143e68dd69a2674fc1544ffaae27236ba1f517fe516bf1f. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax-and-semantics
  3. % Section: free-vars-sentences
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{fol}{syn}{fvs}
  7. \olsection{Free \printtoken{P}{variable} and \printtoken{P}{sentence}}
  8. \begin{defn}[Free occurrences of !!a{variable}]
  9. \ollabel{defn:free-occ}
  10. The \emph{free} occurrences of !!a{variable} in !!a{formula} are defined
  11. inductively as follows:
  12. \begin{enumerate}
  13. \item \indcase*{!A}{$!A$ is atomic}{all !!{variable} occurrences in
  14. $\indfrm$ are free.}
  15. \tagitem{prvNot}{\indcase{!A}{\lnot !B}{the free !!{variable}
  16. occurrences of $\indfrm$ are exactly those of $!B$.}}{}
  17. \item \indcase{!A}{(!B \ast !C)}{the free
  18. !!{variable} occurrences of $\indfrm$ are those in $!B$
  19. together with those in~$!C$.}
  20. \tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{the free !!{variable}
  21. occurrences in $\indfrm$ are all of those in~$!B$ except for
  22. occurrences of~$x$.}}{}
  23. \tagitem{prvEx}{\indcase{!A}{\lexists[x][!B]}{the free !!{variable}
  24. occurrences in $\indfrm$ are all of those in~$!B$ except for
  25. occurrences of~$x$.}}{}
  26. \end{enumerate}
  27. \end{defn}
  28. \begin{defn}[Bound Variables]
  29. An occurrence of !!a{variable} in a formula~$!A$ is \emph{bound} if
  30. it is not free.
  31. \end{defn}
  32. \begin{prob}
  33. Give an inductive definition of the bound variable occurrences along
  34. the lines of \olref[fol][syn][fvs]{defn:free-occ}.
  35. \end{prob}
  36. \begin{defn}[Scope]
  37. \iftag{prvAll}{If $\lforall[x][!B]$ is an occurrence of a subformula
  38. in a formula~$!A$, then the corresponding occurrence of~$!B$ in~$!A$
  39. is called the \emph{scope} of the corresponding occurrence
  40. of~$\lforall[x]$. \iftag{prvEx}{Similarly for $\lexists[x]$.}{}}{If
  41. $\lexists[x][!B]$ is an occurrence of a subformula in a
  42. formula~$!A$, then the corresponding occurrence of~$!B$ in~$!A$ is
  43. called the \emph{scope} of the corresponding occurrence
  44. of~$\lexists[x]$.}
  45. If $!B$ is the scope of a quantifier occurrence
  46. \iftag{prvAll}{$\lforall[x]$\iftag{prvEx}{ or
  47. $\lexists[x]$}{}}{$\lexists[x]$} in~$!A$, then the free occurrences of
  48. $x$ in~$!B$ are bound in \iftag{prvAll}{$\lforall[x][!B]$\iftag{prvEx}{ and
  49. $\lexists[x][!B]$}{}}{$\lexists[x][!B]$}. We say that these
  50. occurrences are \emph{bound by} the
  51. mentioned quantifier occurrence.
  52. \end{defn}
  53. \begin{ex}
  54. Consider the following formula:
  55. \[
  56. \lexists[\Obj v_0][\underbrace{\Atom{\Obj A^2_0}{\Obj v_0,\Obj v_1}}_{!B}]
  57. \]
  58. $!B$ represents the scope of $\lexists[\Obj v_0]$.
  59. The quantifier binds the occurrence of $\Obj v_0$ in $!B$, but
  60. does not bind the occurrence of $\Obj v_1$. So $\Obj v_1$ is
  61. a free variable in this case.
  62. We can now see how this might work in a more complicated
  63. !!{formula}~$!A$:
  64. \[
  65. \lforall[\Obj v_0][\underbrace{(\Atom{\Obj A^1_0}{\Obj v_0} \lif
  66. \Atom{\Obj A^2_0}{\Obj v_0, \Obj v_1})}_{!B}] \lif \lexists[\Obj
  67. v_1][\underbrace{(\Atom{\Obj A^2_1}{\Obj v_0, \Obj v_1} \lor \lforall[\Obj v_0][\overbrace{\lnot \Atom{\Obj A^1_1}{\Obj v_0}}^{!D}])}_{!C}]
  68. \]
  69. $!B$ is the scope of the first $\lforall[\Obj v_0]$, $!C$ is the scope
  70. of $\lexists[\Obj v_1]$, and $!D$ is the scope of the second
  71. $\lforall[\Obj v_0]$. The first $\lforall[\Obj v_0]$ binds the
  72. occurrences of $\Obj v_0$ in~$!B$, $\lexists[\Obj v_1]$ binds the occurrence
  73. of $\Obj v_1$ in $!C$, and the second $\lforall[\Obj v_0]$ binds the
  74. occurrence of $\Obj v_0$ in~$!D$. The first occurrence of $\Obj v_1$
  75. and the fourth occurrence of $\Obj v_0$ are free in~$!A$. The last
  76. occurrence of $\Obj v_0$ is free in $!D$, but bound in $!C$ and~$!A$.
  77. \end{ex}
  78. \begin{defn}[Sentence]
  79. !!^a{formula}~$!A$ is \article{sentence} \emph{!!{sentence}} iff it
  80. contains no free occurrences of !!{variable}s.
  81. \end{defn}
  82. % add examples!
  83. \end{document}

content/first-order-logic/syntax-and-semantics/substitution.tex

126 lines; SHA-256 19393c28f5f036da9c43ce10bfb5f1b2f330dca8cb2ad950d98eab5b1b7e83b2. Open the byte-exact preserved source file.

  1. % Part: first-order-logic
  2. % Chapter: syntax-and-semantics
  3. % Section: substitution
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{fol}{syn}{sub}
  7. \olsection{Substitution}
  8. \begin{defn}[Substitution in a term]
  9. We define $\Subst{s}{t}{x}$, the result of \emph{substituting} $t$
  10. for every occurrence of~$x$ in $s$, recursively:
  11. \begin{enumerate}
  12. \item \indcase{s}{c}{$\Subst{\indfrm}{t}{x}$ is just $s$.}
  13. \item \indcase{s}{y}{$\Subst{\indfrm}{t}{x}$ is also just~$s$,
  14. provided $y$ is a variable and $y \not\ident x$.}
  15. \item \indcase{s}{x}{$\Subst{\indfrm}{t}{x}$ is~$t$.}
  16. \item\indcase{s}{\Atom{f}{t_1, \dots, t_n}}{$\Subst{\indfrmp}{t}{x}$ is
  17. $\Atom{f}{\Subst{t_1}{t}{x}, \dots, \Subst{t_n}{t}{x}}$.}
  18. \end{enumerate}
  19. \end{defn}
  20. \begin{defn}
  21. A term~$t$ is \emph{!!{free for}} $x$ in $!A$ if none of the free
  22. occurrences of~$x$ in $!A$ occur in the scope of a quantifier that
  23. binds a variable in~$t$.
  24. \end{defn}
  25. \begin{ex} ~
  26. \begin{enumerate}
  27. \item $\Obj v_8$ is free for $\Obj v_1$ in $\lexists[\Obj
  28. v_3]\Atom{\Obj A^2_4}{\Obj v_3,\Obj v_1}$
  29. \item $\Obj f^2_1(\Obj v_1, \Obj v_2)$ is \emph{not} free for $\Obj
  30. v_0$ in $\lforall[\Obj v_2]\Atom{\Obj A^2_4}{\Obj v_0,\Obj v_2}$
  31. \end{enumerate}
  32. \end{ex}
  33. \begin{defn}[Substitution in !!a{formula}]
  34. If $!A$ is !!a{formula}, $x$~is !!a{variable}, and $t$~is a term
  35. !!{free for}~$x$ in~$!A$, then $\Subst{!A}{t}{x}$ is the result of
  36. substituting $t$ for all free occurrences of~$x$ in~$!A$.
  37. \begin{enumerate}
  38. \tagitem{prvFalse}{\indcase{!A}{\lfalse}{$\Subst{\indfrm}{t}{x}$ is
  39. $\lfalse$.}}{}
  40. \tagitem{prvTrue}{\indcase{!A}{\ltrue}{$\Subst{\indfrm}{t}{x}$ is
  41. $\ltrue$.}}{}
  42. \item \indcase{!A}{\Atom{P}{t_1,\dots,
  43. t_n}}{$\Subst{\indfrm}{t}{x}$ is $\Atom{P}{\Subst{t_1}{t}{x},
  44. \dots, \Subst{t_n}{t}{x}}$.}
  45. \item \indcase{!A}{\eq[t_1][t_2]}{$\Subst{\indfrmp}{t}{x}$ is
  46. $\Subst{t_1}{t}{x} = \Subst{t_2}{t}{x}$.}
  47. \tagitem{prvNot}{\indcase{!A}{\lnot !B}{$\Subst{\indfrmp}{t}{x}$ is
  48. $\lnot \Subst{!B}{t}{x}$.}}{}
  49. \tagitem{prvAnd}{\indcase{!A}{(!B \land
  50. !C)}{$\Subst{\indfrmp}{t}{x}$ is $(\Subst{!B}{t}{x} \land
  51. \Subst{!C}{t}{x})$.}}{}
  52. \tagitem{prvOr}{\indcase{!A}{(!B \lor
  53. !C)}{$\Subst{\indfrmp}{t}{x}$ is $(\Subst{!B}{t}{x} \lor
  54. \Subst{!C}{t}{x})$.}}{}
  55. \tagitem{prvIf}{\indcase{!A}{(!B \lif
  56. !C)}{$\Subst{\indfrmp}{t}{x}$ is $(\Subst{!B}{t}{x} \lif
  57. \Subst{!C}{t}{x})$.}}{}
  58. \tagitem{prvIff}{\indcase{!A}{(!B \liff
  59. !C)}{$\Subst{\indfrmp}{t}{x}$ is $(\Subst{!B}{t}{x} \liff
  60. \Subst{!C}{t}{x})$.}}{}
  61. \tagitem{prvAll}{
  62. \indcase{!A}{\lforall[y][!B]}{$\Subst{\indfrmp}{t}{x}$
  63. is $\lforall[y][\Subst{!B}{t}{x}]$, provided $y$ is a variable
  64. other than $x$; otherwise $\Subst{\indfrmp}{t}{x}$
  65. is just $\indfrm$.}}{}
  66. \tagitem{prvEx}{
  67. \indcase{!A}{\lexists[y][!B]}{$\Subst{\indfrmp}{t}{x}$
  68. is $\lexists[y][\Subst{!B}{t}{x}]$, provided $y$ is a variable
  69. other than $x$; otherwise $\Subst{\indfrmp}{t}{x}$
  70. is just $\indfrm$.}}{}
  71. \end{enumerate}
  72. \end{defn}
  73. \begin{explain}
  74. Note that substitution may be vacuous: If $x$ does not occur in $!A$
  75. at all, then $\Subst{!A}{t}{x}$ is just~$!A$.
  76. The restriction that $t$ must be !!{free for}~$x$ in~$!A$ is necessary to
  77. exclude cases like the following. If $!A \ident \lexists[y][x < y]$
  78. and $t \ident y$, then $\Subst{!A}{t}{x}$ would be $\lexists[y][y <
  79. y]$. In this case the free variable $y$ is ``captured'' by the
  80. quantifier $\lexists[y]$ upon substitution, and that is undesirable.
  81. For instance, we would like it to be the case that whenever
  82. $\lforall[x][!B]$ holds, so does $\Subst{!B}{t}{x}$. But consider
  83. $\lforall[x][\lexists[y][x < y]]$ (here $!B$ is $\lexists[y][x <
  84. y]$). It is a sentence that is true about, e.g., the natural numbers:
  85. for every number~$x$ there is a number~$y$ greater than it. If we
  86. allowed $y$ as a possible substitution for~$x$, we would end up with
  87. $\Subst{!B}{y}{x} \ident \lexists[y][y < y]$, which is false. We
  88. prevent this by requiring that none of the free variables in~$t$ would
  89. end up being bound by a quantifier in~$!A$.
  90. \end{explain}
  91. We often use the following convention to avoid cumbersome notation: If
  92. $!A$ is !!a{formula} which may contain the !!{variable}~$x$ free, we
  93. also write~$!A(x)$ to indicate this. When it is clear which $!A$
  94. and~$x$ we have in mind, and $t$ is a term (assumed to be free for $x$
  95. in $!A(x)$), then we write $!A(t)$ as short for $\Subst{!A}{t}{x}$. So
  96. for instance, we might say, ``we call $!A(t)$ an instance
  97. of~$\lforall[x][!A(x)]$.'' By this we mean that if $!A$~is any
  98. !!{formula}, $x$~!!a{variable}, and $t$~a term that's free for~$x$
  99. in~$!A$, then $\Subst{!A}{t}{x}$ is an instance of~$\lforall[x][!A]$.
  100. \end{document}