Skip to content

Commit 383e205

Browse files
committed
revise the computability theory chapter
1 parent 6dc3bbb commit 383e205

24 files changed

+381
-358
lines changed

content/computability/computability-theory/ce-closed-cup-cap.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
\end{cases}
5151
\]
5252
Then $k$ enumerates $A \cup B$; the idea is that $k$ just alternates
53-
between the enumerations offered by $f$ and $g$. Enumerating $A \cap
53+
between the enumerations offered by $f$ and~$g$. Enumerating $A \cap
5454
B$ is tricker. If $A \cap B$ is empty, it is trivially computably
5555
enumerable. Otherwise, let $c$ be any element of $A \cap B$, and
5656
define $l$ by

content/computability/computability-theory/ce-sets.tex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@
2828
\[
2929
S = \{ f(0), f(1), f(2), \dots \},
3030
\]
31-
and so $f$ can be seen as ``enumerating'' the elements of $S$. Note
32-
that according to the definition, $f$ need not be an increasing
31+
and so $f$ can be seen as ``enumerating'' the elements of~$S$. Note
32+
that according to the definition, $f$~need not be an increasing
3333
function, i.e., the enumeration need not be in increasing order. In
34-
fact, $f$ need not even be injective, so that the constant function
35-
$f(x) = 0$ enumerates the set $\{ 0 \}$.
34+
fact, $f$ need not even be injective, i.e., repetitions in the
35+
enumeration $f(0)$, $f(1)$, $f(2)$, \dots{} of~$S$ are allowed. For
36+
instance, the constant function $f(x) = 0$ enumerates the set $\{ 0
37+
\}$.
3638
\end{explain}
3739

3840
Any computable set is computably enumerable. To see this, suppose

content/computability/computability-theory/coding-computations.tex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
step of computation.
2323
\item Test whether a putative record of a computation is in fact the
2424
record of how a computable function with a given definition would be
25-
computed for a given input.
25+
computed for a given input (on which the function is
26+
defined, i.e., the computation halts).
2627
\item Extract from such a description of the complete record of a
2728
computation the value of the function for a given input. For
2829
instance, the contents of the tape in the very last step of a
@@ -33,8 +34,8 @@
3334
computable function a numerical \emph{index} in such a way that the
3435
instructions can be recovered from the index in a computable way.
3536
Similarly, the complete record of a computation can be coded by a
36-
single number as well. The resulting arithmetical relation ``$s$
37-
codes the record of computation of the function with index~$e$ for
37+
single number as well. The resulting arithmetical relation ``$s$~codes
38+
the record of computation of the function with index~$e$ for
3839
input~$x$'' and the function ``output of computation sequence with
3940
code~$s$'' are then computable; in fact, they are primitive recursive.
4041

content/computability/computability-theory/complement-ce.tex

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
\olfileid{cmp}{thy}{cmp}
1010
\olsection{Computably Enumerable Sets not Closed under Complement}
1111

12-
Suppose $A$ is computably enumerable. Is the complement of $A$,
13-
$\Complement{A} = \Nat \setminus A$, necessarily computably enumerable
12+
Suppose $A$ is computably enumerable. Is the complement of~$A$,
13+
$\Complement{A} = \Nat \setminus A$, always computably enumerable
1414
as well? The following theorem and corollary show that the answer is
1515
``no.''
1616

@@ -25,19 +25,19 @@
2525
$\Complement{A}$ is computable as well ($\Char{A} = 1 \tsub
2626
\Char{\Complement{A}}$), and so both are computably enumerable.
2727

