diff --git a/content/computability/computability-theory/application-fixed-point.tex b/content/computability/computability-theory/application-fixed-point.tex index 1ec7622d..98d79e01 100644 --- a/content/computability/computability-theory/application-fixed-point.tex +++ b/content/computability/computability-theory/application-fixed-point.tex @@ -32,7 +32,7 @@ \end{thm} \begin{proof} -Let $f$ be any computable function; we will construct an $e$ +Let $f$ be any partial computable function; we will construct an $e$ such that $W_e$ is computable, but $\cfind{f(e)}$ is not its characteristic function. Using the fixed point theorem, we can find an index $e$ such that @@ -62,9 +62,10 @@ But now notice that if $\cfind{f(e)}(0)$ is defined and equal to $0$, then $\cfind{e}(y)$ is defined exactly when $y$ is equal to $0$, so $W_e = \{ 0 \}$. If $\cfind{f(e)}(0)$ is not defined, or is defined but not -equal to $0$, then $W_e = \emptyset$. Either way, $\cfind{f(e)}$ is not -the characteristic function of~$W_e$, since it gives the wrong answer -on input $0$. +equal to $0$, then $W_e = \emptyset$. Either way, $W_e$ is computable, +but $f(e)$ is undefined or $\cfind{f(e)}$ is not +the characteristic function of~$W_e$, since it gives no answer or +the wrong answer on input $0$. \end{proof} \end{document} diff --git a/content/computability/computability-theory/ce-closed-cup-cap.tex b/content/computability/computability-theory/ce-closed-cup-cap.tex index 7f8f4a18..3bab95a5 100644 --- a/content/computability/computability-theory/ce-closed-cup-cap.tex +++ b/content/computability/computability-theory/ce-closed-cup-cap.tex @@ -51,7 +51,7 @@ \] Then $k$ enumerates $A \cup B$; the idea is that $k$ just alternates between the enumerations offered by $f$ and~$g$. Enumerating $A \cap -B$ is tricker. If $A \cap B$ is empty, it is trivially computably +B$ is trickier. If $A \cap B$ is empty, it is trivially computably enumerable. Otherwise, let $c$ be any element of $A \cap B$, and define $l$ by \[ diff --git a/content/computability/computability-theory/coding-computations.tex b/content/computability/computability-theory/coding-computations.tex index 6d936cac..6e042baf 100644 --- a/content/computability/computability-theory/coding-computations.tex +++ b/content/computability/computability-theory/coding-computations.tex @@ -18,7 +18,7 @@ \item Describe the complete record of the computation of a function given by some definition for a given input. For instance, a Turing machine computation can be described by the sequence of - configurations (state of the machine, contents of the tape) for each + configurations (state of the machine, contents of the tape, and head position) for each step of computation. \item Test whether a putative record of a computation is in fact the record of how a computable function with a given definition would be diff --git a/content/computability/computability-theory/complement-ce.tex b/content/computability/computability-theory/complement-ce.tex index aa29ad2f..035e214b 100644 --- a/content/computability/computability-theory/complement-ce.tex +++ b/content/computability/computability-theory/complement-ce.tex @@ -36,15 +36,15 @@ Now, if $x \in A$, it will succeed in the first case, and if $x \in \Complement{A}$, it will succeed in the second case. So, $h$~is a total computable function. But now we have that for every~$x$, $x \in -A$ if and only if $T(e, x, h(x))$, i.e., if $\cfind{e}$ is the one -that is defined. Since $T(e, x, h(x))$ is a computable relation, +A$ if and only if $T(d, x, h(x))$, i.e., if $\cfind{d}$ is the one +that is defined. Since $T(d, x, h(x))$ is a computable relation, $A$~is computable. \end{proof} \begin{explain} It is easier to understand what is going on in informal computational terms: to decide $A$, on input $x$ search for halting computations of -$\cfind{e}$ and $\cfind{f}$. One of them is bound to halt; if it is $\cfind{e}$, +$\cfind{d}$ and $\cfind{e}$. One of them is bound to halt; if it is $\cfind{d}$, then $x$ is in~$A$, and otherwise, $x$ is in~$\Complement{A}$. \end{explain} diff --git a/content/computability/computability-theory/complete-ce-sets.tex b/content/computability/computability-theory/complete-ce-sets.tex index f203cbff..059b4d93 100644 --- a/content/computability/computability-theory/complete-ce-sets.tex +++ b/content/computability/computability-theory/complete-ce-sets.tex @@ -41,11 +41,12 @@ \olref[ppr]{prop:trans-red}, any computably enumerable set can be reduced to~$K_1$ as well. -$K$ can be reduced to $K_0$ in much the same way. +And $K_0$ can be reduced to~$K$ in much the same way as it was +reduced to~$K_1$, so $K$ is complete as well. \end{proof} \begin{prob} -Give a reduction of $K$ to $K_0$. +Give a reduction of $K_0$ to~$K$. \end{prob} \begin{digress} @@ -53,8 +54,10 @@ that we have considered so far are either computable, or complete. This should seem strange!{} Are there any examples of computably enumerable sets that are neither computable nor complete? The answer -is yes, but it wasn't until the middle of the 1950s that this was -established by Friedberg and Muchnik, independently. +is yes: Post showed this in 1944. If completeness is defined using the +more liberal Turing reducibility instead of many-one reducibility, it +wasn't until the middle of the 1950s that this was established, by +Friedberg and Muchnik, independently. \end{digress} \end{document} diff --git a/content/computability/computability-theory/computability-theory.tex b/content/computability/computability-theory/computability-theory.tex index ae27dd2f..fb51e215 100644 --- a/content/computability/computability-theory/computability-theory.tex +++ b/content/computability/computability-theory/computability-theory.tex @@ -8,8 +8,7 @@ \olchapter{cmp}{thy}{Computability Theory} \begin{editorial} - Material in this chapter should be reviewed and expanded. In - particular, there are no exercises yet. + Material in this chapter should be reviewed and expanded. \end{editorial} \olimport{introduction} diff --git a/content/computability/computability-theory/def-functions-self-reference.tex b/content/computability/computability-theory/def-functions-self-reference.tex index 8878ca35..26ac6e7e 100644 --- a/content/computability/computability-theory/def-functions-self-reference.tex +++ b/content/computability/computability-theory/def-functions-self-reference.tex @@ -29,7 +29,7 @@ \end{cases} \] and then using the fixed-point lemma to find an index~$e$ such that -$\cfind{e}(y) = g(e,y)$. +$\cfind{e}(y) \simeq g(e,y)$. For a concrete example, the ``greatest common divisor'' function $\fn{gcd}(u,v)$ can be defined by diff --git a/content/computability/computability-theory/equiv-ce-defs.tex b/content/computability/computability-theory/equiv-ce-defs.tex index 23bf6403..1426444f 100644 --- a/content/computability/computability-theory/equiv-ce-defs.tex +++ b/content/computability/computability-theory/equiv-ce-defs.tex @@ -55,7 +55,7 @@ $\cfind{e}$. If $S$ is empty, we are done. Otherwise, let $a$ be any element of~$S$. By Kleene's normal form theorem, we can write \[ -\cfind{e}(x) = U(\umin{s}{T(e, x, s)}). +\cfind{e}(x) \simeq U(\umin{s}{T(e, x, s)}). \] In particular, $\cfind{e}(x) \fdefined$ and $= y$ if and only if there is an $s$ such that $T(e, x, s)$ and $U(s) = y$. Define $f(z)$ by @@ -66,8 +66,7 @@ \end{cases} \] Then $f$ is primitive recursive, because $T$ and $U$ -are. \iftag{TMs}{Expressed in terms of Turing machines, if $z$ codes a - pair $\tuple{(z)_0, (z)_1}$ such that $(z)_1$ is a halting +are. \iftag{TMs}{Expressed in terms of Turing machines, if $(z)_1$ is a halting computation of machine~$M_e$ on input $(z)_0$, then $f$ returns the output of the computation; otherwise, it returns~$a$.} @@ -77,7 +76,7 @@ $\cfind{e}$, so for some $x$ and~$s$, $T(e,x,s)$ holds and $U(s) = y$. But then $y = f(\tuple{x,s})$. Conversely, suppose $y$ is in the range of~$f$. Then either $y = a$, or for some~$z$, $T(e,(z)_0,(z)_1)$ and -$U((z)_1) = y$. Since, in the latter case, $\cfind{e}(x) \fdefined = +$U((z)_1) = y$. Since, in the latter case, $\cfind{e}((z)_0) \fdefined = y$, either way, $y$ is in~$S$. (The notation $\cfind{e}(x) \fdefined = y$ means ``$\cfind{e}(x)$ is diff --git a/content/computability/computability-theory/fixed-point-thm.tex b/content/computability/computability-theory/fixed-point-thm.tex index 84fa3666..1ea5a1c1 100644 --- a/content/computability/computability-theory/fixed-point-thm.tex +++ b/content/computability/computability-theory/fixed-point-thm.tex @@ -78,16 +78,16 @@ $(1) \Rightarrow (2)$: Given $f$, define $g$ by $g(x,y) \simeq \fn{Un}(f(x),y)$. Use (1) to get an index~$e$ such that for every~$y$, \begin{align*} -\cfind{e}(y) & = \fn{Un}(f(e),y) \\ -& = \cfind{f(e)}(y). +\cfind{e}(y) & \simeq \fn{Un}(f(e),y) \\ +& \simeq \cfind{f(e)}(y). \end{align*} $(2) \Rightarrow (1)$: Given $g$, use the $s$-$m$-$n$ theorem to get $f$ such that for every $x$ and~$y$, $\cfind{f(x)}(y) \simeq g(x,y)$. Use (2) to get an index~$e$ such that \begin{align*} -\cfind{e}(y) & = \cfind{f(e)}(y) \\ -& = g(e,y). +\cfind{e}(y) & \simeq \cfind{f(e)}(y) \\ +& \simeq g(e,y). \end{align*} This concludes the proof. \end{proof} @@ -184,8 +184,7 @@ string $x$ repeatedly, $y$ times. Then the ``program'' \begin{quote} \begin{verbatim} -getinput(y); -print(diag('getinput(y); print(diag(x), y)'), y) +getinput(y); print(diag('getinput(y); print(diag(x), y)'), y) \end{verbatim} \end{quote} prints itself out $y$ times, on input $y$. Replacing the @@ -211,7 +210,8 @@ \begin{digress} The same idea can be used to get a ``fixed point'' combinator. Suppose you have a lambda term $g$, and you want another term $k$ with the -property that $k$ is $\beta$-equivalent to $gk$. Define terms +property that $k$ is $\beta$-equivalent to $gk$. Choose $x$ not free in +$g$, and define terms \[ \fn{diag}(x) = xx \] diff --git a/content/computability/computability-theory/k-1.tex b/content/computability/computability-theory/k-1.tex index fe8e27fa..8817697e 100644 --- a/content/computability/computability-theory/k-1.tex +++ b/content/computability/computability-theory/k-1.tex @@ -75,9 +75,15 @@ In other words, $\tuple{x, y} \in K_0$ if and only if $s(e,x,y) \in K_1$. So the function $g$ defined by \[ -g(w) = s(e,(w)_0,(w)_1) +g(w) = +\begin{cases} +s(e,(w)_0,(w)_1) & \text{if $w = \tuple{(w)_0, (w)_1}$}\\ +a & \text{otherwise,} +\end{cases} \] -is a reduction of $K_0$ to~$K_1$. +where $a$ is an index of the nowhere defined function, is a reduction +of $K_0$ to~$K_1$. (If $w$ does not code a pair, then $w \notin K_0$ and +$g(w) = a \notin K_1$.) \end{proof} \end{document} diff --git a/content/computability/computability-theory/no-universal-function.tex b/content/computability/computability-theory/no-universal-function.tex index 4671b8b8..62ad597d 100644 --- a/content/computability/computability-theory/no-universal-function.tex +++ b/content/computability/computability-theory/no-universal-function.tex @@ -9,7 +9,7 @@ \olfileid{cmp}{thy}{nou} \olsection{No Universal Computable Function} -Although there is a partial computable function that is total for the +Although there is a partial computable function that is universal for the partial computable functions, there is no total computable function that is universal for the total computable functions. diff --git a/content/computability/computability-theory/non-comp-set.tex b/content/computability/computability-theory/non-comp-set.tex index 7b99b737..8c684d08 100644 --- a/content/computability/computability-theory/non-comp-set.tex +++ b/content/computability/computability-theory/non-comp-set.tex @@ -22,7 +22,7 @@ To see that $K_0$ is computably enumerable, note that it is the domain of the function~$f$ defined by \[ -f(z) = \umin{y}{(\len{z} = 2 \land T((z)_0, (z)_1, y))}. +f(z) = \umin{y}{(z = \tuple{(z)_0, (z)_1} \land T((z)_0, (z)_1, y))}. \] For, if $\cfind{e}(x)$ is defined, $f(\tuple{e, x})$ finds a halting computation sequence; if $\cfind{e}(x)$ is undefined, so is diff --git a/content/computability/computability-theory/prop-reduce.tex b/content/computability/computability-theory/prop-reduce.tex index 5767a56e..0505f03f 100644 --- a/content/computability/computability-theory/prop-reduce.tex +++ b/content/computability/computability-theory/prop-reduce.tex @@ -43,7 +43,7 @@ \begin{proof} Let $f$ be a many-one reduction from $A$ to~$B$. For the first -claim, just check that if $B$ is the domain of a partial function~$g$, +claim, just check that if $B$ is the domain of a partial computable function~$g$, then $A$ is the domain of~$\comp{f}{g}$: \begin{align*} x \in A & \text{ iff } f(x) \in B \\ @@ -66,7 +66,7 @@ \end{prob} \begin{prob} -Show that if $f\colon A \to B$ is a many-one reduction, then $\Char{A} +Show that if $f$ is a many-one reduction of $A$ to~$B$, then $\Char{A} = \comp{f}{\Char{B}}$. \end{prob} diff --git a/content/computability/computability-theory/reducibility.tex b/content/computability/computability-theory/reducibility.tex index 92aeef87..f385bb4e 100644 --- a/content/computability/computability-theory/reducibility.tex +++ b/content/computability/computability-theory/reducibility.tex @@ -39,7 +39,7 @@ \[ K_0 = \Setabs{\tuple{e, x}}{\cfind{e}(x) \fdefined }, \] -i.e., $K_0 = \Setabs{\tuple{x,e}}{x \in W_e}$. It is easy to extend +i.e., $K_0 = \Setabs{\tuple{e,x}}{x \in W_e}$. It is easy to extend any proof of the uncomputability of~$K$ to the uncomputability of~$K_0$: if $K_0$ were computable, we could decide whether or not !!a{element}~$x$ is in $K$ simply by asking whether or not the pair diff --git a/content/computability/computability-theory/rice-theorem.tex b/content/computability/computability-theory/rice-theorem.tex index 929c193f..da9f453f 100644 --- a/content/computability/computability-theory/rice-theorem.tex +++ b/content/computability/computability-theory/rice-theorem.tex @@ -91,13 +91,13 @@ $h(x,y)$ acts just like $f$ or it acts just like $g$, and deciding whether or not $\cfind{x}(x)$ is defined amounts to deciding which of these two cases holds. But this amounts to deciding whether or not -$h_x(y) \simeq h(x,y)$ is in~$C$ or not, and if $A$ were computable, +the function $h_x$, defined by $h_x(y) \simeq h(x,y)$, is in~$C$, and if $A$ were computable, we could do just that. More formally, since $h$~is partial computable, it is equal to the function $\cfind{e}$ for some index~$e$. By the $s$-$m$-$n$ theorem there is a primitive recursive function~$s$ such that for each~$x$, -$\cfind{s(e,x)}(y) = h_x(y)$. Now we have that for each $x$, if +$\cfind{s(e,x)}(y) \simeq h_x(y)$. Now we have that for each $x$, if $\cfind{x}(x) \fdefined$, then $\cfind{s(e,x)}$ is the same function as~$g$, and so $s(e,x)$ is in $A$. On the other hand, if $\cfind{x}(x) \uparrow$, then $\cfind{s(e,x)}$ is the same function as~$f$, and so diff --git a/content/computability/computability-theory/s-m-n.tex b/content/computability/computability-theory/s-m-n.tex index f61a7321..4d43b40a 100644 --- a/content/computability/computability-theory/s-m-n.tex +++ b/content/computability/computability-theory/s-m-n.tex @@ -31,8 +31,8 @@ It is helpful to think of $s^m_n$ as acting on \emph{programs}. That is, $s^m_n$ takes a program~$e$ for an $(m+n)$-ary function, as well as fixed inputs $a_0$, \dots, $a_{m-1}$; and it returns a program -$s^m_n(x, a_0, \dots, a_{m-1})$ for the $n$-ary function of the -remaining arguments. \iftag{TMs}{It you think of $x$ as the description of a +$s^m_n(e, a_0, \dots, a_{m-1})$ for the $n$-ary function of the +remaining arguments. \iftag{TMs}{If you think of $e$ as the description of a Turing machine, then $s^m_n(e, a_0, \dots, a_{m-1})$ is the Turing machine that, on input $y_0$, \dots,~$y_{n-1}$, prepends $a_0$, \dots,~$a_{m-1}$ to the input string, and runs~$e$. Each $s^m_n$ diff --git a/content/computability/computability-theory/total.tex b/content/computability/computability-theory/total.tex index 78d72dcf..9a1aa855 100644 --- a/content/computability/computability-theory/total.tex +++ b/content/computability/computability-theory/total.tex @@ -41,7 +41,7 @@ Using the $s$-$m$-$n$ theorem, there is a primitive recursive function~$k(x)$ such that for every $x$ and~$y$, \[ -\cfind{k(x)}(y) = +\cfind{k(x)}(y) \simeq \begin{cases} 0 & \text{if $x \in K$} \\ \fundefined & \text{otherwise} diff --git a/content/computability/computability-theory/universal-part-function.tex b/content/computability/computability-theory/universal-part-function.tex index 04fede7c..7f527560 100644 --- a/content/computability/computability-theory/universal-part-function.tex +++ b/content/computability/computability-theory/universal-part-function.tex @@ -36,7 +36,7 @@ sequences of numbers we can easily generalize this to more arguments. For example, note that if $f(x,y,z)$ is a $3$-place partial recursive function, then the function $g(x) \simeq f((x)_0, (x)_1, (x)_2)$ is a -unary recursive function. +unary partial recursive function. \end{explain} \end{document} diff --git a/content/computability/recursive-functions/bounded-minimization.tex b/content/computability/recursive-functions/bounded-minimization.tex index bd361e51..fc9724ff 100644 --- a/content/computability/recursive-functions/bounded-minimization.tex +++ b/content/computability/recursive-functions/bounded-minimization.tex @@ -11,13 +11,14 @@ \begin{explain} It is often useful to define a function as the least number satisfying -some property or relation~$P$. If $P$ is decidable, we can compute -this function simply by trying out all the possible numbers, $0$, $1$, -$2$, \dots, until we find the least one satisfying~$P$. This kind of -unbounded search takes us out of the realm of primitive recursive -functions. However, if we're only interested in the least number -\emph{less than some independently given bound}, we stay primitive -recursive. In other words, and a bit more generally, suppose we have a +some property or relation~$P$. If $P$ is decidable, we can search for such a number by trying +$0$, $1$, $2$, \dots, and return the least one satisfying~$P$ if one +exists; otherwise the search does not terminate. This kind of +unbounded search can take us out of the realm of primitive recursive +functions. If $P$ is primitive recursive and we are only interested +in the least number \emph{less than some independently given bound}, +with a specified default when no witness exists, the resulting +function is primitive recursive. In other words, and a bit more generally, suppose we have a primitive recursive relation~$R(x,z)$. Consider the function that maps $x$ and~$y$ to the least $z < y$ such that $R(x, z)$. It, too, can be computed, by testing whether $R(x, 0)$, $R(x, 1)$, \dots, $R(x, y-1)$. @@ -45,9 +46,9 @@ \item There is no such~$z 0$, we write $x \nmid y$.) In other -words, $x \mid y$ iff for some~$z$, $x \cdot z = y$. Obviously, any -such $z$, if it exists, must be $\leq y$. So, we have that $x \mid y$ +$y$ is an integer multiple of~$x$. When $x>0$, this says that division +of $y$ by~$x$ is possible without remainder. (If $x \mid y$ does not +hold, we write $x \nmid y$.) In other +words, $x \mid y$ iff for some~$z$, $x \cdot z = y$. Obviously, if +such a $z$ exists, there is one that is $\leq y$. So, we have that $x \mid y$ iff for some $z \le y$, $x \cdot z = y$. We can define the relation $x \mid y$ by bounded existential quantification from $=$ and multiplication by @@ -61,7 +61,8 @@ This shows, that $\fn{nextPrime}(x)$ and hence $p(x)$ are (not just computable but) primitive recursive. -(If you're curious, here's a quick proof of Euclid's theorem. Suppose +(If you're curious, here's a quick proof of Euclid's theorem. For +$x=0$ or $x=1$, the prime $2$ has the required property. Otherwise, suppose $p_n$ is the largest prime $\le x$ and consider the product $p = p_0\cdot p_1 \cdot \dots \cdot p_n$ of all primes~$\le x$. Either $p+1$ is prime or there is a prime between $x$ and~$p+1$. Why? diff --git a/content/computability/recursive-functions/primitive-recursion.tex b/content/computability/recursive-functions/primitive-recursion.tex index 6ef58eef..8d9295ee 100644 --- a/content/computability/recursive-functions/primitive-recursion.tex +++ b/content/computability/recursive-functions/primitive-recursion.tex @@ -21,7 +21,7 @@ compute $h(1) = h(0+1)$ from~$h(0)$. Using the same instructions for $x=1$, we compute $h(2) = h(1+1)$ from~$h(1)$, and so on. For every natural number~$x$, we'll eventually reach the step where we define -$h(x)$ from $h(x+1)$, and so $h(x)$ is defined for all $x \in \Nat$. +$h(x+1)$ from $h(x)$, and so $h(x)$ is defined for all $x \in \Nat$. For instance, suppose we specify $h\colon \Nat \to \Nat$ by the following two equations: diff --git a/content/computability/recursive-functions/sequences.tex b/content/computability/recursive-functions/sequences.tex index 98d6f147..eff46585 100644 --- a/content/computability/recursive-functions/sequences.tex +++ b/content/computability/recursive-functions/sequences.tex @@ -116,6 +116,16 @@ Note that if $s$ has length~$k$, the elements of $s$ are $(s)_0$, \dots,~$(s)_{k-1}$. +Not every natural number is the code of a sequence. The primitive +recursive predicate $\fn{Seq}(s)$ tests this: +\[ +\fn{Seq}(s) \defiff s=0 \lor + s=\prod_{i<\len{s}} p_i^{(s)_i+1}. +\] +The empty product is $1$, so both codes for the empty sequence are +included. The equality excludes extra prime factors and gaps in the +initial sequence of primes. + \begin{prop} The function $\fn{concat}(s,t)$, which concatenates two sequences, is primitive recursive. @@ -148,7 +158,11 @@ most~$p_{k-1}$, and each raised to at most $x+1$ in the prime factorization of~$s$. In other words, if we define \[ -\fn{sequenceBound}(x,k) = p_{k-1}^{k \cdot (x+1)}, +\fn{sequenceBound}(x,k) = +\begin{cases} +1 & \text{if $k=0$},\\ +p_{k-1}^{k \cdot (x+1)} & \text{if $k>0$}. +\end{cases} \] then the numeric code of the sequence~$s$ described above is at most~$\fn{sequenceBound}(x,k)$. @@ -158,13 +172,15 @@ $\fn{concat}$ using bounded search. All we need to do is write down a primitive recursive \emph{specification} of the object (number of the concatenated sequence) we are looking for, and a bound on how far to -look. The following works: +look. If $\len{t}=0$, set $\fn{concat}(s,t)=s$. For $\len{t}>0$, +the following works: \begin{align*} \fn{concat}(s,t) = {} & \bmin{v < \fn{sequenceBound}(s+t,\len{s} + \len{t})}{} \\ & \quad(\len{v} = \len{s} + \len{t} \land {}\\ - & \qquad \bforall{i < \len{s}}{((v)_i = (s)_i) \land {} \\ - & \qquad \bforall{j < \len{t}}{((v)_{\len{s}+j} = (t)_j)})} + & \qquad \bforall{i < \len{v}}{(p_i \mid v)} \land {} \\ + & \qquad \bforall{i < \len{s}}{((v)_i = (s)_i)} \land {} \\ + & \qquad \bforall{j < \len{t}}{((v)_{\len{s}+j} = (t)_j)}) \end{align*} \begin{prob} @@ -187,8 +203,8 @@ \begin{prop} \ollabel{prop:subseq} The function $\fn{subseq}(s, i, n)$ which returns the subsequence - of $s$ of length~$n$ beginning at the $i$th element, is primitive - recursive. + of $s$ of length~$n$ beginning at the $i$th element when + $i+n\leq\len{s}$, and returns $0$ otherwise, is primitive recursive. \end{prop} \begin{proof} diff --git a/content/computability/recursive-functions/trees.tex b/content/computability/recursive-functions/trees.tex index 95388abb..a32efae9 100644 --- a/content/computability/recursive-functions/trees.tex +++ b/content/computability/recursive-functions/trees.tex @@ -39,7 +39,7 @@ primitive recursive and returns the codes of the immediate subtrees of a tree~$t$. Now we can define a helper function $\fn{hSubtreeSeq}(t,n)$ which computes the sequence of all subtrees - which are $n$ nodes removed from the root. The sequence of subtrees + which are at most $n$ nodes removed from the root. The sequence of subtrees of~$t$ which is $0$ nodes removed from the root---in other words, begins at the root of~$t$---is the sequence consisting just of~$t$. To obtain a sequence of all level~$n+1$ subtrees of $t$, we diff --git a/content/turing-machines/machines-computations/combining-machines.tex b/content/turing-machines/machines-computations/combining-machines.tex index e406fe0c..12671278 100644 --- a/content/turing-machines/machines-computations/combining-machines.tex +++ b/content/turing-machines/machines-computations/combining-machines.tex @@ -36,7 +36,7 @@ \item The transition function is the function $\delta''$ given by: \[\delta''(q,\sigma) = \begin{cases} - \delta(q,\sigma) & \text{if $q \in Q$}\\ + \delta(q,\sigma) & \text{if $q \in Q$ and $\delta(q,\sigma)$ is defined}\\ \delta'(q,\sigma) & \text{if $q \in Q'$}\\ \tuple{q_0', \sigma, \TMstay} & \text{if $q \in Q$ and $\delta(q,\sigma)$ is undefined} @@ -152,14 +152,15 @@ \begin{prop} If $M$ and $M'$ are disciplined and compute the functions $f\colon \Nat^k \to \Nat$ and $f'\colon \Nat \to \Nat$, respectively, then - $M \frown M'$ is disciplined and computes~$\comp{f}{f'}$. + $M \frown M'$ computes~$\comp{f}{f'}$. If $M$ and $M'$ have the + same tape alphabet, $M \frown M'$ is also disciplined. \end{prop} \begin{proof} Since $M$ is disciplined, when it halts with output~$f(n_1,\dots,n_k) = m$, the head is scanning square~$1$. If we now enter the start state of~$M'$, the machine will halt with - output $f'(m)$, again scanning square~$1$. The other conditions of + output $f'(m)$, again scanning square~$1$. If the tape alphabets agree, the other conditions of \olref[dis]{defn:disciplined} are also satisfied. \end{proof} diff --git a/content/turing-machines/machines-computations/configuration.tex b/content/turing-machines/machines-computations/configuration.tex index abe28f2f..459c3d9a 100644 --- a/content/turing-machines/machines-computations/configuration.tex +++ b/content/turing-machines/machines-computations/configuration.tex @@ -51,13 +51,15 @@ \begin{defn}[Initial configuration] The \emph{initial configuration} of $M$ for input $I \in \Sigma^*$ is \[ -\tuple{\TMendtape \frown I, 1, q_0}. +\tuple{\TMendtape \frown I \frown \TMblank, 1, q_0}. \] \end{defn} \begin{explain} The~$\frown$ symbol is for \emph{concatenation}---the input string -begins immediately to the left end marker. +begins immediately to the right of the left end marker. The +final~$\TMblank$ makes sure that square~$1$ exists even if the input is +empty. \end{explain} \begin{defn} diff --git a/content/turing-machines/machines-computations/disciplined-machines.tex b/content/turing-machines/machines-computations/disciplined-machines.tex index e11f77c1..f6f5e705 100644 --- a/content/turing-machines/machines-computations/disciplined-machines.tex +++ b/content/turing-machines/machines-computations/disciplined-machines.tex @@ -41,8 +41,8 @@ $\delta(q, \sigma) = \tuple{h, \sigma, N}$ for any pair $\tuple{q,\sigma}$ where the original $\delta$~is undefined. It is true, although tedious to prove, that any Turing machine~$M$ can be -turned into a disciplined Turing machine~$M'$ which halts on the same -inputs and produces the same output. For instance, if the Turing +turned into a disciplined Turing machine~$M'$ which produces the same +output whenever $M$ has an output, and does not halt if $M$ does not halt. For instance, if the Turing machine halts and is not on square~$1$, we can add some instructions to make the head move left until it finds the tape-end marker, then move one square to the right, then halt. We'll leave you to think @@ -51,7 +51,8 @@ \begin{ex} In \olref{fig:adder-disc}, we turn the addition machine - from \olref[una]{ex:adder} into a disciplined machine. + from \olref[una]{ex:adder} into a machine that is disciplined on + the specified numerical inputs. \begin{figure}\[ \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm, semithick] @@ -71,7 +72,7 @@ (D) edge [loop above] node {\TMtrans{\TMstroke}{\TMstroke}{\TMleft}} (D) edge node {\TMtrans{\TMendtape}{\TMendtape}{\TMright}} (H); \end{tikzpicture} -\]\caption{A disciplined addition machine} +\]\caption{An addition machine disciplined on numerical inputs} \ollabel{fig:adder-disc} \end{figure} \end{ex} @@ -90,7 +91,8 @@ \begin{prob}\label{tur:mac:dis:prob:copier} Find a disciplined machine which, when started on input $\TMstroke^n$ -produces output $\TMstroke^n \concat \TMblank \concat \TMstroke^n$. +produces output $\TMstroke^n \concat \TMblank \concat \TMstroke^n$ +for $n>0$, and empty output for $n=0$. \end{prob} \end{document} diff --git a/content/turing-machines/machines-computations/introduction.tex b/content/turing-machines/machines-computations/introduction.tex index 65b9d23b..0a57bb68 100644 --- a/content/turing-machines/machines-computations/introduction.tex +++ b/content/turing-machines/machines-computations/introduction.tex @@ -40,7 +40,7 @@ $\TMendtape$, and a finite number of squares which contain the \emph{input}. At any time, the mechanism is in one of a finite number of \emph{states}. At the outset, the head scans the leftmost square -and in a specified \emph{initial state}. At each step of the +of the input and the mechanism is in a specified \emph{initial state}. At each step of the mechanism's run, the content of the square currently scanned together with the state the mechanism is in and the Turing machine program determine what happens next. The Turing machine program is given by a @@ -116,15 +116,16 @@ that it is not hard to adapt his notions to computable functions on the natural numbers, and so on. Notice that this was a full five years before the first working general purpose computer was built in -1941 (by the German Konrad Zuse in his parent's living room), seven -years before Turing and his colleagues at Bletchley Park built the -code-breaking Colossus (1943), nine years before the American ENIAC +1941 (by the German Konrad Zuse in his Berlin workshop), seven +years before Tommy Flowers built the code-breaking Colossus for +Bletchley Park (1943), nine years before the American ENIAC (1945), twelve years before the first British general purpose computer---the Manchester Small-Scale Experimental Machine---was built in Manchester (1948), and thirteen years before the Americans first tested the BINAC (1949). The Manchester SSEM has the distinction of -being the first stored-program computer---previous machines had to be -rewired by hand for each new task. +being the first stored-program computer---previous machines read their +programs from punched tape, or had to be rewired by hand for each new +task. \end{history} \end{document} diff --git a/content/turing-machines/machines-computations/representing-tms.tex b/content/turing-machines/machines-computations/representing-tms.tex index 7336ab8c..e6cea604 100644 --- a/content/turing-machines/machines-computations/representing-tms.tex +++ b/content/turing-machines/machines-computations/representing-tms.tex @@ -85,7 +85,7 @@ \TMendtape \TMstroke_0 \TMstroke \TMstroke \TMstroke \TMblank \ldots \] The above configuration is straightforward. As can be seen, the -machine starts in state one, scanning the leftmost~$\TMstroke$. This +machine starts in state~$q_0$, scanning the leftmost~$\TMstroke$. This is represented by a subscript of the state name on the first~$\TMstroke$. The applicable instruction at this point is $\delta(q_0, \TMstroke) = \tuple{q_1, \TMstroke, \TMright}$, and so @@ -170,7 +170,7 @@ machines. Machine tables have the tape alphabet displayed on the $x$-axis, and the set of machine states across the $y$-axis. Inside the table, at the intersection of each state and symbol, is written the -rest of the instruction---the new state, new symbol, and direction of +rest of the instruction---the new symbol, new state, and direction of movement. Machine tables make it easy to determine in what state, and for what symbol, the machine halts. Whenever there is a gap in the table is a possible point for the machine to halt. Unlike state diff --git a/content/turing-machines/machines-computations/unary-numbers.tex b/content/turing-machines/machines-computations/unary-numbers.tex index 0d595a11..db0c4090 100644 --- a/content/turing-machines/machines-computations/unary-numbers.tex +++ b/content/turing-machines/machines-computations/unary-numbers.tex @@ -229,7 +229,7 @@ \begin{enumerate} \item $M$ halts on input $\TMstroke^{n_1}\concat\TMblank\concat \dots \concat\TMblank\concat\TMstroke^{n_k}$ with output $\TMstroke^{m}$ if $f(n_1, \dots, n_k) = m$. - \item $M$ does not halt at all, or with an output that is not a + \item $M$ does not halt at all, or halts without an output that is a single block of~$\TMstroke$'s if $f(n_1, \dots, n_k)$ is undefined. \end{enumerate} \end{defn} diff --git a/content/turing-machines/machines-computations/variants.tex b/content/turing-machines/machines-computations/variants.tex index 7721ec7e..db720eeb 100644 --- a/content/turing-machines/machines-computations/variants.tex +++ b/content/turing-machines/machines-computations/variants.tex @@ -50,7 +50,8 @@ definition, it just stays put instead of ``falling off'', but we could have defined it so that it halts when that happens. This definition is also equivalent: we could simulate the behavior of a Turing machine -that halts when it attempts to move left from square~$0$ by deleting +that preserves a tape-end marker unique to square~$0$ and halts when +it attempts to move left from square~$0$, by deleting every transition $\delta(q,\TMendtape) = \tuple{q',\sigma,\TMleft}$---then instead of attempting to move left on~$\TMendtape$ the machine halts.\footnote{This doesn't \emph{quite} diff --git a/content/turing-machines/undecidability/decision-problem.tex b/content/turing-machines/undecidability/decision-problem.tex index 2bf56139..a57d770a 100644 --- a/content/turing-machines/undecidability/decision-problem.tex +++ b/content/turing-machines/undecidability/decision-problem.tex @@ -27,8 +27,8 @@ Our strategy for proving that the decision problem is unsolvable is to reduce the halting problem to it. This means the following: We have -proved that the function~$h(e,w)$ that halts with output~$1$ if the -Turing machine described by~$e$ halts on input~$w$ and outputs~$0$ +proved that the function~$h(e,w)$ that has value~$1$ if the +Turing machine described by~$e$ halts on input~$w$ and value~$0$ otherwise, is not Turing computable. We will show that if there were a Turing machine that decides validity of first-order sentences, then there is also Turing machine that computes~$h$. Since $h$ cannot be diff --git a/content/turing-machines/undecidability/enumerating-tms.tex b/content/turing-machines/undecidability/enumerating-tms.tex index ce7d9110..0098609e 100644 --- a/content/turing-machines/undecidability/enumerating-tms.tex +++ b/content/turing-machines/undecidability/enumerating-tms.tex @@ -146,7 +146,7 @@ Can you think of a way to describe Turing machines that does not require that the states and alphabet symbols are explicitly listed? You may define your own notion of ``standard'' machine, but say - something about why every Turing machine can be computed by a + something about why every Turing machine can be simulated by a ``standard'' machine in your new sense. \end{prob} diff --git a/content/turing-machines/undecidability/halting-problem.tex b/content/turing-machines/undecidability/halting-problem.tex index 34f105b5..61a41121 100644 --- a/content/turing-machines/undecidability/halting-problem.tex +++ b/content/turing-machines/undecidability/halting-problem.tex @@ -64,9 +64,8 @@ \begin{proof} We suppose, for contradiction, that the function~$s$ is Turing computable. Then there would be a Turing machine~$S$ that -computes~$s$. We may assume, without loss of generality, that when $S$ -halts, it does so while scanning the first square (i.e., that it is -disciplined). This machine can be ``hooked up'' to another +computes~$s$. We may assume, without loss of generality, that $S$ is +disciplined. In particular, it halts while scanning square~$1$. This machine can be ``hooked up'' to another machine~$J$, which halts if it is started on input~$0$ (i.e., if it reads $\TMblank$ in the initial state while scanning the square to the right of the end-of-tape symbol), and otherwise wanders off to the diff --git a/content/turing-machines/undecidability/representing-tms.tex b/content/turing-machines/undecidability/representing-tms.tex index 7dac94bb..c5b5eaab 100644 --- a/content/turing-machines/undecidability/representing-tms.tex +++ b/content/turing-machines/undecidability/representing-tms.tex @@ -111,7 +111,7 @@ \item Axioms describing the transition from one configuration to the next: -For the following, let $!A(x, y)$ be the conjunction of all !!{sentence}s +For the following, let $!A(x, y)$ be the conjunction of all !!{formula}s of the form \[ \lforall[z][ @@ -142,7 +142,7 @@ & \lforall[x][\lforall[y][ ((\Obj Q_{q_i}(x', y) \land \Obj S_{\sigma}(x', y)) \lif {}]]\\ & \qquad (\Obj Q_{q_j}(x, y') \land \Obj S_{\sigma'}(x', y') \land -!A(x, y))) \land {}\\ +!A(x', y))) \land {}\\ & \lforall[y][((\Obj Q_{q_i}(\num{0}, y) \land \Obj S_{\sigma}(\num{0}, y)) \lif {}]\\ & \qquad (\Obj Q_{q_j}(\num{0}, y') \land \Obj S_{\sigma'}(\num{0}, diff --git a/content/turing-machines/undecidability/trakhtenbrot.tex b/content/turing-machines/undecidability/trakhtenbrot.tex index e26a0187..2fac2e7b 100644 --- a/content/turing-machines/undecidability/trakhtenbrot.tex +++ b/content/turing-machines/undecidability/trakhtenbrot.tex @@ -34,7 +34,7 @@ input~$w$, we can build a finite model~$\Struct M'$ in the same way. Suppose $M$ started on input~$w$ halts after~$k$ steps. Take as domain~$\Domain{M'}$ the set $\{0, \dots, n\}$, where $n$ is the - larger of~$k$ and the length of~$w$, and let + larger of~$k$ and the length of~$w$, plus~$1$, and let \[ \Assign{\prime}{M'}(x) = \begin{cases} @@ -67,9 +67,9 @@ \begin{prob} Let $M$ be a Turing machine with the single state $q_0$ and single - instruction $\delta(q_0,\TMblank) = \tuple{q,\TMblank,\TMstay}$. + instruction $\delta(q_0,\TMblank) = \tuple{q_0,\TMblank,\TMstay}$. Let $\Domain{M''} = \{0, 1, 2\}$, $\Assign{\prime}{M''}(0) = - \Assign{\prime}{M'}(1) = 1$ and $\Assign{\prime}{M''}(2) = 2$, and + \Assign{\prime}{M''}(1) = 1$ and $\Assign{\prime}{M''}(2) = 2$, and $\Assign{<}{M''} = \{\tuple{0,1}, \tuple{1,1}, \tuple{2,2}\}$. Define $\Assign{\Obj Q_{q_0}}{M''}$, $\Assign{\Obj S_{\TMblank}}{M''}$, and $\Assign{\Obj S_{\TMendtape}}{M''}$ so @@ -115,7 +115,7 @@ & \lforall[x][\lforall[y][ ((\Obj Q_{q_i}(x', y) \land \Obj S_{\sigma}(x', y)) \lif {}]]\\ & \qquad (\Obj Q_{q_j}(x, y') \land \Obj S_{\sigma'}(x', y') \land -!A(x, y))) \land {}\\ +!A(x', y) \land !B(y'))) \land {}\\ & \lforall[y][((\Obj Q_{q_i}(\num{0}, y) \land \Obj S_{\sigma}(\num{0}, y)) \lif {}]\\ & \qquad (\Obj Q_{q_j}(\num{0}, y') \land \Obj S_{\sigma'}(\num{0}, @@ -179,14 +179,14 @@ \end{cases} \\ \tuple{x,y} \in \Assign{<}{M'} &\text{iff $x < y$ or $x = y = n$,} \end{align*} - where $n = \max(k,\len{w})$ and $k$~is the least number such that + where $n = \max(k,\len{w}) + 1$ and $k$~is the least number such that $M$ started on input~$w$ has halted after~$k$ steps. We leave the verification that $\Sat{M'}{!T'(M,w) \land E(M,w)}$ as an exercise. \end{proof} \begin{prob} Complete the proof of \olref[tur][und][tra]{lem:halts-sat} by - proving that $\Sat{M'}{!T(M,w) \land E(M,w)}$. + proving that $\Sat{M'}{!T'(M,w) \land !E(M,w)}$. \end{prob} \begin{lem}\ollabel{lem:sat-halts} @@ -197,14 +197,15 @@ \begin{proof} We show the contrapositive. Suppose that $M$ started on~$w$ does not halt. If $!T'(M,w) \land !E(M,w)$ has no model at all, we are done. - So assume $\Struct{M}$ is a model of~$!T(M,w) \land !E(M, w)$. We + So assume $\Struct{M}$ is a model of~$!T'(M,w) \land !E(M, w)$. We have to show that it cannot be finite. We can prove, just like in \olref[ver]{lem:config}, that if~$M$, started on input~$w$, has not halted after~$n$ steps, then $!T'(M,w) - \Entails !C(M, w, n) \land !B(\num{n})$. Since $M$ started on + \Entails !C(M, w, n)$, and also $!T'(M,w) \Entails !B(\num{n})$ if + $n > 0$. Since $M$ started on input~$w$ does not halt, $!T'(M,w) \Entails !C(M, w, n) \land - !B(\num{n})$ for all~$n \in \Nat$. Note that by + !B(\num{n})$ for all~$n > 0$. Note that by \olref[rep]{prop:mlessk}, $!T'(M,w) \Entails \num{k} < \num{n}$ for all~$k < n$. Also $!B(\num{n}) \Entails \num{k} < \num{n} \lif \eq/[\num{k}][\num{n}]$. So, $\Sat{M}{\eq/[\num{k}][\num{n}]}$ for @@ -217,7 +218,7 @@ \begin{prob} Complete the proof of \olref[tur][und][tra]{lem:sat-halts} by proving that if~$M$, started on input~$w$, has not halted after~$n$ - steps, then $!T'(M,w) \Entails !B(\num{n})$. + steps and $n > 0$, then $!T'(M,w) \Entails !B(\num{n})$. \end{prob} \begin{thm}[Trakhtenbrot's Theorem] diff --git a/content/turing-machines/undecidability/universal-tm.tex b/content/turing-machines/undecidability/universal-tm.tex index 177859c4..9583af49 100644 --- a/content/turing-machines/undecidability/universal-tm.tex +++ b/content/turing-machines/undecidability/universal-tm.tex @@ -84,7 +84,9 @@ symbol is~$3$, $1$ being the number of~$\TMendtape$ and $2$ being the number of~$\TMblank$). At the left end of this sequence of blocks (separated by $\TMblank$ symbols on the tape of~$U$), it writes a - single~$\TMstroke$, the code for~$\TMendtape$. + single~$\TMstroke$, the code for~$\TMendtape$. It also appends a + block of two strokes for an initial blank square; whenever the simulated + head moves beyond the represented tape, it appends another such block. $U$ now has on its tape: the index~$e$, the number~$n$, the code number of the start state (the ``current state''), the number of the @@ -109,8 +111,9 @@ \item Move the head to where it records the current ``state'' and replace the number there with the number of the new state, \item Move to the place where it records the ``tape position'' and - erase a~$\TMstroke$ or add a~$\TMstroke$ (if the instruction says - to move left or right, respectively). + erase a~$\TMstroke$ if the instruction says to move left and the + counter is nonempty, or add a~$\TMstroke$ if it says to move right. + Leave the counter unchanged for a stay instruction or a left move at $0$. \item Repeat.\footnote{We're glossing over some subtle difficulties here. E.g., $U$~may need some extra space when it increases the counter where it keeps track of the ``current head @@ -120,20 +123,16 @@ If $M_e$ started on input~$n$ never halts, then $U$ also never halts, so its output is undefined. - If in step~\olref{find-inst} it turns out that the description - of~$M_e$ contains no instruction for the current - ``state''/``symbol'' pair, then $M_e$ would halt. If this happens, - $U$ erases the part of its tape to the left of the ``tape.'' For - each block of three~$\TMstroke$'s (representing a~$\TMstroke$ on - $M_e$'s tape), it writes a $\TMstroke$ on the left end of its own - tape, and successively erases the ``tape.'' When this is done, - $U$'s~tape contains a single block of~$\TMstroke$'s of length~$m$. - - If $U$ encounters something other than a block of - three~$\TMstroke$'s on the ``tape,'' it immediately halts. Since - $U$'s~tape in this case does not contain a single block - of~$\TMstroke$'s, its output is not a natural number, i.e., $f(e,n)$ - is undefined in this case. + If in step~\olref{find-inst} there is no instruction for the current + ``state''/``symbol'' pair, then $M_e$ would halt. Check whether the + encoded ``tape'' consists of the code for $\TMendtape$, followed by + $m$ codes for $\TMstroke$ and then zero or more codes for $\TMblank$. + In that case, $U$ erases its working data, preserving its own tape-end + marker, writes $m$ strokes immediately to its right, and halts. + This includes $m=0$, when the output is empty. Otherwise, $U$ erases + its working data and halts with output $\TMblank\TMstroke$, which is + not a single block of strokes. Thus $U$ halts whenever $M_e$ halts, + and its numerical output is defined exactly when $M_e$ has one. \end{proof} \end{document} diff --git a/content/turing-machines/undecidability/unsolvability-decision-problem.tex b/content/turing-machines/undecidability/unsolvability-decision-problem.tex index 94456e06..150468b9 100644 --- a/content/turing-machines/undecidability/unsolvability-decision-problem.tex +++ b/content/turing-machines/undecidability/unsolvability-decision-problem.tex @@ -23,7 +23,7 @@ follows. We construct a Turing machine~$E$ that, given as input the number~$e$ of Turing machine~$M_e$ and input~$w$, computes the corresponding !!{sentence}~$!T(M_e, w) \lif !E(M_e, w)$ and halts, -scanning the leftmost square on the tape. The machine $E \concat D$ +scanning square~$1$, the first square of its output. The machine $E \concat D$ would then, given input $e$ and $w$, first compute~$!T(M_e, w) \lif !E(M_e, w)$ and then run the decision problem machine~$D$ on that input. $D$ halts with output~$1$ iff $!T(M_e, w) \lif !E(M_e, w)$ is diff --git a/content/turing-machines/undecidability/verification.tex b/content/turing-machines/undecidability/verification.tex index a0316f75..b3ec0a40 100644 --- a/content/turing-machines/undecidability/verification.tex +++ b/content/turing-machines/undecidability/verification.tex @@ -49,7 +49,7 @@ $!T(M, w)$ is true: its domain will be $\Nat$, and the interpretation of all the $\Obj Q_q$ and $\Obj S_\sigma$ will be given by the configurations of~$M$ during a run on input~$w$. So, e.g., -$\Sat{M}{\Obj Q_q(\num{m}, \num{n})}$ iff $T$, when run on input~$w$ +$\Sat{M}{\Obj Q_q(\num{m}, \num{n})}$ iff $M$, when run on input~$w$ for $n$ steps, is in state~$q$ and scanning square~$m$. Now since $!T(M, w) \Entails !E(M, w)$ by hypothesis, and since $\Sat{M}{!T(M, w)}$ by construction, $\Sat{M}{!E(M, w)}$. But $\Sat{M}{!E(M, w)}$ @@ -66,9 +66,9 @@ \] where $q$ is the state of $M$ at time~$n$, $M$ is scanning square~$m$ at time~$n$, square~$i$ contains symbol~$\sigma_i$ at time~$n$ for $0 -\le i \le k$ and $k$ is the right-most non-blank square of the tape at -time~$0$, or the right-most square the tape head has visited after $n$ -steps, whichever is greater. +\le i \le k$ and $k$ is the greater of the length of the full input +word~$w$ and the right-most square the tape head has visited up to time~$n$ +(including its initial position~$1$). \end{defn} \begin{lem}\ollabel{lem:halt-config-implies-halt} @@ -92,10 +92,10 @@ \lexists[x][\lexists[y][(\bigvee_{\tuple{q, \sigma} \in X}(\Obj Q_q(x, y) \land \Obj S_\sigma(x, y)))]] \] -since $\Obj Q_{q'}(\num{m}, \num{n}) \land S_{\sigma'}(\num{m}, -\num{n}) \Entails \bigvee_{\tuple{q, \sigma} \in X} (\Obj Q_q(\num{m}, -\num{n}) \land \Obj S_{\sigma}(\num{m}, \num{n}))$, as -$\tuple{q',\sigma'} \in X$. +since $\Obj Q_q(\num{m}, \num{n}) \land \Obj S_\sigma(\num{m}, +\num{n}) \Entails \bigvee_{\tuple{q', \sigma'} \in X} (\Obj Q_{q'}(\num{m}, +\num{n}) \land \Obj S_{\sigma'}(\num{m}, \num{n}))$, as +$\tuple{q,\sigma} \in X$. \end{proof} \begin{explain} @@ -106,20 +106,25 @@ \begin{lem} \ollabel{lem:config} -For each $n$, if $M$ has not halted after $n$ steps, $!T(M, w) +For each $n$, if $M$ has not halted before the $n$th step, $!T(M, w) \Entails !C(M, w, n)$. \end{lem} \begin{proof} -Induction basis: If $n = 0$, then the conjuncts of $!C(M, w, 0)$ are -also conjuncts of $!T(M, w)$, so entailed by it. +Induction basis: If $n = 0$ and $w$ is nonempty, the conjuncts of +$!C(M, w, 0)$ are conjuncts of $!T(M, w)$. If $w$ is empty, then +$k=1$. The input tail axiom and $\num{0}<\num{1}$ give +$\Obj S_\TMblank(\num{1},\num{0})$. Transitivity gives +$\num{1} 0$ and after $n$ steps, $M$ started on $w$ is in +Suppose after $n$ steps, $M$ started on $w$ is in state~$q$ scanning square~$m$. Since $M$ does not halt after~$n$ steps, there must be an instruction of one of the following three forms in the program of~$M$: @@ -162,8 +167,8 @@ \intertext{We now get} & \Obj Q_{q'}(\num{m}', \num{n}') \land \Obj S_{\sigma'}(\num{m}, \num{n}') \land {}\\ -& \qquad\Obj S_{\sigma_0}(\num{0}, \num{n}') \land \dots \land - \Obj S_{\sigma_k}(\num{k}, \num{n}') \land {}\\ +& \qquad\bigwedge_{\substack{0\leq i\leq k\\ i\neq m}} + \Obj S_{\sigma_i}(\num{i}, \num{n}') \land {}\\ & \qquad \lforall[x][(\num{k} < x \lif \Obj S_\TMblank(x, \num{n}'))] \end{align*} as follows: The first line comes directly from the consequent of the @@ -204,10 +209,10 @@ & \lforall[x][\lforall[y][((\Obj Q_{q}(x', y) \land \Obj S_{\sigma}(x', y)) \lif {}]]\\ & \qquad (\Obj Q_{q'}(x, y') \land \Obj - S_{\sigma'}(x', y') \land !A(x, y))) \land {}\\ -& \lforall[y][((\Obj Q_{q_i}(\num{0}, y) \land \Obj S_{\sigma}(\num{0}, + S_{\sigma'}(x', y') \land !A(x', y))) \land {}\\ +& \lforall[y][((\Obj Q_q(\num{0}, y) \land \Obj S_{\sigma}(\num{0}, y)) \lif {}]\\ -& \qquad (\Obj Q_{q_j}(\num{0}, y') \land \Obj S_{\sigma'}(\num{0}, y') +& \qquad (\Obj Q_{q'}(\num{0}, y') \land \Obj S_{\sigma'}(\num{0}, y') \land !A(\num{0}, y))) \intertext{is a conjunct of $!T(M,w)$. If $m>0$, then let $l = m - 1$ (i.e., $m = l+1$). The first conjunct of the above !!{sentence} @@ -215,17 +220,17 @@ & (\Obj Q_{q}(\num{l}', \num{n}) \land \Obj S_{\sigma}(\num{l}', \num{n})) \lif {} \\ & \qquad (\Obj Q_{q'}(\num{l}, \num{n}') \land \Obj S_{\sigma'}(\num{l}', -\num{n}') \land !A(\num{l}, \num{n})) +\num{n}') \land !A(\num{l}', \num{n})) \intertext{Otherwise, let $l = m = 0$ and consider the following !!{sentence} entailed by the second conjunct:} -& ((\Obj Q_{q_i}(\num{0}, \num{n}) \land \Obj S_{\sigma}(\num{0}, \num{n})) \lif {}\\ -& \qquad (\Obj Q_{q_j}(\num{0}, \num{n}') \land \Obj S_{\sigma'}(\num{0}, \num{n}') \land +& ((\Obj Q_q(\num{0}, \num{n}) \land \Obj S_{\sigma}(\num{0}, \num{n})) \lif {}\\ +& \qquad (\Obj Q_{q'}(\num{0}, \num{n}') \land \Obj S_{\sigma'}(\num{0}, \num{n}') \land !A(\num{0}, \num{n}))) \intertext{Either sentence implies} & \Obj Q_{q'}(\num{l}, \num{n}') \land \Obj S_{\sigma'}(\num{m}, \num{n}') \land {}\\ -&\qquad \Obj S_{\sigma_0}(\num{0}, \num{n}')\land \dots \land - \Obj S_{\sigma_k}(\num{k}, \num{n}') \land {} \\ +&\qquad \bigwedge_{\substack{0\leq i\leq k\\ i\neq m}} + \Obj S_{\sigma_i}(\num{i}, \num{n}') \land {} \\ & \qquad \lforall[x][(\num{k} < x \lif \Obj S_\TMblank(x, \num{n}'))] \end{align*} @@ -245,8 +250,9 @@ \begin{prob} Give !!a{derivation} of $\Obj S_{\sigma_i}(\num{i}, \num{n}')$ from -$\Obj S_{\sigma_i}(\num{i}, \num{n})$ and $!A(m, n)$ (assuming $i \neq -m$, i.e., either $i < m$ or $m < i$). +$\Obj S_{\sigma_i}(\num{i}, \num{n})$ and $!A(\num{m}, \num{n})$, +together with the successor-growth and transitivity axioms for $<$ in +$!T(M,w)$ (assuming $i \neq m$, i.e., either $i