Sunteți pe pagina 1din 78

Recursion Theory Notes, Fall 2011

Lecturer: Lou van den Dries


0.1 Introduction
Recursion theory (or: theory of computability) is a branch of mathematical logic
studying the notion of computability from a rather theoretical point of view.
This includes giving a lot of attention to what is not computable, or what is
computable relative to any given, not necessarily computable, function. The
subject is interesting on philosophical-scientic grounds because of the Church-
Turing Thesis and its role in computer science, and because of the intriguing
concept of Kolmogorov complexity. This course tries to keep touch with how
recursion theory actually impacts mathematics and computer science. This
impact is small, but it does exist.
Accordingly, the rst chapter of the course covers the basics: primitive recur-
sion, partial recursive functions and the Church-Turing Thesis, arithmetization
and the theorems of Kleene, the halting problem and Rices theorem, recur-
sively enumerable sets, selections and reductions, recursive inseparability, and
index systems. (Turing machines are briey discussed, but the arithmetization
is based on a numerical coding of combinators.)
The second chapter is devoted to the remarkable negative solution (but with
positive aspects) of Hilberts 10th Problem. This uses only the most basic
notions of recursion theory, plus some elementary number theory that is worth
knowing in any case; the coding aspects of natural numbers are combined here
ingeniously with the arithmetic of the semiring of natural numbers.
The last chapter is on Kolmogorov complexity, where concepts of recursion
theory are used to dene and study notions of randomness and information
content. This also involves a bit of measure theory.
The rst and last chapter are largely based on a set of notes written by
Christian Rosendal, and in the second chapter I follow mostly the treatment in
Smorynskis excellent book Logical Number Theory I.
An obvious omission in the material above is that of relative computability. This
topic merges with eective descriptive set theory and deserves to be included,
but there is only so much one can do in one semester. I have opted for a rather
careful treatment of fewer topics.
Notation: N = 0, 1, 2, . . . is the set of natural numbers, including 0, and
a, b, c, d, e and k, l, m, n (sometimes with subscripts or accents) range over N.
1
Chapter 1
Basic Recursion Theory
In this chapter, x, y, z, sometimes with subscripts, range over N as well. (In
later chapters, x, y, z can be something else.)
1.1 Primitive Recursion
We dene T
d
to be the set of all functions f : N
d
N, and put T :=

d
T
d
.
We identify T
0
with N in the obvious way. For i = 1, . . . , d, the ith projection
function P
i
d
: N
d
N is given by P
i
d
(x
1
, . . . , x
d
) = x
i
. The successor function
S : N N is given by S(x) = x + 1. To denote functions, we sometimes
borrow a notation from -calculus: if t(x
1
, . . . , x
d
) is an expression such that
t(a
1
, . . . , a
d
) N for all a
1
, . . . , a
d
, then x
1
. . . x
d
.t(x
1
, . . . , x
d
) denotes the
corresponding function
(a
1
, . . . , a
d
) t(a
1
, . . . , a
d
) : N
d
N.
For example, S = x.x + 1 and P
i
d
= x
1
. . . x
d
.x
i
.
Now we dene substitution. For g T
n
and f
1
, . . . , f
n
T
d
, g(f
1
, . . . , f
n
)
is the function x
1
. . . x
d
.g(f
1
(x
1
, . . . , x
d
), . . . , f
n
(x
1
, . . . , x
d
)) in T
d
.
For any g T
d
and h T
d+2
, there is a unique f T
d+1
such that for all
x
1
, . . . , x
d
, y:
f(x
1
, . . . , x
d
, 0) = g(x
1
, . . . , x
d
),
f(x
1
, . . . , x
d
, y + 1) = h(x
1
, . . . , x
d
, y, f(x
1
, . . . , x
d
, y)).
This function f is said to be obtained by primitive recursion from g and h.
1.1.1 Primitive Recursive Functions
Loosely speaking, the functions obtainable by the above procedures are the
primitive recursive functions. More precisely,
2
Denition 1. The set PR of primitive recursive functions is the smallest
subset of T such that, with PR
d
:= PR T
d
,
(a) all constant functions in T belong to PR;
(b) S PR
1
;
(c) P
i
d
PR
d
for i = 1, . . . , d;
(d) if g PR
n
, f
1
, . . . , f
n
PR
d
, then g(f
1
, . . . , f
n
) PR
d
(closure under
substitution);
(e) if g PR
d
and h PR
d+2
and f T
d+1
is obtained by primitive recursion
from g, h then f PR
d+1
(closure under primitive recursion).
Essentially all functions in T that arise in ordinary mathematical practice
are primitive recursive. For example, the greatest common divisor function gcd
is primitive recursive, but proving such facts will be much easier once we have
some lemmas available.
In addition to functions, some sets will be called primitive recursive. Recall
that the characteristic function of a set A N
d
is the function
A
: N
d
N
dened by
A
(x) = 1 if x A and
A
(x) = 0 if x N
d
A.
Denition 2. A set A N
d
is said to be primitive recursive if its charac-
teristic function
A
is primitive recursive.
A set A N
d
is often construed as a d-ary relation on N, and so, when x A,
we often write A(x) instead of x A.
1.1.2 Basic Examples
The addition operation + : N
2
N is primitive recursive: let g = P
1
1

T
1
E, h = S(P
3
3
) T
3
E, i.e. g(x) = x and h(x, y, z) = z + 1. Then
+ is obtained by primitive recursion from g, h:
x + 0 = x = g(x), x + (y + 1) = (x +y) + 1 = h(x, y, x +y).
The multiplication operation : N
2
N is primitive recursive. For let
g T
1
E, h T
3
E be given by
g(x) = 0, h(x, y, z) = z +x (= +(P
3
3
, P
1
3
)(x, y, z)).
Then is obtained by primitive recursion from g, h, since x 0 = 0 = g(x)
and x (y + 1) = xy +x = h(x, y, xy).
xy.x
y
is primitive recursive: x
0
= 1, x
y+1
= x
y
x.
The monus function

: N
2
N, where
x

y =
_
x y if x y,
0 otherwise.
3
First, we observe that x.x

1 is primitive recursive, as 0

1 = 0 and
(x+1)

1 = x. Then

itself is primitive recursive: x

0 = x, x

(y+1) =
(x

y)

1.
sign : N N, given by
sign(x) =
_
1 if x > 0,
0 if x = 0,
is primitive recursive, for sign(0) = 0, sign(x + 1) = 1.
The set A = (x, y) N
2
: x < y N
2
is primitive recursive since

A
(x, y) = sign(y

x).
The diagonal = (x, y) N
2
: x = y N
2
is primitive recursive:

(x, y) = 1

((x

y) + (y

x)).
For A, B N
d
we have

= 0,
AB
=
A

B
, and
A
= 1


A
.
Therefore, the primitive recursive subsets of N
d
are the elements of a
boolean algebra of subsets of N
d
.
Denition by cases: Suppose A N
d
and f, g T
d
are primitive
recursive. Then the function h : N
d
N given by
h(x) =
_
f(x) for x A,
g(x) for x , A,
is primitive recursive because h = f
A
+g
A
.
Iterated sums/products: Let f T
d+1
and let
g = x
1
. . . x
d
y.
y

i=0
f(x
1
, . . . , x
d
, i).
Note that g(x, 0) = f(x, 0) and g(x, y +1) = g(x, y) +f(x, y +1). Thus if
f is primitive recursive, so is g, and vice-versa. Similarly, if f is primitive
recursive, so is
x
1
. . . x
d
y.
y

i=0
f(x
1
, . . . , x
d
, i).
Notation. Let p(i) be a condition on i N: for each i N either p(i) holds, or
p(i) does not hold. Then i
y
p(i) denotes the least i y such that p(i) holds
if there is such an i, and if no such i exists, then i
y
p(i) := 0. For example,
if A N, then i
3
i A is one of the numbers 0, 1, 2, 3.
4
Bounded search: Let A N
d+1
, and dene f T
d+1
by
f(x, y) = i
y
A(x, i).
If A is primitive recursive, then so is f. This is because f(x, 0) = 0 and
f(x, y + 1) =
_
_
_
f(x, y) if

y
i=0

A
(x, i) 1,
y + 1 if

y
i=0

A
(x, i) = 0 and A(x, y + 1),
0 if

y
i=0

A
(x, i) = 0 and A(x, y + 1).
More generally, if A N
d+1
and g T
d+1
are primitive recursive, so is
the function xy.i
g(x,y)
A(x, i) (this is a function in T
d+1
).
Bounded quantication: Let A N
d+1
and dene:

A = (x, y) N
d+1
: i y A(x, i) N
d+1
,

A = (x, y) N
d+1
: i y A(x, i) N
d+1
.
Since

A
(x, y) = sign
_
y
i=0

A
(x, i)
_
and

A
(x, y) = sign
_
y
i=0

A
(x, i)
_
,
it follows that if A is primitive recursive, then so are

A and

A.
Exercise. Prove that gcd : N
2
N is primitive recursive. Here, gcd(0, 0) = 0,
and gcd(x, y) is the greatest d such that d[x and d[y, for x, y not both zero.
1.1.3 Coding
Enumerate N
2
diagonally as follows:
(0, 0) (1, 0) (0, 1) (2, 0) (1, 1) (0, 2) (3, 0)

0 1 2 3 4 5 6
5
This bijection (x, y) [x, y[ : N
2
N is given by:
[x, y[ =
(x +y)(x +y + 1)
2
+y.
This bijection is primitive recursive: use that
[x, y[ = i
f(x,y)
2i = f(x, y)
with f : N
2
N given by f(x, y) = (x + y)(x + y + 1) + 2y, so f is primitive
recursive. Note also that x [x, y[ and y [x, y[ for all x, y.
Proposition 3. For d 1, we have primitive recursive functions
)
d
: N
d
N and ( )
d
1
, . . . , ( )
d
d
: N N,
such that )
d
is a bijection and (x)
d
1
, . . . , (x)
d
d
) = x for all x.
Proof. For d = 1, take both )
1
and ( )
1
1
as the identity function on N. For
d = 2, take x, y)
2
= [x, y[ and dene ( )
2
1
and ( )
2
2
by bounded search:
(x)
2
1
:= i
x
(y x [i, y[ = x), (x)
2
2
= i
x
(y x [y, i[ = x).
We now proceed by induction. Given )
d
and ( )
d
1
, . . . , ( )
d
d
with the desired
properties, and d 2, put
x
1
, . . . , x
d
, y)
d+1
= [x
1
, . . . , x
d
)
d
, y[ and
(x)
d+1
i
= ((x)
2
1
)
d
i
for i = 1, . . . , d, (x)
d+1
d+1
= (x)
2
2
.
Note that the identities just displayed also hold for d = 1.
1.1.4 More General Recursions
Let us consider rst double recursions: Suppose g, g

T
d
and h, h

T
d+3
are
primitive recursive. Let f, f

T
d+1
be given by:
f(x, 0) = g(x), f(x, y + 1) = h
_
x, y, f(x, y), f

(x, y)
_
,
f

(x, 0) = g

(x), f

(x, y + 1) = h

_
x, y, f(x, y), f

(x, y)
_
.
Then f is primitive recursive. To see this, we use the above coding method and
dene t T
d+1
by t(x, 0) = [g(x), g

(x)[, and
t(x, y + 1) = [h
_
x, y, (t(x, y))
2
1
, (t(x, y))
2
2
_
, h

_
x, y, (t(x, y))
2
1
, (t(x, y))
2
2
_
[.
Thus t is primitive recursive. We have f(x, y) = (t(x, y))
2
1
and f

(x, y) =
(t(x, y))
2
2
, so f and f

are primitive recursive.


It turns out that if a function is dened recursively in terms of several of
its previous values (the most general case being that f(x, y +1) is computed in
terms of f(x, 0), . . . , f(x, y)), then it is still primitive recursive. To deal with
6
this situation, we use a Skolem trick. Given f T
d+1
, dene

f T
d+1
by

f(x, 0) = f(x, 0), and



f(x, y) = [f(x, y),

f(x, y 1)[ for y > 0. So

f(x, y)
encodes the values of f at (x, 0), (x, 1), . . . , (x, y).
Let g T
d
and h T
d+2
, and dene f T
d+1
by
f(x, 0) = g(x) and f(x, y + 1) = h(x, y,

f(x, y)).
Claim. If g and h are primitive recursive, then so is f.
Proof. Assume g and h are primitive recursive. To obtain that f is primitive
recursive, it suces to show that

f is primitive recursive, because
f(x, y) =
_

f(x, y) if y = 0,
(

f(x, y))
2
1
if y > 0.
But

f(x, 0) = g(x), and

f(x, y + 1) = f(x, y + 1),



f(x, y))
= h(x, y,

f(x, y)),

f(x, y)),
so

f is primitive recursive, as desired.
Exercise. Show that the Fibonacci sequence (F
n
) dened by F
0
= 0, F
1
= 1
and F
n
= F
n1
+F
n2
for n 2, is primitive recursive.
For later use we also need an encoding of nite sequences of variable length such
that the length of the sequence can be decoded from its code. We dene
m
1
, . . . , m
d
) := m
1
, . . . , m
d
, d)
d+1
.
Note that then
m
1
, . . . , m
d
) = n
1
, . . . , n
e
) d = e and m
1
= n
1
, . . . , m
d
= n
d
.
Dene lh : N N by lh(n) = (n)
2
2
, so that lh(n
1
. . . , n
d
)) = d. It is clear that
lh is primitive recursive. Let B N be the set of all n
1
, . . . , n
d
) for all d.
Claim. B = b N : (b)
2
2
> 0 0.
To see this, note that if (b)
2
2
= d > 0, then b = [a, d[ with a N, so a =
n
1
, . . . , n
d
)
d
for suitable n
1
, . . . , n
d
, hence b = n
1
, . . . , n
d
) B. It remains to
note that the only element n
1
, . . . , n
d
) of B with d = 0 is 0)
1
= 0.
It follows from the claim that B is primitive recursive. Next, we introduce
a primitive recursive function (n, j) (n)
j
: N
2
N such that for n =
n
1
, . . . , n
d
) and 1 j d we have (n)
j
= n
j
, and thus (n)
j
< n. First
we dene a primitive recursive f : N
2
N by
f(n, 0) = n, f(n, i + 1) =
_
f(n, i)
_
2
1
.
7
It is easy to check that for n = n
d
, n
d1
, . . . , n
1
) and 1 i d we have
f(n, i) = n
d
, . . . , n
i
)
d+1i
.
Now dene the primitive recursive function (n, j) (n)
j
: N
2
N by
(n)
j
:= f(n, lh(n) + 1

j)
2
2
for j ,= 1, (n)
1
:= f(n, lh(n)).
This function has the desired properties as is easily veried.
1.2 Partial Recursive Functions
From the way we dened primitive recursive, it is clear that each primitive
recursive function is computable in an intuitive sense. A standard diagonaliza-
tion argument, however, yields a computable function f : N N that is not
primitive recursive. This argument goes as follows: one can eectively produce
a list f
0
, f
1
, f
2
, . . . of all functions in PR
1
. (Any primitive recursive function
N N may appear innitely often in this list.) Here, eective means that we
have an algorithm/program that on any input (m, n) computes f
m
(n). Now
dene
f : N N, f(n) := f
n
(n) + 1.
Then f is computable in the intuitive sense, but f ,= f
n
for every n, so f cannot
be primitive recursive. More generally, any eective method of characterizing
the intuitive notion of (total) computable function N N must fail by a similar
diagonalization.
It turns out that we can eectively characterize a more general notion of
partial computable function N N that does correspond to the intuitive notion
of what is computable by an algorithm; the key point is that algorithms may
fail to terminate on some inputs. Accordingly, we extend our notion of primitive
recursive function to that of partial recursive function, essentially by allowing
unbounded search.
Notation
For sets P, Q, we denote by f : P Q a partial function f from P into Q, that
is, a function from a set D(f) P into Q; then
f(p) (in words: f converges at p)
means that p D(f), and
f(p) (in words: f diverges at p)
means that p P but p / D(f).
Let f : N
d+1
N. Then x. (yf(x, y) = 0) denotes the partial function
g : N
d
N such that for x N
d
:
g(x) y
_
i y f(x, i) and i < y f(x, i) ,= 0 and f(x, y) = 0

,
8
and if g(x) , then g(x) is the unique y witnessing the righthandside in the
above equivalence. Let g : N
n
N and f
1
, . . . , f
n
: N
d
N. Then
g(f
1
, . . . , f
n
) : N
d
N
is given by:
g(f
1
, . . . , f
n
)(x) f
1
(x) , . . . , f
n
(x) and g(f
1
(x), . . . , f
n
(x))
and if g(f
1
, . . . , f
n
)(x) , then g(f
1
, . . . , f
n
)(x) = g(f
1
(x), . . . , f
n
(x)). Given
g : N
d
N, h : N
d+2
N there is clearly a unique f : N
d+1
N such that for
all x N
d
and y N:
f(x, 0) g(x) ; if f(x, 0) , then f(x, 0) = g(x).
f(x, y + 1) f(x, y) , h(x, y, f(x, y)) ; if f(x, y + 1) , then
f(x, y + 1) = h(x, y, f(x, y)).
This f is said to be obtained by primitive recursion from g, h.
Denition 4. The set of partial recursive functions is the smallest set of partial
functions N
d
N for d = 0, 1, 2, . . . such that:
(a) the function O : N
0
N with value 0 is partial recursive, and the successor
function S : N N is partial recursive;
(b) the functions P
i
d
, for 1 i d, are partial recursive;
(c) whenever g : N
m
N, h
1
, . . . , h
m
: N
d
N are partial recursive, so is
g(h
1
, . . . , h
m
);
(d) whenever g : N
d
N, h : N
d+2
N are partial recursive, then so is the
function obtained from g, h by primitive recursion;
(e) whenever f : N
d+1
N is partial recursive, then so is
x. (yf(x, y) = 0) : N
d
N.
A recursive function is a partial recursive function f : N
d
N, the notation
here indicating that D(f) = N
d
. A set A N
d
is recursive if
A
: N
d
N is
recursive. It is easy to check that primitive recursive functions are recursive.
Lemma 5. Given f : N
d
N, the following are equivalent:
(a) f is recursive;
(b) graph(f) N
d+1
is recursive.
Proof. Use that
graph(f)
(x, y) =

(f(x), y). In the other direction, use


f(x) = y(
graph(f)
(x, y) = 1).
9
By similar arguments as for primitive recursive sets one obtains:
Theorem 6. The class of recursive subsets of N
d
is closed under nite unions,
intersections and complements. If A N
d+1
is recursive, so are

A and

A
as subsets of N
d
.
Exercise. Show that if f : N N is a recursive bijection, then so is its
inverse. Show that there is a primitive recursive bijection N N whose inverse
is not primitive recursive. (For the second problem, use that there is a recursive
function N N that is not primitive recursive.)
1.2.1 Turing Machines
Denition 7. A Turing machine consists of a biinnite tape of successive boxes,

q
i

head
and a head that can read, erase, write in the box in case it is blank, and
move to the box on the left or the right. Moreover, there are given
A nite alphabet = s
0
, s
1
, . . . , s
n
with n 1, s
i
,= s
j
when i ,= j, with
distinguished symbols s
0
:= # for blank, and s
1
:= 0.
A nite set of internal states Q = q
0
, q
1
, . . . , q
m
with m 1, q
i
,= q
j
for
i ,= j, with distinguished states q
0
(the initial state), and q
m
:= q
f
(the
nal state).
A nite set I
1
, . . . , I
p
of instructions, each of one of the following three
types:
(a) q
a
s
b
s
c
q
d
: if in state q
a
reading s
b
, erase s
b
, write s
c
in its place, and
enter state q
d
;
(b) q
a
s
b
Rq
d
: if in state q
a
reading s
b
, move to the box on the right, and
enter state q
d
;
(c) q
a
s
b
Lq
d
: if in state q
a
reading s
b
, move to the box on the left, and
enter state q
d
.
This set of instructions should be complete: for each q
a
,= q
f
, and each symbol s
b
there is exactly one instruction of the form q
a
s
b
. . . , and there is no instruction
of the form q
f
. . . ..
Formally, a Turing machine is just a triple (, Q, I
1
, . . . , I
p
) as above.
Denition 8. Let M be a Turing machine with alphabet #, 0, 1. We say that
M computes the partial function f : N
d
N if for any input (x
1
, . . . , x
d
) as
follows:
10
0 1 1 1 0 1 1 1 0 0 1 1 1 0
q
0

head
. .
x1
. .
x2
. .
x
d
the machine, applying the instructions,
either never enters q
f
, and then f(x) .
or eventually enters state q
f
, and then f(x) , with its head and tape as
follows:
0 1 1 1 0
q
f

head
. .
f(x1,...,x
d
)
Fact. Turing Computable = Partial Recursive.
Turing gave a compelling analysis of the intuitive concept of computability, in
1936, and this led him to identify it with the precise notion of Turing com-
putability. Turing machines remain important as a model of computation in
connection with complexity theory. But in the rest of this course we deal di-
rectly with partial recursive functions without using Turing machines.
1.3 Arithmetization and Kleenes Theorems
We shall give numerical codes to the programs that compute partial recursive
functions. First, we introduce formal expressions that specify these programs.
These expressions will be called combinators and they are words on the alphabet
with the following distinct symbols:
(a) the two symbols O and S,
(b) for each pair i, d such that 1 i d a symbol P
i
d
,
(c) for each pair m, d, a symbol S
m
d
(a substitution symbol),
(d) for each d a symbol R
d
(a primitive recursion symbol),
(e) for each d a symbol S
d
(an unbounded search symbol).
Each combinator has a specic arity (a natural number) and each d-ary combi-
nator f is a word on this alphabet, and has associated to it a partial recursive
function

f : N
d
N. The denition is inductive:
(a) The word O of length 1 is a nullary combinator with associated function
N
0
N taking the value 0. The word S of length 1 is a unary combinator
with associated function x x + 1 : N N.
11
(b) For 1 i d, the word P
i
d
is a d-ary combinator of length 1 with associ-
ated function (x
1
, . . . , x
d
) x
i
: N
d
N.
(c) If g is an m-ary combinator and h
1
, . . . , h
m
are d-ary combinators, then
S
m
d
gh
1
. . . h
m
is a d-ary combinator with associated function g(

h
1
, . . . ,

h
m
).
(d) If g is a d-ary combinator and h is a (d+2)-ary combinator, then R
d
gh is
a (d+1)-ary combinator whose associated function N
d+1
N is obtained
by primitive recursion from g and

h.
(e) If g is a (d + 1)-ary combinator, then S
d
g is a d-ary combinator whose
associated function is
x
1
. . . x
d
. (y ( g(x
1
, . . . , x
d
, y) = 0) .
Next we associate inductively to each combinator g a number #g N:
(a) #O = 1, 0), #S = 1, 1),
(b) #P
i
d
= 2, i, d),
(c) #(S
m
d
fg
1
. . . g
m
) = 3, #f, #g
1
, . . . , #g
m
, d),
(d) #(R
d
gh) = 4, #g, #h, d + 1),
(e) #S
d
g = 5, #g, d).
Let Co be the set of all combinators. Then # : Co N is clearly injective.
It is easy to check that the primitive recursive function : N N given by
(n) := (n)
lh(n)
has the property that if n = #g with g Co, then (n) is the
arity of g.
Lemma 9. The set #Co is primitive recursive.
Proof. With B as in subsection 1.1.4, consider the following subsets of B:
(a) B
1
:= 1, 0), 1, 1);
(b) B
2
:= n B : (n)
1
= 2, lh(n) = 3, 1 (n)
2
(n)
3
;
(c) B
3
is the set of all n B such that (n)
1
= 3 and such that m := ((n)
2
)
satises lh(n) = m+ 3, ((n)
3
) = ((n)
4
) = = ((n)
m+2
) = (n)
lh(n)
;
(d) B
4
:= n B : (n)
1
= 4, lh(n) = 4, ((n)
3
) = ((n)
2
) + 2 = (n)
4
+ 1;
(e) B
5
:= n B : (n)
1
= 5, lh(n) = 3, ((n)
2
) = (n)
3
+ 1.
Note that these sets B
i
are primitive recursive. Let A := #Co, so
A
(n) = 0
if n / B, and also if n B

