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.
% Part: first-order-logic% Chapter: syntax\documentclass[../../../include/open-logic-chapter]{subfiles}\begin{document}\olchapter{fol}{syn}{Syntax of First-Order Logic}\olimport{intro-syntax}\olimport{first-order-languages}\olimport{terms-formulas}\olimport{unique-readability}\olimport{main-operator}\olimport{subformulas}\olimport{formation-sequences}\olimport{free-vars-sentences}\olimport{substitution}\OLEndChapterHook\end{document}
content/first-order-logic/syntax-and-semantics/intro-syntax.tex
33 lines; SHA-256 ba7dcce5f1e3340374ff693a1c22c5bf4ccb0c2709cd8c6d50474d4982f7cdfc. Open the byte-exact preserved source file.
% Part: first-order-logic% Chapter: syntax% Section: intro-syntax\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{fol}{syn}{itx}\olsection{Introduction}In order to develop the theory and metatheory of first-order logic, wemust first define the syntax and semantics of its expressions. Theexpressions of first-order logic are terms and !!{formula}s. Termsare formed from !!{variable}s, !!{constant}s, and !!{function}s.!!^{formula}s, in turn, are formed from !!{predicate}s together withterms (these form the smallest, ``atomic'' !!{formula}s), and thenfrom atomic !!{formula}s we can form more complex ones using logicalconnectives and quantifiers. There are many different ways to setdown the formation rules; we give just one possible one. Other systemswill chose different symbols, will select different sets ofconnectives as primitive, will use parentheses differently (or even notat all, as in the case of so-called Polish notation). What allapproaches have in common, though, is that the formation rules definethe set of terms and !!{formula}s \emph{inductively}. If doneproperly, every expression can result essentially in only one wayaccording to the formation rules. The inductive definition resultingin expressions that are \emph{uniquely readable} means we can givemeanings to these expressions using the same method---inductivedefinition.\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.
% Part: first-order-logic% Chapter: syntax-and-semantics% Section: first-order-languages\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{fol}{syn}{fol}\olsection{First-Order Languages}Expressions of first-order logic are built up from a basic vocabularycontaining \emph{!!{variable}s}, \emph{!!{constant}s},\emph{!!{predicate}s} and sometimes \emph{!!{function}s}. From them,together with logical connectives, quantifiers, and punctuationsymbols such as parentheses and commas, \emph{terms} and\emph{!!{formula}s} are formed.\begin{explain}Informally, !!{predicate}s are names for properties and relations,!!{constant}s are names for individual objects, and !!{function}s arenames for mappings. These, except for the !!{identity}~$\eq$, are the\emph{non-logical symbols} and together make up a language. Anyfirst-order language~$\Lang L$ is determined by its non-logicalsymbols. In the most general case, $\Lang L$ contains infinitely manysymbols of each kind.\end{explain}In the general case, we make use of the following symbols infirst-order logic:\begin{enumerate}\item Logical symbols\begin{enumerate}\item Logical connectives:\startycommalist\iftag{prvNot}{\ycomma $\lnot$ (negation)}{}%\iftag{prvAnd}{\ycomma $\land$ (conjunction)}{}%\iftag{prvOr}{\ycomma $\lor$ (disjunction)}{}%\iftag{prvIf}{\ycomma $\lif$ (!!{conditional})}{}%\iftag{prvIff}{\ycomma $\liff$ (!!{biconditional})}{}%\iftag{prvAll}{\ycomma $\lforall$ (universal quantifier)}{}%\iftag{prvEx}{\ycomma $\lexists$ (existential quantifier)}{}.\tagitem{prvFalse}{The propositional constant for !!{falsity}~$\lfalse$.}{}\tagitem{prvTrue}{The propositional constant for !!{truth}~$\ltrue$.}{}\item The two-place !!{identity}~$\eq$.\item A !!{denumerable}s set of !!{variable}s: $\Obj v_0$, $\Obj v_1$, $\Objv_2$, \dots\end{enumerate}\item Non-logical symbols, making up the \emph{standardlanguage} of first-order logic\begin{enumerate}\item A !!{denumerable}s set of $n$-place !!{predicate}s for each $n>0$: $\ObjA^n_0$, $\Obj A^n_1$, $\Obj A^n_2$, \dots\item A !!{denumerable}s set of !!{constant}s: $\Obj c_0$, $\Obj c_1$, $\Objc_2$, \dots.\item A !!{denumerable}s set of $n$-place !!{function}s for each $n>0$:$\Obj f^n_0$, $\Obj f^n_1$, $\Obj f^n_2$, \dots\end{enumerate}\item Punctuation marks: (, ), and the comma.\end{enumerate}Most of our definitions and results will be formulated for the fullstandard language of first-order logic. However, depending on theapplication, we may also restrict the language to only a few!!{predicate}s, !!{constant}s, and !!{function}s.\begin{ex}The language~$\Lang L_A$ of arithmetic contains a single two-place!!{predicate}~$<$, a single !!{constant}~$\Obj 0$, one one-place!!{function}~$\prime$, and two two-place !!{function}s~$+$ and~$\times$.\end{ex}\begin{ex}The language of set theory~$\Lang L_Z$ contains only the singletwo-place !!{predicate}~$\in$.\end{ex}\begin{ex}The language of orders~$\Lang L_\le$ contains only the two-place!!{predicate}~$\le$.\end{ex}Again, these are conventions: officially, these are just aliases,e.g., $<$, $\in$, and $\le$ are aliases for $\Obj A^2_0$, $\Obj 0$ for$\Obj c_0$, $\prime$ for $\Obj f^1_0$, $+$ for $\Obj f^2_0$, $\times$ for$\Obj f^2_1$.\iftag{defNot,defOr,defAnd,defIf,defIff,defTrue,defFalse,defEx,defAll}{%In addition to the primitive connectives and\iftag{notprvEx,notprvAll}{quantifier}{quantifiers} introducedabove, we also use the following \emph{defined} symbols:\startycommalist\iftag{defNot}{\ycomma $\lnot$ (negation)}{}%\iftag{defAnd}{\ycomma $\land$ (conjunction)}{}%\iftag{defOr}{\ycomma $\lor$ (disjunction)}{}%\iftag{defIf}{\ycomma $\lif$ (!!{conditional})}{}%\iftag{defIff}{\ycomma $\liff$ (!!{biconditional})}{}%\iftag{defAll}{\ycomma $\lforall$ (universal quantifier)}{}%\iftag{defEx}{\ycomma $\lexists$ (existential quantifier)}{}%\iftag{defFalse}{\ycomma !!{falsity}~$\lfalse$}{}%\iftag{defTrue}{\ycomma !!{truth}~$\ltrue$}}{}.\begin{tagblock}{defNot,defOr,defAnd,defIf,defIff,defTrue,defFalse,defEx,defAll}\begin{explain}A defined symbol is not officially part of the language, but isintroduced as an informal abbreviation: it allows us to abbreviateformulas which would, if we only used primitive symbols, get quitelong. This is obviously an advantage. The bigger advantage, however,is that proofs become shorter. If a symbol is primitive, it has to betreated separately in proofs. The more primitive symbols, therefore,the longer our proofs.\end{explain}\end{tagblock}% Alternate symbols\begin{intro}You may be familiar with different terminology and symbols than theones we use above. Logic texts (and teachers) commonly use$\sim$, $\neg$, or~!\ for ``negation'', $\wedge$, $\cdot$, or $\&$for ``conjunction''. Commonly used symbols for the ``conditional'' or``implication'' are $\rightarrow$, $\Rightarrow$, and $\supset$.\iftag{prvIff,defIff}{Symbols for ``biconditional,'' ``bi-implication,''or ``(material) equivalence'' are $\leftrightarrow$,$\Leftrightarrow$, and $\equiv$.}{}\iftag{prvFalse,defFalse}{The $\lfalse$ symbol is variously called``falsity,'' ``falsum,'', ``absurdity,'' or ``bottom.''}{}\iftag{prvTrue,defTrue}{The $\ltrue$ symbol is variously called``truth,'' ``verum,'' or ``top.''}{}It is conventional to use lower case letters (e.g., $a$, $b$, $c$) fromthe beginning of the Latin alphabet for !!{constant}s (sometimes callednames), and lower case letters from the end (e.g., $x$, $y$, $z$) for!!{variable}s. Quantifiers combine with !!{variable}s, e.g., $x$;notational variations include $\forall x$, $(\forall x)$, $(x)$, $\Pi x$,$\bigwedge_x$ for the universal quantifier and $\exists x$, $(\existsx)$, $(Ex)$, $\Sigma x$, $\bigvee_x$ for the existential quantifier.\end{intro}\begin{explain}We might treat all the propositional operators and both quantifiers asprimitive symbols of the language. We might instead choose a smallerstock of primitive symbols and treat the other !!{operator}s asdefined. ``Truth functionally complete'' sets of Boolean operatorsinclude $\{ \lnot, \lor \}$, $\{ \lnot, \land \}$, and $\{ \lnot,\lif\}$---these can be combined with either quantifier for anexpressively complete first-order language.You may be familiar with two other !!{operator}s: the Shefferstroke~$|$ (named after Henry Sheffer), and Peirce'sarrow~$\downarrow$, also known as Quine's dagger. When given theirusual readings of ``nand'' and ``nor'' (respectively), these operatorsare truth functionally complete by themselves.\end{explain}\end{document}
content/first-order-logic/syntax-and-semantics/terms-formulas.tex
237 lines; SHA-256 0b607ce2324ca66b23b164684f4f35b127107b903bbbd567eb25e94c2ce70210. Open the byte-exact preserved source file.
% Part: first-order-logic% Chapter: syntax-and-semantics% Section: terms-formulas\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{fol}{syn}{frm}\olsection{Terms and \printtoken{P}{formula}}Once a first-order language~$\Lang L$ is given, we can defineexpressions built up from the basic vocabulary of~$\Lang L$. Theseinclude in particular \emph{terms} and \emph{!!{formula}s}.\begin{defn}[Terms]\ollabel{defn:terms}The set of \emph{terms}~$\Trm[L]$ of~$\Lang L$ isdefined inductively by:\begin{enumerate}\item Every !!{variable} is a term.\item Every !!{constant} of~$\Lang L$ is a term.\item If $f$ is an $n$-place !!{function} and $t_1$, \dots, $t_n$are terms, then $\Atom{f}{t_1, \ldots, t_n}$ is a term.\tagitem{limitClause}{Nothing else is a term.}{}\end{enumerate}A term containing no !!{variable}s is a \emph{closed term}.\end{defn}\begin{explain}The !!{constant}s appear in our specification of the language and theterms as a separate category of symbols, but they could instead havebeen included as zero-place !!{function}s. We could then do withoutthe second clause in the definition of terms. We just have tounderstand $\Atom{f}{t_1, \ldots, t_n}$ as just $f$ by itself if $n =0$.\end{explain}\begin{defn}[Formulas]\ollabel{defn:formulas}The set of \emph{!!{formula}s}~$\Frm[L]$ of the language~$\Lang L$is defined inductively as follows:\begin{enumerate}\tagitem{prvFalse}{$\lfalse$ is an atomic !!{formula}.}{}\tagitem{prvTrue}{$\ltrue$ is an atomic !!{formula}.}{}\item If $R$ is an $n$-place !!{predicate} of~$\Lang L$ and $t_1$, \dots,$t_n$ are terms of~$\Lang L$, then $\Atom{R}{t_1,\ldots, t_n}$ is anatomic !!{formula}.\item If $t_1$ and $t_2$ are terms of~$\Lang L$, then $\Atom{\eq}{t_1, t_2}$is an atomic !!{formula}.\tagitem{prvNot}{If $!A$ is !!a{formula}, then $\lnot !A$ is!!a{formula}.}{}\tagitem{prvAnd}{If $!A$ and $!B$ are !!{formula}s, then $(!A \land!B)$ is !!a{formula}.}{}\tagitem{prvOr}{If $!A$ and $!B$ are !!{formula}s, then $(!A \lor !B)$is !!a{formula}.}{}\tagitem{prvIf}{If $!A$ and $!B$ are !!{formula}s, then $(!A \lif !B)$is !!a{formula}.}{}\tagitem{prvIff}{If $!A$ and $!B$ are !!{formula}s, then $(!A \liff !B)$is !!a{formula}.}{}\tagitem{prvAll}{If $!A$ is !!a{formula} and $x$ is !!a{variable},then $\lforall[x][!A]$ is !!a{formula}.}{}\tagitem{prvEx}{If $!A$ is !!a{formula} and $x$ is !!a{variable},then $\lexists[x][!A]$ is !!a{formula}.}{}\tagitem{limitClause}{Nothing else is !!a{formula}.}{}\end{enumerate}\end{defn}\begin{explain}The definitions of the set of terms and that of !!{formula}s are\emph{inductive definitions}. Essentially, we construct the set of!!{formula}s in infinitely many stages. In the initial stage, wepronounce all atomic formulas to be formulas; this corresponds to thefirst few cases of the definition, i.e., the cases for\iftag{prvTrue}{$\ltrue$, }{}%\iftag{prvFalse}{$\lfalse$, }{}%$\Atom{R}{t_1,\dots,t_n}$ and $\Atom{\eq}{t_1,t_2}$. ``Atomic!!{formula}'' thus means any !!{formula} of this form.The other cases of the definition give rules for constructing new!!{formula}s out of !!{formula}s already constructed. At the secondstage, we can use them to construct !!{formula}s out of atomic!!{formula}s. At the third stage, we construct new formulas from theatomic formulas and those obtained in the second stage, and so on. A!!{formula} is anything that is eventually constructed at such astage, and nothing else.\end{explain}By convention, we write $\eq$ between its arguments and leave out theparentheses: $\eq[t_1][t_2]$ is an abbreviation for$\Atom{\eq}{t_1,t_2}$. Moreover, $\lnot \Atom{\eq}{t_1,t_2}$ isabbreviated as $\eq/[t_1][t_2]$. When writing a formula $(!B \ast !C)$constructed from $!B$, $!C$ using a two-place connective~$\ast$, wewill often leave out the outermost pair of parentheses and writesimply~$!B \ast !C$.\begin{intro}Some logic texts require that the !!{variable}~$x$ must occur in~$!A$in order for\iftag{prvEx}{$\lexists[x][!A]$ }{}%\iftag{notprvEx,notprvAll}{}{and }%\iftag{prvAll}{$\lforall[x][!A]$ }{}%to count as\iftag{notprvEx,notprvAll}{!!a{formula}}{!!{formula}s}.Nothing bad happens if you don't require this, and it makes thingseasier.\end{intro}\begin{tagblock}{defNot,defOr,defAnd,defIf,defIff,defTrue,defFalse,defEx,defAll}\begin{defn}Formulas constructed using the defined operators are to be understoodas follows:\begin{tagenumerate}{defTrue,defFalse,defNot,defOr,defAnd,defIf,defIff,defEx,defAll}\tagitem{defTrue}{$\ltrue$ abbreviates\iftag{prvFalse}{$\lnot\lfalse$}{$(!A \lor \lnot !A)$ for somefixed atomic !!{formula}~$!A$}.}{}\tagitem{defFalse}{$\lfalse$ abbreviates\iftag{prvTrue}{$\lnot\ltrue$}{$(!A \land \lnot !A)$ for somefixed atomic !!{formula}~$!A$}.}{}\tagitem{defNot}{$\lnot !A$ abbreviates $!A \lif \lfalse$.}{}\tagitem{defOr}{$!A \lor !B$ abbreviates\iftag{prvAnd}{$\lnot(\lnot !A \land \lnot !B)$}{$\lnot !A \lif!B$}.}{}\tagitem{defAnd}{$!A \land !B$ abbreviates\iftag{prvOr}{$\lnot(\lnot !A \lor \lnot !B)$}{$\lnot (!A \lif\lnot !B)$}.}{}\tagitem{defIf}{$!A \lif !B$ abbreviates\iftag{prvOr}{$\lnot !A \lor !B)$}{$\lnot (!A \land \lnot !B)$}.}{}\tagitem{defIff}{$!A \liff !B$ abbreviates $(!A \lif !B) \land (!B\lif !A)$.}{}\tagitem{defAll}{$\lforall[x][!A]$ abbreviates $\lnot\lexists[x][\lnot !A]$.}{}\tagitem{defEx}{$\lexists[x][!A]$ abbreviates $\lnot\lforall[x][\lnot !A]$.}{}\end{tagenumerate}\end{defn}\end{tagblock}If we work in a language for a specific application, we will oftenwrite two-place !!{predicate}s and !!{function}s between therespective terms, e.g., $t_1 < t_2$ and $(t_1 + t_2)$ in the languageof arithmetic and $t_1 \in t_2$ in the language of set theory. Thesuccessor function in the language of arithmetic is even writtenconventionally \emph{after} its argument:~$t'$. Officially, however,these are just conventional abbreviations for $\Atom{\Obj A^2_0}{t_1, t_2}$,$\Obj f^2_0(t_1, t_2)$, $\Atom{\Obj A^2_0}{t_1, t_2}$ and $f^1_0(t)$,respectively.\begin{defn}[Syntactic identity]The symbol $\ident$ expresses syntactic identity between strings ofsymbols, i.e., $!A \ident !B$ iff $!A$ and $!B$ are strings of symbolsof the same length and which contain the same symbol in each place.\end{defn}The $\ident$ symbol may be flanked by strings obtained byconcatenation, e.g., $!A \ident (!B \lor !C)$ means: the string ofsymbols~$!A$ is the same string as the one obtained by concatenatingan opening parenthesis, the string $!B$, the $\lor$ symbol, thestring~$!C$, and a closing parenthesis, in this order. If this is thecase, then we know that the first symbol of~$!A$ is an openingparenthesis, $!A$ contains $!B$ as a substring (starting at the secondsymbol), that substring is followed by~$\lor$, etc.As terms and !!{formula}s are built up from basic elements via inductivedefinitions, we can use the following induction principles to provethings about them.\begin{lem}[\emph{Principle of induction on terms}]\ollabel{lem:trmind}Let $\Lang L$ be a first-order language.If some property~$P$ is such that%\begin{enumerate}\item it holds for every !!{variable}~$v$,%\item it holds for every !!{constant}~$a$ of~$\Lang L$, and%\item it holds for $f(t_1,\dotsc,t_n)$ whenever it holds for$t_1$,~\dots, $t_n$ and $f$~is an $n$-place!!{function} of~$\Lang L$\end{enumerate}(assuming $t_1$,~\dots, $t_n$ are terms of~$\Lang{L}$),then $P$ holds for every term in~$\Trm[L]$.\end{lem}\begin{prob}Prove \olref[fol][syn][frm]{lem:trmind}.\end{prob}\begin{lem}[\emph{Principle of induction on !!{formula}s}]\ollabel{thm:frmind}Let $\Lang L$ be a first-order language.If some property~$P$ holds for all the atomic !!{formula}sand is such that%\begin{enumerate}\tagitem{prvNot}{it holds for $\lnot !A$ whenever itholds for~$!A$;}{}\tagitem{prvAnd}{it holds for $(!A \land !B)$whenever it holds for $!A$ and~$!B$;}{}\tagitem{prvOr}{it holds for $(!A \lor !B)$whenever it holds for $!A$ and~$!B$;}{}\tagitem{prvIf}{it holds for $(!A \lif !B)$whenever it holds for $!A$ and~$!B$;}{}\tagitem{prvIff}{it holds for $(!A \liff !B)$whenever it holds for $!A$ and~$!B$;}{}\tagitem{prvEx}{it holds for $\lexists[x][!A]$whenever it holds for~$!A$;}{}\tagitem{prvAll}{it holds for $\lforall[x][!A]$whenever it holds for~$!A$;}{}\end{enumerate}(assuming $!A$ and $!B$ are !!{formula}s of~$\Lang{L}$),then $P$ holds for all formulas in~$\Frm[L]$.\end{lem}\end{document}
content/first-order-logic/syntax-and-semantics/unique-readability.tex
203 lines; SHA-256 f2ad2961312808ef6c8dedc884c9f8e00a2be9ef993cfb7be748a9d253d84e66. Open the byte-exact preserved source file.
% Part: first-order-logic% Chapter: syntax-and-semantics% Section: unique-readability\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{fol}{syn}{unq}\olsection{Unique Readability}\begin{explain}The way we defined !!{formula}s guarantees that every !!{formula} hasa \emph{unique reading}, i.e., there is essentially only one way ofconstructing it according to our formation rules for !!{formula}s andonly one way of ``interpreting'' it. If this were not so, we wouldhave ambiguous !!{formula}s, i.e., !!{formula}s that have more thanone reading or intepretation---and that is clearly something we wantto avoid. But more importantly, without this property, most of thedefinitions and proofs we are going to give will not go through.Perhaps the best way to make this clear is to see what would happen ifwe had given bad rules for forming !!{formula}s that would notguarantee unique readability. For instance, we could have forgottenthe parentheses in the formation rules for connectives, e.g., we mighthave allowed this:\begin{quote}If $!A$ and $!B$ are !!{formula}s, then so is $!A \lif !B$.\end{quote}Starting from an atomic formula $!D$, this would allow us to form $!D\lif !D$. From this, together with $!D$, we would get $!D \lif !D\lif !D$. But there are two ways to do this:\begin{enumerate}\item We take $!D$ to be $!A$ and $!D \lif !D$ to be $!B$.\item We take $!A$ to be $!D \lif !D$ and $!B$ is~$!D$.\end{enumerate}Correspondingly, there are two ways to``read'' the !!{formula}~$!D \lif !D \lif !D$. It is of the form $!B\lif !C$ where $!B$ is $!D$ and $!C$ is $!D \lif !D$, but \emph{it isalso} of the form $!B \lif !C$ with $!B$ being $!D \lif !D$ and $!C$being~$!D$.If this happens, our definitions will not always work. For instance,when we define the !!{main operator} of a formula, we say: in aformula of the form $!B \lif !C$, the !!{main operator} is theindicated occurrence of~$\lif$. But if we can match the formula $!D\lif !D \lif !D$ with $!B \lif !C$ in the two different ways mentionedabove, then in one case we get the first occurrence of $\lif$ as the!!{main operator}, and in the second case the second occurrence. Butwe intend the !!{main operator} to be a \emph{function} of the!!{formula}, i.e., every !!{formula} must have exactly one !!{mainoperator} occurrence.\end{explain}\begin{lem}The number of left and right parentheses in !!a{formula}~$!A$ areequal.\end{lem}\begin{proof}We prove this by induction on the way $!A$ is constructed. Thisrequires two things: (a) We have to prove first that all atomicformulas have the property in question (the induction basis). (b) Thenwe have to prove that when we construct new formulas out of givenformulas, the new formulas have the property provided the old ones do.Let $l(!A)$ be the number of left parentheses, and $r(!A)$ the numberof right parentheses in~$!A$, and $l(t)$ and $r(t)$ similarly thenumber of left and right parentheses in a term~$t$.\begin{prob}Prove that for any term~$t$, $l(t) = r(t)$.\end{prob}\begin{enumerate}\tagitem{prvFalse}{\indcase{!A}{\lfalse}{$\indfrm$ has $0$ left and $0$right parentheses.}}{}\tagitem{prvTrue}{\indcase{!A}{\ltrue}{$\indfrm$ has $0$ left and $0$right parentheses.}}{}\item \indcase{!A}{\Atom{R}{t_1,\dots,t_n}}{$l(\indfrm) = 1 + l(t_1) +\dots + l(t_n) = 1 + r(t_1) + \dots + r(t_n) = r(\indfrm)$. Here wemake use of the fact, left as an exercise, that $l(t) = r(t)$ forany term~$t$.}\item \indcase{!A}{\eq[t_1][t_2]}{$l(\indfrm) = l(t_1) + l(t_2) =r(t_1) + r(t_2) = r(\indfrm)$.}\tagitem{prvNot}{\indcase{!A}{\lnot !B}{By induction hypothesis,$l(!B) = r(!B)$. Thus $l(\indfrm) = l(!B) = r(!B) =r(\indfrm)$.}}{}\item \indcase{!A}{(!B \ast !C)}{By induction hypothesis, $l(!B) =r(!B)$ and $l(!C) = r(!C)$. Thus $l(\indfrm) = 1 + l(!B) + l(!C) =1 + r(!B) + r(!C) = r(\indfrm)$.}\tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{By inductionhypothesis, $l(!B) = r(!B)$. Thus, $l(\indfrm) = l(!B) = r(!B) =r(\indfrm)$.}}{}% Print case for \lexists if prvEx and not prvAll\tagitem{prvAll,notprvEx}{}{\indcase{!A}{\lexists[x][!B]}{By inductionhypothesis, $l(!B) = r(!B)$. Thus, $l(\indfrm) = l(!B) = r(!B) =r(\indfrm)$.}}% Just say similarly if prvEx and prvAll\tagitem{notprvAll,notprvEx}{}{\indcase{!A}{\lexists[x][!B]}{Similarly.}}\end{enumerate}\end{proof}\begin{defn}[Proper prefix]A string of symbols $!B$ is a \emph{proper prefix} of a string of symbols~$!A$ ifconcatenating $!B$ and a non-empty string of symbols yields~$!A$.\end{defn}\begin{lem}\ollabel{lem:no-prefix}If $!A$ is !!a{formula}, and $!B$ is a proper prefix of $!A$, then$!B$ is not !!a{formula}.\end{lem}\begin{proof}Exercise.\end{proof}\begin{prob}Prove \olref[fol][syn][unq]{lem:no-prefix}.\end{prob}\begin{prop}\ollabel{prop:unique-atomic}If $!A$ is an atomic !!{formula}, then it satisfies one, and only oneof the following conditions.\begin{enumerate}\tagitem{prvFalse}{$!A \ident \lfalse$.}{}\tagitem{prvTrue}{$!A \ident \ltrue$.}{}\item $!A \ident \Atom{R}{t_1,\dots,t_n}$ where $R$ is an $n$-place!!{predicate}, $t_1$, \dots, $t_n$ are terms, and each of $R$,$t_1$, \dots, $t_n$ is uniquely determined.\item $!A \ident \eq[t_1][t_2]$ where $t_1$ and $t_2$ are uniquelydetermined terms.\end{enumerate}\end{prop}\begin{proof}Exercise.\end{proof}\begin{prob}Prove \olref[fol][syn][unq]{prop:unique-atomic} (Hint: Formulate andprove a version of \olref[fol][syn][unq]{lem:no-prefix} for terms.)\end{prob}\begin{prop}[Unique Readability]Every !!{formula} satisfies one, and only one of the following conditions.\begin{enumerate}\item $!A$ is atomic.\tagitem{prvNot}{$!A$ is of the form $\lnot !B$.}{}\tagitem{prvAnd}{$!A$ is of the form $(!B \land !C)$.}{}\tagitem{prvOr}{$!A$ is of the form $(!B \lor !C)$.}{}\tagitem{prvIf}{$!A$ is of the form $(!B \lif !C)$.}{}\tagitem{prvIff}{$!A$ is of the form $(!B \liff !C)$.}{}\tagitem{prvAll}{$!A$ is of the form $\lforall[x][!B]$.}{}\tagitem{prvEx}{$!A$ is of the form $\lexists[x][!B]$.}{}\end{enumerate}Moreover, in each case $!B$, or $!B$ and $!C$, are uniquelydetermined. This means that, e.g., there are no different pairs $!B$,$!C$ and $!B'$, $!C'$ so that $!A$ is both of the form\iftag{prvIf}{$(!B \lif !C)$ and $(!B' \lif !C')$.}{\iftag{prvOr}{$(!B \lor !C)$ and $(!B' \lor !C')$.}{\iftag{prvAnd}{$(!B \land !C)$ and $(!B' \land !C')$.}{}}}\end{prop}\begin{proof}The formation rules require that if !!a{formula} is not atomic, itmust start with an opening parenthesis~(, \iftag{prvNot}{$\lnot$,}{}or a quantifier. On the other hand, every !!{formula} that starts withone of the following symbols must be atomic: !!a{predicate}, !!a{function}, !!a{constant}\iftag{prvFalse}{, $\lfalse$}{}\iftag{prvTrue}{, $\ltrue$}{}.So we really only have to show that if $!A$ is of the form $(!B \ast!C)$ and also of the form $(!B' \mathbin{\ast'} !C')$, then $!B \ident!B'$, $!C \ident !C'$, and $\ast = {\ast'}$.So suppose both $!A \ident (!B \ast !C)$ and $!A \ident (!B'\mathbin{\ast'} !C')$. Then either $!B \ident !B'$ or not. If it is,clearly $\ast = {\ast'}$ and $!C \ident !C'$, since they then aresubstrings of $!A$ that begin in the same place and are of the samelength. The other case is $!B \not\ident !B'$. Since $!B$ and$!B'$ are both substrings of $!A$ that begin at the same place, onemust be a proper prefix of the other. But this is impossible by\olref{lem:no-prefix}.\end{proof}\end{document}
content/first-order-logic/syntax-and-semantics/main-operator.tex
101 lines; SHA-256 1bc4cc76cc670fdb1069ca53312d13dfcf2ea8444adbb3d9ef4b8d31a5da41fc. Open the byte-exact preserved source file.
% Part: first-order-logic% Chapter: syntax-and-semantics% Section: main-operator\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{fol}{syn}{mai}\olsection{\printtoken{S}{main operator} of a Formula}\begin{explain}It is often useful to talk about the last operator used inconstructing !!a{formula}~$!A$. This operator is called the \emph{mainoperator} of~$!A$. Intuitively, it is the ``outermost'' operatorof $!A$. For example, the main operator of $\lnot !A$ is $\lnot$,the main operator of $(!A \lor !B)$ is $\lor$, etc.\end{explain}\begin{defn}[!!^{main operator}]\ollabel{def:main-op}The \emph{!!{main operator}} of !!a{formula}~$!A$ isdefined as follows:\begin{enumerate}\item \indcase*{!A}{!A}{$\indfrm$ has no !!{main operator}.}\tagitem{prvNot}{\indcase{!A}{\lnot !B}{the !!{main operator} of $\indfrm$is~$\lnot$.}}{}\tagitem{prvAnd}{\indcase{!A}{(!B \land !C)}{the !!{main operator} of$\indfrm$ is~$\land$.}}{}\tagitem{prvOr}{\indcase{!A}{(!B \lor !C)}{the !!{main operator} of$\indfrm$ is~$\lor$.}}{}\tagitem{prvIf}{\indcase{!A}{(!B \lif !C)}{the !!{main operator} of$\indfrm$ is~$\lif$.}}{}\tagitem{prvIff}{\indcase{!A}{(!B \liff !C)}{the !!{main operator} of$\indfrm$ is~$\liff$.}}{}\tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{the !!{main operator}of $\indfrm$ is~$\lforall$.}}{}\tagitem{prvEx}{\indcase{!A}{\lexists[x][!B]}{the !!{main operator} of$\indfrm$ is~$\lexists$.}}{}\end{enumerate}\end{defn}In each case, we intend the specific indicated \emph{occurrence} ofthe !!{main operator} in the formula. For instance, since the formula$((!D \lif !E) \lif (!E \lif !D))$ is of the form $(!B \lif !C)$ where$!B$ is $(!D \lif !E)$ and $!C$ is $(!E \lif !D)$, the secondoccurrence of $\lif$ is the !!{main operator}.\begin{explain}This is a \emph{recursive} definition of a function which maps allnon-atomic !!{formula}s to their !!{main operator} occurrence. Becauseof the way !!{formula}s are defined inductively, every!!{formula}~$!A$ satisfies one of the cases in \olref{def:main-op}.This guarantees that for each non-atomic !!{formula}~$!A$ !!a{mainoperator} exists. Because each !!{formula} satisfies only one of theseconditions, and because the smaller !!{formula}s from which $!A$ isconstructed are uniquely determined in each case, the !!{mainoperator} occurrence of~$!A$ is unique, and so we have defined afunction.\end{explain}We call !!{formula}s by the names in \olref{tab:main-op} depending onwhich symbol their !!{main operator}is.\iftag{defNot,defOr,defAnd,defIf,defIff,defTrue,defFalse,defEx,defAll}{ Recall, however, that defined operators do not officially appear in!!{formula}s. They are just abbreviations, so officially they cannotbe the main operator of a formula. In proofs about all !!{formula}sthey therefore do not have to be treated separately.}\begin{table}[!h]\centering\begin{tabular}{c | c | c}!!^{main operator} & Type of !!{formula} & Example\\\hlinenone & atomic (!!{formula}) &\iftag{prvFalse}{$\lfalse$,}{}\iftag{prvTrue}{$\ltrue$,}{}$\Atom{R}{t_1, \dots, t_n}$,$\eq[t_1][t_2]$\\$\lnot$ & negation & $\lnot !A$ \\$\land$ & conjunction & $(!A \land !B$) \\$\lor$ & disjunction & $(!A \lor !B$) \\$\lif$ & !!{conditional} & $(!A \lif !B$) \\$\liff$ & !!{biconditional} & $(!A \liff !B)$ \\$\lforall[][]$ & universal (!!{formula})& $\lforall[x][!A]$ \\$\lexists[][]$ & existential (!!{formula})& $\lexists[x][!A]$\end{tabular}\caption{Main operator and names of !!{formula}s}\ollabel{tab:main-op}\end{table}\end{document}
content/first-order-logic/syntax-and-semantics/subformulas.tex
111 lines; SHA-256 4c43825e4c236e55d25092ff1f5b68ed38a3f1e9ae8ed12fc2e14f3a03fc6c77. Open the byte-exact preserved source file.
% Part: first-order-logic% Chapter: syntax-and-semantics% Section: subformulas\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{fol}{syn}{sbf}\olsection{\printtoken{P}{subformula}}\begin{explain}It is often useful to talk about the !!{formula}s that ``make up'' agiven !!{formula}. We call these its \emph{!!{subformula}s}. Any!!{formula} counts as !!a{subformula} of itself; a subformula of $!A$other than $!A$ itself is a \emph{proper !!{subformula}}.\end{explain}\begin{defn}[Immediate !!^{subformula}]If $!A$ is !!a{formula}, the \emph{immediate !!{subformula}s}of $!A$ are defined inductively as follows:\begin{enumerate}\item Atomic !!{formula}s have no immediate !!{subformula}s.\tagitem{prvNot}{\indcase{!A}{\lnot !B}{The only immediate!!{subformula} of $\indfrm$ is~$!B$.}}{}\item \indcase{!A}{(!B \ast !C)}{The immediate !!{subformula}s of$\indfrm$ are $!B$ and $!C$ ($\ast$ is any one of the two-placeconnectives).}\tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{The only immediate!!{subformula} of $\indfrm$ is~$!B$.}}{}\tagitem{prvEx}{\indcase{!A}{\lexists[x][!B]}{The only immediate!!{subformula} of $\indfrm$ is~$!B$.}}{}\end{enumerate}\end{defn}\begin{defn}[Proper !!^{subformula}]If $!A$ is !!a{formula}, the \emph{proper !!{subformula}s}of $!A$ are defined recursively as follows:\begin{enumerate}\item Atomic !!{formula}s have no proper !!{subformula}s.\tagitem{prvNot}{\indcase{!A}{\lnot !B}{The proper !!{subformula}s of$\indfrm$ are~$!B$ together with all proper !!{subformula}sof~$!B$.}}{}\item \indcase{!A}{(!B \ast !C)}{The proper !!{subformula}s of$\indfrm$ are $!B$, $!C$, together with all proper !!{subformula}sof $!B$ and those of~$!C$.}\tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{The proper!!{subformula}s of $\indfrm$ are~$!B$ together with all proper!!{subformula}s of~$!B$.}}{}\tagitem{prvEx}{\indcase{!A}{\lexists[x][!B]}{The proper!!{subformula}s of $\indfrm$ are~$!B$ together with all proper!!{subformula}s of~$!B$.}}{}\end{enumerate}\end{defn}\begin{defn}[!!^{subformula}]The !!{subformula}s of $!A$ are $!A$ itself together with all itsproper !!{subformula}s.\end{defn}\begin{explain}Note the subtle difference in how we have defined immediate!!{subformula}s and proper !!{subformula}s. In the first case, wehave directly defined the immediate !!{subformula}s of a formula~$!A$for each possible form of~$!A$. It is an explicit definition bycases, and the cases mirror the inductive definition of the set of!!{formula}s. In the second case, we have also mirrored the way theset of all !!{formula}s is defined, but in each case we have alsoincluded the proper !!{subformula}s of the smaller !!{formula}s $!B$,$!C$ in addition to these !!{formula}s themselves. This makes thedefinition \emph{recursive}. In general, a definition of a functionon an inductively defined set (in our case, !!{formula}s) is recursiveif the cases in the definition of the function make use ofthe function itself. To be well defined, we must make sure, however,that we only ever use the values of the function for arguments thatcome ``before'' the one we are defining---in our case, when defining``proper !!{subformula}'' for $(!B \ast !C)$ we only use the proper!!{subformula}s of the ``earlier'' !!{formula}s $!B$ and $!C$.\end{explain}\begin{prop}\ollabel{prop:subfrm-trans}Suppose $!B$ is a subformula of $!A$ and $!C$ is a subformula of $!B$.Then $!C$ is a subformula of $!A$. In other words, the subformularelation is transitive.\end{prop}\begin{prob}Prove \olref[fol][syn][sbf]{prop:subfrm-trans}.\end{prob}\begin{prop}\ollabel{prop:count-subfrms}Suppose $!A$ is a formula with $n$ connectives and quantifiers.Then $!A$ has at most $2n+1$ subformulas.\end{prop}\begin{prob}Prove \olref[fol][syn][sbf]{prop:count-subfrms}.\end{prob}\end{document}
content/first-order-logic/syntax-and-semantics/formation-sequences.tex
278 lines; SHA-256 dc1735bb077f5086c6fd6e2f968591415a9cba90b65bc0a3d412742cc62bc6ff. Open the byte-exact preserved source file.
% Part: first-order-logic% Chapter: syntax-and-semantics% Section: formation-sequences\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{fol}{syn}{fseq}\olsection{Formation Sequences}Defining !!{formula}s via an inductive definition, and thecomplementary technique of proving properties of !!{formula}s viainduction, is an elegant and efficient approach. However, it canalso be useful to consider a more bottom-up, step-by-step approachto the construction of !!{formula}s, which we do here using thenotion of a \emph{formation sequence}.%To show how terms and !!{formula}s can be introduced in this waywithout needing to refer to their inductive definitions, we firstintroduce the notion of an arbitrary string of symbols drawn fromsome language~$\Lang L$.\begin{defn}[Strings]\ollabel{defn:string}Suppose $\Lang L$ is a first-order language. An \emph{$\LangL$-string} is a finite sequence of symbols of~$\Lang L$. Where thelanguage~$\Lang L$ is clearly fixed by the context, we will oftenrefer to a $\Lang L$-string simply as a \emph{string}.\end{defn}\begin{ex}For any first-order language $\Lang L$, all$\Lang L$-!!{formula}s are $\Lang L$-strings, but notconversely. For example, \[)(\Obj v_0\lif\lexists\] is an$\Lang L$-string but not an $\Lang L$-!!{formula}.\end{ex}\begin{defn}[Formation sequences for terms]\ollabel{defn:fseq-trm}A finite sequence of $\Lang L$-strings $\tuple{t_0,\dotsc,t_n}$ is a\emph{formation sequence} for a term $t$ if $t \ident t_n$ and for all$i \leq n$, either $t_i$ is !!a{variable} or !!a{constant}, or $\LangL$ contains a $k$-ary !!{function}~$f$ and there exist$m_0,\dotsc,m_k < i$ such that $t_i \ident f(t_{m_0},\dotsc,t_{m_k})$.When it is necessary to distinguish, we will refer to formationsequences for terms as \emph{term formation sequences}.\end{defn}\begin{ex}The sequence\[\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}}}\]is a formation sequence for the term $\Atom{\Obj f^1_0}{\Atom{\Objf^2_0}{\Obj c_0, \Obj v_0}}$, as is\[\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}}}.\]\end{ex}\begin{defn}[Formation sequences for formulas]\ollabel{defn:fseq-frm}A finite sequence of $\Lang L$-strings $\tuple{!A_0,\dotsc,!A_n}$is a \emph{formation sequence} for~$!A$ if $!A \ident !A_n$ andfor all $i \leq n$, either $!A_i$ is an atomic !!{formula} or thereexist $j,k < i$ and !!a{variable}~$x$ such that one of the followingholds:\begin{enumerate}\tagitem{prvNot}{$!A_i \ident \lnot !A_j$.}{}%\tagitem{prvAnd}{$!A_i \ident (!A_j \land !A_k)$.}{}%\tagitem{prvOr}{$!A_i \ident (!A_j \lor !A_k)$.}{}%\tagitem{prvIf}{$!A_i \ident (!A_j \lif !A_k)$.}{}%\tagitem{prvIff}{$!A_i \ident (!A_j \liff !A_k)$.}{}%\tagitem{prvAll}{$!A_i \ident \lforall[x][!A_j]$.}{}%\tagitem{prvEx}{$!A_i \ident \lexists[x][!A_j]$.}{}%\end{enumerate}When it is necessary to distinguish, we will refer to formationsequences for formulas as \emph{formula formation sequences}.\end{defn}\begin{ex}\[\tuple{\Atom{\Obj A^1_0}{\Obj v_0},\Atom{\Obj A^1_1}{\Obj c_1},(\Atom{\Obj A^1_1}{\Obj c_1} \land \Atom{\Obj A^1_0}{\Obj v_0}),\lexists[\Obj v_0][(\Atom{\Obj A^1_1}{\Obj c_1} \land \Atom{\Obj A^1_0}{\Obj v_0})]}\]is a formation sequence of $\lexists[\Obj v_0][(\Atom{\Obj A^1_1}{\Objc_1} \land \Atom{\Obj A^1_0}{\Obj v_0})]$, as is\begin{multline*}\tuple{\Atom{\Obj A^1_0}{\Obj v_0},\Atom{\Obj A^1_1}{\Obj c_1},(\Atom{\Obj A^1_1}{\Obj c_1} \land \Atom{\Obj A^1_0}{\Obj v_0}),\Atom{\Obj A^1_1}{\Obj c_1},\\\lforall[\Obj v_1][\Atom{\Obj A^1_0}{\Obj v_0}],\lexists[\Obj v_0][(\Atom{\Obj A^1_1}{\Obj c_1} \land \Atom{\Obj A^1_0}{\Obj v_0})]}.\end{multline*}%As can be seen from the second example, formation sequencesmay contain ``junk'': !!{formula}s which are redundant or do notcontribute to the construction.\end{ex}\begin{prop}\ollabel{prop:formed}Every !!{formula}~$!A$ in~$\Frm[L]$ has a formation sequence.\end{prop}\begin{proof}Suppose $!A$ is atomic. Then the sequence $\tuple{!A}$ is aformation sequence for~$!A$.%Now suppose that $!B$ and~$!C$ have formation sequences$\tuple{!B_0,\dotsc,!B_n}$ and $\tuple{!C_0,\dotsc,!C_m}$respectively.%\begin{enumerate}\tagitem{prvNot}{If $!A \ident \lnot !B$,then $\tuple{!B_0,\dotsc,!B_n,\lnot !B_n}$is a formation sequence for~$!A$.}{}\tagitem{prvAnd}{If $!A \ident (!B \land !C)$,then $\tuple{!B_0,\dotsc,!B_n,!C_0,\dotsc,!C_m,(!B_n \land !C_m)}$is a formation sequence for~$!A$.}{}\tagitem{prvOr}{If $!A \ident (!B \lor !C)$,then $\tuple{!B_0,\dotsc,!B_n,!C_0,\dotsc,!C_m,(!B_n \lor !C_m)}$is a formation sequence for~$!A$.}{}\tagitem{prvIf}{If $!A \ident (!B \lif !C)$,then $\tuple{!B_0,\dotsc,!B_n,!C_0,\dotsc,!C_m,(!B_n \lif !C_m)}$is a formation sequence for~$!A$.}{}\tagitem{prvIff}{If $!A \ident (!B \liff !C)$,then $\tuple{!B_0,\dotsc,!B_n,!C_0,\dotsc,!C_m,(!B_n \liff !C_m)}$is a formation sequence for~$!A$.}{}\tagitem{prvAll}{If $!A \ident \lforall[x][!B]$,then $\tuple{!B_0,\dotsc,!B_n,\lforall[x][!B_n]}$is a formation sequence for~$!A$.}{}\tagitem{prvEx}{If $!A \ident \lexists[x][!B]$,then $\tuple{!B_0,\dotsc,!B_n,\lexists[x][!B_n]}$is a formation sequence for~$!A$.}{}\end{enumerate}By the principle of induction on !!{formula}s,every !!{formula} has a formation sequence.\end{proof}We can also prove the converse. This is important because it showsthat our two ways of defining formulas are equivalent: they givethe same results. It also means that we can prove theorems aboutformulas by using ordinary induction on the length of formationsequences.\begin{lem}\ollabel{lem:fseq-init}Suppose that $\tuple{!A_0,\dotsc,!A_n}$ is a formation sequencefor~$!A_n$, and that $k \leq n$. Then $\tuple{!A_0,\dotsc,!A_k}$is a formation sequence for~$!A_k$.\end{lem}\begin{proof}Exercise.\end{proof}\begin{prob}Prove \olref[fol][syn][fseq]{lem:fseq-init}.\end{prob}\begin{thm}\ollabel{thm:fseq-frm-equiv}$\Frm[L]$ is the set of all $\Lang L$-strings~$!A$ such thatthere exists a formula formation sequence for~$!A$.\end{thm}\begin{proof}Let $F$ be the set of all strings of symbols in the language~$\Lang L$that have a formation sequence. We have seen in\olref[fol][syn][fseq]{prop:formed} that $\Frm[L] \subseteq F$, so nowwe prove the converse.Suppose $!A$ has a formation sequence $\tuple{!A_0,\dotsc,!A_n}$.We prove that $!A \in \Frm[L]$ by strong induction on~$n$.Our induction hypothesis is that every string of symbols with aformation sequence of length $m < n$ is in $\Frm[L]$.By the definition of a formation sequence, either $!A \ident !A_n$ isatomic or there must exist $j,k < n$ such that one of thefollowing is the case:\begin{enumerate}\tagitem{prvNot}{$!A \ident \lnot !A_j$.}{}%\tagitem{prvAnd}{$!A \ident (!A_j \land !A_k)$.}{}%\tagitem{prvOr}{$!A \ident (!A_j \lor !A_k)$.}{}%\tagitem{prvIf}{$!A \ident (!A_j \lif !A_k)$.}{}%\tagitem{prvIff}{$!A \ident (!A_j \liff !A_k)$.}{}%\tagitem{prvAll}{$!A \ident \lforall[x][!A_j]$.}{}%\tagitem{prvEx}{$!A \ident \lexists[x][!A_j]$.}{}%\end{enumerate}Now we reason by cases. If $!A$ is atomic then$!A_n \in \Frm[L_0]$. Suppose instead that$!A \equiv (!A_j \land !A_k)$. By\olref[fol][syn][fseq]{lem:fseq-init},$\tuple{!A_0,\dotsc,!A_j}$ and $\tuple{!A_0,\dotsc,!A_k}$ areformation sequences for $!A_j$ and~$!A_k$, respectively. Sincethese are proper initial subsequences of the formation sequencefor~$!A$, they both have length less than~$n$. Therefore bythe induction hypothesis, $!A_j$ and~$!A_k$ are in~$\Frm[L_0]$,and by the definition of !!a{formula}, so is$(!A_j \land !A_k)$. The other cases follow by parallelreasoning.\end{proof}Formation sequences for terms have similar properties to thosefor !!{formula}s.\begin{prop}\ollabel{prop:fseq-trm-equiv}$\Trm[L]$ is the set of all $\Lang L$-strings $t$such that there exists a term formation sequence for~$t$.\end{prop}\begin{proof}Exercise.\end{proof}\begin{prob}Prove \olref[fol][syn][fseq]{prop:fseq-trm-equiv}.Hint: use a similar strategy to that used in the proof of\olref[fol][syn][fseq]{thm:fseq-frm-equiv}.\end{prob}There are two types of ``junk'' that can appear in formationsequences: repeated elements, and elements that are irrelevantto the construction of the formation or term. We can eliminateboth by looking at minimal formation sequences.\begin{defn}[Minimal formation sequences]\ollabel{defn:minimal-fseq}A formation sequence $\tuple{!A_0, \ldots, !A_n}$ for aformula~$!A$ is a \emph{minimal formation sequence} for~$!A$if for every other formation sequence~$s$ for~$!A$,the length of~$s$ is greater than or equal to~$n+1$.Similarly, a formation sequence $\tuple{t_0, \ldots, t_n}$for a term~$t$ is a \emph{minimal formation sequence}for~$t$ if for every other formation sequence~$s$ for~$t$,the length of~$s$ is greater than or equal to~$n+1$.\end{defn}Note that a formula or term can have more than one minimalformation sequence, but they will contain exactly the samestrings.\begin{prop}\ollabel{prop:subformula-equivs}The following are equivalent:\begin{enumerate}\item $!B$ is a sub-!!{formula} of~$!A$.\item $!B$ occurs in every formation sequence of~$!A$.\item $!B$ occurs in a minimal formation sequence of~$!A$.\end{enumerate}\end{prop}\begin{proof}Exercise.\end{proof}\begin{prob}Prove \olref[fol][syn][fseq]{prop:subformula-equivs}.\end{prob}\begin{history}Formation sequences were introduced by Raymond Smullyan in histextbook \emph{First-Order Logic} \citep{Smullyan1968}.Additional properties of formation sequences were established by\citet{Zuckerman1973}.\end{history}\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.
% Part: first-order-logic% Chapter: syntax-and-semantics% Section: free-vars-sentences\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{fol}{syn}{fvs}\olsection{Free \printtoken{P}{variable} and \printtoken{P}{sentence}}\begin{defn}[Free occurrences of !!a{variable}]\ollabel{defn:free-occ}The \emph{free} occurrences of !!a{variable} in !!a{formula} are definedinductively as follows:\begin{enumerate}\item \indcase*{!A}{$!A$ is atomic}{all !!{variable} occurrences in$\indfrm$ are free.}\tagitem{prvNot}{\indcase{!A}{\lnot !B}{the free !!{variable}occurrences of $\indfrm$ are exactly those of $!B$.}}{}\item \indcase{!A}{(!B \ast !C)}{the free!!{variable} occurrences of $\indfrm$ are those in $!B$together with those in~$!C$.}\tagitem{prvAll}{\indcase{!A}{\lforall[x][!B]}{the free !!{variable}occurrences in $\indfrm$ are all of those in~$!B$ except foroccurrences of~$x$.}}{}\tagitem{prvEx}{\indcase{!A}{\lexists[x][!B]}{the free !!{variable}occurrences in $\indfrm$ are all of those in~$!B$ except foroccurrences of~$x$.}}{}\end{enumerate}\end{defn}\begin{defn}[Bound Variables]An occurrence of !!a{variable} in a formula~$!A$ is \emph{bound} ifit is not free.\end{defn}\begin{prob}Give an inductive definition of the bound variable occurrences alongthe lines of \olref[fol][syn][fvs]{defn:free-occ}.\end{prob}\begin{defn}[Scope]\iftag{prvAll}{If $\lforall[x][!B]$ is an occurrence of a subformulain a formula~$!A$, then the corresponding occurrence of~$!B$ in~$!A$is called the \emph{scope} of the corresponding occurrenceof~$\lforall[x]$. \iftag{prvEx}{Similarly for $\lexists[x]$.}{}}{If$\lexists[x][!B]$ is an occurrence of a subformula in aformula~$!A$, then the corresponding occurrence of~$!B$ in~$!A$ iscalled the \emph{scope} of the corresponding occurrenceof~$\lexists[x]$.}If $!B$ is the scope of a quantifier occurrence\iftag{prvAll}{$\lforall[x]$\iftag{prvEx}{ or$\lexists[x]$}{}}{$\lexists[x]$} in~$!A$, then the free occurrences of$x$ in~$!B$ are bound in \iftag{prvAll}{$\lforall[x][!B]$\iftag{prvEx}{ and$\lexists[x][!B]$}{}}{$\lexists[x][!B]$}. We say that theseoccurrences are \emph{bound by} thementioned quantifier occurrence.\end{defn}\begin{ex}Consider the following formula:\[\lexists[\Obj v_0][\underbrace{\Atom{\Obj A^2_0}{\Obj v_0,\Obj v_1}}_{!B}]\]$!B$ represents the scope of $\lexists[\Obj v_0]$.The quantifier binds the occurrence of $\Obj v_0$ in $!B$, butdoes not bind the occurrence of $\Obj v_1$. So $\Obj v_1$ isa free variable in this case.We can now see how this might work in a more complicated!!{formula}~$!A$:\[\lforall[\Obj v_0][\underbrace{(\Atom{\Obj A^1_0}{\Obj v_0} \lif\Atom{\Obj A^2_0}{\Obj v_0, \Obj v_1})}_{!B}] \lif \lexists[\Objv_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}]\]$!B$ is the scope of the first $\lforall[\Obj v_0]$, $!C$ is the scopeof $\lexists[\Obj v_1]$, and $!D$ is the scope of the second$\lforall[\Obj v_0]$. The first $\lforall[\Obj v_0]$ binds theoccurrences of $\Obj v_0$ in~$!B$, $\lexists[\Obj v_1]$ binds the occurrenceof $\Obj v_1$ in $!C$, and the second $\lforall[\Obj v_0]$ binds theoccurrence of $\Obj v_0$ in~$!D$. The first occurrence of $\Obj v_1$and the fourth occurrence of $\Obj v_0$ are free in~$!A$. The lastoccurrence of $\Obj v_0$ is free in $!D$, but bound in $!C$ and~$!A$.\end{ex}\begin{defn}[Sentence]!!^a{formula}~$!A$ is \article{sentence} \emph{!!{sentence}} iff itcontains no free occurrences of !!{variable}s.\end{defn}% add examples!\end{document}
content/first-order-logic/syntax-and-semantics/substitution.tex
126 lines; SHA-256 19393c28f5f036da9c43ce10bfb5f1b2f330dca8cb2ad950d98eab5b1b7e83b2. Open the byte-exact preserved source file.
% Part: first-order-logic% Chapter: syntax-and-semantics% Section: substitution\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{fol}{syn}{sub}\olsection{Substitution}\begin{defn}[Substitution in a term]We define $\Subst{s}{t}{x}$, the result of \emph{substituting} $t$for every occurrence of~$x$ in $s$, recursively:\begin{enumerate}\item \indcase{s}{c}{$\Subst{\indfrm}{t}{x}$ is just $s$.}\item \indcase{s}{y}{$\Subst{\indfrm}{t}{x}$ is also just~$s$,provided $y$ is a variable and $y \not\ident x$.}\item \indcase{s}{x}{$\Subst{\indfrm}{t}{x}$ is~$t$.}\item\indcase{s}{\Atom{f}{t_1, \dots, t_n}}{$\Subst{\indfrmp}{t}{x}$ is$\Atom{f}{\Subst{t_1}{t}{x}, \dots, \Subst{t_n}{t}{x}}$.}\end{enumerate}\end{defn}\begin{defn}A term~$t$ is \emph{!!{free for}} $x$ in $!A$ if none of the freeoccurrences of~$x$ in $!A$ occur in the scope of a quantifier thatbinds a variable in~$t$.\end{defn}\begin{ex} ~\begin{enumerate}\item $\Obj v_8$ is free for $\Obj v_1$ in $\lexists[\Objv_3]\Atom{\Obj A^2_4}{\Obj v_3,\Obj v_1}$\item $\Obj f^2_1(\Obj v_1, \Obj v_2)$ is \emph{not} free for $\Objv_0$ in $\lforall[\Obj v_2]\Atom{\Obj A^2_4}{\Obj v_0,\Obj v_2}$\end{enumerate}\end{ex}\begin{defn}[Substitution in !!a{formula}]If $!A$ is !!a{formula}, $x$~is !!a{variable}, and $t$~is a term!!{free for}~$x$ in~$!A$, then $\Subst{!A}{t}{x}$ is the result ofsubstituting $t$ for all free occurrences of~$x$ in~$!A$.\begin{enumerate}\tagitem{prvFalse}{\indcase{!A}{\lfalse}{$\Subst{\indfrm}{t}{x}$ is$\lfalse$.}}{}\tagitem{prvTrue}{\indcase{!A}{\ltrue}{$\Subst{\indfrm}{t}{x}$ is$\ltrue$.}}{}\item \indcase{!A}{\Atom{P}{t_1,\dots,t_n}}{$\Subst{\indfrm}{t}{x}$ is $\Atom{P}{\Subst{t_1}{t}{x},\dots, \Subst{t_n}{t}{x}}$.}\item \indcase{!A}{\eq[t_1][t_2]}{$\Subst{\indfrmp}{t}{x}$ is$\Subst{t_1}{t}{x} = \Subst{t_2}{t}{x}$.}\tagitem{prvNot}{\indcase{!A}{\lnot !B}{$\Subst{\indfrmp}{t}{x}$ is$\lnot \Subst{!B}{t}{x}$.}}{}\tagitem{prvAnd}{\indcase{!A}{(!B \land!C)}{$\Subst{\indfrmp}{t}{x}$ is $(\Subst{!B}{t}{x} \land\Subst{!C}{t}{x})$.}}{}\tagitem{prvOr}{\indcase{!A}{(!B \lor!C)}{$\Subst{\indfrmp}{t}{x}$ is $(\Subst{!B}{t}{x} \lor\Subst{!C}{t}{x})$.}}{}\tagitem{prvIf}{\indcase{!A}{(!B \lif!C)}{$\Subst{\indfrmp}{t}{x}$ is $(\Subst{!B}{t}{x} \lif\Subst{!C}{t}{x})$.}}{}\tagitem{prvIff}{\indcase{!A}{(!B \liff!C)}{$\Subst{\indfrmp}{t}{x}$ is $(\Subst{!B}{t}{x} \liff\Subst{!C}{t}{x})$.}}{}\tagitem{prvAll}{\indcase{!A}{\lforall[y][!B]}{$\Subst{\indfrmp}{t}{x}$is $\lforall[y][\Subst{!B}{t}{x}]$, provided $y$ is a variableother than $x$; otherwise $\Subst{\indfrmp}{t}{x}$is just $\indfrm$.}}{}\tagitem{prvEx}{\indcase{!A}{\lexists[y][!B]}{$\Subst{\indfrmp}{t}{x}$is $\lexists[y][\Subst{!B}{t}{x}]$, provided $y$ is a variableother than $x$; otherwise $\Subst{\indfrmp}{t}{x}$is just $\indfrm$.}}{}\end{enumerate}\end{defn}\begin{explain}Note that substitution may be vacuous: If $x$ does not occur in $!A$at all, then $\Subst{!A}{t}{x}$ is just~$!A$.The restriction that $t$ must be !!{free for}~$x$ in~$!A$ is necessary toexclude cases like the following. If $!A \ident \lexists[y][x < y]$and $t \ident y$, then $\Subst{!A}{t}{x}$ would be $\lexists[y][y <y]$. In this case the free variable $y$ is ``captured'' by thequantifier $\lexists[y]$ upon substitution, and that is undesirable.For instance, we would like it to be the case that whenever$\lforall[x][!B]$ holds, so does $\Subst{!B}{t}{x}$. But consider$\lforall[x][\lexists[y][x < y]]$ (here $!B$ is $\lexists[y][x <y]$). It is a sentence that is true about, e.g., the natural numbers:for every number~$x$ there is a number~$y$ greater than it. If weallowed $y$ as a possible substitution for~$x$, we would end up with$\Subst{!B}{y}{x} \ident \lexists[y][y < y]$, which is false. Weprevent this by requiring that none of the free variables in~$t$ wouldend up being bound by a quantifier in~$!A$.\end{explain}We often use the following convention to avoid cumbersome notation: If$!A$ is !!a{formula} which may contain the !!{variable}~$x$ free, wealso write~$!A(x)$ to indicate this. When it is clear which $!A$and~$x$ we have in mind, and $t$ is a term (assumed to be free for $x$in $!A(x)$), then we write $!A(t)$ as short for $\Subst{!A}{t}{x}$. Sofor instance, we might say, ``we call $!A(t)$ an instanceof~$\lforall[x][!A(x)]$.'' By this we mean that if $!A$~is any!!{formula}, $x$~!!a{variable}, and $t$~a term that's free for~$x$in~$!A$, then $\Subst{!A}{t}{x}$ is an instance of~$\lforall[x][!A]$.\end{document}