28-
In the other direction, suppose $A$ and $\Complement{A}$ are both
29-
computably enumerable. Let $A$ be the domain of $\cfind{d}$, and let
30-
$\Complement{A}$ be the domain of $\cfind{e}$. Define $h$ by
28+
In the other direction, suppose $A$ and~$\Complement{A}$ are both
29+
computably enumerable. Let $A$ be the domain of~$\cfind{d}$, and let
30+
$\Complement{A}$ be the domain of~$\cfind{e}$. Define $h$ by
3131
\[
3232
h(x) = \umin{s}{(T(d,x,s) \lor T(e,x,s))}.
3333
\]
34-
In other words, on input $x$, $h$ searches for either a halting
35-
computation of~$\cfind{d}$ or a halting computation
36-
of~$\cfind{e}$. Now, if $x \in A$, it will succeed in the first case,
37-
and if $x \in \Complement{A}$, it will succeed in the second case. So,
38-
$h$~is a total computable function. But now we have that for every
39-
$x$, $x \in A$ if and only if $T(e, x, h(x))$, i.e., if $\cfind{e}$ is
40-
the one that is defined. Since $T(e, x, h(x))$ is a computable relation,
34+
In other words, on input~$x$, $h$~searches for either a halting
35+
computation of~$\cfind{d}$ or a halting computation of~$\cfind{e}$.
36+
Now, if $x \in A$, it will succeed in the first case, and if $x \in
37+
\Complement{A}$, it will succeed in the second case. So, $h$~is a
38+
total computable function. But now we have that for every~$x$, $x \in
39+
A$ if and only if $T(e, x, h(x))$, i.e., if $\cfind{e}$ is the one
40+
that is defined. Since $T(e, x, h(x))$ is a computable relation,
4141
$A$~is computable.
4242
\end{proof}
4343

@@ -56,7 +56,7 @@
5656
\begin{proof}
5757
We know that $K_0$ is computably enumerable, but not computable. If
5858
$\Complement{K_0}$ were computably enumerable, then $K_0$ would be
59-
computable by \olref{thm:ce-comp}.
59+
computable by \olref{thm:ce-comp}, contradicting \olref[ncp]{thm:K-0}.
6060
\end{proof}
6161

6262
\end{document}

content/computability/computability-theory/complete-ce-sets.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
\olsection{Complete Computably Enumerable Sets}
1111

1212
\begin{defn}
13-
A set $A$ is a \emph{complete computably enumerable set}
13+
A set $A$ is a \emph{complete !!{computably enumerable} set}
1414
(under many-one reducibility) if
1515
\begin{enumerate}
1616
\item $A$ is computably enumerable, and
@@ -19,7 +19,7 @@
1919
\end{defn}
2020

2121
In other words, complete computably enumerable sets are the
22-
``hardest'' computably enumerable sets possible; they allow one to
22+
``hardest'' computably enumerable sets possible. They allow one to
2323
answer questions about \emph{any} computably enumerable set.
2424

2525
\begin{thm}
@@ -34,12 +34,12 @@
3434
\]
3535
Let $f$ be the function $f(x) = \tuple{e, x}$. Then for every natural
3636
number $x$, $x \in B$ if and only if $f(x) \in K_0$. In other words, $f$
37-
reduces $B$ to $K_0$.
37+
reduces $B$ to~$K_0$.
3838

3939
To see that $K_1$ is complete, note that in the proof of
4040
\olref[k1]{prop:k1} we reduced $K_0$ to it. So, by
4141
\olref[ppr]{prop:trans-red}, any computably enumerable set can be
42-
reduced to $K_1$ as well.
42+
reduced to~$K_1$ as well.
4343

4444
$K$ can be reduced to $K_0$ in much the same way.
4545
\end{proof}

content/computability/computability-theory/computability-theory.tex

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
\olimport{equiv-ce-defs}
3636

37+
\olimport{non-comp-set}
38+
3739
\olimport{ce-closed-cup-cap}
3840

3941
\olimport{complement-ce}
@@ -56,10 +58,6 @@
5658

5759
\olimport{def-functions-self-reference}
5860

59-
\iftag{lambda}{
60-
\olimport{minimization-lambda}
61-
}{}
62-
6361
\OLEndChapterHook
6462

6563
\end{document}

content/computability/computability-theory/computable-sets.tex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@
1414

