Incompleteness

Representability in Q

content/incompleteness/representability-in-q/representability-in-q.tex

% Part: incompleteness% Chapter: representability-in-q\documentclass[../../../include/open-logic-chapter]{subfiles}\begin{document}\olchapter{inc}{req}{Representability in $\Th{Q}$}\olimport{introduction}\olimport{representable-comp}\olimport{beta-function}\olimport{prim-rec}\olimport{basic-representable}\olimport{composition-representable}\olimport{minimization-representable}\olimport{comp-representable}\olimport{representing-relations}\olimport{undecidability}\olimport{sigma1-completeness}\OLEndChapterHook\end{document}

content/incompleteness/representability-in-q/introduction.tex

% Part: incompleteness% Chapter: representability-in-q% Section: introduction\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{int}\olsection{Introduction}The incompleteness theorems apply to theories in which basic factsabout computable functions can be expressed and proved.  We willdescribe a very minimal such theory called ``$\Th{Q}$'' (or, sometimes,``Robinson's $Q$,'' after Raphael Robinson). We will say what it meansfor a function to be \emph{representable} in $\Th{Q}$, and then wewill prove the following:\begin{quote}  A function is representable in $\Th{Q}$ if and only if it is computable.\end{quote}For one thing, this provides us with another model ofcomputability. But we will also use it to show that the set$\Setabs{!A}{\Th{Q} \Proves !A}$ is not decidable, by reducing thehalting problem to it. By the time we are done, we will have provedmuch stronger things than this.The language of $\Th{Q}$ is the language ofarithmetic; $\Th{Q}$ consists of the following axioms(to be used in conjunction with the other axioms and rules offirst-order logic with !!{identity}):\begin{align*}& \lforall[x][\lforall[y][(\eq[x'][y'] \lif \eq[x][y])]] \tag{$!Q_1$}\\& \lforall[x][\eq/[\Obj 0][x']] \tag{$!Q_2$}\\& \lforall[x][(\eq[x][\Obj 0] \lor \lexists[y][\eq[x][y']])] \tag{$!Q_3$}\\& \lforall[x][\eq[(x + \Obj 0)][x]] \tag{$!Q_4$}\\& \lforall[x][\lforall[y][\eq[(x + y')][(x + y)']]] \tag{$!Q_5$}\\& \lforall[x][\eq[(x \times \Obj 0)][\Obj 0]] \tag{$!Q_6$}\\& \lforall[x][\lforall[y][\eq[(x \times y')][((x \times y) + x)]]] \tag{$!Q_7$}\\& \lforall[x][\lforall[y][(x < y \liff \lexists[z][\eq[(z' + x)][y]])]] \tag{$!Q_8$}\end{align*}For each natural number $n$, define the numeral $\num{n}$ to be theterm $\Obj{0}^{\prime\prime\ldots\prime}$ where there are $n$ tick marks inall.  So, $\num{0}$ is the !!{constant}~$\Obj{0}$ by itself, $\num{1}$is $\Obj{0}'$, $\num{2}$ is $\Obj{0}''$, etc.As a theory of arithmetic, $\Th{Q}$ is \emph{extremely} weak; forexample, you can't even prove very simple facts like$\lforall[x][\eq/[x][x']]$ or $\lforall[x][\lforall[y][(x + y) = (y +    x)]]$. But we will see that much of the reason that $\Th{Q}$ is sointeresting is \emph{because} it is so weak. In fact, it is justbarely strong enough for the incompleteness theorem to hold. Anotherreason $\Th{Q}$ is interesting is because it has a \emph{finite} setof axioms.A stronger theory than $\Th{Q}$ (called \emph{Peano arithmetic} $\Th{PA}$)is obtained by adding a schema of induction to~$\Th{Q}$:\[(!A(\Obj 0) \land \lforall[x][(!A(x) \lif !A(x'))]) \lif \lforall[x][!A(x)]\]where $!A(x)$ is any formula. If $!A(x)$ contains free !!{variable}sother than $x$, we add universal quantifiers to the front to bind allof them (so that the corresponding instance of the induction schema is!!a{sentence}). For instance, if $!A(x, y)$ also contains the!!{variable}~$y$ free, the corresponding instance is\[\lforall[y][((!A(\Obj 0) \land \lforall[x][(!A(x) \lif !A(x'))]) \lif  \lforall[x][!A(x)])]\]Using instances of the induction schema, one can prove much more fromthe axioms of~$\Th{PA}$ than from those of $\Th{Q}$. In fact, it takesa good deal of work to find ``natural'' statements about the naturalnumbers that can't be proved in Peano arithmetic!{}\begin{defn}\ollabel{defn:representable-fn}  A function $f(x_0,\ldots,x_k)$ from the natural numbers to  the natural numbers is said to be {\em representable in $\Th{Q}$} if  there is a formula $!A_f(x_0,\dots,x_k,y)$ such that whenever  $f(n_0,\dots,n_k) = m$, $\Th{Q}$ proves\begin{enumerate}\item\ollabel{defn:rep:a} $!A_f(\num{n_0}, \dots, \num{n_k}, \num{m})$\item\ollabel{defn:rep:b} $\lforall[y][(!A_f(\num{n_0}, \dots,\num{n_k}, y) \lif \num{m} = y)]$.\end{enumerate}\end{defn}There are other ways of stating the definition; for example, we couldequivalently require that $\Th{Q}$ proves $\lforall[y][(!A_f(\num{n_0}, \dots,\num{n_k}, y) \liff \eq[y][\num{m}])]$.\begin{thm}\ollabel{thm:representable-iff-comp}A function is representable in $\Th{Q}$ if and only if it is computable.\end{thm}There are two directions to proving the theorem. The left-to-rightdirection is fairly straightforward once arithmetization of syntax isin place. The other direction requires more work.  Here is the basicidea: we pick ``general recursive'' as a way of making ``computable''precise, and show that every general recursive function isrepresentable in~$\Th{Q}$. Recall that a function is general recursiveif it can be defined from $\Zero$, the successor function~$\Succ$, and theprojection functions~$\Proj{n}{i}$, using composition, primitive recursion,and regular minimization. So one way of showing that every generalrecursive function is representable in~$\Th{Q}$ is to show that thebasic functions are representable, and whenever some functions arerepresentable, then so are the functions defined from them usingcomposition, primitive recursion, and regular minimization. In otherwords, we might show that the basic functions are representable, andthat the representable functions are ``closed under'' composition,primitive recursion, and regular minimization.  This guarantees thatevery general recursive function is representable.It turns out that the step where we would show that representablefunctions are closed under primitive recursion is hard. In order toavoid this step, we show first that in fact we can do withoutprimitive recursion. That is, we show that every general recursivefunction can be defined from basic functions using composition andregular minimization alone.  To do this, we show that primitiverecursion can actually be done by a specific regular minimization.However, for this to work, we have to add some additional basicfunctions: addition, multiplication, and the characteristic functionof the identity relation~$\Char{=}$.  Then, we can prove the theoremby showing that all of \emph{these} basic functions are representablein~$\Th{Q}$, and the representable functions are closed undercomposition and regular minimization.\end{document}

content/incompleteness/representability-in-q/representable-comp.tex

% Part: incompleteness% Chapter: representability-in-q% Section: representable-comp\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{rpc}\olsection{Functions Representable in $\Th{Q}$ are Computable}We'll prove that every function that is representable in~$\Th{Q}$ iscomputable. We first have to establish a lemma about functionsrepresentable in~$\Th{Q}$.\begin{lem}\ollabel{lem:rep-q}  If $f(x_0,  \dots, x_k)$ is representable in~$\Th{Q}$, there is  !!a{formula}~$!A(x_0, \dots, x_k, y)$ such that  \[  \Th{Q} \Proves !A_f(\num{n_0}, \dots, \num{n_k}, \num{m})  \quad\text{iff}\quad m = f(n_0, \dots, n_k).  \]\end{lem}\begin{proof}  The ``if'' part is\olref[int]{defn:representable-fn}\olref[int]{defn:rep:a}. The ``onlyif'' part is seen as follows: Suppose $\Th{Q} \Proves !A_f(\num{n_0},\dots, \num{n_k}, \num{m})$ but $m \neq f(n_0, \dots, n_k)$. Let $l =f(n_0, \dots, n_k)$. By\olref[int]{defn:representable-fn}\olref[int]{defn:rep:a}, $\Th{Q}\Proves !A_f(\num{n_0}, \dots, \num{n_k}, \num{l})$. By\olref[int]{defn:representable-fn}\olref[int]{defn:rep:b},$\lforall[y][(!A_f(\num{n_0}, \dots, \num{n_k}, y) \lif \num{l} =y)]$. Using logic and the assumption that $\Th{Q} \Proves!A_f(\num{n_0}, \dots, \num{n_k}, \num{m})$, we get that $\Th{Q}\Proves \eq[\num{l}][\num{m}]$. On the other hand, by\olref[bre]{lem:q-proves-neq}, $\Th{Q} \Proves\eq/[\num{l}][\num{m}]$. So $\Th{Q}$ is inconsistent. But that isimpossible, since $\Th{Q}$ is satisfied by the standard model (see\olref[int][def]{def:standard-model}), $\Sat{N}{\Th{Q}}$, andsatisfiable theories are always consistent by the Soundness Theorem(\tagrefs{prfAX/{fol:axd:sou:cor:consistency-soundness},prfSC/{fol:seq:sou:cor:consistency-soundness},prfND/{fol:ntd:sou:cor:consistency-soundness},prfTab/{fol:tab:sou:cor:consistency-soundness}}).\end{proof}\begin{lem}Every function that is representable in $\Th{Q}$ is computable.\end{lem}\begin{proof}Let's first give the intuitive idea for why this is true. Tocompute~$f$, we do the following.  List all the possible!!{derivation}s~$\delta$ in the language of arithmetic. This ispossible to do mechanically. For each one, check if it is!!a{derivation} of !!a{formula} of the form~$!A_f(\num{n_0}, \dots,\num{n_k}, \num{m})$ (the !!{formula} representing $f$ in~$\Th{Q}$from \olref{lem:rep-q}). If it is, $m = f(n_0, \dots, n_k)$ by\olref{lem:rep-q}, and we've found the value of~$f$. The searchterminates because $\Th{Q} \Proves !A_f(\num{n_0}, \dots, \num{n_k},\num{f(n_0, \dots, n_k)})$, so eventually we find a $\delta$ of theright sort.This is not quite precise because our procedure operates on!!{derivation}s and !!{formula}s instead of just on numbers, and wehaven't explained exactly why ``listing all possible !!{derivation}s''is mechanically possible.  But as we've seen, it is possible to codeterms, !!{formula}s, and !!{derivation}s by G\"odel numbers. We'vealso introduced a precise model of computation, the general recursivefunctions. And we've seen that the relation $\Prf[\Th{Q}](d,y)$, whichholds iff $d$ is the G\"odel number of !!a{derivation} of the !!{formula}with G\"odel number~$y$ from the axioms of~$\Th{Q}$, is (primitive)recursive. Other primitive recursive functions we'll need are$\fn{num}$ (\olref[art][trm]{prop:num-primrec}) and $\fn{Subst}$(\olref[art][sub]{prop:subst-primrec}).  From these, it is possible todefine~$f$ by minimization; thus, $f$ is recursive.First, define\begin{multline*}  A(n_0, \dots, n_k, m) = \\  \fn{Subst}(\fn{Subst}(\dots\fn{Subst}(\Gn{!A_f}, \fn{num}(n_0), \Gn{x_0}),\\ \dots),  \fn{num}(n_k),  \Gn{x_k}), \fn{num}(m), \Gn{y})\end{multline*}This looks complicated, but it's just the function $A(n_0, \dots, n_k,m) = \Gn{!A_f(\num{n_0}, \dots, \num{n_k}, \num{m})}$.Now, consider the relation~$R(n_0, \dots, n_k, s)$ which holds if$(s)_0$ is the G\"odel number of !!a{derivation} from~$\Th{Q}$ of$!A_f(\num{n_0}, \dots, \num{n_k}, \num{(s)_1})$:\[R(n_0, \dots, n_k, s) \quad\text{iff}\quad \Prf[\Th{Q}]((s)_0, A(n_0,\dots, n_k, (s)_1))\]If we can find an~$s$ such that $R(n_0, \dots, n_k, s)$ holds, we havefound a pair of numbers---$(s)_0$ and~$(s)_1$---such that $(s)_0$ isthe G\"odel number of !!a{derivation} of~$A_f(\num{n_0}, \dots,\num{n_k}, (s)_1)$. So looking for~$s$ is like looking for the pair$d$ and $m$ in the informal proof. And a computable function that``looks for'' such an $s$ can be defined by regular minimization.Note that $R$ is regular: for every $n_0$, \dots, $n_k$, there is!!a{derivation}~$\delta$ of $\Th{Q} \Proves !A_f(\num{n_0}, \dots,\num{n_k}, \num{f(n_0, \dots, n_k)})$, so $R(n_0, \dots, n_k, s)$holds for $s = \tuple{\Gn{\delta}, f(n_0, \dots, n_k)}$.  So, we canwrite $f$ as\[f(n_0,\dots,n_{k}) = (\umin{s}{R(n_0, \dots, n_k, s)})_1.\]\end{proof}\end{document}

content/incompleteness/representability-in-q/beta-function.tex

% Part: incompleteness% Chapter: representability-in-q% Section: beta-function\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{bet}\olsection{The Beta Function Lemma}In order to show that we can carry out primitive recursion ifaddition, multiplication, and $\Char{=}$ are available, we need todevelop functions that handle sequences. (If we had exponentiation aswell, our task would be easier.) When we had primitive recursion, wecould define things like the ``$n$-th prime,'' and pick a fairlystraightforward coding. But here we do not have primitiverecursion---in fact we want to show that we can do primitive recursionusing minimization---so we need to be more clever.\begin{lem}\ollabel{lem:beta}There is a function $\beta(d,i)$ such that for every sequence $a_0$,\dots,~$a_n$ there is a number~$d$, such that for every $i \le n$,$\beta(d,i) = a_i$. Moreover, $\beta$ can be defined from the basicfunctions using just composition and regular minimization.\end{lem}Think of $d$ as coding the sequence $\tuple{a_0, \dots, a_n}$, and$\beta(d,i)$ returning the $i$-th element. (Note that this ``coding''does \emph{not} use the power-of-primes coding we're already familiarwith!). The lemma is fairly minimal; it doesn't say we can concatenatesequences or append elements, or even that we can \emph{compute}~$d$from $a_0$, \dots,~$a_n$ using functions definable by composition andregular minimization. All it says is that there is a ``decoding''function such that every sequence is ``coded.''The use of the notation $\beta$ is G\"odel's. To repeat, the hard partof proving the lemma is defining a suitable~$\beta$ using theseemingly restricted resources, i.e., using just composition andminimization---however, we're allowed to use addition, multiplication,and~$\Char{=}$. There are various ways to prove this lemma, but one ofthe cleanest is still G\"odel's original method, which used anumber-theoretic fact called Sunzi's Theorem(traditionally, the ``Chinese Remainder Theorem'').\begin{defn}Two natural numbers $a$ and $b$ are \emph{relatively prime} iff theirgreatest common divisor is~$1$; in other words, they have no otherdivisors in common.\end{defn}\begin{defn}Natural numbers $a$ and $b$ are \emph{congruent modulo~$c$},$a \equiv b \mod c$, iff $c \mid (a-b)$, i.e., $a$ and $b$ have thesame remainder when divided by~$c$.\end{defn}Here is Sunzi's Theorem:\begin{thm}Suppose $x_0$, \dots,~$x_n$ are (pairwise) relatively prime. Let$y_0$, \dots,~$y_n$ be any numbers. Then there is a number $z$ such that\begin{align*}z & \equiv y_0 \mod x_0 \\z & \equiv y_1 \mod x_1 \\& \vdots  \\z & \equiv y_n \mod x_n.\end{align*}\end{thm}Here is how we will use Sunzi's Theorem: if $x_0$,\dots,~$x_n$ are bigger than $y_0$, \dots,~$y_n$ respectively, then wecan take $z$ to code the sequence $\tuple{y_0, \dots,y_n}$. Torecover~$y_i$, we need only divide $z$ by~$x_i$ and take theremainder. To use this coding, we will need to find suitable valuesfor $x_0$, \dots,~$x_n$.A couple of observations will help us in this regard. Given$y_0$, \dots,~$y_n$, let\begin{align*}j &= \max(n, y_0 + 1, \dots, y_n + 1), \\m &= \lcm(1,\dots,j),\end{align*}and let\begin{align*}x_0 & = 1 + m \\x_1 & = 1 + 2 \cdot m \\x_2 & = 1 + 3 \cdot m \\& \vdots  \\x_n & = 1 + (n+1) \cdot m\end{align*}Then two things are true:\begin{enumerate}\item\ollabel{rel-prime} $x_0,\dots,x_n$ are relatively prime.\item\ollabel{less} For each $i$, $y_i < x_i$.\end{enumerate}To see that \olref{rel-prime} is true, note that if $p$ is a prime numberand $p \mid x_i$ and $p \mid x_k$, then $p \mid 1 + (i+1) m$ and$p \mid 1 + (k+1) m$. But then $p$ divides their difference,\[(1 + (i+1)m) - (1+ (k+1)m) = (i-k) m.\]Since $p$ divides $1 + (i+1)m$, it can't divide $m$ as well(otherwise, the first division would leave a remainder of~$1$). So $p$divides $i-k$, since $p$ divides $(i-k)m$. But $\left|i-k\right|$ is atmost~$n$, and we have chosen $j \geq n$, so this implies that$p \mid m$, again a contradiction. So there is no prime number dividingboth $x_i$ and $x_k$. Clause~\olref{less} is easy:we have $y_i < j \leq m < x_i$.Now let us prove the $\beta$ function lemma. Remember that we can use$0$, successor, plus, times, $\Char{=}$, projections, and any functiondefined from them using composition and minimization applied toregular functions. We can also use a relation if its characteristicfunction is so definable. As before we can show that these relationsare closed under Boolean combinations and bounded quantification; forexample:\begin{align*}\fn{not}(x) & \defis \Char{=}(x,0)\\\bmin{x \leq z}{R(x,y)} & \defis \umin{x}{(R(x,y) \lor x = z)}\\\bexists{x \leq z}{R(x,y)} & \defiff R(\bmin{x \leq z}{R(x,y)}, y)\end{align*}We can then show that all of the following are also definable withoutprimitive recursion:\begin{enumerate}\item The pairing function, $J(x,y) = \frac{1}{2}[(x+y)(x+y+1)] + x$;% maybe explain more what is going on here, a bit confusing.\item the projection functions\begin{align*}K(z) & = \bmin{x \leq z}{\bexists{y \leq z}{z = J(x,y)}},\\L(z) & = \bmin{y \leq z}{\bexists{x \leq z}{z = J(x,y)}};\end{align*}\item the less-than relation $x < y$;\item the divisibility relation $x \mid y$;% \item $x \tsub y$% \item $\fn{Prime}(x)$% \item Assuming $p$ is prime, the relation ``$x$ is a power of $p$'':% \[% \bforall{y \leq x}{(y \mid x \lif y = 1 \lor y = x)}.% \]\item the function $\fn{rem}(x,y)$ which returns the remainder when  $y$ is divided by~$x$.\end{enumerate}Now define\begin{align*}\beta^*(d_0,d_1,i) & = \fn{rem}(1+(i+1) d_1,d_0) \text{ and}\\\beta(d,i) & = \beta^*(K(d),L(d),i).\end{align*}This is the function we want. Given $a_0,\dots,a_n$ as above, let\[j = \max(n,a_0+1,\dots,a_n+1),\]and let $d_1 = \lcm(1,\dots,j)$. By \olref{rel-prime} above,we know that $1+d_1$, $1+2 d_1$, \dots, $1+(n+1) d_1$ are relativelyprime, and by~\olref{less} that all are greater than $a_0,\dots,a_n$.By Sunzi's Theorem there is a value~$d_0$ such that for each~$i$,\[d_0 \equiv a_i \mod (1+(i+1)d_1)\]and so (because $d_1$ is greater than~$a_i$),\[a_i = \fn{rem}(1+(i+1)d_1,d_0).\]Let $d = J(d_0,d_1)$. Then for each $i \le n$, we have\begin{align*}\beta(d,i) & =  \beta^*(d_0,d_1,i) \\& =  \fn{rem}(1+(i+1) d_1,d_0) \\& =  a_i\end{align*}which is what we need. This completes the proof of the$\beta$-function lemma.\begin{prob}  Show that the relations $x < y$, $x \mid y$, and the  function~$\fn{rem}(x,y)$ can be defined without primitive recursion.  You may use $0$, successor, plus, times, $\Char{=}$, projections,  and bounded minimization and quantification.\end{prob}\end{document}

content/incompleteness/representability-in-q/prim-rec.tex

% Part: incompleteness% Chapter: representability-in-q% Section: prim-rec\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{pri}\olsection{Simulating Primitive Recursion}Now we can show that definition by primitive recursion can be``simulated'' by regular minimization using the beta function. Supposewe have $f(\vec x)$ and $g(\vec x, y, z)$. Then the function~$h(x,\vecz)$ defined from $f$ and~$g$ by primitive recursion is\begin{align*}h(\vec x, 0) & =  f(\vec x) \\h(\vec x, y+1) & =  g(\vec x, y, h(\vec x, y)).\end{align*}We need to show that $h$ can be defined from $f$ and~$g$ using justcomposition and regular minimization, using the basic functions andfunctions defined from them using composition and regular minimization(such as~$\beta$).\begin{lem}\ollabel{lem:prim-rec}If $h$ can be defined from $f$ and $g$ using primitive recursion, itcan be defined from $f$, $g$, the functions $\Zero$, $\Succ$,$\Proj{n}{i}$, $\Add$, $\Mult$, $\Char{=}$, using composition andregular minimization.\end{lem}\begin{proof}First, define an auxiliary function $\hat h(\vec x, y)$ which returnsthe least number~$d$ such that $d$ codes a sequence which satisfies\begin{enumerate}\item $(d)_0 = f(\vec x)$, and\item for each $i < y$, $(d)_{i+1} = g(\vec x, i, (d)_i)$,\end{enumerate}where now $(d)_i$ is short for $\beta(d,i)$. In other words, $\hat h$returns the sequence $\tuple{h(\vec x, 0), h(\vec x, 1), \dots, h(\vecx, y)}$. We can write $\hat h$ as\[\hat h(\vec x, y) = \umin{d}{(\beta(d,0) = f(\vec x) \land \bforall{i <  y}{\beta(d,i+1) = g(\vec x, i,\beta(d,i)})}.\]Note: no primitive recursion is needed here, just minimization. Thefunction we minimize is regular because of the beta function lemma\olref[bet]{lem:beta}.But now we have\[h(\vec x, y) = \beta(\hat h(\vec x, y), y),\]so $h$ can be defined from the basic functions using just compositionand regular minimization.\end{proof}\end{document}

content/incompleteness/representability-in-q/basic-representable.tex

% Part: incompleteness% Chapter: representability-in-q% Section: basic-representable\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{bre}\olsection{Basic Functions are Representable in~$\Th{Q}$}First we have to show that all the basic functions are representablein~$\Th{Q}$. In the end, we need to show how to assign to each $k$-arybasic function $f(x_0,\dots,x_{k-1})$ !!a{formula}$!A_f(x_0,\dots,x_{k-1},y)$ that represents it.We will be able to represent zero, successor, plus, times, thecharacteristic function for equality, and projections. In each case,the appropriate representing function is entirely straightforward; forexample, zero is represented by the formula $y = \Obj 0$, successor isrepresented by the !!{formula} $x_0' = y$, and addition is representedby the !!{formula} $(x_0 + x_1) = y$. The work involves showing that$\Th{Q}$ can prove the relevant !!{sentence}s; for example, sayingthat addition is represented by the !!{formula} above involves showingthat for every pair of natural numbers $m$ and $n$, $\Th{Q}$ proves\begin{align*}& \eq[\num n + \num m][\num {n+m}] \text{ and}\\& \lforall[y][(\eq[(\num n + \num m)][y] \lif \eq[y][\num{n+m}])].\end{align*}\begin{prop}\ollabel{prop:rep-zero}The zero function $\Zero(x) = 0$ is represented in~$\Th{Q}$ by$!A_{\Zero}(x,y) \ident \eq[y][\Obj 0]$.\end{prop}\begin{prop}\ollabel{prop:rep-succ}The successor function $\Succ(x) = x+1$ is represented in~$\Th{Q}$ by$!A_{\Succ}(x,y) \ident \eq[y][x']$.  \end{prop}\begin{prop}\ollabel{prop:rep-proj}The projection function $\Proj{n}{i}(x_0, \dots, x_{n-1}) = x_i$ isrepresented in~$\Th{Q}$ by \[!A_{\Proj{n}{i}}(x_0, \dots, x_{n-1}, y) \ident \eq[y][x_i].\]\end{prop}\begin{prob}Prove that $\eq[y][\Obj 0]$, $\eq[y][x']$, and $\eq[y][x_i]$ represent$\Zero$, $\Succ$, and $\Proj{n}{i}$, respectively.\end{prob}\begin{prop}\ollabel{prop:rep-id}The characteristic function of~$=$,\[\Char{=}(x_0, x_1) =\begin{cases}  1 & \text{if } x_0 =x_1\\  0 & otherwise\end{cases}\]is represented in~$\Th{Q}$ by\[  !A_{\Char{=}}(x_0, x_1, y) \ident (\eq[x_0][x_1] \land \eq[y][\num{1}]) \lor (\eq/[x_0][x_1] \land\eq[y][\num{0}]).\]\end{prop}The proof requires the following lemma.\begin{lem}\ollabel{lem:q-proves-neq} Given natural numbers $n$ and $m$, if $n\neq m$, then $\Th{Q} \Proves \eq/[\num n][\num m]$.\end{lem}\begin{proof}Use induction on $n$ to show that for every $m$, if $n \neq m$, then$Q \Proves \eq/[\num n][\num m]$.In the base case, $n = 0$. If $m$ is not equal to $0$, then $m = k +1$ for some natural number $k$. We have an axiom that says$\lforall[x][\eq/[0][x']]$. By a quantifier axiom, replacing $x$ by  $\num k$, we can conclude $\eq/[0][\num k']$. But $\num k'$ is just  $\num m$.In the induction step, we can assume the claim is true for $n$, andconsider $n+1$. Let $m$ be any natural number. There are twopossibilities: either $m = 0$ or for some $k$ we have $m = k+1$. Thefirst case is handled as above. In the second case, suppose $n+1 \neqk+1$. Then $n \neq k$. By the induction hypothesis for $n$ we have$\Th{Q} \Proves \eq/[\num n][\num k]$. We have an axiom that says$\lforall[x][\lforall[y][\eq[x'][y'] \lif \eq[x][y]]]$. Using aquantifier axiom, we have $\eq[\num n'][\num k'] \lif \eq[\num n][\num  k]$. Using propositional logic, we can conclude, in $\Th{Q}$,$\eq/[\num n][\num k] \lif \eq/[\num n'][\num k']$. Using modusponens, we can conclude $\eq/[\num n'][\num k']$, which is what we want,since $\num k'$ is $\num m$.\end{proof}\begin{explain}Note that the lemma does not say much: in essence it says that $\Th{Q}$ canprove that different numerals denote different objects. For example,$\Th{Q}$ proves $0'' \neq 0'''$. But showing that this holds in generalrequires some care. Note also that although we are using induction, itis induction \emph{outside} of $\Th{Q}$.\end{explain}\begin{proof}[Proof of \olref{prop:rep-id}]If $n = m$, then $\num{n}$ and $\num{m}$ are the same term, and$\Char{=}(n, m) = 1$. But $\Th{Q} \Proves (\eq[\num{n}][\num{m}] \land\eq[\num{1}][\num{1}])$, so it proves $!A_=(\num{n}, \num{m},\num{1})$.  If $n \neq m$, then $\Char=(n, m) = 0$. By\olref{lem:q-proves-neq}, $\Th{Q} \Proves \eq/[\num{n}][\num{m}]$ andso also $(\eq/[\num{n}][\num{m}] \land \Obj 0 = \Obj 0)$. Thus $\Th{Q}\Proves !A_=(\num{n}, \num{m}, \num{0})$.For the second part, we also have two cases. If $n = m$, we have toshow that $\Th{Q} \Proves \lforall[y][(!A_=(\num{n}, \num{m}, y)  \lif \eq[y][\num{1}])]$.  Arguing informally, suppose $!A_=(\num{n},\num{m}, y)$, i.e.,\[(\eq[\num{n}][\num{n}] \land \eq[y][\num{1}]) \lor(\eq/[\num{n}][\num{n}] \land \eq[y][\num{0}])\]The left disjunct implies $\eq[y][\num{1}]$ by logic; the rightcontradicts $\eq[\num{n}][\num{n}]$ which is provable by logic.Suppose, on the other hand, that $n \neq m$. Then $!A_=(\num{n},\num{m}, y)$ is\[(\eq[\num{n}][\num{m}] \land \eq[y][\num{1}]) \lor(\eq/[\num{n}][\num{m}] \land \eq[y][\num{0}])\]Here, the left disjunct contradicts $\eq/[\num{n}][\num{m}]$, which isprovable in $\Th{Q}$ by \olref{lem:q-proves-neq}; the right disjunctentails $\eq[y][\num{0}]$.\end{proof}\begin{prop}\ollabel{prop:rep-add}The addition function $\Add(x_0, x_1) = x_0+x_1$ is representedin~$\Th{Q}$ by\[  !A_{\Add}(x_0, x_1, y) \ident \eq[y][(x_0 + x_1)].\]\end{prop}\begin{lem}\ollabel{lem:q-proves-add}$\Th{Q} \Proves \eq[(\num{n} + \num{m})][\num{n+m}]$\end{lem}\begin{proof}We prove this by induction on~$m$. If $m = 0$, the claim is that$\Th{Q} \Proves \eq[(\num{n} + \Obj 0)][\num{n}]$. This follows byaxiom~$!Q_4$.  Now suppose the claim for $m$; let's prove the claimfor $m+1$, i.e., prove that $\Th{Q} \Proves \eq[(\num{n} +  \num{m+1})][\num{n+m+1}]$. Note that $\num{m+1}$ is just $\num{m}'$,and $\num{n+m+1}$ is just $\num{n+m}'$.  By axiom $!Q_5$, $\Th{Q}\Proves \eq[(\num{n} + \num{m}')][(\num{n}+\num{m})']$. By inductionhypothesis, $\Th{Q} \Proves \eq[(\num{n} + \num{m})][\num{n+m}]$. So$\Th{Q} \Proves \eq[(\num{n} + \num{m}')][\num{n+m}']$.\end{proof}\begin{proof}[Proof of \olref{prop:rep-add}]The !!{formula}~$!A_\Add(x_0, x_1, y)$ representing $\Add$ is$\eq[y][(x_0 + x_1)]$. First we show that if $\Add(n, m) = k$, then$\Th{Q} \Proves !A_\Add(\num{n}, \num{m}, \num{k})$, i.e., $\Th{Q}\Proves \eq[\num{k}][(\num{n} + \num{m})]$. But since $k = n + m$,$\num{k}$ just is $\num{n+m}$, and we've shown in\olref{lem:q-proves-add} that $\Th{Q} \Proves \eq[(\num{n} +  \num{m})][\num{n+m}]$.We also have to show that if $\Add(n, m) = k$, then\[\Th{Q} \Proves \lforall[y][(!A_\Add(\num{n}, \num{m}, y) \lif  \eq[y][\num{k}])].\]Suppose we have $\eq[(\num{n} + \num{m})][y]$. Since\[\Th{Q} \Proves \eq[(\num{n}+\num{m})][\num{n+m}],\]we can replace the left side with $\num{n+m}$ and get$\eq[\num{n+m}][y]$, for arbitrary~$y$.\end{proof}\begin{prop}\ollabel{prop:rep-mult}The multiplication function $\Mult(x_0, x_1) = x_0 \cdot x_1$ is representedin~$\Th{Q}$ by\[  !A_{\Mult}(x_0, x_1, y) \ident y = (x_0 \times x_1).\]\end{prop}\begin{proof} Exercise. \end{proof}\begin{lem}\ollabel{lem:q-proves-mult}$\Th{Q} \Proves \eq[(\num{n} \times \num{m})][\num{n \cdot m}]$\end{lem}\begin{proof} Exercise. \end{proof}\begin{prob}Prove \olref[inc][req][bre]{lem:q-proves-mult}.\end{prob}\begin{prob}Use \olref[inc][req][bre]{lem:q-proves-mult} to prove\olref[inc][req][bre]{prop:rep-mult}.\end{prob}\begin{explain}  Recall that we use $\times$ for the function symbol of the language  of arithmetic, and $\cdot$ for the ordinary multiplication operation  on numbers. So $\cdot$ can appear between expressions for numbers  (such as in $m \cdot n$) while $\times$ appears only between terms  of the language of arithmetic (such as in $(\num{m} \times  \num{n})$).  Even more confusingly, $+$ is used for both the  !!{function} and the addition operation. When it appears between  terms---e.g., in $(\num{n} + \num{m})$---it is the $2$-place  !!{function} of the language of arithmetic, and when it appears  between numbers---e.g., in $n+m$---it is the addition operation.  This includes the case $\num{n+m}$: this is the standard numeral  corresponding to the number~$n+m$.\end{explain}\end{document}

content/incompleteness/representability-in-q/composition-representable.tex

% Part: incompleteness% Chapter: representability-in-q% Section: composition-representable\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{cmp}\olsection{Composition is Representable in $\Th{Q}$}Suppose $h$ is defined by\[h(x_0,\dots,x_{l-1}) = f(g_0(x_0,\dots,x_{l-1}), \dots,g_{k-1}(x_0,\dots,x_{l-1})).\]where we have already found !!{formula}s $!A_f, !A_{g_0}, \dots,!A_{g_{k-1}}$ representing the functions $f$, and $g_0$,\dots,~$g_{k-1}$, respectively. We have to find !!a{formula}~$!A_h$representing $h$.Let's start with a simple case, where all functions are $1$-place,i.e., consider $h(x) = f(g(x))$. If $!A_f(y, z)$ represents~$f$, and$!A_g(x, y)$ represents~$g$, we need !!a{formula}~$!A_h(x, z)$ thatrepresents~$h$.  Note that $h(x) = z$ iff there is a~$y$ such thatboth $z = f(y)$ and $y = g(x)$. (If $h(x) = z$, then $g(x)$ is sucha~$y$; if such a $y$ exists, then since $y = g(x)$ and $z = f(y)$, $z= f(g(x))$.) This suggests that $\lexists[y][(!A_g(x, y) \land !A_f(y,  z))]$ is a good candidate for~$!A_h(x, z)$. We just have to verifythat $\Th{Q}$ proves the relevant !!{formula}s.\begin{prop}\ollabel{prop:rep1}If $h(n) = m$, then $\Th{Q} \Proves !A_h(\num{n}, \num{m})$.\end{prop}\begin{proof}Suppose $h(n) = m$, i.e., $f(g(n)) = m$.  Let $k = g(n)$. Then\begin{align*}  \Th{Q} & \Proves !A_g(\num{n}, \num{k})  \intertext{since $!A_g$ represents~$g$, and}  \Th{Q} & \Proves !A_f(\num{k}, \num{m})  \intertext{since $!A_f$ represents~$f$. Thus,}  \Th{Q} & \Proves !A_g(\num{n}, \num{k}) \land !A_f(\num{k}, \num{m})  \intertext{and consequently also}  \Th{Q} & \Proves \lexists[y][(!A_g(\num{n}, y) \land !A_f(y, \num{m}))],\end{align*}i.e., $\Th{Q} \Proves !A_h(\num{n}, \num{m})$.\end{proof}\begin{prop}\ollabel{prop:rep2}If $h(n) = m$, then $\Th{Q} \Proves \lforall[z][(!A_h(\num{n}, z) \lif  z = \num{m})]$.\end{prop}\begin{proof}Suppose $h(n) = m$, i.e., $f(g(n)) = m$.  Let $k = g(n)$. Then\begin{align*}  \Th{Q} & \Proves \lforall[y][(!A_g(\num{n}, y) \lif \eq[y][\num{k}])]  \intertext{since $!A_g$ represents~$g$, and}  \Th{Q} & \Proves \lforall[z][(!A_f(\num{k}, z) \lif \eq[z][\num{m}])]  \intertext{since $!A_f$ represents~$f$. Using just a little bit of    logic, we can show that also}  \Th{Q} & \Proves \lforall[z][(\lexists[y][(!A_g(\num{n}, y) \land      !A_f(y, z))] \lif \eq[z][\num{m}])].\end{align*}i.e., $\Th{Q} \Proves \lforall[y][(!A_h(\num n, y) \lif \eq[y][\num m])]$.\end{proof}The same idea works in the more complex case where $f$ and~$g_i$ havearity greater than~$1$.\begin{prop}\ollabel{prop:rep-composition}If $!A_f(y_0, \dots, y_{k-1}, z)$ represents $f(y_0, \dots, y_{k-1})$in~$\Th{Q}$, and $!A_{g_i}(x_0, \dots, x_{l-1}, y)$ represents$g_i(x_0, \dots, x_{l-1})$ in~$\Th{Q}$, then\begin{multline*}  \lexists[y_0\dots][\lexists[y_{k-1}][(!A_{g_0}(x_0,\dots,x_{l-1},y_0) \land      \dots \land {}]]\\  !A_{g_{k-1}}(x_0,\dots,x_{l-1},y_{k-1}) \land !A_f(y_0,\dots,y_{k-1},z))\end{multline*}represents\[h(x_0, \dots, x_{l-1}) = f(g_0(x_0, \dots, x_{l-1}), \dots, g_{k-1}(x_0,\dots, x_{l-1})).\]\end{prop}\begin{proof}Exercise.\end{proof}\begin{prob}Using the proofs of \olref[inc][req][cmp]{prop:rep2} and\olref[inc][req][cmp]{prop:rep2} as a guide, carry out the proof of\olref[inc][req][cmp]{prop:rep-composition} in detail.\end{prob}\end{document}

content/incompleteness/representability-in-q/minimization-representable.tex

% Part: incompleteness% Chapter: representability-in-q% Section: minimization-representable\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{min}\olsection{Regular Minimization is Representable in $\Th{Q}$}Let's consider unbounded search. Suppose $g(x, z)$ is regular andrepresentable in $\Th{Q}$, say by the !!{formula}~$!A_g(x, z, y)$. Let$f$ be defined by $f(z) = \umin{x}{[g(x, z) = 0]}$. We would like to find!!a{formula}~$!A_f(z, y)$ representing~$f$.  The value of~$f(z)$ isthat number~$x$ which (a) satisfies $g(x, z) = 0$ and (b) is the leastsuch, i.e., for any $w < x$, $g(w, z) \neq 0$.  So the following is anatural choice:\[!A_f(z,y) \ident !A_g(y, z, \Obj 0) \land \lforall[w][(w < y \lif \lnot  !A_g(w, z, \Obj 0))].\]In the general case, of course, we would have to replace $z$ with$z_0$, \dots, $z_k$.The proof, again, will involve some lemmas about things $\Th{Q}$ isstrong enough to prove.\begin{lem}\ollabel{lem:succ} For every !!{constant}~$a$ and every naturalnumber~$n$,\[\Th{Q} \Proves \eq[(a' + \num n)][(a + \num n)'].\]\end{lem}\begin{proof}The proof is, as usual, by induction on $n$. In the base case, $n =0$, we need to show that $\Th{Q}$ proves $\eq[(a' + \Obj 0)][(a + \Obj0)']$. But we have:\begin{align}  \Th{Q} & \Proves \eq[(a' + \Obj 0)][a'] \quad \text{by axiom $Q_4$}  \ollabel{step1}\\  \Th{Q} & \Proves  \eq[(a + \Obj 0)][a] \quad \text{by axiom $Q_4$}  \ollabel{step2} \\  \Th{Q} & \Proves \eq[(a + \Obj 0)'][a'] \quad \text{by \olref{step2}}  \ollabel{step3} \\  \Th{Q} & \Proves \eq[(a' + \Obj 0)][(a + \Obj 0)'] \quad  \text{by \olref{step1} and \olref{step3}}\notag\end{align}In the induction step, we can assume that we have shown that $\Th{Q}\Proves \eq[(a' + \num n)][(a + \num n)']$. Since$\num{n+1}$ is $\num{n}'$, we need to show that $\Th{Q}$ proves$\eq[(a' + \num{n}')][(a + \num{n}')']$. We have:\begin{align}  \Th{Q} & \Proves \eq[(a' + \num n')][(a' + \num n)'] \quad  \text{by axiom $!Q_5$} \ollabel{step5}\\  \Th{Q} & \Proves \eq[(a' + \num n')][(a + \num n')'] \quad  \text{inductive hypothesis} \ollabel{step6}\\  \Th{Q} & \Proves \eq[(a' + \num n)'][(a + \num n')'] \quad  \text{by \olref{step5} and \olref{step6}.} \notag\end{align}\end{proof}It is again worth mentioning that this is weaker than saying that$\Th{Q}$ proves $\lforall[x][\lforall[y][(x' + y) = (x + y)']]$.Although this !!{sentence} is true in~$\Struct{N}$, $\Th{Q}$ does notprove it.\begin{lem}\ollabel{lem:less-zero}$\Th{Q} \Proves \lforall[x][\lnot x < \Obj 0]$.\end{lem}\begin{proof}We give the proof informally (i.e., only giving hints as tohow to construct the formal !!{derivation}).We have to prove $\lnot a < \Obj 0$ for an arbitrary~$a$. By thedefinition of $<$, we need to prove $\lnot\lexists[y][\eq[(y'+a)][\Obj 0]]$ in $\Th{Q}$. We'll assume$\lexists[y][\eq[(y'+a)][\Obj 0]]$ and prove a contradiction. Suppose$\eq[(b'+a)][\Obj 0]$. Using $!Q_3$, wehave that $\eq[a][\Obj 0] \lor \lexists[y][\eq[a][y']]$. Wedistinguish cases. Case 1: $\eq[a][\Obj 0]$ holds. From $\eq[(b'+a)][\Obj 0]$, we have$\eq[(b' + \Obj 0)][\Obj 0]$. By axiom~$!Q_4$ of $\Th{Q}$, we have$\eq[(b' + \Obj 0)][b']$, and hence $\eq[b'][\Obj 0]$. But byaxiom~$!Q_2$ we also have $\eq/[b'][\Obj 0]$, a contradiction. Case 2: For some $c$, $\eq[a][c']$. But then we have $\eq[(b' +c')][\Obj 0]$. By axiom~$!Q_5$, we have $\eq[(b' + c)'][\Obj 0]$, againcontradicting axiom~$Q_2$.\end{proof}\begin{lem}\ollabel{lem:less-nsucc}For every natural number~$n$,   \[  \Th{Q} \Proves  \lforall[x][(x < \num {n+1} \lif (\eq[x][\Obj 0] \lor \dots \lor    \eq[x][\num n]))].  \]\end{lem}\begin{proof}We use induction on~$n$. Let us consider the base case, when $n = 0$.In that case, we need to show $a < \num 1 \lif \eq[a][\Obj 0]$, forarbitrary~$a$. Suppose $a < \num 1$. Then by the defining axiom for$<$, we have $\lexists[y][\eq[(y'+a)][\Obj 0']]$ (since $\num 1 \ident\Obj 0'$).Suppose $b$ has that property, i.e., we have $\eq[(b'+a)][\Obj 0']$.We need to show $\eq[a][\Obj 0]$. By axiom~$!Q_3$, we have either$\eq[a][\Obj 0]$ or that there is a $c$ such that $\eq[a][c']$. In theformer case, there is nothing to show. So suppose $\eq[a][c']$. Thenwe have $\eq[(b' + c')][\Obj 0']$. By axiom~$!Q_5$ of $\Th{Q}$, we have$\eq[(b'+c)'][\Obj 0']$. By axiom~$!Q_1$, we have $\eq[(b' + c)][\Obj0]$. But this means, by axiom~$!Q_8$, that $c < \Obj 0$, contradicting\olref{lem:less-zero}.Now for the inductive step. We prove the case for $n+1$, assuming thecase for~$n$. So suppose $a < \num {n+2}$. Again using $!Q_3$ we candistinguish two cases: $\eq[a][\Obj 0]$ and for some $b$,$\eq[a][b']$. In the first case, $\eq[a][\Obj 0] \lor \dots \lor\eq[a][\num{n+1}]$ follows trivially. In the second case, we have $b'< \num {n+2}$, i.e., $b' < \num{n+1}'$. By axiom~$!Q_8$, for some $c$,$\eq[(c'+b')][\num{n+1}']$. By axiom $!Q_5$,$\eq[(c'+b)'][\num{n+1}']$. By axiom~$!Q_1$, $\eq[(c'+b)][\num{n+1}]$,and so $b < \num{n+1}$ by axiom~$!Q_8$. By inductive hypothesis,$\eq[b][\Obj 0] \lor \dots \lor \eq[b][\num{n}]$. From this, we get$\eq[b'][\Obj 0'] \lor \dots \lor \eq[b'][\num{n}']$ by logic, and so$\eq[a][\num{1}] \lor \dots \lor \eq[a][\num{n+1}]$ since$\eq[a][b']$.\end{proof}\begin{lem}  \ollabel{lem:trichotomy} For every natural number~$m$,  \[  \Th{Q} \Proves  \lforall[y][((y < \num{m} \lor \num{m} < y) \lor \eq[y][\num{m}])].  \]\end{lem}\begin{proof}By induction on~$m$. First, consider the case $m=0$. $\Th{Q} \Proves\lforall[y][(\eq[y][\Obj 0] \lor \lexists[z][\eq[y][z']])]$ by~$!Q_3$.Let $a$ be arbitrary. Then either $\eq[a][\Obj 0]$ or for some~$b$,$\eq[a][b']$. In the former case, we also have $(a < \Obj 0 \lor \Obj0 < a) \lor \eq[a][\Obj 0]$. But if $\eq[a][b']$, then $\eq[(b' +\Obj 0)][(a + \Obj 0)]$ by the logic of~$\eq$. By $!Q_4$, $\eq[(a +\Obj 0)][a]$, so we have $\eq[(b' + \Obj 0)][a]$, and hence$\lexists[z][\eq[(z' + \Obj 0)][a]]$. By the definition of $<$ in$!Q_8$, $\Obj 0 < a$.  If $\Obj 0 < a$, then also $(\Obj 0 < a \lor a< \Obj 0) \lor \eq[a][\Obj 0]$. Now suppose we have\begin{align*}  \Th{Q} & \Proves \lforall[y][((y < \num{m} \lor \num{m} < y) \lor    \eq[y][\num{m}])]  \intertext{and we want to show}  \Th{Q} & \Proves \lforall[y][((y < \num{m+1} \lor \num{m+1} < y) \lor    \eq[y][\num{m+1}])]\end{align*}Let $a$ be arbitrary. By $!Q_3$, either $\eq[a][\Obj 0]$ or forsome~$b$, $\eq[a][b']$. In the first case, we have $\eq[\num{m}' +a][\num{m+1}]$ by $!Q_4$, and so $a < \num{m+1}$ by $!Q_8$.Now consider the second case, $\eq[a][b']$. By the inductionhypothesis, $(b < \num{m} \lor \num{m} < b) \lor    \eq[b][\num{m}]$.The first disjunct $b < \num{m}$ is equivalent (by $!Q_8$) to$\lexists[z][\eq[(z' + b)][\num{m}]]$. Suppose $c$ has this property.If $\eq[(c' + b)][\num{m}]$, then also $\eq[(c' + b)'][\num{m}']$. By$!Q_5$, $\eq[(c' + b)'][(c' + b')]$. Hence, $\eq[(c' +b')][\num{m}']$. We get $\lexists[u][\eq[(u' + b')][\num{m+1}]]$ byexistentially generalizing on~$c'$ and keeping in mind that $\num{m}'\ident \num{m+1}$. Hence, if $b < \num{m}$ then $b' < \num{m+1}$ andso $a < \num{m+1}$.Now suppose $\num{m} < b$, i.e., $\lexists[z][\eq[(z' +\num{m})][b]]$.  Suppose $c$ is such a~$z$, i.e., $\eq[(c' +\num{m})][b]$. By logic, $\eq[(c' + \num{m})'][b']$. By $!Q_5$,$\eq[(c' + \num{m}')][b']$. Since $\eq[a][b']$ and $\num{m}' \ident\num{m+1}$, $\eq[(c' + \num{m+1})][a]$. By $!Q_8$, $\num{m+1} < a$.Finally, assume $\eq[b][\num{m}]$. Then, by logic,$\eq[b'][\num{m}']$, and so $\eq[a][\num{m+1}]$.Hence, from each disjunct of the case for~$m$ and~$b$, we can obtainthe corresponding disjunct for~$m+1$ and~$a$.\end{proof}  \begin{prop}\ollabel{prop:rep-minimization}If $!A_g(x, z, y)$ represents $g(x, z)$ in~$\Th{Q}$, then\[!A_f(z,y) \ident !A_g(y, z, \Obj 0) \land \lforall[w][(w < y \lif \lnot  !A_g(w, z, \Obj 0))]\]represents $f(z) = \umin{x}{[g(x, z) = 0]}$.\end{prop}\begin{proof}First we show that if $f(n) = m$, then $\Th{Q} \Proves !A_f(\num n, \num m)$,i.e.,  \begin{align}  \Th{Q} & \Proves !A_g(\num{m}, \num{n}, \Obj 0) \land \lforall[w][(w <    \num{m} \lif \lnot !A_g(w, \num{n}, \Obj 0))]. \notag  \intertext{Since $!A_g(x, z, y)$ represents $g(x, z)$ and $g(m, n) =    0$ if $f(n) = m$, we have}\Th{Q} & \Proves !A_g(\num{m}, \num{n}, \Obj 0). \notag\intertext{If $f(n) = m$, then for every $k < m$, $g(k, n) \neq 0$. So}\Th{Q} & \Proves \lnot !A_g(\num{k}, \num{n}, \Obj 0). \notag\intertext{We get that}\Th{Q} & \Proves \lforall[w][(w < \num{m} \lif \lnot  !A_g(w, \num{n}, \Obj 0))]. \ollabel{rep-less}\end{align}by \olref{lem:less-zero} in case $m = 0$ and by \olref{lem:less-nsucc} otherwise.Now let's show that if $f(n) = m$, then $\Th{Q} \Proves\lforall[y][(!A_f(\num{n}, y) \lif \eq[y][\num{m}])]$.  We againsketch the argument informally, leaving the formalization to thereader.Suppose $!A_f(\num{n}, b)$. From this we get (a) $!A_g(b, \num{n},\Obj 0)$ and (b) $\lforall[w][(w < b \lif \lnot !A_g(w, \num{n}, \Obj  0))]$.  By \olref{lem:trichotomy}, $(b < \num{m} \lor \num{m} < b)\lor \eq[b][\num{m}]$. We'll show that both $b < \num{m}$ and $\num{m}< b$ leads to a contradiction.If $\num{m} < b$, then $\lnot !A_g(\num{m}, \num{n}, \Obj 0)$from~(b). But $m = f(n)$, so $g(m, n) = 0$, and so $\Th{Q} \Proves!A_g(\num{m}, \num{n}, \Obj 0)$ since $!A_g$ represents~$g$. So wehave a contradiction.Now suppose $b < \num{m}$. Then since $\Th{Q} \Proves \lforall[w][(w <  \num{m} \lif \lnot !A_g(w, \num{n}, \Obj 0))]$ by \olref{rep-less}, weget $\lnot !A_g(b, \num{n}, \Obj 0)$. This again contradicts~(a).\end{proof}\end{document}

content/incompleteness/representability-in-q/comp-representable.tex

% Part: incompleteness% Chapter: representability-in-q% Section: comp-representable\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{crq}\olsection{Computable Functions are Representable in $\Th{Q}$}\begin{thm}Every computable function is representable in~$\Th{Q}$.\end{thm}\begin{proof}For definiteness, and using the Church--Turing Thesis, let's say that afunction is computable iff it is general recursive. The generalrecursive functions are those which can be defined from the zerofunction~$\Zero$, the successor function~$\Succ$, and the projectionfunction~$\Proj{n}{i}$ using composition, primitive recursion, andregular minimization. By \olref[pri]{lem:prim-rec}, any function~$h$that can be defined from $f$ and~$g$ can also be defined usingcomposition and regular minimization from $f$, $g$, and $\Zero$,$\Succ$, $\Proj{n}{i}$, $\Add$, $\Mult$, $\Char{=}$. Consequently, afunction is general recursive iff it can be defined from $\Zero$,$\Succ$, $\Proj{n}{i}$, $\Add$, $\Mult$, $\Char{=}$ using compositionand regular minimization.We've furthermore shown that the basic functions in question arerepresentable in~$\Th{Q}$(\cref{inc:req:bre:prop:rep-zero,inc:req:bre:prop:rep-succ,inc:req:bre:prop:rep-proj,inc:req:bre:prop:rep-id,inc:req:bre:prop:rep-add,inc:req:bre:prop:rep-mult}),and that any function defined from representable functions bycomposition or regular minimization(\olref[cmp]{prop:rep-composition},\olref[min]{prop:rep-minimization}) is also representable. Thus everygeneral recursive function is representable in~$\Th{Q}$.\end{proof}\begin{explain}We have shown that the set of computable functions can becharacterized as the set of functions representable in $\Th{Q}$. Infact, the proof is more general. From the definition ofrepresentability, it is not hard to see that any theory extending$\Th{Q}$ (or in which one can interpret $\Th{Q}$) can represent thecomputable functions. But, conversely, in any !!{derivation} system inwhich the notion of !!{derivation} is computable, every representablefunction is computable. So, for example, the set of computablefunctions can be characterized as the set of functions representablein Peano arithmetic, or even Zermelo--Fraenkel set theory. As G\"odelnoted, this is somewhat surprising.  We will see that when it comes toprovability, questions are very sensitive to which theory youconsider; roughly, the stronger the axioms, the more you can prove.But across a wide range of axiomatic theories, the representablefunctions are exactly the computable ones; stronger theories do notrepresent more functions as long as they are axiomatizable.\end{explain}\end{document}

content/incompleteness/representability-in-q/representing-relations.tex

% Part: incompleteness% Chapter: representability-in-q% Section: representing-relations\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{rel}\olsection{Representing Relations}Let us say what it means for a \emph{relation} to be representable.\begin{defn}\ollabel{defn:representing-relations} A relation $R(x_0,\dots,x_k)$ onthe natural numbers is {\em representable in $\Th{Q}$} if there is aformula $!A_R(x_0,\dots,x_k)$ such that whenever $R(n_0,\dots,n_k)$ istrue, $\Th{Q}$ proves $!A_R(\num{n_0},\dots,\num{n_k})$, and whenever$R(n_0,\dots,n_k)$ is false, $\Th{Q}$ proves $\lnot !A_R(\num{n_0},\dots, \num{n_k})$.\end{defn}\begin{thm}\ollabel{thm:representing-rels} A relation is representable in$\Th{Q}$ if and only if it is computable.\end{thm}\begin{proof}For the forwards direction, suppose $R(x_0,\dots,x_k)$ isrepresented by the formula $!A_R(x_0,\dots,x_k)$. Here is analgorithm for computing $R$: on input $n_0$, \dots,~$n_k$, simultaneouslysearch for a proof of $!A_R(\num{n_0}, \dots, \num{n_k})$ and a proof of$\lnot !A_R(\num{n_0}, \dots, \num{n_k})$. By our hypothesis, the searchis bound to find one or the other; if it is the first, report ``yes,''and otherwise, report ``no.''In the other direction, suppose $R(x_0, \dots, x_k)$ is computable. Bydefinition, this means that the function $\Char{R}(x_0, \dots, x_k)$is computable. By \olref[int]{thm:representable-iff-comp}, $\Char{R}$is represented by a formula, say $!A_{\Char{R}}(x_0, \dots, x_k,y)$. Let $!A_R(x_0, \dots, x_k)$ be the formula $!A_{\Char{R}}(x_0,\dots, x_k, \num{1})$. Then for any $n_0$, \dots,~$n_k$, if $R(n_0,\dots, n_k)$ is true, then $\Char{R}(n_0, \dots, n_k) = 1$, in whichcase $\Th{Q}$ proves $!A_{\Char{R}}(\num{n_0}, \dots, \num{n_k},\num{1})$, and so $\Th{Q}$ proves $!A_R(\num{n_0}, \dots,\num{n_k})$. On the other hand, if $R(n_0, \dots, n_k)$ is false, then$\Char{R}(n_0, \dots, n_k) = 0$. This means that $\Th{Q}$ proves\[\lforall[y][(!A_{\Char{R}}(\num{n_0}, \dots, \num{n_k}, y) \lif y =  \num{0})].\]Since $\Th{Q}$ proves $\eq/[\num{0}][\num{1}]$, $\Th{Q}$ proves$\lnot !A_{\Char{R}}(\num{n_0}, \dots, \num{n_k}, \num{1})$, and so itproves $\lnot !A_R(\num{n_0}, \dots, \num{n_k})$.\end{proof}\begin{prob}Show that if $R$ is representable in~$\Th{Q}$, so is~$\Char{R}$.\end{prob}\end{document}

content/incompleteness/representability-in-q/undecidability.tex

% Part: incompleteness% Chapter: representability-in-q% Section: undecidability\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{req}{und}\olsection{Undecidability}We call a theory $\Th{T}$ \emph{undecidable} if there is nocomputational procedure which, after finitely many steps andunfailingly, provides a correct answer to the question ``does $\Th{T}$prove~$!A$?'' for any sentence~$!A$ in the language of~$\Th{T}$.  So$\Th{Q}$ would be decidable iff there were a computational procedurewhich decides, given a sentence~$!A$ in the language of arithmetic,whether $\Th{Q} \Proves !A$ or not.  We can make this more precise byasking: Is the relation~$\Prov[\Th{Q}](y)$, which holds of~$y$iff $y$ is the G\"odel number of a sentence provable in~$\Th{Q}$,recursive?  The answer is: no.\begin{thm}$\Th{Q}$ is undecidable, i.e., the relation\[\Prov[\Th{Q}](y) \defiff \fn{Sent}(y) \land\lexists[x][\Prf[\Th{Q}](x, y)]\]is not recursive.\end{thm}\begin{proof}Suppose it were.  Then we could solve the halting problem as follows:Given $e$ and $n$, we know that $\cfind{e}(n) \fdefined$ iff there isan~$s$ such that $T(e, n, s)$, where $T$ is Kleene's predicate from\olref[cmp][rec][nft]{thm:kleene-nf}.  Since $T$ is primitive recursiveit is representable in~$\Th{Q}$ by a formula $!B_T$, that is, $\Th{Q}\Proves !B_T(\num{e}, \num{n}, \num{s})$ iff $T(e, n, s)$.  If $\Th{Q}\Proves !B_T(\num{e}, \num{n}, \num{s})$ then also $ \Th{Q} \Proves\lexists[y][!B_T(\num{e}, \num{n}, y)]$.  If no such $s$ exists, then$\Th{Q} \Proves \lnot !B_T(\num{e}, \num{n}, \num{s})$ forevery~$s$.  But $\Th{Q}$ is $\omega$-consistent, i.e., if $\Th{Q}\Proves \lnot !A(\num{n})$ for every~$n \in \Nat$, then $\Th{Q}\Proves/ \lexists[y][!A(y)]$.  We know this because the axioms of$\Th{Q}$ are true in the standard model~$\Struct{N}$.  So, $\Th{Q}\Proves/ \lexists[y][!B_T(\num{e}, \num{n}, y)]$.  In other words,$\Th{Q} \Proves \lexists[y][!B_T(\num{e}, \num{n}, y)]$ iff there isan $s$ such that $T(e, n, s)$, i.e., iff $\cfind{e}(n) \fdefined$.From $e$ and~$n$ we can compute $\Gn{\lexists[y][!B_T(\num{e},    \num{n}, y)]}$, let $g(e, n)$ be the primitive recursive functionwhich does that.  So\[h(e, n) =\begin{cases}1 & \text{if $\Prov[\Th{Q}](g(e, n))$}\\0 & \text{otherwise}.\end{cases}\]This would show that $h$ is recursive if $\Prov[\Th{Q}]$ is. But~$h$is not recursive, by \olref[cmp][rec][hlt]{thm:halting-problem}, so$\Prov[\Th{Q}]$ cannot be either.\end{proof}\begin{cor}First-order logic is undecidable.\end{cor}\begin{proof}If first-order logic were decidable, provability in~$\Th{Q}$ would beas well, since $\Th{Q} \Proves !A$ iff $\Proves !T \lif !A$, where$!T$ is the conjunction of the axioms of~$\Th{Q}$.\end{proof}\end{document}

content/incompleteness/representability-in-q/sigma1-completeness.tex

% Part: incompleteness% Chapter: representability-in-q% Section: sigma1-completeness\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{inc}{inp}{s1c}\olsection{\texorpdfstring{$\Sigma_1$}{Sigma-1} completeness}Despite the incompleteness of $\Th{Q}$ and its consistent, axiomatizableextensions, we have seen that $\Th{Q}$ does prove many basic facts aboutnumerals. In fact, this can be extended quite considerably. To understandthe scope of what can be proved in~$\Th{Q}$, we introduce the notions of$\Delta_0$, $\Sigma_1$, and $\Pi_1$ !!{formula}s. Roughly speaking, a$\Sigma_1$ !!{formula} is one of the form $\lexists[x][!B(x)]$, where $!B$is constructed using only propositional connectives and boundedquantifiers. We shall show that if $!A$ is a $\Sigma_1$ !!{sentence}which is true in $\Struct{N}$, then $\Th{Q} \Proves !A$(\olref{thm:sigma1-completeness}).\begin{defn}\ollabel{defn:bd-quant}A \emph{bounded existential !!{formula}} is one of the form$\lexists[x][(x < t \land !A(x))]$ where $t$ is any term, which weconventionally write as $\bexists{x < t}{!A(x)}$.%A \emph{bounded universal !!{formula}} is one of the form$\lforall[x][(x < t \lif !A(x))]$ where $t$ is any term, which weconventionally write as $\bforall{x < t}{!A(x)}$.\end{defn}\begin{defn}\ollabel{defn:delta0-sigma1-pi1-frm}A !!{formula} $!B$ is $\Delta_0$ if it is built up from atomic!!{formula}s using only propositional connectives and boundedquantification.%A !!{formula} $!A$ is $\Sigma_1$ if $!A \ident \lexists[x][!B(x)]$where $!B$ is $\Delta_0$.%A !!{formula} $!A$ is $\Pi_1$ if $!A \ident \lforall[x][!B(x)]$where $!B$ is $\Delta_0$.\end{defn}\begin{lem}\ollabel{lem:q-proves-clterm-id} Suppose $t$ is a closed term such that$\Value{t}{N} = n$. Then $\Th{Q} \Proves \eq[t][\num n]$.\end{lem}\begin{proof}We prove this by induction on the complexity of~$t$. For the base case,$\Value{\Obj 0}{N} = 0$, and $\Th{Q} \Proves \eq[\Obj 0][\num 0]$since $\num 0 \ident \Obj 0$.%For the inductive case, let $t_1$ and $t_2$ be terms such that$\Value{t_1}{N} = n_1$, $\Value{t_2}{N} = n_2$,$\Th{Q} \Proves \eq[t_1][\num n_1]$, and$\Th{Q} \Proves \eq[t_2][\num n_2]$.Then $\Value{(t_1')}{N} = n_1 + 1$, and we have that $\Th{Q} \Proves\eq[t_1'][{\num n_1}']$ by the first-order rules for identity appliedto the induction hypothesis and the !!{formula}$\eq[\num{n_1}'][\num{n_1}']$,so we have $\Th{Q} \Proves \eq[t_1'][\num{n_1 + 1}]$by the definition of numerals.For sums we have\[      \Value{(t_1 + t_2)}{N}    = \Value{t_1}{N} + \Value{t_2}{N}    = n_1 + n_2.\]By the induction hypothesis and the rules for identity,$\Th{Q} \Proves \eq[t_1 + t_2][\num{n_1} + t_2]$, and then$\Th{Q} \Proves \eq[t_1 + t_2][\num{n_1} + \num{n_2}]$by a second application of the rules for identity.By \olref[inc][req][bre]{lem:q-proves-add},$\Th{Q} \Proves \eq[\num{n_1} + \num{n_2}][\num{n_1 + n_2}]$,so $\Th{Q} \Proves \eq[t_1 + t_2][\num{n_1 + n_2}]$.Similar reasoning also works for~$\times$, using\olref[inc][req][bre]{lem:q-proves-mult}.%Since this exhausts the closed terms of arithmetic, we have that$\Th{Q} \Proves \eq[t][\num n]$ for all closed terms~$t$ such that$\Value{t}{N} = n$.\end{proof}\begin{prob}Prove in detail the part of \olref{lem:q-proves-clterm-id}involving~$\times$.\end{prob}\begin{lem}\ollabel{lem:atomic-completeness}Suppose $t_1$ and $t_2$ are closed terms. Then\begin{enumerate}\item If $\Value{t_1}{N} = \Value{t_2}{N}$,    then $\Th{Q} \Proves \eq[t_1][t_2]$.\item If $\Value{t_1}{N} \neq \Value{t_2}{N}$,    then $\Th{Q} \Proves \eq/[t_1][t_2]$.\item If $\Value{t_1}{N} < \Value{t_2}{N}$,    then $\Th{Q} \Proves t_1 < t_2$.\item If $\Value{t_2}{N} \leq \Value{t_1}{N}$,    then $\Th{Q} \Proves \lnot(t_1 < t_2)$.\end{enumerate}\end{lem}\begin{proof}Given terms $t_1$ and $t_2$, we fix $n = \Value{t_1}{N}$ and$m = \Value{t_2}{N}$.Suppose $!A \ident t_1 = t_2$. By \olref{lem:q-proves-clterm-id},$\Th{Q} \Proves \eq[t_1][\num n]$ and $\Th{Q} \Proves \eq[t_2][\num n]$.If $n = m$, then $\Th{Q} \Proves \eq[\num n][\num m]$ and hence$\Th{Q} \Proves \eq[t_1][t_2]$ by the transitivity of identity.If $n \neq m$ then $\Th{Q} \Proves \eq/[\num n][\num m]$,and by the transitivity of identity again,$\Th{Q} \Proves \eq/[t_1][t_2]$.Now let $!A \ident t_1 < t_2$. For both cases, we rely on axiom~$!Q_8$,which states that $x < y \liff \lexists[z][\eq[z' + x][y]]$for all $x,y$.Suppose $\Sat{N}{t_1 < t_2}$. Then there exists some $k \in \Nat$such that $n + k + 1 = m$. By \olref{lem:q-proves-clterm-id},$\Th{Q} \Proves \eq[t_1][\num n]$ and $\Th{Q} \Proves \eq[t_2][\num m]$,and by the first part of this lemma,$\Th{Q} \Proves \eq[\num n + {\num k}'][\num m]$.By the transitivity of identity it follows that$\Th{Q} \Proves \eq[{\num k}' + t_1][t_2]$,so $\Th{Q} \Proves \lexists[z][\eq[z' + t_1][t_2]]$.By the right-to-left direction of~$!Q_8$, $\Th{Q} \Proves t_1 < t_2$.Suppose instead that $\Sat/{N}{t_1 < t_2}$, i.e., $m \leq n$.%We work in~$\Th{Q}$ and assume that $t_1 < t_2$. By the left-to-rightdirection of~$!Q_8$, there is some~$z$ such that $\eq[z' + t_1][t_2]$.Since $\Th{Q} \Proves \eq[t_1][\num n]$ and$\Th{Q} \Proves \eq[t_2][\num m]$, $\eq[z' + \num n][\num m]$.%By an external induction on~$m$ using~$!Q_5$,$\eq[z' + \num{n - m}][\Obj 0]$.If $m = n$ then $\eq/[z'][\Obj 0]$, giving a contradiction via~$!Q_3$.If $m < n$ then $\eq[(z' + \num{n - m - 1})'][\Obj 0]$ by~$!Q_5$ again,giving a contradiction via~$!Q_3$.So $\Th{Q} \Proves \lnot(t_1 < t_2)$.\end{proof}\begin{lem}\ollabel{lem:bounded-quant-equiv}Suppose $!A$ is !!a{formula}, $t$ a closed term, and $k=\Value{t}{N}$. Then\begin{enumerate}\item $\Th{Q} \Proves \bforall{x<t}{!A(x)}$ iff $\Th{Q} \Proves    !A(\num 0) \land \dots \land !A(\num{k-1})$.\item $\Th{Q} \Proves \bexists{x<t}{!A(x)}$ iff $\Th{Q} \Proves    !A(\num 0) \lor \dots \lor !A(\num{k-1})$.\end{enumerate}\end{lem}\begin{proof}    We prove the case for the bounded universal quantifier.    If $\Value{t}{N} = 0$ then the left-hand side of the    equivalence is provable in~$\Th{Q}$, because there is no    $x<\num 0$ by \olref[inc][req][min]{lem:less-zero}.    Similarly, we can take an empty disjunction to be simply    $\ltrue$, which is also provable in~$\Th{Q}$.    %    We therefore suppose that $\Value{t}{N} = k+1$ for some    natural number~$k$. By \olref{lem:q-proves-clterm-id} we    can assume that we are working with !!a{formula} of the    form $\bforall{x<\num{k+1}}{!A(x)}$.        Suppose that $\Th{Q} \Proves \bforall{x<\num{k+1}}{!A(x)}$,    and let $n \leq k$. Since $\Th{Q} \Proves \num n < \num{k+1}$    by \olref{lem:atomic-completeness}, it follows by logic that    $\Th{Q} \Proves !A(\num n)$. Applying this fact $k+1$ times    for each $n \leq k$, we get that $\Th{Q} \Proves !A(\num 0)    \land \dots \land !A(\num k)$ as desired.        For the other direction, suppose that $\Th{Q} \Proves    !A(\num 0) \land \dots \land !A(\num k)$. Working in    $\Th{Q}$, suppose that $x < \num{k+1}$.    By \olref[inc][req][min]{lem:less-nsucc} we have that    $x = \num 0 \lor \dots \lor x = \num k$, so by logic it    follows that~$!A(x)$, and hence the universal claim    $\bforall{x<\num{k+1}}{!A(x)}$ follows.        The proof of the equivalence for bounded existentially    quantified !!{formula}s is similar.\end{proof}\begin{prob}Give a detailed proof of the existential case in\olref{lem:bounded-quant-equiv}.\end{prob}\begin{lem}\ollabel{lem:delta0-completeness}If $!A$ is a $\Delta_0$ !!{sentence} which is true in$\Struct{N}$, then $\Th{Q} \Proves !A$.\end{lem}\begin{proof}We prove this by induction on !!{formula} complexity.%The base case is given by \olref{lem:atomic-completeness},so we move to the induction step. For simplicity we splitthe case of negation into subcases depending on thestructure of the !!{formula} to which the negation isapplied.\begin{enumerate}\item Suppose $(!A \land !B)$ is true in $\Struct{N}$,so $!A$ and $!B$ are true in~$\Struct{N}$.By the induction hypothesis, $\Th{Q} \Proves !A$ and$\Th{Q} \Proves !B$,so $\Th{Q} \Proves (!A \land !B)$ by logic.%\item Suppose $\lnot (!A \land !B)$ is true in $\Struct{N}$,so either $\lnot !A$ or $\lnot !B$ is true in $\Struct{N}$.Without loss of generality, suppose the former. By theinduction hypothesis $\Th{Q} \Proves \lnot !A$, and hence$\Th{Q} \Proves \lnot (!A \land !B)$ by logic.%\item Suppose $(!A \lor !B)$ is true in $\Struct{N}$, soeither $!A$ is true in $\Struct{N}$ or $!B$ is true in$\Struct{N}$. Without loss of generality, suppose the formerholds. By the induction hypothesis $\Th{Q} \Proves !A$, andhence $\Th{Q} \Proves (!A \lor !B)$ by logic.%\item Suppose $\lnot(!A \lor !B)$ is true in $\Struct{N}$,so $\lnot !A$ and $\lnot !B$ are true in $\Struct{N}$.Then $\Th{Q} \Proves \lnot !A$ and $\Th{Q} \Proves \lnot !B$by the induction hypothesis. Consequently,$\Th{Q} \Proves \lnot(!A \lor !B)$ by logic.%\item Suppose that $\bforall{x<t}{!A(x)}$ is true in~$\Struct{N}$, where $t$ is a closed term and $k=\Value{t}{N}$. By the inductionhypothesis and logic, if $!A(\num n)$ is true in~$\Struct{N}$for all $n < \Value{t}{N}$ then $\Th{Q} \Proves!A(\num 0) \land \dots \land !A(\num{k-1})$.By \olref{lem:bounded-quant-equiv} it follows that$\Th{Q} \Proves \bforall{x<t}{!A(x)}$.%\item The case for the bounded existential quantifier, wherewe have !!a{sentence} of the form $\bexists{x < t}{!A(x)}$,is similar to that for the bounded universal quantifier.%\item Suppose that $\lnot \bforall{x<t}{!A(x)}$ is true in~$\Struct{N}$, where $t$ is a closed term. This !!{sentence}is equivalent to the !!{sentence} $\bexists{x<t}{\lnot !A(x)}$,with the equivalence derivable in~$\Th{Q}$, so we may applythe reasoning for bounded existential quantifiers.%\item Similarly, suppose that $\lnot \bexists{x<t}!A(x)$ istrue in $\Struct{N}$, where $t$ is a closed term. This!!{sentence} is equivalent in $\Th{Q}$ to$\bforall{x<t}{\lnot!A(x)}$, and so we may apply the reasoningfor bounded universal quantifiers.%\item Finally, suppose $\lnot !A$ is true in $\Struct{N}$.The only cases remaining are when $!A$ is atomic and when$\lnot !A \ident \lnot\lnot !B$ for some $\Delta_0$!!{sentence} $!B$. If $!A$ is atomic then by\olref{lem:atomic-completeness}, $\Th{Q} \Proves \lnot !A$.If $\lnot !A \ident \lnot\lnot !B$, then by logic it isprovably equivalent in~$\Th{Q}$ to~$!B$, which is true in~$\Struct{N}$ since $\lnot !A$ is true in~$\Struct{N}$.By the induction hypothesis we therefore have that$\Th{Q} \Proves \lnot !A$.\end{enumerate}\end{proof}\begin{prob}Give a detailed proof of the existential case in\olref{lem:delta0-completeness}.\end{prob}\begin{thm}\ollabel{thm:sigma1-completeness}If $!A$ is a $\Sigma_1$ !!{sentence} which is truein~$\Struct{N}$, then $\Th{Q} \Proves !A$.\end{thm}\begin{proof}If $\lexists{x}!A(x)$ is a $\Sigma_1$ !!{sentence} whichis true in~$\Struct{N}$, then there exists a naturalnumber~$n$ and a variable assignment~$s$ such that $s(x) = n$ and$\Sat{N}{!A(x)}[s]$. By standard facts aboutthe satisfaction relation it follows that$\Sat{N}{!A(\num n)}$. But $!A(\num n)$ is a$\Delta_0$ !!{formula}, so by \olref{lem:delta0-completeness}we have that $\Th{Q} \Proves !A(\num n)$, and hence bylogic we also have that $\Th{Q} \Proves \lexists[x][!A(x)]$.\end{proof}\end{document}