5
i=1
B
i
. It remains to describe
A
on the B
i
.
Clearly,
A
(n) = 1 for n B
1
B
2
. For n B
3
and m := ((n)
2
) we have

A
(n) =
m+2

i=2

A
((n)
i
),
12
For n B
4
we have
A
(n) =
A
((n)
2
)
A
((n)
3
), and for n B
5
we have

A
(n) =
A
((n)
2
).
Note that for any partial recursive function : N
d
N, there are innitely
many d-ary combinators f such that

f = . This is because for any d-ary
combinator f we have

f = g where g := S
1
d
P
1
1
f.
We have encoded programsmore precisely, combinatorsby numbers, and
next we shall encode terminating computations using these programs.
Given a d-ary combinator f and x = (x
1
, . . . , x
d
), we also write f(x) instead of

f(x).
Let f be a combinator and f(x) = y. The latter means that x is in the domain
of

f and

f(x) = y. Then we assign to the triple (f, x, y) a number ct(f, x, y)
N, called the computation tree of f at input x. This assignment is dened
inductively:
(a) if f is O, S, or P
i
d
, then, with x = (x
1
, . . . , x
d
),
ct(f, x, y) := #f, x, y) := #f, x
1
, . . . , x
d
, y);
(b) if f is S
m
d
gh
1
. . . h
m
, then, with x = (x
1
, . . . , x
d
), h
1
(x) = u
1
, . . . , h
m
(x) =
u
m
, u = (u
1
, . . . , u
m
), and g(u) = y = f(x),
ct(f, x, y) := #f, x, ct(h
1
, x, u
1
), . . . , ct(h
m
, x, u
m
), ct(g, u, y), y);
(c) if f is R
d
gh, then, with x = (x
1
, . . . , x
d
, x
d+1
) and x
d
:= (x
1
, . . . , x
d
),
ct(f, x, y) :=
_
#f, x
d
, 0, ct(g, x
d
, y), y) if x
d+1
= 0
#f, x
d
, n + 1, ct(h, x
d
, n, f(x
d
, n), y), y) if x
d+1
= n + 1;
(d) if f is S
d
g, then, with x = (x
1
, . . . , x
d
),
ct(f, x, y) := #f, x, ct(g, x, 0, g(x, 0)), . . . , ct(g, x, y, g(x, y)), y).
Lemma 10. The map
(f, x, y) ct(f, x, y) : f a combinator, f(x) = y N
is injective, and its image T N is primitive recursive.
Proof. As before.
Recall that we introduced the primitive recursive function
: N N, (z) := (z)
lh(z)
.
Theorem 11 (Kleene). For each d we have a primitive recursive T
d
N
d+2
such that for every d-ary combinator f and all x N
d
:
13
if f(x) , then T
d
(#f, x, z) for a unique z and f(x) = (z) for this z;
if f(x) , then T
d
(#f, x, z) for no z.
Proof. Dene T
d
N
d+2
as follows:
T
d
(e, x, z) z is the computation tree of some d-ary combinator
f with #f = e at input x = (x
1
, . . . , x
d
)
T(z), (z)
1
= e, (z)
2
= x
1
, . . . , (z)
d+1
= x
d
, (e) = d.
Thus, T
d
is primitive recursive. If f is a d-ary combinator, and f(x) = y, then
clearly T
d
(#f, x, z) for a unique z, namely z = ct(f, x, y), and y = (z)
lh(z)
=
(z) for this z. If f is a d-ary combinator and f(x) , then there is no z with
T
d
(#f, x, z).
Corollary 12. Suppose : N
d
N is partial recursive. Then =

f for some
d-ary combinator f with exactly one occurrence of an unbounded search symbol.
Proof. Take any d-ary combinator g such that = g. Then for all x
1
, . . . , x
d
,
(x
1
, . . . , x
d
)
_
z(T
d
(#g, x
1
, . . . , x
d
, z))
_
.
[Note: The symbol indicates that either both sides are dened and equal, or
both sides are undened.] Thus =

f for some d-ary combinator f in which S
d
occurs exactly once, and no other unbounded search symbol occurs.
Denition 13.
(d)
e
= x
1
. . . x
d
.
_
z(T
d
(e, x
1
, . . . , x
d
, z))
_
: N
d
N.
Corollary 14. Each
(d)
e
is partial recursive, and for each partial recursive
: N
d
N there is an e such that =
(d)
e
.
Another consequence is that the recursive functions, as dened earlier, are
exactly the computable functions, as dened in MATH 570.
Tracing back the denition of T
d
in terms of combinators and computation
trees we see that if e = #f with f a d-ary combinator, then
(d)
e
=

f, while if
e ,= #f for all d-ary combinators f, then
(d)
e
is the partial function N
d
N
with empty domain. This fact is needed to prove:
Lemma 15. Let d 1 be given. Then there is a primitive recursive function
: N
2
N (depending on d) such that for all x
1
, . . . , x
d
,

(d)
e
(x
1
, . . . , x
d
)
(d1)
(e,x1)
(x
2
, . . . , x
d
).
Before giving the proof we note that for all a, d there is a d-ary combinator c
d
a
whose associated function is the constant (total) function N
d
N taking the
value a. Indeed, one can construct c
d
a
in such a way that, for any given d, the
map
a #(c
d
a
) : N N
is primitive recursive. We leave this construction as an exercise to the reader.
14
Proof. Let f be a d-ary combinator, d 1. Then
f
a
:= S
d
d1
f c
d1
a
P
1
d1
P
d1
d1
is a (d 1)-ary combinator such that for all x
2
, . . . , x
d
,

f
a
(x
2
, . . . , x
d
)

f(a, x
2
, . . . , x
d
).
Note that
#(f
a
) = 3, #f, #(c
d1
a
), 2, 1, d 1), . . . , 2, d 1, d 1), d 1).
Thus the primitive recursive function : N
2
N dened by
(e, a) := 3, e, #(c
d1
a
), 2, 1, d 1), . . . , 2, d 1, d 1), d 1)
has the property that if f is any d-ary combinator with #f = e, then f
a
is a
(d1)-ary combinator with #(f
a
) = (e, a), while if there is no d-ary combinator
f with #f = e, then there is no (d 1)-ary combinator g with #g = (e, a).
It is clear from the remark preceding the lemma that this function has the
desired properties.
If we have to indicate the dependence on d we let
d
be a function as in the
lemma. The next consequence has the strange name of s-m-n theorem.
Corollary 16. Given m, n, there is a primitive recursive s
m
n
: N
m+1
N such
that for all e, x
1
, . . . , x
m
, y
1
, . . . , y
n
:

(m+n)
e
(x
1
, . . . , x
m
, y
1
, . . . , y
n
)
(n)
s
m
n
(e,x1,...,xm)
(y
1
, . . . , y
n
).
Proof. Take s
0
n
:= id
N
, and put
s
m+1
n
(e, x
1
, . . . , x
m+1
) :=
n+1
(s
m
n
(e, x
1
, . . . , x
m
), x
m+1
).
The next result corresponds to the existence of a universal computer:
Corollary 17. There is a partial recursive : N
2
N such that for all d, e
and x N
d
we have

(d)
e
(x) (e, x)).
Proof. Exercise.
The next three results are due to Kleene, and are collectively referred to as the
Recursion Theorem. They look a bit strange, but are very useful.
Theorem 18. Let f : N
d+1
N be partial recursive. Then there exists an e
0
such that for all x N
d
,
f(e
0
, x)
(d)
e0
(x).
15
Proof. Dene partial recursive g : N
d+1
N by g(e, x) f(s
1
d
(e, e), x). Take a
such that g =
(d+1)
a
. Then for all x N
d
,
f(s
1
d
(a, a), x) g(a, x)
(d+1)
a
(a, x)
(d)
s
1
d
(a,a)
(x).
Thus e
0
= s
1
d
(a, a) works.
From now on,
e
:=
(1)
e
, so
0
,
1
,
2
, . . . is an enumeration of the set of partial
recursive functions N N.
Note also that the function (e, x)
e
(x) : N
2
N is partial recursive.
Theorem 19. Let h : N N be recursive. Then there exists an e
0
such that

e0
=
h(e0)
.
Proof. Dene a partial recursive f : N
2
N by f(e, x)
h(e)
(x). By the
previous theorem we get e
0
N such that for all x,

e0
(x) f(e
0
, x)
h(e0)
(x),
so
e0
=
h(e0)
.
Theorem 20. There is a primitive recursive : N N such that for each
total
e
,

(e)
=
e((e))
.
This is a uniform version of the previous theorem: given recursive h : N N
with index e, that is, h =
e
, the number e
0
= (e) satises
e0
=
h(e0)
.
Proof. We claim that : N N dened by (k) = s
1
1
(s
1
2
(b, k), s
1
2
(b, k)) does
the job, where b is an index of the partial recursive function g : N
3
N dened
by g(e, x, y)
e(s
1
1
(x,x))
(y). Verication of claim:

(e)
(y)
s
1
1
(s
1
2
(b,e),s
1
2
(b,e))
(y)

(2)
s
1
2
(b,e)
(s
1
2
(b, e), y)

(3)
b
(e, s
1
2
(b, e), y)
g(e, s
1
2
(b, e), y)

e(s
1
1
(s
1
2
(b,e),s
1
2
(b,e)))
(y)

e((e))
(y).
16
1.4 The Halting Problem and Rices Theorem
Instead of saying that A N
d
is recursive, we also say that A is decidable.
Assuming the Church-Turing Thesis, for A to be decidable means to have an
eective procedure for deciding membership in A, that is, an algorithm that
decides for any input x N
d
whether x A.
Theorem 21 (Turing). The halting problem,
K
0
:= (e, n) :
e
(n)
is undecidable.
Proof. Suppose otherwise. Then the set e :
e
(e) is decidable. Dene
f : N N by
f(e) =
_
0 if
e
(e) ,
if
e
(e) .
Note that f is partial recursive since f(e) = y(y = 0 &
e
(e) ). So we have
an e
0
such that f =
e0
. But f(e
0
)
e0
(e
0
) , that is,

e0
(e
0
)
e0
(e
0
) ,
a contradiction.
This proof also shows that the set
K := e :
e
(e)
is undecidable. Most natural undecidability results in mathematics can be re-
duced to the halting problem, although the reduction is not always obvious.
Let / be a set of partial recursive functions N N. In many cases it is
natural to ask whether there is an eective procedure for deciding, for any
unary combinator f, whether the associated partial function

f belongs to /.
For example, is it decidable whether a unary combinator denes
(a) a partial function with nonempty domain?
(b) a partial function with nite domain?
(c) a partial function with nite image?
(d) a total function?
and so on. Assuming the Church-Turing Thesis, the next theorem of Rice says
that all such questions have a negative answer. To understand this reading of
Rices theorem, note that one can eectively compute from any unary combi-
nator f its index e = #f, and in the other direction, we can decide for any
given e whether e is the index of a unary combinator, and if so, nd such a
combinator. So these decision problems about unary combinators translate to
equivalent decision problems about natural numbers.
17
Theorem 22 (Rice). Let / be a nonempty proper subset of the set of all partial
recursive functions N N. Then e :
e
/ is undecidable.
Proof. Suppose e :
e
/ is decidable. Take a, b such that
a
/ and

b
/ /. Dene partial recursive f : N
2
N by
f(e, n)
a
(n) if
e
/ /,
f(e, n)
b
(n) if
e
/.
By the recursion theorem we have an e such that
e
= f(e, .). If
e
/ /, then