1515
\begin{defn}
1616
Let $S$ be a set of natural numbers. Then $S$ is \emph{computable}
17-
iff its characteristic function is. In other words, $S$ is
18-
computable iff the function
17+
iff its characteristic function~$\Char{S}$ is. In other words,
18+
$S$~is computable iff the function
1919
\[
2020
\Char{S}(x) =
2121
\begin{cases}
2222
1 & \text{if $x \in S$} \\
2323
0 & \text{otherwise}
2424
\end{cases}
2525
\]
26-
is computable. Similarly, a relation $\Atom{R}{x_0, \dots, x_{k-1}}$ is
26+
is computable. Similarly, a relation $R(x_0, \dots, x_{k-1})$ is
2727
computable if and only if its characteristic function is.
28+
29+
Computable sets and relations are also called \emph{decidable}.
2830
\end{defn}
2931

3032
\begin{explain}
31-
Computable sets are also called \emph{decidable}.
32-
3333
Notice that we now have a number of notions of computability: for
3434
partial functions, for functions, and for sets. Do not get them
3535
confused!{} \iftag{TMs}{The Turing machine computing a partial function

content/computability/computability-theory/def-functions-self-reference.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
\[
3737
\fn{gcd}(u,v) \simeq
3838
\begin{cases}
39-
v & \text{if $0 = 0$} \\
39+
v & \text{if $u = 0$} \\
4040
\fn{gcd}(\fn{mod}(v, u), u) & \text{otherwise}
4141
\end{cases}
4242
\]
@@ -50,7 +50,7 @@
5050
fancier than the examples just discussed. Most programming languages
5151
support definitions of functions in terms of themselves, one way or
5252
another. Note that this is a little bit less dramatic than being able
53-
to define a function in terms of an {\em index} for an algorithm
53+
to define a function in terms of an \emph{index} for an algorithm
5454
computing the functions, which is what, in full generality, the
5555
fixed-point theorem lets you do.
5656

content/computability/computability-theory/equiv-ce-defs.tex

Lines changed: 49 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
Let $S$ be a set of natural numbers. Then the following are
2121
equivalent:
2222
\begin{enumerate}
23-
\item $S$ is computably enumerable.
24-
\item $S$ is the range of a \emph{partial} computable function.
25-
\item $S$ is empty or the range of a primitive recursive function.
26-
\item $S$ is the \emph{domain} of a partial computable function.
23+
\item\ollabel{case:ce} $S$ is computably enumerable.
24+
\item\ollabel{case:ran-pc} $S$ is the range of a \emph{partial} computable function.
25+
\item\ollabel{case:ran-prim} $S$ is empty or the range of a primitive recursive function.
26+
\item\ollabel{case:ce-domain} $S$ is the \emph{domain} of a partial computable function.
2727
\end{enumerate}
2828
\end{thm}
2929

@@ -32,7 +32,7 @@
3232
computably enumerable set to be enumerated by either a computable
3333
function, a partial computable function, or a primitive recursive
3434
function. The fourth clause tells us that if $S$ is computably
35-
enumerable, then for some index $e$,
35+
enumerable, then for some index~$e$,
3636
\[
3737
S = \Setabs{x}{\cfind{e}(x) \fdefined}.
3838
\]
@@ -44,66 +44,69 @@
4444

4545
\begin{proof}
4646
Since every primitive recursive function is computable and every
47-
computable function is partial computable, (3) implies (1) and (1)
48-
implies~(2). (Note that if $S$ is empty, $S$ is the range of the
49-
partial computable function that is nowhere defined.) If we show that
50-
(2) implies (3), we will have shown the first three clauses
51-
equivalent.
47+
computable function is partial computable, \olref{case:ran-prim}
48+
implies \olref{case:ce} and \olref{case:ce}
49+
implies~\olref{case:ran-pc}. (Note that if $S$ is empty, $S$~is the
50+
range of the partial computable function that is nowhere defined.) If
51+
we show that \olref{case:ran-pc} implies \olref{case:ran-prim}, we
52+
will have shown the first three clauses equivalent.
5253

5354
So, suppose $S$ is the range of the partial computable function
5455
$\cfind{e}$. If $S$ is empty, we are done. Otherwise, let $a$ be any
5556
element of~$S$. By Kleene's normal form theorem, we can write
5657
\[
57-
\cfind{e}(x) = U (\umin{s}{T(e, x, s)}).
58+
\cfind{e}(x) = U(\umin{s}{T(e, x, s)}).
5859
\]
5960
In particular, $\cfind{e}(x) \fdefined$ and $= y$ if and only if there
6061
is an $s$ such that $T(e, x, s)$ and $U(s) = y$. Define $f(z)$ by
6162
\[
6263
f(z) = \begin{cases}
63-
U((z)_1) & \text{if $T(e, (z)_0, (z)_1)$} \\
64-
a & \text{otherwise.}
64+
U((z)_1) & \text{if $T(e, (z)_0, (z)_1)$} \\
65+
a & \text{otherwise.}
6566
\end{cases}
6667
\]
6768
Then $f$ is primitive recursive, because $T$ and $U$
6869
are. \iftag{TMs}{Expressed in terms of Turing machines, if $z$ codes a
6970
pair $\tuple{(z)_0, (z)_1}$ such that $(z)_1$ is a halting
70-
computation of machine $e$ on input $(z)_0$, then $f$ returns the
71-
output of the computation; otherwise, it returns $a$.}
71+
computation of machine~$M_e$ on input $(z)_0$, then $f$ returns the
72+
output of the computation; otherwise, it returns~$a$.}
7273

