content/second-order-logic/metatheory/metatheory.tex
1% Part: second-order-logic2% Chapter: metatheory34\documentclass[../../../include/open-logic-chapter]{subfiles}56\begin{document}78\olchapter{sol}{met}{Metatheory of Second-order Logic}910\olimport{introduction}1112\olimport{second-order-arithmetic}1314\olimport{undecidability-and-axiomatizability}1516\olimport{compactness}1718\olimport{loewenheim-skolem}1920\OLEndChapterHook2122\end{document}
content/second-order-logic/metatheory/introduction.tex
1% Part: second-order-logic2% Chapter: metatheory3% Section: introduction45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{sol}{met}{int}1011\olsection{Introduction}1213First-order logic has a number of nice properties. We know it is not14decidable, but at least it is axiomatizable. That is, there are proof15systems for first-order logic which are sound and complete, i.e., they16give rise to !!a{derivability} relation~$\Proves$ with the property17that for any set of !!{sentence}s~$\Gamma$ and !!{sentence}~$!A$,18$\Gamma \Entails !A$ iff $\Gamma \Proves !A$. This means in19particular that the validities of first-order logic are !!{computably20 enumerable}. There is a computable function~$f\colon \Nat \to21\Sent[L]$ such that the values of~$f$ are all and only the valid22!!{sentence}s of~$\Lang{L}$. This is so because !!{derivation}s can be23enumerated, and those that !!{derive} a single~!!{sentence} are then24mapped to that !!{sentence}. Second-order logic is more expressive25than first-order logic, and so it is in general more complicated to26capture its validities. In fact, we'll show that second-order logic27is not only undecidable, but its validities are not even !!{computably28 enumerable}. This means there can be no sound and complete proof29system for second-order logic (although sound, but incomplete proof30systems are available and in fact are important objects of research).3132First-order logic also has two more properties: it is compact (if33every finite subset of a set~$\Gamma$ of !!{sentence}s is satisfiable,34$\Gamma$ itself is satisfiable) and the L\"owenheim--Skolem Theorem35holds for it (if $\Gamma$ has an infinite model it has36!!a{denumerable} model). Both of these results fail for second-order37logic. Again, the reason is that second-order logic can express facts38about the size of !!{domain}s that first-order logic cannot.3940\end{document}
content/second-order-logic/metatheory/second-order-arithmetic.tex
1% Part: second-order-logic2% Chapter: metatheory3% Section: second-order-arithmetic45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{sol}{met}{spa}1011\olsection{Second-order Arithmetic}1213Recall that the theory $\Th{PA}$ of Peano arithmetic includes the14eight axioms of~$\Th{Q}$,15\begin{align*}16& \lforall[x][\eq/[x'][\Obj 0]]\\17& \lforall[x][\lforall[y][(\eq[x'][y'] \lif \eq[x][y])]]\\18& \lforall[x][(\eq[x][\Obj 0] \lor \lexists[y][\eq[x][y']])]\\ 19& \lforall[x][\eq[(x + \Obj 0)][x]]\\20& \lforall[x][\lforall[y][\eq[(x + y')][(x + y)']]]\\21& \lforall[x][\eq[(x \times \Obj 0)][\Obj 0]]\\22& \lforall[x][\lforall[y][\eq[(x \times y')][((x \times y) + x)]]]\\23& \lforall[x][\lforall[y][(x < y \liff \lexists[z][\eq[(z' + x)][y]])]]\\24\intertext{plus all sentences of the form}25& (!A(\Obj 0) \land \lforall[x][(!A(x) \lif !A(x'))]) \lif \lforall[x][!A(x)].26\end{align*}27The latter is a ``schema,'' i.e., a pattern that generates infinitely28many !!{sentence}s of the language of arithmetic, one for each29!!{formula}~$!A(x)$. We call this schema the (first-order)30\emph{axiom schema of induction}. 31In \emph{second-order} Peano arithmetic~$\Th{PA^2}$, induction32can be stated as a single sentence. $\Th{PA^2}$33consists of the first eight axioms above plus the (second-order)34\emph{induction axiom}:35\[36\lforall[X][((X(\Obj 0) \land \lforall[x][(X(x) \lif X(x'))]) \lif \lforall[x][X(x)])].37\]38It says that if a subset~$X$ of the !!{domain}39contains~$\Assign{\Obj{0}}{M}$ and with any~$x \in \Domain{M}$ also40contains~$\Assign{\prime}{M}(x)$ (i.e., it is ``closed under41successor'') it contains everything in the !!{domain} (i.e., $X =42\Domain{M})$.4344The induction axiom guarantees that any !!{structure} satisfying it45contains only those !!{element}s of~$\Domain{M}$ the axioms require to46be there, i.e., the values of~$\num{n}$ for $n \in \Nat$. A model of47$\Th{PA^2}$ contains no non-standard numbers.4849\begin{thm}50\ollabel{thm:sol-pa-standard}51If $\Sat{M}{\Th{PA^2}}$ then $\Domain{M} =52\Setabs{\Value{\num{n}}{M}}{n \in \Nat}$.53\end{thm}5455\begin{proof}56Let $N = \Setabs{\Value{\num{n}}{M}}{n \in \Nat}$, and suppose57$\Sat{M}{\Th{PA^2}}$. Of course, for any $n \in \Nat$,58$\Value{\num{n}}{M} \in \Domain{M}$, so $N \subseteq \Domain{M}$.5960Now for inclusion in the other direction. Consider a variable61assignment $s$ with $s(X) = N$. By assumption,62\begin{align*}63\Sat{M}{\lforall[X][((X(\Obj 0) \land \lforall[x][(X(x)64 \lif X(x'))]) \lif \lforall[x][X(x)])]}, & \text{ thus}\\65\Sat{M}{(X(\Obj 0) \land \lforall[x][(X(x) \lif X(x'))]) \lif66 \lforall[x][X(x)]}[s]. & 67\end{align*}68Consider the antecedent of this conditional. $\Value{\Obj{0}}{M} \in69N$, and so $\Sat{M}{X(\Obj{0})}[s]$. The second conjunct,70$\lforall[x][(X(x) \lif X(x'))]$ is also satisfied. For suppose $x \in71N$. By definition of~$N$, $x = \Value{\num{n}}{M}$ for some~$n$. That72gives $\Assign{\prime}{M}(x) = \Value{\num{n+1}}{M} \in N$. So,73$\Assign{\prime}{M}(x) \in N$.7475We have that $\Sat{M}{X(\Obj 0) \land \lforall[x][(X(x) \lif X(x'))]}[s]$.76Consequently, $\Sat{M}{\lforall[x][X(x)]}[s]$. But that means that for77every $x \in \Domain{M}$ we have $x \in s(X) = N$. So, $\Domain{M}78\subseteq N$.79\end{proof}8081\begin{cor}82\ollabel{cor:sol-pa-categorical}83Any two models of~$\Th{PA^2}$ are isomorphic.84\end{cor}8586\begin{proof}87By \olref{thm:sol-pa-standard}, the domain of any model of $\Th{PA^2}$88is exhausted by $\Value{\num{n}}{M}$. Any such model is also a model89of~$\Th{Q}$. By \olref[mod][mar][stm]{prop:thq-standard}, any such90model is standard, i.e., isomorphic to~$\Struct{N}$.91\end{proof}9293Above we defined $\Th{PA^2}$ as the theory that contains the first eight 94arithmetical axioms plus the second-order induction axiom. In fact, thanks95to the expressive power of second-order logic, only the \emph{first two} 96of the arithmetical axioms plus induction are needed for second-order Peano 97arithmetic.9899\begin{prop}\ollabel{prop:sol-pa-definable}100Let $\Th{PA^{2\dagger}}$ be the second-order theory containing the101first two arithmetical axioms (the successor axioms) and the102second-order induction axiom. Then $\le$, $+$, and $\times$ are definable103in $\Th{PA^{2\dagger}}$.104\end{prop}105106\begin{proof}107To show that $\le$ is definable, we have to find a formula~$!A_\le(x, y)$108such that $\Sat{N}{!A_\le(\num n, \num m)}$ iff $n \le m$. Consider the formula109\[110!B(x, Y) \ident Y(x) \land \lforall[y][(Y(y) \lif Y(y'))]111\]112Clearly, $!B(\num n, Y)$ is satisfied by a set $Y \subseteq \Nat$ iff113$\Setabs{m}{n \le m} \subseteq Y$, so we can take $!A_\le(x, y) \ident114\lforall[Y][(!B(x, Y) \lif Y(y))]$.115116To see that addition is definable observe that $k+l=m$ iff there is a117function $u$ such that $u(0)=k$, $u(n')=u(n)'$ for all $n$, and $m = u(l)$. 118We can use this equivalence to define addition in $\Th{PA^{2\dagger}}$ 119by the following formula:120\[121!A_+(x,y,z) \ident \lexists[u][(u(\Obj 0)=x \land \lforall[w][u(x')=u122 (x)'] \land u(y)=z)]123\] 124It should be clear that $\Sat{N}{!A_+(\num k, \num l, \num m)}$ 125iff $k+l=m$.126\end{proof}127128\begin{prob}129Complete the proof of \olref[sol][met][spa]{prop:sol-pa-definable}.130\end{prob}131132\end{document}
content/second-order-logic/metatheory/undecidability-and-axiomatizability.tex
1% Part: second-order-logic2% Chapter: metatheory3% Section: undecidability-and-axiomatizability45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{sol}{met}{nax}1011\olsection{Second-order Logic is not Axiomatizable}121314\begin{thm}15\ollabel{thm:sol-undecidable}16Second-order logic is undecidable.17\end{thm}1819\begin{proof}20A first-order !!{sentence} is valid in first-order logic iff it is21valid in second-order logic, and first-order logic is undecidable.22\end{proof}2324\begin{thm}25\ollabel{cor:sol-not-axiomatizable}26There is no sound and complete !!{derivation} system for second-order logic.27\end{thm}2829\begin{proof}30Let $!A$ be !!a{sentence} in the language of arithmetic. $\Sat{N}{!A}$31iff $\Th{PA^2} \Entails !A$. Let $!P$ be the conjunction of the nine32axioms of~$\Th{PA^2}$. $\Th{PA^2} \Entails !A$ iff $\Entails !P \lif33!A$, i.e., $\Sat{M}{!P \lif !A$}. Now consider the !!{sentence}34$\lforall[z][\lforall[u][\lforall[u'][\lforall[u''][\lforall[L][(!P' \lif !A')]]]]]$ resulting by35replacing $\Obj{0}$ by $z$, $\prime$ by the one-place function36variable $u$, $+$ and $\times$ by the two-place function-variables 37$u'$ and $u''$, respectively,38and $<$ by the two-place relation variable~$L$ and39universally quantifying. It is a valid sentence of pure second-order40logic iff the original sentence was valid iff $\Th{PA^2} \Entails !A$41iff $\Sat{N}{!A}$. Thus if there were a sound and complete proof42system for second-order logic, we could use it to define a computable43enumeration $f\colon \Nat \to \Sent[L_A]$ of the !!{sentence}s true44in~$\Struct{N}$. This function would be representable in~$\Th{Q}$ by45some first-order formula~$!B_f(x, y)$. Then the46!!{formula}~$\lexists[x][!B_f(x, y)]$ would define the set of true47first-order !!{sentence}s of~$\Struct{N}$, contradicting Tarski's48Theorem.49\end{proof}50515253\end{document}
content/second-order-logic/metatheory/compactness.tex
1% Part: second-order-logic2% Chapter: metatheory3% Section: compactness45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{sol}{met}{com}1011\olsection{Second-order Logic is not Compact}1213\begin{explain}14Call a set of sentences~$\Gamma$ \emph{finitely satisfiable} if every15one of its finite subsets is satisfiable. First-order logic has the16property that if a set of !!{sentence}s~$\Gamma$ is finitely17satisfiable, it is satisfiable. This property is called18\emph{compactness}. It has an equivalent version involving19entailment: if $\Gamma \Entails !A$, then already $\Gamma_0 \Entails20!A$ for some finite subset~$\Gamma_0 \subseteq \Gamma$. In this21version it is an immediate corollary of the completeness theorem: for22if $\Gamma \Entails !A$, by completeness $\Gamma \Proves !A$. But a23!!{derivation} can only make use of finitely many !!{sentence}s24of~$\Gamma$.2526Compactness is not true for second-order logic. There are sets of27second-order !!{sentence}s that are finitely satisfiable but not28satisfiable, and that entail some~$!A$ without a finite subset29entailing~$!A$. 30\end{explain}313233\begin{thm}34\ollabel{thm:sol-undecidable}35Second-order logic is not compact.36\end{thm}3738\begin{proof}39Recall that 40\[41\fn{Inf} \ident \lexists[u][(\lforall[x][\lforall[y][(\eq[u(x)][u(y)]42 \lif \eq[x][y])]] \land \lexists[y][\lforall[x][\eq/[y][u(x)]]])]43\]44is satisfied in !!a{structure} iff its domain is infinite. Let45$!A^{\ge n}$ be a sentence that asserts that the domain has at least46$n$ !!{element}s, e.g.,47\[48!A^{\ge n} \ident \lexists[x_1][\dots\lexists[x_n][(\eq/[x_1][x_2]49 \land \eq/[x_1][x_3] \land \dots \land \eq/[x_{n-1}][x_n])]].50\]51Consider the set of !!{sentence}s52\[53\Gamma = \{\lnot \fn{Inf}, !A^{\ge 1}, !A^{\ge 2}, !A^{\ge 3}, \dots\}.54\]55It is finitely satisfiable, since for any finite subset~$\Gamma_056\subseteq \Gamma$57there is some $k$ so that $!A^{\ge k} \in \Gamma$ but no $!A^{\ge n}58\in \Gamma$ for $n>k$. If $\Domain{M}$ has $k$ !!{element}s,59$\Sat{M}{\Gamma_0}$. But, $\Gamma$ is not satisfiable: if60$\Sat{M}{\lnot \fn{Inf}}$, $\Domain{M}$ must be finite, say, of61size~$k$. Then $\Sat/{M}{!A^{\ge k+1}}$.62\end{proof}6364\begin{prob}65Give an example of a set~$\Gamma$ and !!a{sentence}~$!A$ so that66$\Gamma \Entails !A$ but for every finite subset~$\Gamma_0 \subseteq67\Gamma$, $\Gamma_0 \Entails/ !A$.68\end{prob}697071\end{document}
content/second-order-logic/metatheory/loewenheim-skolem.tex
1% Part: second-order-logic2% Chapter: metatheory3% Section: compactness45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{sol}{met}{lst}1011\olsection{The L\"owenheim--Skolem Theorem Fails for Second-order Logic}1213\begin{explain}14The (Downward) L\"owenheim--Skolem Theorem states that every set of15!!{sentence}s with an infinite model has !!a{enumerable} model. It,16too, is a consequence of the completeness theorem: the proof of17completeness generates a model for any consistent set of18!!{sentence}s, and that model is !!{enumerable}. There is also an19Upward L\"owenheim--Skolem Theorem, which guarantees that if a set of20!!{sentence}s has !!a{denumerable} model it also has21!!a{nonenumerable} model. Both theorems fail in second-order logic.22\end{explain}232425\begin{thm}26\ollabel{thm:sol-no-ls} The L\"owenheim--Skolem Theorem fails for27second-order logic: There are !!{sentence}s with infinite models but28no !!{enumerable} models.29\end{thm}3031\begin{proof}32Recall that 33\[34\fn{Count} \ident \lexists[z][\lexists[u][\lforall[X][((X(z) \land35 \lforall[x][(X(x) \lif X(u(x)))]) \lif \lforall[x][X(x)])]]]36\]37is true in !!a{structure}~$\Struct{M}$ iff $\Domain{M}$ is38!!{enumerable}, so $\lnot\fn{Count}$ is true in~$\Struct{M}$39iff $\Domain{M}$ is !!{nonenumerable}. There are40such !!{structure}s---take any !!{nonenumerable} set as the41!!{domain}, e.g., $\Pow{\Nat}$ or~$\Real$. So $\lnot \fn{Count}$ 42has infinite models but no !!{enumerable} models.43\end{proof}4445\begin{thm}46There are !!{sentence}s with !!{denumerable} but no47!!{nonenumerable} models.48\end{thm}4950\begin{proof}51$\fn{Count} \land \fn{Inf}$ is true in $\Nat$ but not in any52 !!{structure}~$\Struct{M}$ with $\Domain{M}$ !!{nonenumerable}.53\end{proof}545556\end{document}