e
= f(e, .) =
a
/. If
e
/, then
e
= f(e, .) =
b
/ /. Thus we have a
contradiction.
Of course, if / is empty or / is the entire set of partial recursive functions
N N, then e :
e
/ is empty or equal to N, so the restrictions on / in
Rices theorem cannot be dropped.
Corollary 23. The set (a, b) :
a
=
b
is undecidable.
Proof. If (a, b) :
a
=
b
were decidable, so would be the set a :
a
=
0
.
By Rices Theorem, the latter set is undecidable, and thus the former must be
undecidable.
Here is another typical application of the recursion theorem:
There is an e such that D(
e
) = e.
To get such an e, let : N
2
N be the partial recursive function given by
(x, y)
_
0 if x = y,
if x ,= y.
The recursion theorem gives an e such that (e, ) =
e
. Then D(
e
) = e.
1.5 Recursively Enumerable Sets
Denition 24. A set A N is called recursively enumerable, abbreviated r.e.
(or computably enumerable, abbreviated c.e.) if A = or A = f(N) for some
recursive f : N N.
Proposition 25. Let A N. The following are equivalent:
(a) A is recursively enumerable;
(b) A = Im(f) for some partial recursive f : N N;
(c) There is a primitive recursive S N
2
such that for all x,
x A y S(x, y);
18
(d) A = D(f) for some partial recursive function f : N N;
(e) A = , or A = f(N) for some primitive recursive function f : N N.
Proof. The case that A = is trivial, so we assume that A is non-empty. The
implication (a) = (b) is clear. For (b) = (c), let A = Im(
e
). Then
y A xz
_
T
1
(e, x, z) & y = (z)
_
n
_
T
1
(e, (n)
1
, (n)
2
) & y = ((n)
2
_
.
Now use that the set
(y, n) : T
1
(e, (n)
1
, (n)
2
) & y = ((n)
2
)
is primitive recursive. For (c) = (d), let S be as in (c). Dene a partial
recursive function f : N N by f(x) y S(x, y). Then A = D(f).
For (d) = (e), let A = D(
e
). Then for all x,
x A z
_
T
1
(e, x, z)
_
.
Pick a A and dene f : N N by
f(n) =
_
(n)
1
if T
1
_
e, (n)
1
, (n)
2
_
,
a otherwise.
Then f is primitive recursive with f(N) = A. It is clear that (e) = (a).
If A N is recursive, then A is recursively enumerable: use (d) above with
f : N N dened by
f(x) =
_
1 if x A,
otherwise.
For arbitrary d we call a set A N
d
recursively enumerable if there is a partial
recursive function f : N
d
N such that A = D(f).
Lemma 26. Let A N
d
. Then A is recursively enumerable i A = (S)
for some primitive recursive set S N
d+1
, where : N
d+1
N
d
is given by
(x
1
, . . . , x
d
, y) = (x
1
, . . . , x
d
).
We leave the proof as an exercise. The reader should check that the lemma still
holds when primitive recursive is replaced by recursive.
Lemma 27. If A, B N
d
are recursively enumerable, so are AB and AB.
If C N
m+n
is recursively enumerable, then so is (C) N
m
, where
: N
m+n
N
m
, (x
1
, . . . , x
m
, y
1
, . . . , y
n
) = (x
1
, . . . , x
m
).
If A N
d
and B N
e
are recursively enumerable, so is AB N
d+e
.
19
Proof. Suppose A

, B

N
d+1
are primitive recursive such that
A = x N
d
: y A

(x, y), B = x N
d
: y B

(x, y).
Then A B = x N
d
: y
_
A

(x, y) or B

(x, y)
_
. Since A

is primitive
recursive, A B is recursively enumerable. Also,
A B = x N
d
: y
_
A

(x, (y)
1
) & B

(x, (y)
2
)
_
,
hence A B is recursively enumerable.
Let C

N
m+n+1
be primitive recursive and
C = (x, y) N
m+n
: z C

(x, y, z).
Then
(C) = x N
m
: y C

(x, (y)
1
, . . . , (y)
n+1
),
hence C is recursively enumerable.
The asssertion on cartesian products of r.e. sets is left as an exercise.
Exercise. Show that if A N
d+1
is recursively enumerable, then so is

A.
Some notation: For i = 1, . . . , n, let f
i
: N
m
N be such that D(f
i
) = D(f
j
)
for i, j 1, . . . , n. This yields the partial map f = (f
1
, . . . , f
n
) : N
m
N
n
.
For A N
m
and B N
n
we set
f(A) : = f(A D(f)) = f(x) : x A D(f),
f
1
(B) : = x D(f) : f(x) B.
We call f partial recursive if each f
i
is partial recursive.
Lemma 28. For f : N
m
N
n
as above, f is partial recursive i graph(f)
N
m+n
is recursively enumerable.
Proof. We assume n = 1 since the general case follows easily from this case.
Suppose f =
(m)
e
. Then for all (x, y) N
m+1
,
(x, y) graph(f) z
_
T
m
(e, x, z) & (z) = y
_
.
For the converse, suppose graph(f) N
m+1
is recursively enumerable. Take
recursive S N
m+2
such that for all (x, y) N
m+1
,
(x, y) graph(f) z S(x, y, z).
Then f(x)
_
n S(x, (n)
1
, (n)
2
)
_
1
.
Corollary 29. Let f : N
m
N
n
be partial recursive, and let A N
m
and
B N
n
be recursively enumerable. Then f(A) N
n
and f
1
(B) N
m
are
recursively enumerable.
20
Proof. Use that for all y N
n
,
y f(A) x
_
A(x) & (x, y) graph(f)
_
,
and that projecting a recursively enumerable set to N
n
yields a recursively
enumerable set. Also, for all x N
m
,
x f
1
(B) y N
n
_
B(y) & (x, y) graph(f)
_
,
showing that f
1
(B) is recursively enumerable.
It will be convenient to approximate
e
by functions
e,s
with nite domains.
Here s N and
e,s
: N N is given by

e,s
(x)
_

e
(x) if z s
_
T
1
(e, x, z)
_
,
otherwise.
Note that if T
1
(e, x, z), then x z, so D(
e,s
) 0, . . . , s.
We also use the following traditional notations:
W
e
:= D(
e
), W
e,s
:= D(
e,s
).
Note that (W
e
)
eN
is an enumeration of the set of recursively enumerable subsets
of N, and that W
e
= K
0
(e).
Corollary 30. With these notations, we have:
(a) The halting set
K
0
:= (e, n) N
2
:
e
(n) = (e, n) : z z z T
1
(e, n, z)
is recursively enumerable;
(b) K := e N :
e
(e) = e N : z T
1
(e, e, z) is recursively
enumerable;
(c) W
e,s
W
e,s+1
, and

sN
W
e,s
= W
e
;
(d) The set (e, n, s) N
3
: n W
e,s
= (e, n, s) N
3
: z s(T
1
(e, n, z))
is primitive recursive.
Theorem 31. Let B N be recursively enumerable. Then there is a primitive
recursive function : N N such that for all n, B(n) K((n)).
Proof. Let B = D(
b
). Dene a partial recursive function f : N
2
N by
f(x, y)
b
(x). Take c such that f =
(2)
c
. Then for all n,
B(n)
b
(n) f(n, s
1
1
(c, n))

(2)
c
(n, s
1
1
(c, n))
s
1
1
(c,n)
(s
1
1
(c, n)) K(s
1
1
(c, n)).
Thus we can take (n) := s
1
1
(c, n) for this c.
The signicance of this result is that deciding membership in any recursively
enumerable subset of N reduces computably to deciding membership in K.
21
1.6 Selections & Reductions
Theorem 32 (Selection Theorem). Let A N
d+1
be recursively enumerable.
Then there is a partial recursive function f : N
d
N such that for all x N
d
,
(a) f(x) y A(x, y),
(b) f(x) = A(x, f(x)).
Proof. Take a primitive recursive S N
d+2
such that for all (x, y) N
d+1
,
A(x, y) z S(x, y, z). Dene f : N
d
N by
f(x)
_
n(S(x, (n)
1
, (n)
2
)
_
1
.
Then f has the desired properties.
An f as in the theorem above is called a partial recursive selector for A.
Theorem 33 (Reduction Theorem). Let A, B N be recursively enumerable.
Then there are recursively enumerable sets C, D N such that C A, D B,
C D = , and C D = A B.
Proof. Let E := (A0) (B1) N
2
. Then E is recursively enumerable.
Take a partial recursive selector f : N N for E. Let C = f
1
(0), D = f
1
(1).
Then C and D have the desired properties.
Theorem 34 (Posts Theorem). A set A N is recursive i A and N A are
recursively enumerable.
Proof. The left-to-right direction is clear. Assume that A and N A are recur-
sively enumerable. Let
E := ((N A) 1) (A0).
By assumption, E N
2
is recursively enumerable. Take a partial recursive
selector f : N N for E. Then D(f) = N, so f is a recursive function. Since
f =
A
, we obtain that A is recursive.
Posts Theorem is easy to explain by the Church-Turing Thesis: Suppose A and
NA are recursively enumerable and nonempty, and let f, g : N N computably
enumerate these sets. Since the union of these two sets is N, every natural
number must appear in exactly one of the sequences f(0), f(1), f(2), . . . and
g(0), g(1), g(2), . . . . Hence the computable sequence
f(0), g(0), f(1), g(1), f(2), g(2), . . .
enumerates all of N, and thus provides a computable way to determine whether
or not a given n is in A.
The sets A, B N are called recursively separable if there is a recursive set
R N such that A R and B R = (so A and B are disjoint). Such an R
is said to recursively separate A from B.
22
Theorem 35. There are disjoint recursively enumerable sets A, B N that
cannot be recursively separated.
Proof. Let A = e :
e
(e) 0, and B = e :
e
(e) 1. Then A and B are
disjoint and recursively enumerable.
Assume that R N recursively separates A and B. Let e
0
N satisfy

R
=
e0
. Then
e
0
R
e0
(e
0
) 1 e
0
B = e
0
/ R,
e
0
/ R
e0
(e
0
) 0 e
0
A = e
0
R,
a contradiction.
1.7 Trees and Recursive Inseparability
We recall that 2
N
is the set of all functions : N 0, 1, that is, the set of all
characteristic functions of subsets of N, and we think of 2
N
as the innite
sequence (0), (1), (2), . . . of zeros and ones. Graphically we represent 2
N
as
the innite binary tree, suggested in the picture below. For example, a sequence
0, 1, 1, 0, 0, . . . represents the branch in the tree that travels from the top down
via left, right, right, left, left, . . . , with 0 representing go left and 1
representing go right.
Figure 1.1: The complete innite binary tree
We also let 2
<N
be the set of all nite sequences s = (s
0
, . . . , s
n1
) such that
s
i
0, 1 for i < n; note that this includes an empty sequence for n = 0. The
elements of 2
<N
correspond to the nodes in the tree above, the empty sequence
corresponding to the top node.
Let s = (s
0
, . . . , s
n1
) 2
<N
. The length of s is the number [s[ := n. An
initial segment of s is a nite sequence (s
0
, . . . , s
m1
) with m n. A binary
tree is a non-empty set D 2
<N
closed under initial segments.
An innite branch of a binary tree D is a sequence 2
N
such that for all n,
((0), . . . , (n 1)) D. A set D 2
<N
is said to be recursive if the set
s
0
, . . . , s
n1
) : (s
0
, . . . , s
n1
) D N
23
Figure 1.2: A binary tree
is recursive.
Lemma 36. The full binary tree 2
<N
is recursive.
Proof. Let A := s
0
, . . . , s
n1
) : (s
0
, . . . , s
n1
) 2
<N
. Then
x A x B i lh(x)
_
i = 0 (x)
i
= 0 (x)
i
= 1
_
.
Thus A is recursive.
Lemma 37 (Konig). Every innite binary tree has an innite branch.
Proof. Let D be an innite binary tree. We dene : N 0, 1 inductively
such that is an innite branch of D.
(0) =
_
0 if there are innitely many s D such that s
0
= 0,
1 otherwise,
and for n > 0
(n) =
_

_
0 if there are innitely many s D such that
[s[ > n, s
n
= 0 and s
i
= (i) for i < n,
1 otherwise.
Induction on n shows that for each n there are innitely many s D such that
[s[ > n and (0) = s
0
, . . . , (n) = s
n
. It follows that is an innite branch of
D. (It is actually the leftmost such branch.)
Theorem 38. There exists an innite recursive binary tree with no recursive
innite branch.
24
Proof. Let A
0
, A
1
N be disjoint and recursively inseparable r.e. sets. Thus
we have recursive sets S
0
, S
1
N
2
such that for all m,
A
0
(m) nS
0
(m, n)
A
1
(m) nS
1
(m, n)
Next, dene D 2
<N
as follows; for s = (s
0
, . . . , s
m1
) 2
<N
,
s D k < m[(n < m (k, n) S
i
) s
k
= i] for i = 0, 1.
It is easy to check that D is a recursive binary tree. To see that D is innite we
show how to construct, for any m, a sequence of length m in D. The sequence
(s
0
, . . . , s
m1
) dened such that for k < m, if there exists an n < m with
(k, n) S
1
, then s
k
= 1 and otherwise s
k
= 0, satises our requirements.
Next we show that for any innite branch : N 0, 1 of D, the set R N
such that
R
= , is not recursive. Specically, we show that R separates A
0
and A
1
, and thus cannot be recursive.
Let k A
i
and take n such that (k, n) S
i
. Consider any sequence
((0), . . . , (m 1)) where m > k, n; note that ((0), . . . , (m 1)) D
by assumption. Then by denition (k) = i, so k A
0
k / R and
k A
1
k R, so R A
0
= and A
1
R. If R was recursive this
would contradict that A
0
and A
1
are not recursively separable.
1.8 Indices and Enumeration
In this section =
n
e
is an index system, that is, for each n,

n
e
: e = 0, 1, . . . = f : N
n
N : f is partial recursive.
Our earlier work shows that
(n)
e
is an index system.
Denition 39. We say that satises enumeration if for each n there is an
a such that

n+1
a
(e, x)
n
e
(x) for all (e, x) N
1+n
,
equivalently, ex.
n
e
(x) : N
1+n
N is partial recursive, for each n.
We say that satises parametrization if for all m, n there is a recursive s :
N
1+n
N such that

n
s(e,x)
(y)
m+n
e
(x, y) for all (e, x, y) N
1+m+n
.
We say that is acceptable if for each n there are recursive f
n
, g
n
: N N
such that for all e

n
e
=
(n)
fn(e)
and
(n)
e
=
n
gn(e)
The index system
(n)
e
is trivially acceptable, and earlier results show that it
satises enumeration and parametrization. We put
e
:=
1
e
.
25
Proposition 40. is acceptable if and only if satises enumeration and
parametrization.
Proof. Assume is acceptable and let f
n
, g
n

n
witness this as in the denition.
To prove enumeration, x n and take c such that
(n)
k
(x)
(n+1)
c
(k, x) for all
(k, x) N
1+n
. Then for all e, x,

n
e
(x)
(n)
fn(e)
(x)
(n+1)
c
(f
n
(e), x).
The right hand side is partial recursive as a function of (e, x), so we have b such
that

(n+1)
c
(f
n
(e), x)
(n+1)
b
(e, x)
n+1
gn+1(b)
(e, x) for all (e, x).
So for a = g
n+1
(b), we have
n
e
(x)
n+1
a
(e, x) for all e, x.
To prove parametrization, x m, n. Then enumeration gives a such that for
all (e, x, y) N
1+m+n
,

m+n
e
(x, y)
1+m+n
a
(e, x, y)

(1+m+n)
f1+m+n(a)
(e, x, y)

(n)
s
1+m
n
(f1+m+n(a),e,x)
(y)

n
gn(s
1+m
n
(f1+m+n(a),e,x))
(y),
so satises parametrization.
Conversely, assume satises enumeration and parametrization. Fix n, and
take a such that
1+n
a
(e, x)
n
e
(x) for all (e, x) N
1+n
. Also, take b such
that
(1+n)
b
(e, x)
1+n
a
(e, x) for all e, x, hence

(n)
s
1
n
(b,e)
(x)
1+n
a
(e, x)
n
e
(x) for all e, x.
Then f
n
: N N given by f
n
(e) = s
1
n
(b, e) satises

n
e
=
(n)
fn(e)
.
Likewise we can get a recursive g
n
: N N such that for all e we have

(n)
e
=
n
gn(e)
.
We need an eective form of the recursion theorem for acceptable .
Corollary 41. Assume is acceptable. There is a recursive : N N so
that for any recursive h : N N and any d with h =
d
the number e = (d)
satises
e
=
h(e)
.
Proof. Repeat the proofs of Kleenes recursion theorems 18, 19, and 20, with
the system instead of
(n)
e
, using that these proofs only rely on enumeration
and parametrization.
26
Lemma 42 (Padding Lemma). Assume is acceptable. Then we can eectively
construct, for any a, innitely many b such that
a
=
b
.
Proof. Given a and nite D N such that
d
=
a
for all d D, we shall
construct e , D with
e
=
a
. Dene partial recursive g : N
2
N by
g(e, x)
_

a
(x) if e , D
if e D.
Enumeration and parametrization give a recursive f : N N such that for all
(e, x) N
2
,

f(e)
(x) g(e, x)
The recursion theorem yields e
0
, eectively from a, D, with
e0
=
f(e0)
. If
e
o
, D, then
e0
=
a
and we are done. Suppose e
0
D; then
a
=
e0
, hence
D(
a
) = D(
e0
) = . So it remains to construct eectively an index e , D
with D(
e
) = . As before, we get a recursive h : N N such that

h(i)
(x) =
_
0 if i D
if i , D
The recursion theorem gives e
1
with
h(e1)
=
e1
. If e
1
D, then

a
=
e1
=
h(e1)
, a function with nonempty domain,
contradicting D(
a
) = . So e
1
, D, hence D(
e1
) = , and we are done.
Theorem 43. The index system is acceptable if and only if for each n, there
is a recursive bijection h : N N such that
n
e
=
(n)
h(e)
for all e.
Proof. Such a bijection for each n witnesses the acceptability condition for .
Conversely, suppose is acceptable. We shall construct h as in the theorem for
n = 1, and we leave it to the reader to deal with arbitrary n.
We have recursive functions f, g : N N such that
d
=
f(d)
and
e
=
g(e)
for all d, e. We construct h in stages where at each stage n we have a partial
function h
n
: N N with [D(h
n
)[ = n.
Stage 0: Take h
0
with empty domain.
Stage 2n + 1: Take the least d / D(h
2n
) and use f and the padding lemma for
to obtain eectively an e / Im(h
2n
) such that
d
=
e
. Dene h
2n+1
as
an extension of h
2n
with D(h
2n+1
) = D(h
2n
) d with h
2n+1
(d) = e.
Stage 2n + 2: Take the least e / Im(h
2n+1
) and use g and the padding lemma
to obtain eectively a d / D(h
2n+1
) such that
d
=
e
. Dene h
2n+2
as
an extension of h
2n+1
with D(h
2n+2
) = D(h
2n+1
)d with h
2n+2
(d) = e.
Then h =

h
n
has the desired properties.
27
Chapter 2
Hilberts 10th Problem
2.1 Introduction
Recursively enumerable sets occur outside pure recursion theory, most strikingly
in Hilberts 10th Problem, hereafter denoted H10:
Question. Is there an algorithm that decides for any given polynomial
f(X
1
, . . . , X
n
) Z[X
1
, . . . , X
n
]
whether the equation
f(X
1
, . . . , X
n
) = 0 (2.1)
has a solution in Z
n
? A solution of (2.1) in Z
n
(or integer solution of (2.1)) is
a tuple (x
1
, . . . , x
n
) Z
n
such that f(x
1
, . . . , x
n
) = 0. Likewise we dene what
we mean by a solution of (2.1) in N
n
(or natural number solution).
The answer to H10 is known since 1970: there is no such algorithm. It is still
open whether such an algorithm exists when n is xed to be 2.
Observation. The following are equivalent:
(a) There is an algorithm that decides for any f(X
1
, . . . , X
n
) Z[X
1
, . . . , X
n
]
whether (2.1) has a solution in Z
n
.
(b) There is an algorithm that decides for any f(X
1
, . . . , X
n
) Z[X
1
, . . . , X
n
]
whether (2.1) has a solution in N
n
.
Proof. Note that (2.1) has a solution in Z
n
if and only if one of the 2
n
equations
f(q
1
X
1
, . . . , q
n
X
n
) = 0,
with all q
i
1, 1, has a solution in N
n
. This yields (b) = (a).
28
For the other direction we use Lagranges four-square theorem. By this
theorem, (2.1) has a solution in N
n
if and only if the equation
f(X
2
11
+X
2
12
+X
2
13
+X
2
14
, . . . , X
2
n1
+X
2
n2
+X
2
n3
+X
2
n4
) = 0
has a solution in Z
n
.
In the following account of H10, we use the Observation above to restrict
attention to natural number solutions for equations of type (2.1). Thus from
now on in this chapter, u, x, y, z (sometimes with subscripts) range over N. This
is in addition to the convention that a, b, c, d, e, k, l, m, n range over N.
Let A
1
, . . . , A
m
, X
1
, . . . , X
n
be distinct polynomial indeterminates, A =
(A
1
, . . . , A
m
), X = (X
1
, . . . , X
n
), and f(A, X) Z[A, X]. We consider f(A, X)
as dening the family of diophantine equations
f(a, X) = 0, a N
m
.
Denition 44. The diophantine set dened by f(A, X) is
a N
m
: x(f(a, x) = 0)
A diophantine set in N
m
is a diophantine set dened by some polynomial f(A, X)
Z[A, X], where X = (X
1
, . . . , X
n
) and n can be arbitrary.
Lemma 45. Diophantine sets are recursively enumerable.
Proof. Let f = f(A, X) Z[A, X] be as before, and take g, h N[A, X] such
that f = g h. Then
(a, x) N
m+n
: f(a, x) = 0 = (a, x) N
m+n
: g(a, x) = h(a, x),
so (a, x) N
m+n
: f(a, x) = 0 is primitive recursive. Thus the set
a N
m
: x(f(a, x) = 0)
is recursively enumerable.
Suppose we have a nonrecursive diophantine set D N
m
. Then, assuming
the Church-Turing Thesis, the answer to H10 is negative. To see why, take
f(A, X) Z[A, X] as above such that
D = a N
m
: f(a, X
1
, . . . , X
n
) = 0 has a solution in N
n

Since D is not recursive, the Church-Turing Thesis says that there cannot
exist an algorithm deciding for any a N
m
as input, whether the equation
f(a, X) = 0 has a solution in N
n
. In particular, there cannot exist an algorithm
as demanded by H10.
The following is the key result. It gives much more than just a nonrecursive
diophantine set.
29
Main Theorem [Matiyasevich 1970]. The diophantine sets in N
m
are exactly
the recursively enumerable sets in N
m
.
It follows that there is no algorithm as required in H10 (assuming the Church-
Turing Thesis). Suggestive results in the direction of Matiyasevichs theorem
were obtained by M. Davis, H. Putnam, and J. Robinson in the 50s and 60s.
Basically, they reduced the problem to showing that the set
(a, b) : b = 2
a
N
2
is diophantine. This reduction is given in the next section.
2.2 Reduction to Exponentiation
Lemma 46. The following sets are diophantine.
(a) (a, b) : a = b N
2
,
(b) (a, b) : a b N
2
,
(c) (a, b) : a < b N
2
,
(d) (a, b) : a[b N
2
,
(e) (a, b, c) : a b mod c N
3
,
(f ) (a, b, c) : c = [a, b[ N
3
,
(g) a : a ,= 2
n
for all n N.
Proof. Just note the following equivalences:
(a) a = b a b = 0;
(b) a b x a +x = b;
(c) a < b x a +x + 1 = b;
(d) a[b x ax = b;
(e) a b mod c xy a b = cx cy;
(f) c = [a, b[ 2c = (a +b)(a +b + 1) + 2a;
(g) a ,= 2
n
for all n xy (2x + 3)y = a.
Lemma 47. Being diophantine is preserved under certain operations:
(a) If D, E N
m
are diophantine, so are D E, D E N
m
.
30
(b) If D N
m+n
is diophantine, so is (D) N
m
where : N
m+n
N
m
is
dened by (x
1
, . . . , x
m
, y
1
, . . . , y
n
) = (x
1
, . . . , x
m
).
(c) A set D N
m
is diophantine if and only if D is existentially denable in
the ordered semiring (N; 0, 1, +, , ).
Proof.
(a) Let D, E N
m
be diophantine, and take f, g Z[A; X] such that
D = a : x f(a, x) = 0,
E = a : x g(a, x) = 0.
Then clearly
D E = a : x f(a, x)g(a, x) = 0,
D E = a : x f(a, x)
2
+g(a, x)
2
= 0.
(b) Let D N
m+n
be diophantine, and take f Z[A, B, X] such that
D = (a,

b) : x f(a,

b, x) = 0
Then (D) = a :

b x f(a,

b, x) = 0.
(c) For () use that for each f Z[A, X] there exist g, h N[A, X] such
that f = g h.
For the () direction, note that for any quantier free formula in the
language of (N; 0, 1, +, , <) you can get rid of inequalities, negations, dis-
junctions, and conjunctions at the cost of introducing extra existentially
quantied variables by means of the following equivalences:
x ,= y z (x +z + 1 = y y +z + 1 = x) ,
x = 0 y = 0 xy = 0,
x = 0 y = 0 x
2
+y
2
= 0,
x < y z (x +z + 1 = y) .
Denition 48. A diophantine function f : N
m
N is a function whose graph
is a diophantine set in N
m+1
.
For example, addition and multiplication are diophantine functions on N
2
, and
so is the monus function. Also gcd : N
2
N is diophantine:
gcd(a, b) = c x, y
_
(ax by = c by ax = c) c[a c[b
_
.
31
Lemma 49. Let f : N
m
N, R N
m
and g
1
, . . . , g
m
: N
n
N be diophantine.
Then the function f(g
1
, . . . , g
m
) : N
n
N, and the relation R(g
1
, . . . , g
m
) N
n
dened by
R(g
1
, . . . , g
m
)(a) R(g
1
(a), . . . , g
m
(a))
are diophantine.
Proof. Exercise.
Some terminology. A polynomial zero set in N
n
is a set x N
n
: f(x) = 0
where f(X) Z[X]. A projection of a set R N
n
is a set S = (R) N
m
with m n and : N
n
N
m
given by (x
1
, . . . , x
n
) = (x
1
, . . . , x
m
).
Thus polynomial zero sets are primitive recursive, and the diophantine sets
are just the projections of polynomial zero sets.
The bounded universal quantication of a set R N
n+2
, denoted

R, is the
subset of N
n+1
dened by: (

R)(x, y) i
y
R(x, y, i). Let be the
smallest subset of

m
T(N
m
) that contains all polynomial zero sets and is closed
under taking projections and bounded universal quantications.
Proposition 50. =

m
S : S is a recursively enumerable set in N
m
.
Before we can prove this we need to know that is closed under some elementary
operations like taking cartesian products and intersections. This is basically an
exercise in predicate logic, which we now carry out.
Instead of N and its ordering we may consider in this exercise any nonempty
set A with a binary relation on A. Till further notice we let a, b, x, y, some-
times with indices, range over A, with vector notation like a used to denote a
tuple (a
1
, . . . , a
n
) of the appropriate length n. For R A
n+2
we dene the
bounded universal quantication

R A
n+1
of R by
(

R)(a, b) : y
b
R(a, b, y) : y
_
y b R(a, b, y)
_
,
For n m, let
n
m
: A
n
A
m
be given by
n
m
(x
1
, . . . , x
n
) = (x
1
, . . . , x
m
).
Taking cartesian products commutes with projecting:
D A
d
, m n, S A
n
= D
n
m
(S) =
d+n
d+m
(D S).
It also commutes with bounded universal quantication:
D A
d
, R A
n+2
=

(D R) = D

R.
For : 1, . . . , m 1, . . . , n and S A
m
we dene
(S) := (x
1
, . . . , x
n
) : (x
(1)
, . . . , x
(m)
) S A
n
.
Let for each n a collection (
n
of subsets of A
n
be given such that:
A
0
(
0
and := (x, y) : x = y (
2
;
32
C, D (
n
= C D (
n
;
: 1, . . . , m 1, . . . , n is injective, C (
m
(C) (
n
.
With m = 0 in the last condition we obtain A
n
( for all n. More generally,
the inclusion map 1, . . . , m 1, . . . , m + n shows that if C (
m
, then
C A
n
(
n
. Using also permutations of coordinates we see that if D (
n
,
then A
m
D (
m+n
, and thus by intersecting C A
n
and A
m
D,
C (
m
, D (
n
= C D (
m+n
.
Also, if 1 i < j n, then
n
i,j
:= (x
1
, . . . , x
n
) : x
i
= x
j
(
n
.
An example of a family ((
n
) with the properties above is obtained by taking
(
n
to be the set of polynomial zerosets in N
n
, with (A, ) = (N, ).
Let ( :=

n
(
n
, a subset of the disjoint union

n
T(A
n
), and dene (()
to be the smallest subset of

n
T(A
n
) that includes (, and is closed under
projection and bounded universal quantication. (In the example above for
(A, ) = (N, ) this gives (() = .) Below we show that the conditions
imposed on ( are inherited by ((). The main issue is to deal with the fact
that bounded universal quantication does not commute with some coordinate
reindexings given by maps : 1, . . . , m 1, . . . , n.
Lemma 51. If D (, and S ((), then D S (().
Proof. Let D (
d
. Dene the subset

of (() to have as elements the


S (() such that D S ((). Note that (

. Since projection
and bounded universal quantication commute with the operation of taking
the cartesian product with D as rst factor, it follows that

is closed under
projection and bounded universal quantication. Thus

= (().
Lemma 52. If S ((), S A
m
, then:
(1) C S (() for all C (
m
;
(2) (S) (() for all injective : 1, . . . , m 1, . . . , n.
Proof. Dene the subset

of (() to have as its elements the S A


m
, m =
0, 1, 2 . . . , such that S (() and D(S) (() for all D (
n
and injective
: 1, . . . , m 1, . . . , n. Then (

. Next we show that

is closed under
projection. Let m n and S A
n
, S

. To show that
n
m
S

, let :
1, . . . , m 1, . . . , k be injective and D (
k
. Then for a = (a
1
, . . . , a
k
)
A
k
and with x = (x
1
, . . . , x
nm
) ranging over A
nm
,
_
D (
n
m
S)
_
(a) D(a) & (
n
m
S)(a
(1)
, . . . , a
(m)
)
D(a) & x S(a
(1)
, . . . , a
(m)
, x)
x
_
D(a) & S(a
(1)
, . . . , a
(m)
, x)
_
x
_
D(a) & (S)(a, x)
_
, where
: 1, . . . , n 1, . . . , k +n m is given by
(j) = (j) for 1 j m, (m+j) = k +j for 1 j n m,
33
Since S

, the set (D A
nm
) S belongs to (C), and so does
D (
n
m
S) =
k+nm
k
_
(D A
nm
) S
_
.
Thus

is closed under projection. It remains to show that

is closed under
bounded universal quantication, so let R A
m+2
, R

. To get

,
let : 1, . . . , m + 1 1, . . . , n be injective and D (
n
. Then for S =
D (

R) and a = (a
1
, . . . , a
n
),
S(a) D(a) & (

R)(a
(1)
, . . . , a
(m+1)
)
D(a) & y
a
(m+1)
R(a
(1)
, . . . , a
(m+1)
, y)
x
_
D(a) & x = a
(m+1)
& y
x
R(a
(1)
, . . . , a
(m)
, x, y)
_
xy
x
_
D(a) & x = a
(m+1)
& (R)(a, x, y)
_
, where
: 1, . . . , m+ 2 1, . . . , n + 2 is given by
(j) = (j) for 1 j m, (m+ 1) = n + 1, (m+ 2) = n + 2.
Arguing as before this gives S ((), and so

is closed under bounded


universal quantication.
Corollary 53. If S, T ((), then S T ((). If S, T (() and also
S, T A
n
, then S T (().
Proof. Let S A
n
and S ((). Dene

to be the subset of (() whose


elements are the T (() with S T ((). It follows from Lemma 51
and (2) of Lemma 52 that (

. Also, projection and bounded universal


quantication commute with taking cartesian products with S as rst factor,
so

is closed under projection and bounded universal quantication. Hence

= ((), which gives the rst claim of the corollary. Now, with also T A
n
and T ((), we have
S T =
2n
n
_

2n
1,n+1

2n
n,2n
(S T)
_
,
and so S T (() by (1) of Lemma 52.
We have now shown that (() inherits the conditions that we imposed on (.
In particular, with (A, ) = (N, ), it follows that is closed under cartesian
products and intersections. We now return to the setting where variables like
a, b, x, y range over N and give the proof of Proposition 50:
Proof. For , note that the polynomial zero sets are primitive recursive, and
hence recursively enumerable. Now use that the class of recursively enumerable
sets is closed under taking projections and bounded universal quantications.
For we use the familiar inductive denition of recursive function to show
that these functions are in , that is, their graphs are. It is clear that this holds
for the initial functions (addition, multiplication, . . . ). Assume inductively that
34
the graphs of f : N
n
N and g
1
, . . . , g
n
: N
m
N belong to . Then with
a = (a
1
, . . . , a
m
) and x = (x
1
, . . . , x
n
) we have the equivalence
f(g
1
, . . . , g
n
)(a) = b x
_
g
1
(a) = x
1
& . . . & g
n
(a) = x
n
& f(x) = b
_
,
which shows that the graph of f(g
1
, . . . , g
n
) belongs to . Next, assume that
the graph of g : N
n+1
N is in , that for all x N
n
there is y such that
g(x, y) = 0 and that f : N
n
N is given by f(x) = y g(x, y) = 0. Then
f(x) = y g(x, y) = 0 & i
<y
z g(x, y) = z + 1,
so the graph of f belongs to . It follows that every recursive set S N
m
is in . It remains to use that recursively enumerable sets are projections of
recursive sets.
It follows from Proposition 50 that to obtain the Main Theorem, it suces to
show that if D N
m+2
is diophantine, so is

D N
m+1
. Thus we have to
eliminate a bounded universal quantier in favour of existential quantiers. We
shall be able to do this, but at the cost of introducing non-polynomial functions
like 2
x
. This reduces our task to showing that these functions are diophantine.
In order to eliminate bounded universal quantiers, it helps to introduce the
functions qu, rem : N
2
N (quotient and remainder), dened by
x = qu(x, y) y + rem(x, y), where
rem(x, y) < y if y ,= 0, rem(x, 0) = qu(x, 0) = x.
It is easy to check that qu and rem are diophantine. We also need the functions
x x! : N N and (x, y)
_
x
y
_
: N
2
N, where
_
x
y
_
=
x(x 1) . . . (x y + 1)
y!
=
_
x!
y!(xy)!
if x y,
0 otherwise.
Lemma 54. If the function 2
x
is diophantine, so are x
y
,
_
x
y
_
and x!.
Proof. Trivially, 2
xy
x mod 2
xy
x, so (2
xy
)
y
x
y
mod 2
xy
x, that is,
2
xy
2
x
y
mod 2
xy
x.
As x
y
< 2
xy
x for y > 1, we have x
y
= rem(2
xy
2
, 2
xy
x) for y > 1. This
expression shows that if 2
x
is diophantine, so is x
y
.
For
_
x
y
_
, note that 2
x
= (1 + 1)
x
=

x
y=0
_
x
y
_
, so
_
x
y
_
< 2
x
for x > 0. Also, we
have (1 +d)
x
=

x
y=0
_
x
y
_
d
y
, which gives the base d expansion of (1 +d)
x
when
d 2
x
. In other words, for all x > 0, 0 y x and all n:
_
x
y
_
= n c, d
_
d = 2
x
, n < d, c < d
y
, (1 +d)
x
c +nd
y
mod d
y+1

.
35
This equivalence shows that if 2
x
is diophantine, then
_
x
y
_
is diophantine.
For x!, note that if y > x > 1 then
_
y
x
_
=
y(y 1) . . . (y x + 1)
x!
=
y
x
(1
1
y
) . . . (1
x1
y
)
x!
.
An easy induction on n shows that for 0
1
, . . . ,
n
1 we have
n

i=1
(1
i
) 1
n

i=1

i
.
For x > 1 and y x
2
this gives
x!
_
y
x
_
y
x
= x!
_
y
x
_
1
(1
1
y
) . . . (1
x1
y
)
x!
_
y
x
__
1 +
x
2
y
_
= x!
_
y
x
_
+
x
2
x!
y
_
y
x
_
.
Hence, if
x
2
x!
y
< 1, then x! = qu(y
x
,
_
y
x
_
). But
x
2
x!
y
< 1 for y 2x
x+2
, and thus
x! = qu(y
x
,
_
y
x
_
) for y = 2x
x+2
, x > 1. Therefore, x! is diophantine if 2
x
is.
We are going to reduce the proof of the Main Theorem to showing that 2
x
is a
diophantine function. This reduction can be viewed as an elaborated version of
Godels coding lemma, which we review here for the readers convenience, since
its proof is suggestive of what comes later.
Lemma 55. Let b
1
, . . . , b
n
B N. Then there is a unique N such that
<
n

i=1
(1 +i n!B) and b
i
= rem(, 1 +i n!B) for i = 1, . . . , n.
Proof. The numbers 1 +i n! B for i = 1, . . . , n are pairwise coprime: if p were
a common prime factor of 1 + i n!B and 1 + j n!B with 1 i < j n, then
p [ (j i) n!B, so p [ n! or p [ B, a contradiction.
Therefore, by the Chinese Remainder Theorem, there exists N such that
b
i
mod 1 + i n!B for i = 1, . . . , n and such a is uniquely determined
modulo

n
i=1
(1 +i n! B).
Since b
i
< 1 + i n! B for i = 1, . . . , n, the unique <

n
i=1
(1 + i n! B)
with b
i
mod 1 +i n! B for i = 1, . . . , n has the desired property.
36
It will be convenient to x some notation in the remainder of this section:
a := (a
1
, . . . , a
m
),

b := (b
1
, . . . , b
n
), v := (v
1
, . . . , v
n
),
v y : v
1
y, . . . , v
n
y.
We showed that, for each m, the recursively enumerable sets in N
m
are exactly
the subsets of N
m
that are in . Hence, to obtain the Main Theorem, it suces
to prove: If D N
m+2
is diophantine, then so is

D N
m+1
.
We rst make a small further reduction. Let the diophantine set D N
m+2
be
given by the equivalence
D(a, x, u) v F(a, x, u, v) = 0
where F(A, X, U, V ) Z[A, X, U, V ], A = (A
1
, . . . , A
m
), V = (V
1
, . . . , V
n
)
and where A
1
, . . . , A
m
, X, U, V
1
, . . . , V
n
are distinct polynomial indeterminates.
Then for all a, x we have:
(

D)(a, x) u
x
D(a, x, u)
u
x
v F(a, x, u, v) = 0
y u
x
v y F(a, x, u, v) = 0.
Thus it remains to show that for any F(A, X, U, V ) Z[A, X, U, V ], the set
(a, x, y) : u
x
v
y
F(a, x, u, v) = 0 N
m+2
is diophantine. The next result goes under the name of Bounded Quantier
Theorem. Besides the polynomial indeterminates in (A, X, U, V ), we let Y be
an extra indeterminate which we allow also to occur in F:
Theorem 56. Suppose F(A, X, Y, U, V ) in Z[A, X, Y, U, V ] and G(A, X, Y ) in
N[A, X, Y ] are polynomials such that for all a, x, y and all u x and v y,
G(a, x, y) > [F(a, x, y, u, v)[ + 2x +y + 2.
Then the following equivalence holds for all a, x, y, with g := G(a, x, y):
u
x
v
y
F(a, x, y, u, v) = 0

b
_
_
b1
y+1
_

_
bn
y+1
_
F(a, x, y, g! 1,

b) 0 mod
_
g!1
x+1
_
_
Before we start the proof, note that for any F Z[A, X, Y, U, V ] we obtain
G(A, X, Y ) N[A, X, Y ] as in the hypothesis of the lemma as follows: Let
F

N[A, X, Y, U, V ] be obtained from F by replacing each coecient with its


absolute value and put
G(A, X, Y ) := F

(A, X, Y, X, Y, . . . , Y ) + 2X +Y + 3.
37
Proof. We shall refer to the equivalence in the Bounded Quantier Theorem as
the BQ-equivalence. Let a, x, and y be given and put g = G(a, x, y). Then
_
g! 1
x + 1
_
=
(g! 1)(g! 2) . . . (g! x 1)
1 2 (x + 1)
=
g! 1
1

g! 2
2

g! x 1
x + 1
=
_
g!
1
1
__
g!
2
1
_
. . .
_
g!
x + 1
1
_
.
Since g > x + 2, all x + 1 factors in this last product are in N
>1
.
Claim 1. Each prime factor of
_
g!1
x+1
_
is greater than g.
This is because g 2x +2, so every prime p g divides
g!
u+1
for each u x, so
no prime p g divides
_
g!1
x+1
_
.
Claim 2. The factors
g!
1
1,
g!
2
1, . . . ,
g!
x+1
1 are pairwise coprime.
To see why, suppose p is a prime factor of
g!
i
1, and
g!
j
1, with 1 i < j x+1.
Then p > g, but p [ g! i, p [ g! j, so p [ j i, contradicting j i g.
For each u x, take a prime factor p
u
of
g!
u+1
1. Then
p
u
> g,
g!
u + 1
1 0 mod p
u
,
so g! u + 1 mod p
u
, hence g! 1 u mod p
u
. Thus for all

b and all u x:
F(a, x, y, g! 1,

b) F(a, x, y, u, rem(b
1
, p
u
), . . . , rem(b
n
, p
u
)) mod p
u
.
Now, assume that for each u x we have natural numbers v
u1
, v
u2
, . . . , v
un
y
such that
F(a, x, y, u, v
u1
, . . . , v
un
) = 0.
For i = 1, . . . , n, the Chinese Remainder Theorem provides b
i
<
_
g!1
x+1
_
such
that b
i
v
ui
mod
g!
u+1
1 for all u x. In other words,
g!
u + 1
1 [ b
i
(b
i
1) (b
i
y) for i = 1, . . . , n and all u x.
Then by Claim 2,
_
g!1
x+1
_
[ b
i
(b
i
1) . . . (b
i
y). By Claim 1 and g > y + 1, all
prime factors of
_
g!1
x+1
_
are greater than y + 1. So,
_
g! 1
x + 1
_
[
b
i
(b
i
1) . . . (b
i
y)
(y + 1)!
=
_
b
i
y + 1
_
.
Hence,
_
b
1
y + 1
_

_
b
n
y + 1
_
0 mod
_
g! 1
x + 1
_
.
38
For u x,
_
g!
u+1
1
_
(u + 1) = g! (u + 1) = (g! 1) u, so
g! 1 u mod
g!
u + 1
1, hence
F(a, x, y, g! 1,

b) F(a, x, y, u, v
u
)
0 mod
g!
u + 1
1.
Thus, by the second claim, F(a, x, y, g! 1,

b) 0 mod
_
g!1
x+1
_
. This proves the
forward direction of the BQ-equivalence.
For the converse, let

b be such that
_
b
1
y + 1
_

_
b
n
y + 1
_
F(a, x, y, g! 1,

b) 0 mod
_
g! 1
x + 1
_
.
Then for 1 i n, u x:
_
b
i
y + 1
_
0 mod p
u
, so p
u
[ b
i
(b
i
1) . . . (b
i
y),
hence p
u
[b
i
k for some k y, which gives rem(b
i
, p
u
) y. Hence
[F(a, x, y, u, rem(b
1
, p
u
), . . . , rem(b
n
, p
u
))[ < g < p
u
[
_
g! 1
x + 1
_
,
and thus F(a, x, y, u, rem(b
1
, p
u
), . . . , rem(b
n
, p
u
)) = 0, as desired.
Lemma 54 and The Bounded Quantier Theorem reduce the proof of the Main
Theorem to showing that the function 2
x
is diophantine. This will be achieved
by exploiting subtle properties of solutions of Pell equations. In the next section
we derive the relevant facts about these equations. We nish this section with
a digression on exponentially diophantine equations. Readers who want to take
the shortest path to a proof of the Main Theorem can skip this.
Exponentially diophantine sets. Some results above are conditional on the
function 2
x
being diophantine. A nice way to eliminate the conditional nature
of these results without proving outright that 2
x
is diophantine is as follows.
Call a set E N
m
exponentially diophantine if for some polynomial
F(A, X, Y ) Z[A, X, Y ], with
A = (A
1
, . . . , A
m
), X = (X
1
, . . . , X
n
), Y = (Y
1
, . . . , Y
n
),
the following equivalence holds for all a N
m
:
E(a) x F(a, x, 2
x
) = 0,
where 2
x
:= (2
x1
, . . . , 2
xn
) for x = (x
1
, . . . , x
n
) N
n
. Clearly, if E N
m
is
diophantine, then E is exponentially diophantine. Note that Lemma 45 goes
39
through with exponentially diophantine instead of diophantine. So does
Lemma 47, where in part (c) the ordered semiring (N; 0, 1, +, , ) is replaced
by the ordered exponential semiring (N; 0, 1, +, , exp, ) with exp(x) := 2
x
.
A function f : N
m
N is said to be exponentially diophantine if its graph
(as a subset of N
m+1
) is exponentially diophantine. Then Lemma 49 goes
through with exponentially diophantine instead of diophantine. The proof
of Lemma 54 shows (unconditionally) that the functions x
y
,
_
x
y
_
, and x! are
exponentially diophantine. We are now approaching a proof of the following
unconditional result.
Theorem 57. For each set S N
m
,
S is recursively enumerable S is exponentially diophantine.
As stated, this is of course a consequence of the Main Theorem to be proved in
the next section, but it seems worth deriving this exponential version using just
the facts we have already established. Moreover, this exponential version holds
in an enhanced form that we briey touch on at the end of this digression. One
might try to prove Theorem 57 by an exponential analogue of the BQ-Theorem.
However, the proof of that theorem doesnt go through, since it can happen that
x y mod m, but 2
x
, 2
y
mod m.
Instead we shall focus on improving Proposition 50, which says that any
given recursively enumerable set can be obtained from a polynomial zero set
by a nite sequence of projections and bounded universal quantications. The
main point is to show that bounded universal quantication is needed only once
in such a description of a given recursively enumerable set. This is an old result
due to Martin Davis, the Davis Normal Form:
Proposition 58. Given any recursively enumerable set S N
d
, there is a
diophantine set D N
d+m+2
with the property that for all a N
d
,
S(a) x
1
. . . x
m
x u
x
D(a, x
1
, . . . , x
m
, x, u).
Proof. We rst show how to interchange the order of bounded universal quan-
tication and existential quantication. Let S N
m+3
. Using the Chinese
Remainder Theorem to code nite sequences as in the proof of Lemma 55 we
have for all (a, b) N
m+1
,
u
b
x S(a, b, u, x)

y, z u
b
S
_
a, b, u, rem(y, 1 + (u + 1)z)
_
.
Next, we show how to contract two successive bounded universal quantications
into a single bounded universal quantication, at the cost of an extra existential
quantication. Let L, R : N N be the functions such that n = [L(n), R(n)[
for all n. It is easy to check that L, R are diophantine. Let now S N
m+4
.
40
Then for all (a, b, c) N
m+2
:
u
b
v
c
S(a, b, c, u, v)

x
|b,c|
_
(L(x) b & R(x) c) S(a, b, c, L(x), R(x))

y x
y
_
y = [b, c[ &
_
L(x) b & R(x) c
_
S(a, b, c, L(x), R(x))
_
]
Now an inductive argument using Proposition 50 yields the desired result.
The BQ-theorem in combination with Proposition 58 and the facts mentioned
earlier on exponentially diophantine sets and functions show that any recursively
enumerable set S N
d
is exponentially diophantine. This concludes the proof
of Theorem 57.
2.3 Pell Equations
Below we assume that d N is not a square, that is,
d , sq(N) := n
2
: n = 0, 1, 2, . . . = 0, 1, 4, 9, . . . .
So 2, 3, 5, 6, 7, 8, 10, . . . are the possible values of d. Then
X
2
dY
2
= 1 (P)
is called a Pell equation. Note that (P) has the solution (1, 0), which we call
the trivial solution. Given any solution (a, b), we have the factorization
a
2
db
2
= (a +b

d)(a b

d) = 1,
which yields (a +b

d)
n
(a b

d)
n
= 1, and taking a

, b

such that
(a +b

d)
n
= a

+b

d, (a b

d)
n
= a

d,
we see that (a

, b

) is also a solution of (P).


Example. Consider the case d = 2. Then X
2
2Y
2
= 1 has the non-trivial
solution (3, 2), and
(3 + 2

2)
2
= 9 + 12

2 + 8 = 17 + 12

2,
(3 2

2)
2
= 9 12

2 + 8 = 17 12

2,
yielding another solution (17, 12).
A key fact in connection with H10 is that the solutions of (P) in N
2
form a se-
quence (x
n
, y
n
), n = 0, 1, 2, . . . where x
n
and y
n
grow roughly as an exponential
function of n. Our short term goal is to establish this fact.
41
Lemma 59. G := x y

d : x
2
dy
2
= 1 is a subgroup of the multiplicative
group R
>0
of positive real numbers.
Proof. First, 1 = 1 +0

d, so 1 G. We have x
2
dy
2
= (x +y

d)(x y

d),
so if x
2
dy
2
= 1, then x y

d =
1
x+y

d
. Also,
(x
1
+y
1

d)(x
2
+y
2

d) = (x
1
x
2
+dy
1
y
2
) + (x
1
y
2
+x
2
y
1
)

d
(x
1
y
1

d)(x
2
y
2

d) = (x
1
x
2
+dy
1
y
2
) (x
1
y
2
+x
2
y
1
)

d
Hence, if x
2
1
dy
2
1
= x
2
2
dy
2
2
= 1, then x
2
dy
2
= 1 where
x := x
1
x
2
+dy
1
y
2
, y := (x
1
y
2
+x
2
y
1
).
Note that the x +y

d G are 1 and the x y

d G are 1.
Corollary 60. Suppose (P) has a nontrivial solution in N
2
. Let (x
1
, y
1
) be such
a solution with minimal x
1
> 1. Then the solutions in N
2
of (P) are exactly the
(x
n
, y
n
) N
2
given by
(x
1
+y
1

d)
n
= x
n
+y
n

d, n = 0, 1, 2, . . .
Proof. Put r := x
1
+ y
1

d, so r is the least element of G which is greater


than 1. We have 1 < r < r
2
< . . . and r
n
as n . Let (x, y)
be a solution of (P). Take the unique n such that r
n
x + y

d < r
n+1
.
Then 1 (x + y

d)r
n
< r. By the previous lemma, (x + y

d)r
n
G, so
(x +y

d)r
n
= 1, that is, x +y

d = r
n
, so x = x
n
, y = y
n
.
If there is a non-trivial solution of (P) in N
2
, then (x
1
, y
1
) as in Corollary 60 is
called the minimal solution of (P). Note that in this corollary, n = 0 yields the
trivial solution, and n = 1 the minimal solution.
We record two rules for solutions of (P), assuming there is a non-trivial
solution of (P) in N
2
. First, the addition rules:
x
m+n
= x
m
x
n
+dy
m
y
n
, y
m+n
= x
m
y
n
+x
n
y
m
,
which follow from the denitions of x
n
and y
n
, and the doubling rules, which
follow from the addition rules:
x
2n
= 2x
2
n
1, y
2n
= 2x
n
y
n
.
Our next goal is Lagranges theorem that non-trivial solutions of (P) in N
2
do
exist. First a lemma.
Lemma 61. Let R
>1
be irrational. Then there are innitely many (x, y)
with y > 0 such that


x
y

<
1
y
2
.
42
The obvious bound would be
1
y
, so the lemma says that there are much better
rational approximations to , in terms of the size of the denominator. One can
show that replacing y
2
in the lemma by y
r
with a xed real number r > 2 would
result in a false statement for =

2.
Proof. Let n 1; we claim that there are x, y > 0 such that y n and


x
y

<
1
ny

1
y
2
.
For y = 0, 1, 2, . . . , n, we have y = x + (y), where x N and 0 (y) < 1.
Divide the interval [0, 1) into the n subintervals
[0, 1/n), [1/n, 2/n), . . . , [(n 1)/n, 1).
By the pigeonhole principle, two of the n + 1 numbers (0), (1), . . . , (n) must
lie in the same subinterval. Thus we have y
1
< y
2
, both in 0, 1, . . . , n such
that [(y
1
) (y
2
)[ < 1/n. This gives x
1
x
2
such that
y
1
= x
1
+(y
1
), y
2
= x
2
+(y
2
).
Now set y = y
2
y
1
and x = x
2
x
1
. We get y = x +(y
2
) (y
1
). So
[y x[ <
1
n
, and thus


x
y

<
1
ny
.
We have x > 0 because > 1 and
1
ny
< 1. For each n 1, take x(n), y(n) N
>0
such that y(n) n and


x(n)
y(n)

<
1
ny

1
y
2
.
As n goes to innity, we have
x(n)
y(n)
, so the set
(x(n), y(n)) : n = 1, 2, 3, . . .
is innite.
Theorem 62. The equation (P) has a nontrivial solution in N
2
.
This theorem is due to Lagrange, but we give Dirichlets proof.
Proof. If x, y N
>0
and

d x/y

< 1/y
2
, then
0 <

d
x
2
y
2

d
x
y

d +
x
y

<
1
y
2
_
1 + 2

d
_
,
so
0 <

x
2
dy
2

< 1 + 2

d.
43
By the previous lemma we have therefore a nonzero integer with [[ < 1+2

d,
such that the equation
X
2
dY
2
= , (P

)
has innitely many solutions (x, y) with x, y N
>0
. Consider two such solutions
of (P

), (x
1
, y
1
) and (x
2
, y
2
). Then:
x
2
1
dy
2
1
= (x
1
+y
1

d)(x
1
y
1

d) = ,
x
2
2
dy
2
2
= (x
2
+y
2

d)(x
2
y
2

d) = ,
so
_
x
1
+y
1

d
x
2
+y
2

d
__
x
1
y
1

d
x
2
y
2

d
_
= 1.
Now we remove square roots from denominators:
x
1
+y
1

d
x
2
+y
2

d
=
(x
1
+y
1

d)(x
2
y
2

d)
(x
2
+y
2

d)(x
2
y
2

d)
=
(x
1
x
2
dy
1
y
2
) + (x
2
y
1
x
1
y
2
)

,
x
1
y
1

d
x
2
y
2

d
=
(x
1
y
1

d)(x
2
+y
2

d)
(x
2
y
2

d)(x
2
+y
2

d)
=
(x
1
x
2
dy
1
y
2
) (x
2
y
1
x
1
y
2
)

.
Thus, setting
s :=

x
1
x
2
dy
1
y
2

, t :=

x
2
y
1
x
1
y
2

,
we get s
2
dt
2
= 1. The problem is that s and t might not be integers. However,
(P

) has innitely many solutions (x, y), so by the pigeonhole principle we can
choose (x
1
, y
1
) and (x
2
, y
2
) as above so that x
1
x
2
mod and y
1
y
2
mod , and (x
1
, y
1
) ,= (x
2
, y
2
). Then
x
1
x
2
dy
1
y
2
x
2
1
dy
2
1
0 mod ,
and x
2
y
1
x
1
y
2
0 mod , so s, t N.
It remains to show that (s, t) is not the trivial solution to (P). Suppose
towards a contradiction that s = 1 and t = 0. Then x
2
y
1
x
1
y
2
= 0, so
x
2
/x
1
= y
2
/y
1
. We can assume x
2
> x
1
; set r = x
2
/x
1
> 1. Then
x
2
2
dy
2
2
= r
2
(x
2
1
dy
2
1
) = r
2
,= ,
a contradiction. So (s, t) is a nontrivial solution of (P) in N
2
.
Although this proof appears non-constructive, one can actually derive from it
an explicit upper bound on the minimal solution: our use of the pigeonhole
principle does not really need innitely many solutions to (P

), but only more


than
2
, and we have [[ < 1 + 2

d.
44
The minimal solution of a Pell equation X
2
dY
2
= 0 varies rather wildly
with d. For our purpose we can restrict attention to a situation where the
minimal solution is obvious: let a 2 and consider a Pell equation
X
2
(a
2
1)Y
2
= 1, (P
a
).
Its minimal solution is (a, 1). Now dene x
a
(n), y
a
(n) N by
x
a
(n) +y
a
(n)
_
a
2
1 = (a +
_
a
2
1)
n
.
By previous results, (x
a
(n), y
a
(n)) : n = 0, 1, 2, . . . is the set of all solutions
in N
2
. We now list several rules, most of which follow trivially from the earlier
addition and doubling rules. First of all, we have the addition rules:
x
a
(m+n) = x
a
(m)x
a
(n) + (a
2
1)y
a
(m)y
a
(n),
y
a
(m+n) = x
a
(m)y
a
(n) +x
a
(n)y
a
(m),
next, the doubling formulae:
x
a
(2n) = 2x
a
(n)
2
1,
y
a
(2n) = 2x
a
(n)y
a
(n),
the simultaneous recursion equations:
x
a
(0) = 1, x
a
(n + 1) = ax
a
(n) + (a
2
1)y
a
(n),
y
a
(0) = 0, y
a
(n + 1) = x
a
(n) +ay
a
(n),
and the course-of-values recursion:
x
a
(0) = 1, x
a
(1) = a, x
a
(n + 2) = 2ax
a
(n + 1) x
a
(n),
y
a
(0) = 0, y
a
(1) = 1, y
a
(n + 2) = 2ay
a
(n + 1) y
a
(n).
One can prove the course-of-values recursion, for example, as follows:
x
a
(n + 2) = ax
a
(n + 1) + (a
2
1)y
a
(n + 1)
= ax
a
(n + 1) + (a
2
1) [x
a
(n) +ay
a
(n)]
= ax
a
(n + 1) + (a
2
1)x
a
(n) +a [x
a
(n + 1) ax
a
(n)]
= 2ax
a
(n + 1) x
a
(n).
In addition we have a result about growth:
(2a 1)
n
y
a
(n + 1) < (2a)
n
2n y
a
(n) for n 2
Exercise. Prove the growth result.
Finally, we state some congruence rules: for a, b 2 we have
y
a
(n) n mod (a 1)
y
a
(n) y
b
(n) mod (a b)
45
Proof. For the rst result, we have y
a
(0) = 0 0 mod (a1) and y
a
(1) = 1 1
mod (a 1). Thus we can apply induction:
y
a
(n + 2) 2y
a
(n + 1) y
a
(n) mod (a 1)
2(n + 1) n
n + 2 mod (a 1).
For the second result, we note that it holds for n = 0, 1, and also that a b
mod (a b). Thus,
y
a
(n + 2) 2by
a
(n + 1) y
a
(n) mod (a b),
which shows that y
a
(n) satises the same recursion as y
b
(n) modulo (ab).
Lemma 63 (Periodicity). Suppose m, n > 0 and y
a
(n) 0 mod m. Then for
all k, l, if k l mod 2n, then y
a
(k) y
a
(l) mod m.
Thus the remainder rem(y
a
(k), m) is periodic as a function of k, with period
dividing 2n, where the period is the least p N
>0
such that
rem(y
a
(k), m) = rem(y
a
(k +lp), m) for all k, l.
Proof. Just observe the following equalities and congruences:
y
a
(k + 2n) = x
a
(k)y
a
(2n) +x
a
(2n)y
a
(k)
= 2x
a
(k)x
a
(n)y
a
(n) + (2x
a
(n)
2
1)y
a
(k)
(2x
a
(n)
2
1)y
a
(k) mod m

_
2
_
(a
2
1)y
a
(n)
2
+ 1
_
1

y
a
(k) mod m
y
a
(k) mod m.
We note also that for any m > 0, there is an n > 0 so that y
a
(n) 0 mod m.
This is because for d := m
2
(a
2
1) the Pell equation X
2
dY
2
= 1 has a
non-trivial solution, say (x, y). Then (x, my) is a nontrivial solution to (P
a
).
Next we prove some step-down lemmas. Roughly speaking, these pro-
vide more precise information about the period in the sequence of remainders
rem(y
a
(k), m) when m has a special form. In addition, they provide information
about n from information about y
a
(n).
Lemma 64 (First Step-Down Lemma). Let m, n > 0. Then:
y
a
(m)[y
a
(n) m[n,
y
a
(m)
2
[y
a
(n) my
a
(m)[n.
46
Proof. Assume rst that m[n, so n = mk, k > 0. Then
x
a
(n) +y
a
(n)
_
a
2
1 = (a +
_
a
2
1)
mk
=
__
a +
_
a
2
1
_
m
_
k
=
_
x
a
(m) +y
a
(m)
_
a
2
1
_
k
.
Expanding the right hand side by the binomial theorem and comparing coe-
cients of

a
2
1, we get
() y
a
(n) = kx
a
(m)
k1
y
a
(m) +y
a
(m)
3
(integer).
In particular, (*) yields that y
a
(m) divides y
a
(n), proving the backwards direc-
tion of the implication.
Conversely, assume that y
a
(m)[y
a
(n). Towards a contradiction, let m n.
Then n = qm+r with q, r N and 0 < r < m. By the addition formula,
y
a
(n) = y
a
(qm+r) = x
a
(qm)y
a
(r) +x
a
(r)y
a
(qm).
From y
a
(m)[y
a
(qm), we obtain y
a
(m)[x
a
(qm)y
a
(r). But y
a
(qm) and x
a
(qm)
are coprime, so y
a
(m) and x
a
(qm) are coprime. Hence y
a
(m)[y
a
(r), which
contradicts 0 < y
a
(r) < y
a
(m). This proves the rst equivalence.
For the second, rst note that both sides of the equivalence imply m[n, so
we can assume n = mk, with k N
>0
. Then we again apply (*):
y
a
(m)
2
[y
a
(n) y
a
(m)
2
[kx
a
(m)
k1
y
a
(m)
y
a
(m)[kx
a
(m)
k1
y
a
(m)[k
my
a
(m)[n.
Lemma 65 (Second Step-Down Lemma). Let n 1 and suppose that y
a
(k)
y
a
(l) mod x
a
(n). Then k l mod 2n.
Proof. Let i, j N. Then the following congruences hold:
y
a
(2n +i) y
a
(i) mod x
a
(n)
y
a
(2n i) y
a
(i) mod x
a
(n) for 0 i n
y
a
(4n +i) y
a
(i) mod x
a
(n)
y
a
(4n i) y
a
(i) mod x
a
(n) for 0 i n
We prove the rst of these congruences, leave the second as an exercise, and
note that the third and fourth follow easily from applications of the rst and
second. The proof of the rst congruence is as follows.
y
a
(2n +i) = x
a
(2n)y
a
(i) +x
a
(i)y
a
(2n)
x
a
(2n)y
a
(i) mod x
a
(n)
(2x
a
(n)
2
1)y
a
(i) mod x
a
(n)
y
a
(i) mod x
a
(n)
47
The second line here uses x
a
(n)[y
a
(2n), which follows from the doubling formula.
Next we have two incongruences to the eect that the congruences above are in
some sense best possible:
y
a
(i) , y
a
(j) mod x
a
(n) for 0 i < j n,
y
a
(i) , y
a
(i) mod x
a
(n) for 0 < i n.
To prove these incongruences we assume a > 2, and leave the somewhat special
case a = 2 to the reader. Then
x
a
(n) =
_
(a
2
1)y
a
(n)
2
+ 1 > y
a
(n)
_
a
2
1 > 2y
a
(n)
The rst incongruence now follows because for 0 i < j n,
x
a
(n) > 2y
a
(n) y
a
(j) y
a
(i).
The second incongruence holds because if 0 < i n, then
x
a
(n) > 2y
a
(n) 2y
a
(i) > 0.
Now put i = rem(k, 4n), j = rem(l, 4n). Then
y
a
(i) y
a
(j) mod x
a
(n).
If i = j then k l mod 4n, so k l mod 2n. If i ,= j, then a close look
at the four initial congruences and the two incongruences above yields i j
mod 2n, so k l mod 2n.
2.4 Proof of the Main Theorem
We are now ready to show that (a, n, y) : a 2, y = y
a
(n) N
3
is diophan-
tine. In the next result and its proof, all variables range over N.
Theorem 66. Let a, y, n 2. Then the following are equivalent
y = y
a
(n);
there are x, u, v, s, t, b such that
(i) 2n y (vi) b 1 mod y
(ii) x
2
(a
2
1)y
2
= 1 (vii) t y mod u
(iii) v 1 & u
2
(a
2
1)v
2
= 1 (viii) t n mod y
(iv) b 2 & s
2
(b
2
1)t
2
= 1 (ix) y
2
[v.
(v) b a mod u
48
Proof. Let x, u, v, s, t, b be as in (i)(ix). Then take k, l, m such that
y = y
a
(k), u = x
a
(l), t = y
b
(m).
We shall prove that k = n, so y = y
a
(n). By (iii), l 1. By the congruence
rules we have y
b
(m) y
a
(m) mod b a, and so by (v),
y
b
(m) y
a
(m) mod x
a
(l).
By (vii) we have y
b
(m) y
a
(k) mod x
a
(l), so
y
a
(m) y
a
(k) mod x
a
(l)
By the second step down lemma,
m k mod 2l
By (ix), y
a
(k)
2
[y
a
(l), so by the rst step down lemma, ky
a
(k)[l, so y[l and thus
m k mod y (2.2)
By the congruence rules, y
b
(m) m mod (b 1), so
y
b
(m) m mod y by (vi),
y
b
(m) n mod y by (viii)
n m mod y and thus by (2.2),
n k mod y (2.3)
By (i) and an earlier result on the bounds on solutions of P
a
we have 2n y,
2k y, which in view of (2.3) yields n = k, so y = y
a
(n), as desired.
For the converse, assume y
a
(n) = y. Then (ii) holds with x = x
a
(n). Take
l := ny
a
(n), u := x
a
(l), v := y
a
(l).
Then (iii) holds. By the rst step down lemma,
y
2
= (y
a
(n))
2
[y
a
(l) = v 1
and (ix) holds. By (iii), u, v are coprime, and y[v, so u, y are coprime. By the
Chinese Remainder Theorem we get b 2 such that
b a mod u
b 1 mod y
Then (v) and (vi) hold. Now take s := x
b
(n), t := y
b
(n). Then (iv) holds, and
the congruence rules yield (vii) and (viii).
Corollary 67. The function x 2
x
is diophantine.
49
Proof. Let a 2. Then
(2a 1)
n
y
a
(n + 1) (2a)
n
, (4a 1)
n
y
2a
(n + 1) (4a)
n
.
Therefore
2
n
_
1
1
4a
_
n
=
(4a 1)
n
(2a)
n

y
2a
(n + 1)
y
a
(n + 1)

(4a)
n
(2a 1)
n
= 2
n
_
1 +
1
2a 1
_
n
.
For xed n, with a ,
_
1 +
1
2a 1
_
n
1,
_
1
1
4a
_
n
1.
So for some B(n) N
>0
, whenever a > B(n), then

y
2a
(n + 1)
y
a
(n + 1)
2
n

<
1
2
,
hence for all a > B(n) and all m,
2
n
= m 2 [y
2a
(n + 1) my
a
(n + 1)[ < y
a
(n + 1).
So it only remains to show that there is a diophantine function B : N N
>0
such that for all n and all a > B(n),

y
2a
(n + 1)
y
a
(n + 1)
2
n

<
1
2
.
We have
2
n
_
1
1
4a
_
n
2
n
_
1
n
4a
_
= 2
n

n2
n
4a
,
so if 4a > 2n2
n
, then 2
n
_
1
1
4a
_
n
> 2
n

1
2
. Also,
2
n
_
1 +
1
2a 1
_
n
2
n
_
1 +
n2
n
2a 1
_
= 2
n
+
n2
2n
2a 1
,
so if 2a1 > 2n2
2n
, then 2
n
_
1 +
1
2a1
_
n
< 2
n
+
1
2
. As 5
n
y
3
(n+1) 6
n
, we
can take B(n) := 2ny
3
(n + 1) + 1. Then B(n) > 2n2
2n
, so B is a diophantine
function as desired.
The main theorem has now been established. It gives much more than a negative
solution to H10.
Exercise. Show that there is no algorithm determining for any system
P
1
(X
1
, . . . , X
n
) = = P
m
(X
1
, . . . , X
n
) = 0
50
with all P
i
Z[X
1
, . . . , X
n
] of degree 2, whether the system has a solution
in Z
n
. Using this, show that there is no algorithm determining for any given
equation
P(X
1
, . . . , X
n
) = 0
with P Z[X
1
, . . . , X
n
] of degree 4 whether the equation has a solution in
Z
n
.
The answer to H10 is not even known for polynomial equations in two variables.
There is, however, an algorithm to decide for any given P Z[X, Y ] whether
P(X, Y ) = 0 has innitely many integer solutions. This follows from a deep
theorem due to C.L. Siegel (1929), with some extra work. There is also an
algorithm based on other work by Siegel to decide whether a given polynomial
equation P(X
1
, . . . , X
n
) = 0 with P Z[X
1
, . . . , X
n
] of degree 2, has an integer
solution.
It is not known whether H10 has a positive answer when we allow rational
solutions instead of integer solutions. On the other hand, H10 does have a
positive answer when we allow real solutions, or p-adic solutions; this follows
from the stronger result that the elementary theory of the real eld is decidable
(Tarski), and likewise for the elementary theory of each p-adic eld (AxKochen
& Ersov).
51
Chapter 3
Kolmogorov Complexity
This is a theory about randomness using concepts of recursion theory. The idea
is that a long nite string of 0s and 1s is random if any program to compute
the string is about as long as the string itself.
Instead of natural numbers it is more convenient to work with nite strings
of 0s and 1s, that is, elements of 2
<N
, as the inputs and outputs of algorithms.
We let x, y, z, , , , range over 2
<N
. For = (
0
, . . . ,
n1
) we dened its
length [[ = n; the concatenation of x, y is denoted xy. The tree coding of 2
<N
is the bijection tr : 2
<N
N indicated in the picture below:

Q
Q
Q
Q
Q
0

@
@
@
1

@
@
@
00

B
B
B
01

B
B
B
10

B
B
B
11

B
B
B
000 001 010 011 100 101 110 111
-
tr
0

Q
Q
Q
Q
Q
1

@
@
@
2

@
@
@
3

B
B
B
4

B
B
B
5

B
B
B
6

B
B
B
7 8 9 10 11 12 13 14
In words, tr is the unique bijection 2
<N
N such that tr() < tr() if [[ < [[,
or [[ = [[ and precedes lexicographically. Via this bijection the notion
of partial recursive function N
d
N can be transferred to a notion of partial
recursive function (2
<N
)
d
2
<N
. Precisely, a partial function f : (2
<N
)
d
2
<N
is declared to be partial recursive if the partial function g : N
d
N such that
g(tr(x
1
), . . . , tr(x
d
)) tr(f(x
1
, . . . x
d
))
is partial recursive. Note: 2
||
1 tr() 2
||+1
2.
52
3.1 Plain Kolmogorov Complexity
Let f : 2
<N
2
<N
be a partial recursive function. The (plain) Kolmogorov
complexity of with respect to f is
C
f
() =
_
min[[ : f() = if there is Df such that f() = ,
otherwise.
We say that is Kolmogorov random with respect to f if C
f
() [[.
Let U : 2
<N
2
<N
2
<N
be a universal partial recursive function. That is,
U is partial recursive and
U(, ) : 2
<N
= f : 2
<N
2
<N
: f is partial recursive.
Dene the partial recursive function u : 2
<N
2
<N
by
u(0
||
1) U(, ),
u() if does not have the form 0
||
1.
Then 1 C
u
() < for all : the left inequality holds because u() , and
the right inequality holds because U(, ) = id
2
<N for some . This complexity
function C
u
is as good as any, up to an additive constant:
Lemma 68. For all partial recursive f : 2
<N
2
<N
and all ,
C
u
() C
f
() + const(f).
Here and later const(f) denotes a constant in N depending only on f. Likewise,
const denotes an absolute constant in N. (Of course, the possible values of const
may vary with the context.)
Proof. Let be such that f = U(, ). If Df and f() = , then
u(0
||
1) = and [0
||
1[ = [[ + 2[[ + 1. Thus for all :
C
u
() C
f
() + 2[[ + 1.
Denition 69. C := C
u
: 2
<N
N.
This complexity function C depends on the initial choice of U, but only in an
inessential way: Let U

: 2
<N
2
<N
2
<N
also be a universal partial recursive
function, with C

: 2
<N
N as its associated complexity function. Then there
is a constant c N such that [C() C

()[ c for all . Our interest is


in the behaviour of C on suciently long strings, and we regard C and C

as
equivalent for this purpose.
Lemma 70. The following hold:
(a) C(x) [x[ + const;
53
(b) C(xx) [x[ + const;
(c) if h : 2
<N
2
<N
is recursive, then for all x
C(h(x)) C(x) + const(h).
Proof. For f = id
2
<N we have C
f
(x) = [x[. So C(x) [x[ + const. This gives
(a). Let h : 2
<N
2
<N
be recursive, and put f := h u. Then
C(h(x)) C
f
(h(x)) + const(f)
C
u
(x) + const(f)
= C(x) + const(h).
This yields (c), and (b) is a special case of (c).
Call x random if C(x) [x[. For each n, there is a random x with [x[ = n. This
follows from the pigeon hole principle:
[ : [[ < n[ = 2
0
+ 2
1
+ + 2
n1
= 2
n
1,
and [ : [[ = n[ = 2
n
, so the partial map
u() : : [[ < n x : [x[ = n
cannot be surjective. More precisely, we have the following result.
Lemma 71. For all n and all k 0, . . . , n,
[x : [x[ = n, C(x) n k[ > 2
n
(1
1
2
k
).
Proof. We have [ : [[ < n k[ = 2
0
+ 2
1
+ + 2
nk1
= 2
nk
1, so
[x : [x[ = n, C(x) n k[ 2
n
(2
nk
1) > 2
n
(1
1
2
k
).
Thus C(x) 90 for more than 99.9% of the strings x of length 100.
Lemma 72 (Martin-Lof). Let k N be given. Then any suciently long z has
an initial segment x with C(x) < [x[ k.
Proof. Let f : 2
<N
2
<N
be the recursive function satisfying f() = , where
tr() = [[. Take N such that C < C
f
+ . Let z be a string satisfying
[z[ > 2
k++2
, and let be the initial segment of z with [[ = k + . Let
r = tr(); then 2
||
1 r < 2
||+1
1, hence [[ +r < k++2
k++1
1 [z[.
Take x = z[
||+r
(the initial segment of z of length [[ + r). Then x = ,
with [[ = r, so f() = = x. Hence,
C(x) < C
f
(x) + [[ + = ([[ ( +k)) +[[ +
= [[ +[[ k = [x[ k.
54
Corollary 73. For all suciently long random z, there are x, y such that z =
xy, but C(x) +C(y) < C(z).
Proof. Take k N such that for all , C() [[ +k. Let z be random and so
long that it has an initial segment x with C(x) < [x[ k. Take y with z = xy.
Then C(x) +C(y) < [x[ k +[y[ +k = [x[ +[y[ = [z[ C(z).
Call a string compressible if C() < [[. Then the Martin-Lof lemma says
that any suciently long string has compressible initial segments, and any suf-
ciently long random string can be decomposed into two strings the sum of
whose complexities is strictly less than that of the original string. Thus, the de-
composition itself stores information additional to that contained in the strings
separately.
The logarithms below are with respect to base 2, so log 2
n
= n.
Lemma 74. C(xy) C(x) +C(y) + 2 log C(x) + const.
Proof. Let f : 2
<N
2
<N
be the partial recursive function that takes as inputs
the strings 0
||
1, where [[ = tr(), with output f(0
||
1) := u()u().
Let x,y be given. Take , be of minimum length such that u() = x and
u() = y. Then C(x) = [[ > 0, and C(y) = [[ > 0. Take such that
[[ = tr(). Then 2
||1
2
||
1 [[ = C(x), so log C(x) [[ 1. Then
f(0
||
1) = xy, and
[0
||
1[ = [[ +[[ + 2[[ + 1 C(x) +C(y) + 2(log(C(x)) 1) + 1
= C(x) +C(y) + 2 log(C(x)) 1,
hence
C(xy) C
f
(xy) + const(f) C(x) +C(y) + 2 log C(x) + const.
The next result has a striking consequence for the incompleteness of any given
axiomatic framework for mathematics, as we discuss after the proof.
Proposition 75. The set A = x : C(x)
|x|
2
of half-random strings is
immune; that is, A has no innite recursively enumerable subset. In particular,
A is not recursively enumerable, and thus C : 2
<N
N is not recursive.
Proof. Suppose B is an innite r.e. subset of A. We can nd a recursive function
h : 2
<N
2
<N
such that for all , h() B and [h()[ tr(). Then we have
C(h())
|h()|
2

tr()
2
, and C(h()) C() + const [[ + const. Thus,
tr()
2
[[ + const, a contradiction.
By Lemma 71, almost all strings are half random: the probability that a string
of length n is half random goes to 1 very rapidly as n . As a consequence
of Proposition 75, however, there are only nitely many for which ZFC can
55
prove that is half random, assuming of course that ZFC is consistent. (Here
ZFC is the standard axiomatic set theory in which essentially all of mathematics
can be formally derived, including the entire contents of this course.) The same
remains true for any recursively axiomatized consistent extension of ZFC.
3.2 Prex-Free Sets
We say that and are comparable if is an initial segment of or is an initial
segment of . We call a set A 2
<N
prex-free if any two distinct , A
are incomparable. Finite strings are going to be treated as initial segments of
innite strings of zeros and ones, and in the rest of this chapter we let , be
such innite strings, that is , : N 0, 1; we consider , also as points of
the so-called Cantor space 2
N
. We let [n := ((0), . . . , (n 1)) 2
<N
be the
initial segment of of length n.
We make 2
N
a topological space by giving it the product topology, where
0, 1 is given the discrete topology. So 2
N
has the clopen sets
N

:= : (i) = (i) for all i < [[


as a basis for its topology. Note that N

= 2
N
, and that and are incompa-
rable i N

= .
Let be the probability measure on the -algebra of Borel subsets of 2
N
(the -algebra on 2
N
generated by the N

) given by (N

) = 2
||
.
Lemma 76. Suppose A 2
<N
is prex-free. Then

A
1
2
||
1.
Proof.

A
1
2
||
=

A
(N

) = (

A
N

) (2
N
) = 1.
Theorem 77 (Kraft-Chaitin). Let (d
i
)
iN
be a sequence of natural numbers
such that

i=0
1
2
d
i
1. Then there is an injective sequence (
i
)
iN
such that
[
i
[ = d
i
for all i and
i
: i N is prex-free.
Proof. We can assume that d
0
d
1
d
2
. . . . Then we choose
0
,
1
,
2
, . . .
successively by always choosing the left-most possibility. For example, when
d
0
, d
1
, d
2
, d
3
are 2, 3, 3, 4, this is illustrated by the following picture.

Q
Q
Q
Q
Q

@
@
@

@
@
@

B
B
B

B
B
B

B
B
B

1

2

D
D
D

D
D
D

D
D
D

D
D
D
56
The assumption that

i=0
1
2
d
i
1 guarantees that we can always continue
this process. We make this precise as follows. Take
0
= 0 . . . 0, with [
0
[ =
d
0
. By the induction hypothesis, suppose that at stage n, we have pairwise
incomparable
0
, . . . ,
n
satisfying [
i
[ = d
i
for i = 0, . . . , n and such that all
with tr([d
n
) tr(
n
) belong to N
0
N
n
. Then there is a with
[[ = d
n
and tr() > tr(
n
); otherwise, all would belong to N
0
N
n
,
yielding 1 = (N
0
N
n
) =

n
i=0
1
2
d
i
<

i=0
1
2
d
i
1, a contradiction.
Let satisfy [[ = d
n
and tr() = tr(
n
) + 1. Dene
n+1
:= 0 . . . 0 with
[
n+1
[ = d
n+1
. It is easy to verify that
0
, . . . ,
n+1
are pairwise incomparable,
and all with tr([d
n+1
) tr(
n+1
) belong to N
0
N
n+1
.
This proof contains an inconstructive step, namely the initial rearrangement
of the d
i
in increasing order. It is desirable to have a more constructive proof
which avoids this.
Constructive proof. We make the inductive assumption that at stage n, we have

0
, . . . ,
n
with [
i
[ = d
i
for i = 0, . . . , n, and for 0 i < j n,
i
and
j
are
incomparable and that in addition we have
n
1
, . . . ,
n
p
, p 1, such that
[
n
1
[ < < [
n
p
[, 2
N
= N
0
. . N
n
. N

n
1
. . N

n
p
,
where the square union signs indicate a disjoint union. Here p depends on n.
For n = 0, the inductive assumption is realized as follows: note that d
0
> 0 and
put
0
= 0 . . . 0, with [
0
[ = d
0
. If d
0
= 1, set p = 1, and
0
1
= 1; if d
0
2, set
p = d
0
, and
0
i
= 0 . . . 01, with [
0
i
[ = i.
Given stage n, we construct
n+1
at stage n + 1 as follows. We are given
d
n+1
. If [
n
i
[ = d
n+1
, 1 i p, then we set
n+1
:=
n
i
, so
2
N
= N
0
. . N
n
. N
n+1
. N

n
1
. . N

n
i1
. N

n
i+1
. . N

n
p
.
We put

n+1
j
=
_

n
j
if 1 j i 1

n
j+1
if i + 1 j p.
Now suppose that for all i 1, . . . , p, [
n
i
[ ,= d
n+1
. It is easy to check that
[
n
1
[ < d
n+1
. Take i 1, . . . , p maximal such that [
n
i
[ < d
n+1
. Set k :=
d
n+1
[
n
i
[. Take
1
, . . . ,
k
,
n+1
such that
j
=
n
i
0 . . . 01, with [
j
[ = [
n
i
[ +j
(so [
k
[ = d
n+1
) for 1 j k, and
n+1
=
n
i
0 . . . 0, with [
n+1
[ = d
n+1
. Then
N

n
i
= N
1
. . N

k
. N
n+1
.
Thus replacing
n
i
in the sequence
n
1
, . . . ,
n
p
by
1
, . . . ,
k
yields a sequence

n+1
1
, . . . ,
n+1
p+k1
with the desired properties.
This constructive proof of the Kraft-Chaitin Theorem yields:
Proposition 78. Let i d
i
: N N be recursive such that

i=0
2
di
1.
Then there is a recursive injective map i
i
: N 2
<N
such that [
i
[ = d
i
for all i and
i
: i N is prex-free.
57
Here a function f : N 2
<N
is said to be recursive if tr(f) : N N is recursive.
Exercise. Show that for each Y 2
<N
there is a prex-free X Y such that
_
Y
N

=
_
X
N

.
3.3 Prex-Free Complexity
A partial recursive function f : 2
<N
2
<N
is said to be prex-free if its domain
D(f) 2
<N
is prex-free. In order to construct an eective enumeration of
f : 2
<N
2
<N
[ f is partial recursive and prex-free,
we rst associate to each partial recursive f : N N the partial recursive

f : 2
<N
2
<N
by tr(

f()) f(tr()). Next, recall our enumeration (
e
) of
f : N N[ f is partial recursive. We dened
e,s
: N N for s N by

e,s
(x)
_

e
(x) if z s T
1
(e, x, z)
otherwise
with D(
e,s
) 0, . . . , s,
e
=

e,s
. This yields an enumeration (

e
) of
f : 2
<N
2
<N
[ f is partial recursive
and for each s a function

e,s
: 2
<N
2
<N
with
D(

e,s
) : tr() 0, . . . , s,
such that

e
=

e,s
for each e. Dene
e,s
: 2
<N
2
<N
by recursion on s :

e,0
=

e,0

e,s+1
=
_

e,s+1
if

e,s+1
is prex-free

e,s
otherwise
So
e,0

e,1

e,2
. . . . Put

e
:=
_
s

e,s
: 2
<N
2
<N
.
A bit of thought shows:
(a) each
e
is partial recursive and prex-free;
(b) (
e
) is an enumeration of
f : 2
<N
2
<N
[ f is partial recursive and prex-free;
(c) there is a recursive : N N such that
e
=

(e)
for all e.
58
Dene : 2
<N
2
<N
by
(0
e
1)
e
(),
() if ,= 0
e
1 for all e and .
Note: is partial recursive, prex-free, surjective, and C

() N
>0
for all .
Lemma 79. Let f : 2
<N
2
<N
be prex-free and partial recursive. Then
C

C
f
+ const(f)
Proof. Take e such that f =
e
. Then C

C
f
+ (e + 1).
Denition 80. The prex-free complexity of a string is
K() := C

() N
>0
.
Lemma 81. There are innitely many such that K() > [[ + log [[.
Proof. Suppose K() [[ + log [[ for all but nitely many . Then, with
ranging over the nonempty strings, we have

2
K()

2
(||+log ||)
+ const
=

n=1

||=n
2
(n+log n)
+ const
=

n=1
2
n
2
(n+log n)
+ const
=

n=1
1
n
+ const = .
Since is surjective, we have an injective map

: 2
<N
D() such that
(

) = and K() = [

[. for all . Since is prex-free,


1

D()
2
||

2
|

|
=

2
K()
= ,
a contradiction.
The only fact about log that we used is that

n=1
2
log n
= . The same
proof yields the following generalization:
Lemma 82. If f : N
>0
R
>0
satises

n=1
2
f(n)
= , then there are
innitely many such that K() > [[ +f([[).
Let n

2
<N
be the string such that tr(n

) = n. For example, if has length


1000 2
10
, then [[

is the string whose tree code is 1000, thus [[

has length
about 10. More generally, length([[

) log(length()).
59
Proposition 83. K() < [[ + 2 log[[ + const for nonempty .
Proof. It suces to nd a prex-free partial recursive f : 2
<N
2
<N
and a
c N such that for all nonempty there exists with
f() , [[ < [[ + 2 log[[ +c.
We shall construct such f via the eective version of the Kraft-Chaitin Theorem,
using

k=0
1
10(k+1)
2
1. Let n
k
=
2
k+1
10(k+1)
2
| N. Note that n
k
as
k . Dene d
i
N by
d
i
= 1 for 0 i < n
0
,
d
i
= 2 for n
0
i < n
0
+n
1
,
d
i
= 3 for n
0
+n
1
i < n
0
+n
1
+n
2
,
.
.
.
d
i
= k + 1 for n
0
+n
1
+ +n
k1
i < n
0
+n
1
+ +n
k
.
Then

i=0
2
di
= n
0
2
1
+n
1
2
2
+. . .
=

k=0
n
k
2
(k+1)

k=0
2
k+1
10(k + 1)
2
2
(k+1)
=

k=0
1
10(k + 1)
2
1.
The function i d
i
: N N is recursive, so by the Kraft-Chaitin Theorem we
have an injective recursive map i
i
: N 2
<N
such that [
i
[ = d
i
for all i,
and
i
: i N is prex-free. Now dene f :
i
: i N 2
<N
by f(
n
) = n

.
Note that f : 2
<N
2
<N
is prex-free, partial recursive, and surjective.
To show f has the above property, note rst that there are n
k
strings in

i
: i N of length k + 1. For m > 0 and k = m+ 2 log m+c|, c N,
60
n
k

2
k+1
10(k + 1)
2
1

2
m+2 log m+c
10(m+ 2 log m+c + 1)
2
1

2
m
2
log m
2
2
c
10(m+ 2 log m+c + 1)
2
1

2
m
m
2
2
c
10(m+ 2 log m+c + 1)
2
1
2
m+1
for c = 10.
Therefore, if 0 < [[ m, we obtain
i
such that
[
i
[ m+ 2 log m+ 11, and f(
i
) = .
Theorem 84. K() [[ +K([[

) + const.
Proof. Since is prex-free, each string has at most initial segment D().
So we can dene a prex-free f : 2
<N
2
<N
by
f() ( = and () [[

).
Then f is partial recursive, so K() = C

() C
f
() + const.
We claim that C
f
() [[ + K([[

). To see this, take of minimal length


such that () [[

. Then [[ = K([[

), and f() . Hence,


C
f
() [[ = [[ +[[ = [[ +K([[

).
From this claim, we obtain
K() C
f
() + const [[ +K([[

) + const .
3.4 Information Content Measures
Here and below we let k range over N.
Denition 85. An information content measure (icm) is a partial function
I : 2
<N
N such that
(a)

D(I)
2
I()
1;
(b) the set (, k) : D(I), I() k 2
<N
N is recursively enumerable.
61
The next two results establish a close connection between partial recursive
prex-free functions and icms, almost a one-to-one correspondence.
Lemma 86. Let : 2
<N
2
<N
be prex-free partial recursive. Then the partial
function I

: 2
<N
N with D(I

) = Im(), and I

() = C

() for Im()
is an icm.
Proof.

D(I

)
2
I

()
=

Im()
2
C

()

D()
2
||
1.
Also, D(I

), I

() k
_
[[ k, ()
_
. Therefore, the set
(, k) : D(I

), I

() k 2
<N
N
is recursively enumerable.
For = , this yields I

= K, so K is an icm. Conversely,
Lemma 87. Let I be an icm with innite domain D(I). Then there is a prex-
free partial recursive map : 2
<N
2
<N
such that
(a) D(I) = Im();
(b) I() + 1 = C

() for all D(I).


Proof. Take a recursive map i (
i
, k
i
) : N 2
<N
N with image
(, k) : D(I), I() k.
We construct a set A (, k + 1) : D(I), I() k in stages.
Stage 0: Put (
0
, k
0
+ 1) in A.
Stage s + 1: Compute (
s+1
, k
s+1
), see whether k
s+1
< k
i
for all i s
with
i
=
s+1
, and if so, put (
s+1
, k
s+1
+ 1) in A.
Note: D(I) d(, d) A: the direction is clear, and holds in the
more precise form that if D(I), then mind : (, d) A = I() + 1.
Put A() := d : (, d) A. Then, for D(I),

dA()
2
d
2
(I()+1)
+ 2
(I()+2)
+ 2 2
(I()+1)
= 2
I()
, so

(,d)A
2
d
=

D(I)

dA()
2
d

D(I)
2
I()
1.
By construction, A is r.e. and innite, so there is an injective recursive map
i (

i
, d
i
) : N 2
<N
N
62
with image A. By the last inequality we have

i=0
2
di
1, so the recursive
version of Kraft-Chaitin yields a recursive injective map i
i
: N 2
<N
such
that [
i
[ = d
i
for all i, and
i
: i N is prex-free. Now dene : 2
<N
N to
have domain D() =
i
: i N and (
i
) =

i
for all i. Then is prex-free
partial recursive and Im() = D(I). It remains to check that (b) is satised:
Let D(I) = Im(). Then
C

() = mind
i
: i N, =

i
= mind : (, d) A = I() + 1.
The next lemma follows from K being an icm with D(K) = 2
<N
.
Lemma 88. The set
(m, n, k) :

||=m
2
K()

n
2
k
N
3
is recursively enumerable.
Proof. Just note that

||=m
2
K()

n
2
k
if and only if there is a tuple
(n

)
||=m
of natural numbers such that

||=m
2
n

n
2
k
and K() n

for each with [[ = m.


Lemma 89. There is an enumeration (I
e
)
eN
of the set of icms such that
(, e, k) 2
<N
N N : D(I
e
), I
e
() k
is recursively enumerable.
Proof. Note that we have a recursive bijection
(, n) [ tr(), n[ : 2
<N
N N.
Using this bijection the sets W
e
and their nite approximations W
e,s
yield an
enumeration (V
e
) of the set of recursively enumerable subsets of 2
<N
N and a
family (V
e,s
) of nite subsets of 2
<N
N with the following properties:
(a) V
e,s
(, n) : [ tr(), n[ s;
(b) [V
e,0
[ 1, V
e,s
V
e,s+1
, and

s
V
e,s
= V
e
;
(c) (, n, e, s) 2
<N
N
3
: (, n) V
e,s
is recursive.
63
Dene
e,s
: 2
<N
N by
e,s
() := n
_
(, n) V
e,s
_
, so D(
e,s
) is nite,
D(
e,s
) D(
e,s+1
), and
e,s+1
()
e,s
() for all D(
e,s
). Moreover, the
partial map
(e, s, )
e,s
() : N
2
2
<N
N
is partial recursive and has recursive domain. Next, dene I
e,s
: 2
<N
N by
recursion on s: I
e,0
:=
e,0
, I
e,s+1
=
e,s+1
if
e,s+1
is an icm, and I
e,s+1
= I
e,s
otherwise. Identifying functions with their graphs, it is easy to check that I
e,s
is a nite icm, D(I
e,s
) D(I
e,s+1
), and I
e,s+1
() I
e,s
() for all D(I
e,s
),
and
(e, s, ) I
e,s
() : N
2
2
<N
N
is partial recursive and has recursive domain. In particular, the set
(, n, e, s) 2
<N
N
3
: I
e,s
() n
is recursive. Dene I
e
: 2
<N
N by
D(I
e
) =
_
s
D(I
e,s
), I
e
() = minI
e,s
() : D(I
e,s
).
Given any icm I, take e such that V
e
= (, k) : D(I), I() k, and note
that then I = I
e
. It follows easily that (I
e
) is an enumeration of the set of icms
as required by the lemma.
Fix an enumeration (I
e
) of the set of icms as in the lemma above. This allows
us to dene

K : 2
<N
N by

K() := minI
e
() +e + 1 : I
e
()
Lemma 90.

K is an icm.
Proof. Condition (a) in the denition of icm holds for

K:

K()

e=0

D(Ie)
2
(Ie()+e+1)
=

e=0
2
(e+1)

D(Ie)
2
Ie()

e=0
2
(e+1)
= 1.
Condition (b) is satised by

K, since

K() k e( D(I
e
), I
e
() +e + 1 k).
64
This icm

K is also called the minimal icm. We can use it to prove results about
K because of the following fact.
Corollary 91. [K

K[ const.
Proof. We already know that

K K + const. Since

K is an icm, Lemma 87
gives a prex-free partial recursive : 2
<N
2
<N
such that C

=

K + 1.
Hence, K() C

() + const =

K() + 1 + const.
Theorem 92 (Counting Theorem). We have
(a) [ : [[ = n, K() < n +K(n

) k[ 2
nk+const
;
(b) n +K(n

) + const maxK() : [[ = n n +K(n

) + const.
Proof. Assuming (a) for the moment, we show how (b) follows. Let c N be a
value of const for which (a) holds. Then
[ : [[ = n, K() < n +K(n

) c 1[ 2
n1
< 2
n
.
So we get with [[ = n such that K() n + K(n

) c 1. This gives the


lower bound in (b). The upper bound is given by Theorem 84.
To prove (b), note rst that
1

2
K()
=

n=0

||=n
2
K()
=

||=tr()
2
K()
.
Take I() [1, ) with 2
I()
=

||=tr()
2
K()
, that is,
I() = log
_
_

||=tr()
2
K()
_
_
.
Then

2
I()
1, so I is like an icm, except that I may have values not in
N. So we modify I to

I : 2
<N
N
>0
by

I() := I()|.
Claim.

I is an information content measure.
To prove this claim, note that

I()

2
I()
1, and

I() k I() k
2
I()
2
k

||=tr()
2
K()
2
k
.
65
Using for example lemma 88 it follows that the set
(, k) :

I() k = (, k) :

||=tr()
2
K()
2
k

is recursively enumerable. This nishes the proof of the claim.


This claim and earlier results yield a c N such that K()

I() + c for
all . Then
K(n

)

I(n

) +c
I(n

) +c + 1
= log
_
_

||=n
2
K()
_
_
+c + 1.
Therefore,
2
K(n

)+c+1

||=n
2
K()
.
Let T := : [[ = n, K() < n + K(n

) k, and assume [T[ 2


nk+c+1
.
Then by the above,
2
K(n

)+c+1

||=n
2
K()

F
2
K()
> 2
nk+c+1
2
nK(n

)+k
= 2
K(n

)+c+1
,
a contradiction.
Likewise, we obtain the following.
Proposition 93. [ : [[ = n, K() < n k[ 2
nK(n

)k+const
.
Proof. Take c as in the previous proof. Let T := : [[ = n, K() < n k.
Assume [T[ > 2
nK(n

)k+c+1
. Then
2
K(n

)+c+1

||=n
2
K()

F
2
K()
> 2
nK(n

)k+c+1
2
(nk)
= 2
K(n

)+c+1
,
a contradiction.
66
3.5 Martin-Lof Randomness
A set T N 2
<N
is called a Martin-Lof test if T is recursively enumerable
and for all n,

_
_
_
T(n)
N

_
_
2
n
where T(n) = : (n, ) T.
A set B 2
N
is said to have eective measure zero if there is a Martin-Lof test
T such that B

n
_

T(n)
N

_
. Note that (B) = 0 for such B, and that
every Martin-Lof test T determines a largest subset of 2
N
of eective measure
zero witnessed by T, namely
N
T
:=

n
_
_
_
T(n)
N

_
_
.
We say that passes the Martin-Lof test T if / N
T
. We say that is 1-
random if it passes every Martin-Lof test. We are going to show that there
is Martin-Lof test such that passing it is equivalent to passing all Martin-Lof
tests. Such a Martin-Lof test is said to be universal. Note that if T is a universal
Martin-Lof test, then N
T
is the largest subset of 2
N
of eective measure zero;
in particular, this set is independent of the choice of universal Martin-Lof test.
This is somewhat remarkable, since for, say, Lebesgue measure on R, there is
obviously no largest subset of R of measure zero.
Theorem 94 (Martin-Lof ). There exists a universal Martin-Lof test.
Proof. Let R N N 2
<N
be recursively enumerable such that (R(e))
eN
enumerates
S N 2
<N
: S is recursively enumerable
and such that for all e there exists innitely many e

with R(e) = R(e

). Take
a recursive function f : N N N 2
<N
such that Image(f) = R and dene
R
t
= f(0), f(1), . . . , f(t) R, t N.
Then R
0
R
1
. . . , R =

tN
R
t
and
R
t
(e, n, ) s t [f(s) = (e, n, )] ,
so the set
(t, e, n, ) : R
t
(e, n, ) N N N 2
<N
is recursive.
Dene T N 2
<N
by
T(k, ) n
k+1
t
_
_
R
t
(n, n, ) &
_
_
_
Rt(n,n)
N

_
_
2
n
_
_
.
67
It is is rather clear from the Church-Turing Thesis that T is recursively enu-
merable. Note also that T(0) T(1) T(2) . . . . Put B
n
t
:=

Rt(n,n)
N

,
so B
n
0
B
n
1
. . . . Moreover,

_
_
_
T(k)
N

_
_
=
_
_
_
nk+1
_
(B
n
t
)2
n
B
n
t
_
_

nk+1

_
_
_
(B
n
t
)2
n
B
n
t
_
_

nk+1
2
n
= 2
k
.
Thus T is a Martin-Lof test. To see that T is universal, let S N2
<N
be any
Martin-Lof test and take m such that R(m) = S. Fix any k and take n k +1
such that R(n) = R(m) = S. Then
N
S
=

lN
_
S(l)
N

lN
_
R(n,l)
N


_
R(n,n)
N

.
Now B
n
t

R(n,n)
N

for each t, and R(n) is a Martin-Lof test, so


(B
n
t
)
_
_
_
R(n,n)
N

_
_
2
n
.
In particular, R(n, n) T(k). Hence,

l

S(l)
N



T(k)
N

.
Since k was arbitrary, we obtain
N
S
=

l
_
S(l)
N

k
_
T(k)
N

= N
T
,
so N
T
is a largest set of eective measure zero.
Corollary 95. The set : is 1-random has measure 1. In other words,
almost all are 1-random.
Exercise. Show that no recursive is 1-random.
We say that is LGC-random if there exists c N such that K([n) n c
for all n. Note that [n = (0), (1), . . . , (n 1) is the initial segment of of
length n.
It wouldnt be interesting to replace K by C in this denition, as by Martin-Lofs
compressability lemma, given any and any and c N, there exists innitely
many n such that C([n) < n c.
68
Theorem 96 (Schnorr).
is LGC-random is 1-random.
Proof. (of ) Dene T N 2
<N
by T(k, ) K() [[ k.
Claim. T is a Martin-Lof test.
To prove this claim note rst that T is recursively enumerable. Moreover,

_
_
_
T(k)
N

_
_

K()||k
2
||

2
K()k
= 2
k

2
K()
2
k
.
Thus T is a Martin-Lof test. Now suppose is 1-random. Then passes T, so
we obtain k such that ,

T(k)
N

, that is,
K([n) > [[ k for all n,
so is LGC-random.
For the converse we need:
Lemma 97. Let T N 2
<N
be a ML-test. Then there exists an ML-test

T N 2
<N
such that for all k,
(a)
_
T(k)
N

=
_

T(k)
N

,
(b)

T(k) 2
<N
is prex-free.
Proof. Let f : N N 2
<N
be recursive and such that Im(f) = T. In addi-
tion, we let s, k range over N for the remainder of the proof. Now, we dene,
recursively, a sequence

T
0


T
1


T
3
. . .
of nite subsets of N 2
<N
such that

T
s
(k) is prex-free for all s, k. Take

T
0
= f(0), and assume inductively that

T
0
. . .

T
s
are nite subsets of
N 2
<N
with

T
s
(k) prex-free for all k. Then

T
s+1
is obtained as follows: let
f(s + 1) = (k, ), and let
(k,
1
), . . . , (k,
n
)
69
be the distinct elements of

T
s
whose rst component is k. Note that it is possible
to nd
1
, . . . ,
m
such that
N

(N
1
. . . . . N
n
) = N
1
. . . . . N
m
where the unions are disjoint, and then we take

T
s+1
=

T
s
(k,
1
), . . . , (k,
m
) .
For

T we take the union of this sequence of sets:

T =
_
sN

T
s
.
Then

T is an ML-test satisfying (a) and (b).
Note also the following property of ML-tests; if T is a ML-test and T(n),
then 2
||
2
n
, and hence [[ n. We now continue with the other direction
of Schnorrs theorem.
Proof of in Schnorrs theorem. We prove the contrapositive. Suppose is
not 1-random; take a ML-test T such that fails T. That is,

n
_
T(n)
N

By Lemma 97, we can assume that T(k) is prex-free for all k. Dene
I : 2
<N
N by D(I) := : T(2n) for some n 1 , and
I() := min[[ n : T(2n) for some n 1 for D(I).
Then

D(I)
2
I()

n1

T(2n)
2
(||n)

n1
2
n

T(2n)
2
||

n1
2
n
2
2n
=

n1
2
n
= 1.
Thus one of the two conditions for I to be be an icm is satised; we leave it as
an exercise to check that the other condition is satised as well. So I is an icm.
By earlier results we have, for D(I)
K() I() + const(I) = min([[ n : T(2n), n 1) + const(I).
Now let c N; it remains to show that K([k) < k c for some k. Consider
any n 1. Because

T(2n)
N

, we can nd T(2n) such that is an


initial segment of . Set k = [[, so [k = , hence k = [[ 2n, D(I),
and
K([k) = K() [[ n + const(I) = k n + const(I) < k c
provided n > const(I) +c. Now choose n to satisfy this inequality.
70
3.6 Solovay Randomness
The denition of Solovay randomness proceeds from a corresponding notion of
a Solovay test.
Denition 98. A Solovay test is a recursively enumerable set S 2
<N
such
that

S
2
||
< .
Given a Solovay test S 2
<N
we say that passes S if only nitely many initial
segments of lie in S. In other words, fails S i has innitely many initial
segments in S, i N

for innitely many S. We say that is Solovay


random if passes all Solovay tests.
Theorem 99. is Solovay random is 1-random.
Proof. For the () direction, take a universal ML-test T and dene
S :=
_
n
T(n) 2
<N
, so

S
2
||

T(n)
2
||

n
2
n
2.
Using the equivalence
S n((, n) T)
it is clear that S is recursively enumerable, so S is a Solovay test.
Let be Solovay random. Then passes S, so there are only nitely many
initial segments of in S. Take m such that [n / S for all n > m. So for
n > m we have /

T(n)
N

, because [[ n for all T(n). Thus,


/

n
_
T(n)
N

,
that is, passes T.
As to the direction (), let be 1-random, and let S be a Solovay test. We
are going to show that passes S. Removing nitely many elements from S,
we arrange that

S
2
||
1.
Dene U
k
2
N
by
U
k
:=
_
[ there are at least 2
k
many S with N

_
.
Then clearly passes S if and only if /

k
U
k
. Next, take T N2
<N
such
that (k, ) T if and only if there are at least 2
k
many initial segments of in
71
S. Then U
k
is equivalent to there being at least 2
k
many initial segments
of in S, and thus equivalent to

T(k)
N

. So U
k
=

T(k)
N

. Hence
passes S /

k
_
T(k)
N

.
So, assuming T is a ML-test, we have that passes T, which implies that
passes S, as promised.
To show that T is, indeed, a ML-test, we leave it as an exercise to check that
T is recursively enumerable. It remains to show that (U
k
) 2
k
for every k.
Take nite subsets S
t
of S, with t N, such that
S
0
S
1
S
2
. . . , and S =
_
t
S
t
.
Put
U
t
k
:=
_
[ there are at least 2
k
many initial segments of in S
t
_
,
so
U
0
k
U
1
k
U
2
k
. . . , and U
k
=
_
t
U
t
k
.
It suces to show that for all t, k,
(U
t
k
) 2
k
.
Fix t and let
1
, . . . ,
n
be the distinct elements of S
t
. Then
_

N
1
() + +
Nn
()
_
d()

_
U
t
k
_

N
1
() + +
Nn
()
_
d() 2
k
(U
t
k
)
and also,
_

N
1
() + +
Nn
()
_
d() =
n

i=1
_

N
i
() d()
=
n

i=1
(N
i
) =
n

i=1
2
|i|

S
2
||
1.
Thus, (U
t
k
) 2
k
as required.
As a consequence of the Theorem and the argument for the () direction, the
set S =

n
T(n) with T a universal ML-test is a universal Solovay test in the
sense that passing S is equivalent to passing all Solovay tests.
We use the following notation for the initial segment relation on 2
<N
:
: is an initial segment of
72
Theorem 100 (Miller and Yu).
is 1-random

n
2
nK(|n)
<
Proof. () We prove the contrapositive; assume is not 1-random, so is not
LGC-random, hence K([n) < n for innitely many n, and thus nK([n) > 0
for innitely many n. Therefore,

n
2
nK(|n)
= .
To prove the other () direction, rst note that

||=m

nm
2
nK(|n)
=

||=m

2
||K()
=

||m
2
m||
2
||K()
= 2
m

||m
2
K()
2
m
where we use that K is an icm. Let p N
1
in what follows. Then

_
_
_
: [[ = m,

nm
2
nK(|n)
p
_
_
_

2
m
p
,
so for each m,

_
_
_
_
_
:

nm
2
nK(|n)
p
_
_
_
_
_

1
p
.
We introduce the following subsets of 2
N
:
U
p,m
:=
_
_
_
:

nm
2
nK(|n)
p
_
_
_
,
so
U
p,0
U
p,1
U
p,2
. . .
In addition, dene U
p
:=

mN
U
p,m
; note that (U
p
)
1
p
.
Now, let T N 2
<N
be dened by the equivalence
T(k, ) :

n||
2
nK(|n)
2
k
.
Along the lines of the proof of Lemma 88 we see that T is recursively enumerable,
and so to prove that T is a ML-test we have only to show that for all k

_
_
_
T(k)
N

_
_
2
k
.
73
To see why this holds, note the following equivalences

_
T(k)
N

m([m T(k))
m
_
_

nm
2
nK(|n)
2
k
_
_
U
2
k,
and so

T(k)
N

= U
2
k. Hence

_
_
_
T(k)
N

_
_
= (U
2
k)
1
2
k
,
which proves that T is a ML-test. Assume now that is 1-random. Then we get
k such that / U
2
k, and so / U
2
k
,m
for each m, that is,

nm
2
nK(|n)
< 2
k
for each m, and thus

n
2
nK(|n)
2
k
< .
We proved earlier that there are innitely many such that
K() > [[ + log [[.
The following corollary is much stronger.
Corollary 101. Suppose f : N R satises

n
2
f(n)
= . Given any
1-random , there are innitely many n such that K([n) > n +f(n).
Proof. Let be 1-random. If K([n) n + f(n) for almost all n, then also
n K([n) f(n) for almost all n. So

n
2
nK(|n)

n
2
f(n)
+ const = ,
which is a contradiction.
As an example for the corollary just proved, let f take the value f(n) = log n
for n > 0. Then

n
2
f(n)

n=1
1
n
= ,
so if is 1-random, then there are innitely many n with K([n) > n + log n.
3.7 Martingales
A martingale is a function f : 2
<N
[0, ) such that for all 2
<N
,
f() =
f(0) +f(1)
2
74
Observation 102. If f and g are martingales, then so are f + g and rf for
r [0, ). Note also that if f is a martingale with f() = 0, then f() = 0 for
all .
Observation 103. Let f be a martingale and ; then 2
||
f() 2
||
f(),
that is, f() (1/2
||||
)f(). For = 0 and = 1 the inequality reduces
to f()
1
2
f(), which holds trivially. The general case follows by induction
on [[ [[.
Theorem 104 (First Kolmogorov Inequality). Let f be a martingale, a string,
and let X : be prex-free. Then
2
||
f()

X
2
||
f().
Proof. We can assume that X is nite. The theorem holds for X = and when
[X[ = 1. Let n 1, assume inductively that the inequality holds for all X
of size at most n, and suppose that [X[ = n + 1. Let 2
<N
be the unique
longest common initial segment of the elements of X, so . For i = 0, 1, set
X
i
:= X : i , and note that X
i
has size at most n. So X = X
0
X
1
and by induction we have

X
2
||
f() =

X0
2
||
f() +

X1
2
||
f()
2
|0|
f(0) + 2
|1|
f(1)
= 2
||
f(0) +f(1)
2
= 2
||
f() 2
||
f(),
which concludes the proof.
Recall from the section on prex-free sets that for each Y 2
<N
there is a
prex-free X Y such that
_
Y
N

=
_
X
N

.
Theorem 105 (Second Kolmogorov Inequality). Let f be a martingale, r
(0, ), and put S
r
(f) := : f() r. Then

_
_
_
S
r
(f)
N

_
_

f()
r
.
Proof. Take a prex-free X S
r
(f) such that
_
S
r
(f)
N

=
_
X
N

.
75
Then

_
_
_
S
r
(f)
N

_
_
=
_
_
X
N

_
=

X
2
||
.
Applying the rst Kolmogorov inequality gives
r
_
_
_
S
r
(f)
N

_
_
=

X
2
||
r

X
2
||
f() f().
Denition 106. A martingale f is said to be eective if there is a recursive
F : 2
<N
N Q
0
such that, for each , we have
F(, 0) F(, 1) F(, 2) . . . and F(, n) f() as n .
Here we code a nonnegative rational q as the unique pair (a, b) N
2
such that
a and b are coprime, b ,= 0 and q = a/b.
Denition 107. A martingale f succeeds on if limsup
n
f([n) = ,
that is, f([n) takes arbitrarily large values.
These denitions allow us to characterize 1-randomness as follows.
Theorem 108 (Schnorr).
is 1-random no eective martingale succeeds on .
Proof. We do the forward direction here; the backward direction is proved in a
stronger form in the next proposition.
Let f be an eective martingale given by F. Take q Q
>0
such that the
martingale g = qf satises g() 1. Dene T N 2
<N
by
T(k, ) g() > 2
k
.
It is easy to see that T is recursively enumerable. In addition,

_
_
_
T(k)
N

_
_

_
_
_
S
2
k
(g)
N

_
_

g()
2
k

1
2
k
,
so T is an ML-test. Now we have the following equivalences:
fails T

k
_
T(k)
N

for every k there is n with g([n) > 2


k
limsup
n
g([n) =
limsup
n
f([n) = .
This concludes the proof of . For the converse, see below.
76
Proposition 109. Let T be an ML-test. Then there is an eective martingale
d
T
such that for all , if fails T, then lim
k
d
T
([k) = .
Proof. By Lemma 97 we can assume that T(n) is prex-free for all n. Dene
the martingale d

by
d

() =
_
_
_
1 if
2
||||
if
0 if , are incomparable.
Dene d
T
: 2
<N
[0, ] by
d
T
() =

nT(n)
d

().
Note that
d
T
() =
d
T
(0) +d
T
(1)
2
,
so d
T
is a martingale if d
T
() ,= (in which case all values of d
T
are nite).
We have
d
T
() =

S
n
T(n)
d

()
=

S
n
T(n)
2
||
=

T(n)
2
||

n
2
n
= 2 < ,
so d
T
is a martingale. The map (, ) d

() into Q
0
is recursive and

n
T(n) is recursively enumerable, from which it follows easily that the innite
sum d
T
of the d

is an eective martingale.
Suppose fails T, that is,

n
_
T(n)
N

.
Then for all n there is k n with [k T(n). We claim that, given any m, we
have d
T
([k) m for all suciently large k. To see why this claim is true, let
m be given. Beginnning with n = 0, take k
0
so that [k
0
T(0). Then (using
n = k
0
+ 1) take k
1
> k
0
with [k
1
T(k
0
+ 1). Proceeding in this fashion,
we get an increasing sequence k
0
< k
1
< . . . with [k
i
T(k
i1
+ 1) for each
i. Thus for k k
m
+ 1 each [k
i
with i < m contributes 1 to the sum forming
d
T
([k), so d
T
([k) m for all k k
m
+ 1. This proves the claim.
77
The direction of Schnorrs theorem now follows by considering the contra-
positive.
Corollary 110. There is a universal eective martingale d, that is, d is an
eective martingale such that for all the following are equivalent:
(i) is 1-random,
(ii) limsup
n
d([n) < ,
(iii) liminf
n
d([n) < .
Proof. Let T be a universal ML-test, and let d = d
T
be the corresponding
eective martingale. Then clearly (i) (ii) (iii) by Schnorrs theorem, and
(iii) passes T, by the proposition, giving (i).
78

S-ar putea să vă placă și