73-
We need to show that $S$ is the range of $f$, i.e., for any natural
74-
number $y$, $y \in S$ if and only if it is in the range of~$f$. In the
74+
We need to show that $S$ is the range of~$f$, i.e., for any natural
75+
number~$y$, $y \in S$ if and only if it is in the range of~$f$. In the
7576
forwards direction, suppose $y \in S$. Then $y$ is in the range of
76-
$\cfind{e}$, so for some $x$ and $s$, $T(e,x,s)$ and $U(s) = y$; but then
77-
$y = f(\tuple{x,s})$. Conversely, suppose $y$ is in the range of
78-
$f$. Then either $y = a$, or for some $z$, $T(e,(z)_0,(z)_1)$ and
79-
$U((z)_1) = y$. Since, in the latter case, $\cfind{e}(x) \fdefined = y$,
80-
either way, $y$ is in $S$.
77+
$\cfind{e}$, so for some $x$ and~$s$, $T(e,x,s)$ holds and $U(s) = y$.
78+
But then $y = f(\tuple{x,s})$. Conversely, suppose $y$ is in the range
79+
of~$f$. Then either $y = a$, or for some~$z$, $T(e,(z)_0,(z)_1)$ and
80+
$U((z)_1) = y$. Since, in the latter case, $\cfind{e}(x) \fdefined =
81+
y$, either way, $y$ is in~$S$.
8182

8283
(The notation $\cfind{e}(x) \fdefined = y$ means ``$\cfind{e}(x)$ is
8384
defined and equal to $y$.'' We could just as well use $\cfind{e}(x) =
8485
y$, but the extra arrow is sometimes helpful in reminding us that we
8586
are dealing with a partial function.)
8687

8788
To finish up the proof of \olref{thm:ce-equiv}, it suffices to show
88-
that (1) and (4) are equivalent. First, let us show that (1) implies
89-
(4). Suppose $S$ is the range of a computable function~$f$, i.e.,
89+
that \olref{case:ce} and~\olref{case:ce-domain} are equivalent. First,
90+
let us show that \olref{case:ce} implies~\olref{case:ce-domain}.
91+
Suppose $S$ is the range of a computable function~$f$, i.e.,
9092
\[
91-
S = \Setabs{y}{\text{for some $x$,} f(x) = y}.
93+
S = \Setabs{y}{\text{for some $x$, } f(x) = y}.
9294
\]
9395
Let
9496
\[
95-
g(y) = \umin{x}{f(x) = y}.
97+
g(y) = \umin{x}{(f(x) = y)}.
9698
\]
9799
Then $g$ is a partial computable function, and $g(y)$ is defined if
98-
and only if for some $x$, $f(x) = y$. In other words, the domain of
100+
and only if for some~$x$, $f(x) = y$. In other words, the domain of
99101
$g$~is the range of~$f$. \iftag{TMs}{Expressed in terms of Turing
100-
machines: given a Turing machine $F$ that enumerates the elements of
101-
$S$, let $G$ be the Turing machine that semi-decides $S$ by
102-
searching through the outputs of~$F$ to see if a given element is in
103-
the set.}{}
104-
105-
Finally, to show (4) implies (1), suppose that $S$~is the domain of the
106-
partial computable function~$\cfind{e}$, i.e.,
102+
machines: given a Turing machine~$F$ that enumerates the elements
103+
of~$S$, let $G$ be the Turing machine that semi-decides $S$ by
104+
searching through the outputs of~$F$ to see if a given element is in
105+
the set, halts if it is and keeps searching forever if it isn't.}{}
106+
107+
Finally, to show \olref{case:ce-domain} implies~\olref{case:ce},
108+
suppose that $S$~is the domain of the partial computable
109+
function~$\cfind{e}$, i.e.,
107110
\[
108111
S = \Setabs{x}{\cfind{e}(x) \fdefined}.
109112
\]
@@ -123,34 +126,37 @@
123126
to halting computations.}{}
124127
\end{proof}
125128

126-
The fourth clause of \olref{thm:ce-equiv} provides us with a
127-
convenient way of enumerating the computably enumerable sets: for each
128-
$e$, let $W_e$ denote the domain of $\cfind{e}$. Then if $A$ is any
129-
computably enumerable set, $A = W_e$, for some $e$.
129+
Clause~\olref{case:ce-domain} of \olref{thm:ce-equiv} provides us with
130+
a convenient way of enumerating the computably enumerable sets: for
131+
each~$e$, let $W_e$ denote the domain of $\cfind{e}$, i.e.,
132+
\[
133+
W_e = \Setabs{x}{\cfind{e}(x) \fdefined}.
134+
\]
135+
Then if $A$ is any computably enumerable set, $A = W_e$, for some~$e$.
130136

131137
The following provides yet another characterization of the computably
132138
enumerable sets.
133139

134140
\begin{thm}
135141
\ollabel{thm:exists-char}
136142
A set $S$ is computably enumerable if and only if there is a
137-
computable relation $\Atom{R}{x,y}$ such that
143+
computable relation $R(x,y)$ such that
138144
\[
139-
S = \Setabs{ x }{ \lexists[y][\Atom{R}{x,y}] }.
145+
S = \Setabs{ x }{ \lexists[y][R(x,y)] }.
140146
\]
141147
\end{thm}
142148

143149
\begin{proof}
144150
In the forward direction, suppose $S$ is computably
145-
enumerable. Then for some $e$, $S = W_e$. For this value of $e$
151+
enumerable. Then for some $e$, $S = W_e$. For this value of~$e$
146152
we can write $S$ as
147153
\[
148154
S = \Setabs{ x }{ \lexists[y][T(e, x, y)] }.
149155
\]
150156
In the reverse direction, suppose $S = \Setabs{ x }{
151-
\lexists[y][\Atom{R}{x, y}] }$. Define $f$~by
157+
\lexists[y][R(x, y)] }$. Define $f$~by
152158
\[
153-
f(x) \simeq \umin{y}{Atom{R}{x,y}}.
159+
f(x) \simeq \umin{y}{R(x, y)}.
154160
\]
155161
Then $f$ is partial computable, and $S$ is the domain of~$f$.
156162
\end{proof}

content/computability/computability-theory/fixed-point-thm.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@
184184
string $x$ repeatedly, $y$ times. Then the ``program''
185185
\begin{quote}
186186
\begin{verbatim}
187-
getinput(y); print(diag('getinput(y); print(diag(x), y)'), y)
187+
getinput(y);
188+
print(diag('getinput(y); print(diag(x), y)'), y)
188189
\end{verbatim}
189190
\end{quote}
190191
prints itself out $y$ times, on input $y$. Replacing the

0 commit comments

Comments
 (0)