0% found this document useful (0 votes)
2 views

computability

These notes provide an introduction to computability theory, focusing on Turing machines as a model of computation. Key concepts include the definition of computable functions, Turing computability, and the Church-Turing thesis, which asserts that a function is computable if it is intuitively computable. The document also discusses the Universal Turing machine, computable approximations, and the computability of sets and relations.

Uploaded by

senguptavivek6
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

computability

These notes provide an introduction to computability theory, focusing on Turing machines as a model of computation. Key concepts include the definition of computable functions, Turing computability, and the Church-Turing thesis, which asserts that a function is computable if it is intuitively computable. The document also discusses the Universal Turing machine, computable approximations, and the computability of sets and relations.

Uploaded by

senguptavivek6
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Computability theory

These notes cover the second part of PMATH 432/632 taught in the Winter
semester of 2020

Dino Rossegger

Compiled: July 27, 2020

1. Introduction to computability theory


Our goal is to develop machinery that captures the intuitive notion of computability of a
function f : N → N. Intuitively a function is said to be computable if there is an algorithm
for it: a fixed finite sequence of atomic instructions so that given a natural number x after
applying the actions defined by my instructions to it, I obtain f (x). The instructions do
not depend on x. Of course to develop a theory of computability we have to formalize
the notion of an algorithm. There are several ways to do this. Historically the three first
were the (primitive) recursive functions (Gödel, Kleene), λ-calculus (Church), and Turing
machines (Turing), which all emerged independently roughly around the same time. We
will focus on Turing’s model of computation, Turing machines, introduced in his paper
“On computable numbers, with an application to the Entscheidungsproblem” in 1937.
Since then several other definitions such as Register machines have emerged, each with its
own advantages and disadvantages. However, one can show that all models of computations
are equivalent in the sense that a function is computable in one model if and only if it is
computable in all of them.
A Turing machine T consists of the following components:

1. A tape, infinite in both directions, whose cells contain either the symbol 1 or the
symbol 0 “blank”

2. a reading head which can move to the right or left on the tape, read the content of
its current cell and replace it by 1 or 0.

At any given time the reading head is in some state q and follows the Turing program P .
The Turing program will be a set of instructions for the reading head, each instruction
being a quadruple:

Q = qi SAqj with S ∈ {0, 1}, A ∈ {0, 1, L, R}

1
The quadruple Q reads as: “If T is in the state qi reading tape symbol S, then perform
action A and pass into the new internal state qj . If T is in the state qi , reading S, then we
say that Q is applicable.

Definition 1.1. A set X of quadruples is consistent if

qi SAqj , qi SA′ qk ∈ X ⇒ A = A′ and qk = qj .

A Turing program is a finite consistent set of quadruples.

Notice how the behaviour of a Turing machine only depends on its program. We often
say ”give a Turing machine for f ” or there is a Turing machine when we mean that there
is a Turing program for a Turing machine.
How can we compute something with a Turing machine, say we want to compute a
function f : Nn → N. We will stick with the following conventions.
To input (n0 , . . . , nn ) we put n0 + 1 consecutives 1 on the otherwise empty tape, then
put a blank, then put n1 + 1 consecutives 1 followed by a blank and so on. We then place
the reading head on the leftmost 1.
If the computation of a Turing machine T halts, output the number φT (n0 , . . . , nn ) of
1’s left on the tape.

Definition 1.2. A Turing machine halts on input n if at some point during its computation
there is no applicable quadruple in its program.

Definition 1.3. A function f : Nn → N is Turing computable if f = φT for some Turing


machine T .

Example 1.1. The successor function n 7→ n + 1 is Turing computable.

Proof. Let T = {}.

Example 1.2. The zero function 0 : n → 0 is Turing computable.

Proof. P consists of the following quadruples:

1. q0 10q1 …delete the one at the current position, then go to q1

2. q1 0Rq0 …move the reading head to the right and get back to q0 to delete more 1’s.

Then φT (n) = 0 for all n ∈ N.

Remark. Notice that the Turing computable functions are not necessarily total, indeed
they might not be defined at some values, as a Turing machine may not halt at some values.

We write φT (n) ↓ to say that the function computed by the Turing machine T is defined
on n. Notice that it is defined only if T halts on input n. Also, given a partial function f
we let dom(f ) be the set of values where f is defined and rg(f ) the range of f .

2
Remark. A function f : Nn → N is partial if it is not defined on some elements of Nn .
Otherwise it is total.
Thesis 1 (Turing’s thesis). A function f is Turing computable if and only if it is intuitively
computable.
Church gave a similar thesis but for partial recursive functions. One can show that the
partial recursive functions are exactly the Turing computable functions. Therefore this
thesis is often also called the Church-Turing thesis.
Supported by this thesis, we can show that something is computable by arguing infor-
mally that an algorithm in whatever system exists and do not rely on the heavy formalism
involved in Turing machines. We therefore refer to the Turing computable functions as
computable functions. We will state in case that a function is total.
Remark. Computable functions are often called recursive functions or partial recursive
functions. This has roots in the fact that they are precisely those functions which are
partial recursive. However, by the Church-Turing thesis, the name computable functions
is warranted, as the “Turing computable” or “partial recursive” functions are precisely the
computable functions.

2. Universal Turing machine


Using a Gödel numbering we can obtain a computable list of all Turing machines. We
define the function gn, first on tape symbols, action symbols and state symbols. Let
gn(L) = 2, gn(R) = 3, gn(0) = 5, gn(1) = 7, qn(qi ) = p4+i where pi is the ith prime
number. For a quadruple Q = qi SAqj let

gn(Q) = 2gn(qi ) 3gn(S) 5gn(A) 7gn(qj )

and if P = {Q0 , Q1 , . . . , Qk } is a Turing program, let


gn(Qk )
gn(P ) = 2gn(Q0 ) . . . pk+1 .

By unique prime factorization gn has a computable inverse. Note that not for every natural
number, this inverse is indeed a Turing machine.
Definition 2.1. 1. The eth Turing machine Pe is defined by
{
P if gn−1 (e) ↓= some Truing program P
Pe =
∅ otherwise.

We say that Pe has index e.


(k)
2. Likewise we let φe be the partial computable function in k arguments computed by
Pe . If the arity is clear form context we drop the superscript.

3
Theorem 2.1 (Enumeration Theorem). There is a partial computable function φ such
that for each e and x φ(e, x) = φe (x).

Proof. We need to describe a Turing machine T computing φ. The computation works as


follows:

1. Compute Pe .

2. Put x on the tape and run the computation Pe .

3. If Pe halts, halt as well.

Theorem 2.2 (s-m-n Theorem). If f (x, y) is partial computable, then there exists a total
computable function g such that f (x, y) = φg(x) (y).

Proof. If f (x, y) is partial computable, then there is a Turing machine Pe such that
(2)
f (x, y) = φe (x, y). Fix x, and let g(x) be Gödel number of the program doing the
following:

1. Put x + 1 consecutive 1’s to the left of the last blank before a 1 on the tape.

2. Position the cursor on the left most 1.

3. Run Pe .

Clearly Pg(x) with one argument behaves like Pe with 2 arguments where the first argument
is x.

The s-m-n theorem can be stated in a more general context.

Exercise 2.1. Let m, n ≥ 1. Show that there exists a total computable function Snm such
that for all x, y1 , . . . ym , z1 , . . . , zn
(n)
φS m (x,y1 ,...,ym ) (z1 , . . . , zn ) = φ(n+m)
x (y1 , . . . , ym , z1 , . . . , zm ).
n

The main intellectual contribution of Turing’s paper was not the invention of the Turing
machine but rather that he showed that there is a universal Turing machine that can
perform any computational task.

Theorem 2.3 (Turing). There exists a Turing machine U – the Universal Turing machine
– which if given input (e, x) simulates the eth Turing machine with input x. That is
(2)
φU (e, x) = φe (x).

Proof. The Turing machine computing the function φ from Theorem 2.1 is such a Turing
machine.

4
Theorem 2.4 (Kleene’s fixed point theorem, also recursion theorem). If f is a total
computable function, then there exists a k ∈ N for which

φf (k) = φk .

k is called a fixed point of f .

Proof. Define the function d by


{
φφu (u) (z) φu (u) ↓
φd(u) (z) =
↑ otherwise.

Note that d can be taken total and computable by the s-m-n theorem. As f is computable
we have that f ◦ d has an index v such that φv = f ◦ d. As both f and d are total so is
f ◦ d and thus φv (v) ↓ and thus φd(v) = φφv (v) . Now

φd(v) = φφv (v) = φf (d(v))

and thus d(v) is a fixed point of f .

Corollary 2.5. There exists e ∈ N such that rg(φe ) = e.

Proof. Consider the function f (x, y) = x. It is a computable function so it has an index i.


By the s − m − n theorem there is a total computable function g such that φg(x) (y) = x.
Now, by the recursion theorem this function has a fixed point v, i.e., φg(v) = φv and by
definition rg(φg(v) ) = rg(φv ) = v.

2.1. Computable approximations


We will shortly see that there is no algorithm that tests whether φe (x) ↓ or φe (x) = y.

Definition 2.2. We write

1. φe,s (x) = y iff x, y, e < s, φe (x) = y and the computation of Pe on input x halts in s
steps,

2. φe,s (x) ↓ if φe,s (x) = y for some y and otherwise we write φe,s (x) ↑.

Theorem 2.6. All the relations in Definition 2.2 are computable (Computability of rela-
tions is defined in 2.2).

Theorem 2.7 (Unbounded search theorem). If θ(x, y) is a partial computable function,


and
ψ(x) = µy[θ(x, y) ↓= 1 & ∀z < yθ(x, z) ↓̸= 1],
then ψ(x) = y is partial computable.

5
Proof. Fix x. Now, as θ is computable, there is an e such that θ = φe . Now for some fixed
s compute φe,s (x, y) for all y < s. If you find y such that φe,s (x, y) = 1 and φe,s (x, z) ↓̸= 1
for all z ≤ y, then halt and set ψ(x) = y, otherwise repeat this procedure with s + 1 instead
of s.
By the Church-Turing thesis it is computable and ψ(x) = y if y is the least satisfying

θ(x, y) ↓= 1 & ∀z < yθ(x, z) ↓̸= 1.

Thus ψ is as required.

In computability theory µy is used to denote the “least y such that”. This is inspired
by the recursive functions as they have the minimization operator µ as one of their basic
components.

2.2. Computability of sets


Definition 2.3. A set S is computable if its characteristic function
{
1 x∈S
χS (x) =
0 x ̸∈ S

is computable.

We could give analogous definitions for relations R ⊆ Nn . However, there is no need for
this since we have a computable bijection N → N → N. One well known example is the
Cantor pairing function defined by
1
⟨k1 , k2 ⟩ = (k1 + k2 )(k1 + k2 + 1) + k2 .
2
We can inductively generalize this definition to obtain pairing functions for arbitratry n,
e.g. for N3 → N we let ⟨x, y, z⟩ = ⟨⟨x, y⟩, z⟩. We thus can make the following definition.

Definition 2.4. A relation R ⊆ Nn is computable if {⟨x1 , . . . , xn ⟩ : (x1 , . . . , xn ) ∈ Nn }.

Proposition 2.8. If X is a computable set, then so is X̄ = N − X.

Note that there are only countably many algorithms but uncountably many subsets of
the natural numbers. Therefore there must be non-computable sets.

Exercise 2.2. Show that if X is a computable set and Y is defined by x ∈ Y ⇔ ∃y <


x⟨x, y⟩ ∈ X, then Y is computable.

Exercise 2.3. Show that any finite or cofinite set is computable.

6
3. C.e. sets
Definition 3.1. A set S is computably enumerable, short c.e., if it is empty or the range
of a partial computable function.

Theorem 3.1. A set S is c.e. iff it is empty or the range of a total computable function.

Proof. The direction from right to left is immediate from the definition. Now, assume S is
c.e. and non-empty, then it is the range of a partial computable function, say f given by
index e. Let y ∈ S and define a new function g by
{
φe (x) φe,s (x) ↓
g(⟨x, s⟩) =
y otherwise.

By the Church-Turing thesis g is computable and by definition it is total. Clearly the range
of g is S.

Proposition 3.2. An infinite set S is computable iff it is the range of a strictly monotonic
computable function.

Proof. (⇒). Say S is computable and define a function f by f (0) = µy[y ∈ S] and
f (x) = µy[y ∈ S&y > f (x − 1)].
(⇐). Say S is the range of an increasing computable function f . Then x ∈ S iff
∃y ≤ x(f (y) = x).

Theorem 3.3. A is computable iff A and Ā = N − A are c.e.

Proof. Say A is computable, then so are the functions


{ {
x x∈A x x ̸∈ A
f (x) = and g(x) =
↑ otherwise ↑ otherwise.
Clearly rg(f ) = A and rg(g) = Ā. Thus both A and Ā are c.e.. On the other hand say A
and Ā are both c.e.. To check whether x ∈ A start enumerating A and Ā in parallel. At
some point x must be enumerated into A or into Ā. Then output 1 if x gets enumerated
into A and 0 if x gets enumerated into Ā.

Definition 3.2. Let We = dom(φe ). We call We the halting set for φe . Similarly to
computable functions we define the set We,s for all s as

We,s = {x : φe,s (x) ↓}.

It is easy to check that We,s is a computable set.

Theorem 3.4 (The normal form theorem). Let A be a set. TFAE

7
1. A is c.e.,
2. the semicharacteristic function of A,
{
1 x∈A
SA (x) =
↑ x ̸∈ A
is computable,
3. A is Σ01 , i.e., there is a computable relation R such that x ∈ A iff ∃yR(x, y),
4. A = We for some e ∈ N.
Proof. (1) ⇒ (3). If A = ∅ then x ∈ A ⇔ ∃sx = x + 1. Otherwise A = range(f ) where
f is computable. Then x ∈ A ⇔ ∃sf (s) = x. (3) ⇒ (2). Say x ∈ A ⇔ ∃sR(x, s). Then
SA (x) = 1 ⇔ ∃sR(x, s) which is clearly partial computable. (2) ⇒ (4). Assume SA is
computable, then SA = φe for some e and by definition We = A. (4) ⇒ (1). Assume
A = We ̸= ∅ and let p ∈ A. Define
{
x φe,s (x) ↓
f (⟨x, s⟩) =
p otherwise

Both f and ⟨•⟩ are computable and we have that


x ∈ A ⇔ φe (x) ↓⇔ ∃sφe,s (x) ↓⇔ f (x, s) = x for some s
and thus A = range(f ).

Exercise 3.1. Let A ⊆ N and f be a total computable function. Show that if


x ∈ A ⇔ ∃y < f (x)⟨x, y⟩ ∈ S
for S a computable set, then A is computable.
Definition 3.3. The Kleene set K is defined as follows.
K = {x : φx (x) ↓}
Theorem 3.5. There exists a c.e. non-computable set.
Proof. The set K is clearly c.e. as
x ∈ K ⇔ x ∈ Wx ⇔ ∃sx ∈ Wx,s
and Wx,s is a computable relation.
Assume K was computable, then K̄ is c.e., i.e. K̄ = We for some e. Then
x ∈ We ⇔ x ∈ K̄ ⇔ x ̸∈ K ⇔ x ̸∈ Wx .
Let x = e to derive a contradiction.

8
4. Many one reducibility and the Entscheidungsproblem
Definition 4.1. We say that A is many-one or m-reducible to B, A ≤m B if there is a
total computable function f such that for all x
x ∈ A ⇔ f (x) ∈ B.
We write A ≡m B if A ≤m B and B ≤m A. We call
degm (A) = {B : B ≡m A},
the m-degree of A.
Exercise 4.1. Show that if X is c.e. and Y ≤m X, then Y is c.e.
Exercise 4.2. Show that if X is c.e. and non-computable and X ≤m Y , then Y is
non-computable.
Proposition 4.1. Let X be any c.e. set, then X ≤m K.
Proof. If X is c.e., then SX = φe for some e. Define a new function f as
f (x, y) = φe (x)
Now clearly, f (x, y) is computable, i.e., f = φi for some i. Then, by the s-m-n theorem
there is a computable function g such that
φi (x, y) = φg(x) (y).
Then
x ∈ X ⇔ φe (x) ↓⇔ φg(x) (g(x)) ↓⇔ g(x) ∈ K.

Proposition 4.2. Let K∅ = {x : φx (0) ↓}. Then K∅ ≡m K.


Proof. To show that K∅ ≤m K it is sufficient to show that it is c.e. K∅ is Σ01 as x ∈ K∅ ⇔
∃sφx,s (0) ↓ and thus it is c.e. Define a function f by f (x, 0) = φx (x) and f (x, y) = 0
otherwise. f is clearly partial computable and thus there is e such that f = φe . By the
s-m-n theorem we have that there is computable g such that
φe (x, y) = φg(x) (y).
Then
x ∈ K ⇔ φx (x) ↓⇔ φg(x) (0) ↓⇔ g(x) ∈ K∅

Definition 4.2. Let Γ ⊆ P(N). Then a set X ∈ Γ is Γ (m-)complete if for every Y ∈ Γ


Y ≤m X.
Proposition 4.3. K is Σ01 complete.
Proof. K is c.e. and thus also Σ01 . By Proposition 4.1 K is Σ01 complete.

9
4.1. The Entscheidungsproblem
The Entscheidungsproblem (Entscheidung german for decision) was a problem of Hilbert’s
posed in 1928 that asked whether there is an algorithm that determines whether |= φ for
any first order formula φ. The Entscheidungsproblem was solved in the negative first by
Church and one year later independently by Turing.
Recall that S ∞ is the symbol set having infinitely many constants and infinitely many
relation and function symbols for any arity. Fix a Gödel-numbering of all S ∞ formulas
and let ψi be the ith formula in this numbering. We show the following.
Theorem 4.4. K ≤m {i :|= ψi }.
As K̄ is not computable we immediately obtain:
Corollary 4.5. There is no algorithm deciding whether a given first order formula is true.
To prove Theorem 4.4 we need to give a computable function f such that Pe does not
halt on input e iff f (e) is unsatisfiable. We obtain fe by coding Turing machines into
sentences. We now work towards describing the sentence f (e) given e.
First notice that at every given time the state of a Turing machine is described by (a)
the position of its head, (b) the content of the tape, (c) the state it is in. We thus will
define a two dimensional grid infinite to the left and the right so that the y-axis corresponds
to the states of a Turing machine during its computation and the x-axis corresponds to
the tape. We will have a constant 0 which is the position of our head at the start of the
program, and will split the grid into a right and left part. To obtain the grid we need the
relation symbol B/1 with the idea that B/1 holds of the bottom row, the constant symbol
0, and the function symbols l/1, r/1, u/1 allowing us to traverse the grid left, right and
up respectively. We also need relation symbols L/1, R/1, O/1 saying that an element is in
the left or right part of the grid or on the origin (the column of 0).
One possible axiomatization of the grid is as follows:
B0 (1)
∀x(Bx ↔ ∃y(By ∧ ly ≡ x)) (2)
∀x(Bx ↔ ∃y(By ∧ ry ≡ x)) (3)
∀x ¬Bux (4)
∀x(urx ≡ rux ∧ lux ≡ ulx ∧ lrx ≡ x ∧ rlx ≡ x) (5)
∀x(¬lx ≡ x ∧ ¬rx ≡ x ∧ ¬ux ≡ x) (6)
∀x∀y (nx ≡ ny → x ≡ y) (7)
∀x(Rx ∨ Lx ∨ Ox) ∧ ¬(Rx ∧ Lx) ∧ ¬(Lx ∧ Ox) ∧ ¬(Rx ∧ Ox) (8)
O0 (9)
∀x(¬Lx ∨ ¬Rx) (10)
∀x((x ≡ l0 → Lx) ∧ (x ≡ r0 → Rx)) (11)
∀x((Lx → Llx) ∧ (Rx → Rrx)) (12)

10
Now, fix Pe and assume that Pe has states q0 , . . . qk . We will work with the relation
symbols S0 /1, S1 /1 for the tape symbols, Q0 /1, . . . , Qk /1 for the states, and H/1 for the
head. The following sentences axiomatize the Turing machine. We write ri x for the term
. . r} x.
r| .{z
i times

∀x((S0 x ∨ S1 x) ∧ ¬(S0 x ∧ S1 x)) (13)


∧ ∧
∀xBx → (x = 0 ↔ Hx) ∧ Q0 0 ∧ ¬Qk 0 ∧ ( x = ri 0 ↔ S1 x) (14)
0<i≤k i≤e

∀x¬Hx → (S1 ux ↔ S1 x) (15)



∀x(Hx ↔ Qi x) (16)
i≤k

Now let qi SAqj ∈ Pe . Assume for demonstration purposes that S = 1 and A = L, then we
add the sentence
∀x((Hx ∧ S1 x ∧ Qi x) → (Hulx ∧ Qj ulx)). (17)
We add similar rules for other types of quadruples.
We still need to add statements saying that if in some row we see a given state, then
this states needs to be specified by the program. We add for all 0 < i ≤ k and all j ∈ 0, 1
the following sentence:
 

∀x (Hx ∧ Qi x ∧ Sj x) → x = 0
   
∨ ∨
∨ ∃y uly = x ∧ (Hy ∧ Sm y ∧ Ql y) ∨ uy = x ∧ (Hy ∧ Sm y ∧ Ql y)
ql Sm Lqi ∈Pe ql Sm jqi ∈Pe
 

∨ ury = x ∧ (Hy ∧ Sm y ∧ Ql y)
ql Sm Rqi ∈Pe
(18)

At last we need to add a sentence that says that Pe halts. Recall that Pe halts on input e
if at any point during its computation it is in a state such that no rule is applicable. Now,
looking at Pe we can extract the “states” at which no rules are applicable,i.e., pairs q_iS
where S ∈ {0, 1}. Let H be the set of such states, we want to find a sentence stating that
Pe (e) does not halt. If H = ∅ let ψH = ∀x x ≡ x, otherwise

ψH = ∀x(Hx → ¬(Qi x ∧ Sj x)). (19)
qi j∈H

11
Lemma 4.6. Sat(1) − (19) iff Pe (e) does not halt.

Proof sketch. (⇐). Say Pe (e) does not halt. We can build a model A of the sentences (1)
to (19) as follows. The universe of A is N and we view N under the pairing function ⟨x, y⟩.
Now we define the relations for ⟨x, −⟩ canonically by looking at Pe (e) after x steps of its
computation.
(⇒). If Sat(1) − (19) then it will have many models. First of all using compactness one
can show that it has countable non-standard models and using Löwenheim-Skolem it will
have models in any cardinality. However axiom (1) − (12) implies that it has a standard
part which behaves like an upper half plane. Given a countable model A we can argue
that it models the computation of Pe (e) as follows:
At stage 0, Pe (e) is in state q0 with the head on the first of e consecutive 1’s and all
other cells of the tape are blank. As A |= (14) the first line of the upper half plane in A
models this behaviour.
By A |= (13), (15) − (18) we have that every row of A models a computational state of
the Turing machine and by A |= (17) and by induction A models the computation of Pe
in its standard rows. Now, as A |= (19) there is no row modeling a halting state (a state
in which no rule is applicable). So in particular, Pe (e) can never reach a halting state, as
there is no halting state modelled in the standard rows.

Exercise 4.3. Use induction to give a full formal proof of Lemma 4.6.

Proof. Proof of Theorem 4.4. We have by Lemma 4.6 that Pe (e) does not halt iff Sat(1) −
(19). In particular
e ∈ K̄ ⇔ Sat(1) − (19).
Let θe be the negation of the conjunction of sentences in (1) to (19). As the Turing program
Pe is finite, this is a first order sentence and as |= θe iff U nsat¬θe we have e ∈ K ⇔|= θe .
Fix a Gödel numbering gn of all S ∞ formulas and let f : e → gn(θe ) (Similar to the case
for Turing machines we can take gn to be a bijection by saying that if a number is not a
Gödel number of a first order formula, then let gn(x) be the code of ∀xx ≡ x). Looking
at the sentences (1)-(19) one sees that in order to compute f it is sufficient to look at
the Turing program coded by e to obtain θe and then take gn(θe ) to obtain f . Thus, by
the Church Turing thesis f is computable. Let V be the set of valid S ∞ sentences, i.e.,
V = {x :|= gn−1 (x)}. Therefore e ∈ K ⇔ f (e) ∈ V , and hence K ≤m V . By Exercise 4.2
V can not be computable and thus there can not be an algorithm deciding whether a first
order formula is valid nor not.

Note that while the Entscheidungsproblem was stated for arbitrary formulas, our proof
can be easily adapted to show something slightly stronger, namely that there is no algorithm
deciding first order sentences.
One can show that if the axioms of a proof system are computable, then the set of
statements provable from it is c.e. We will only describe this informally here but will go
into more detail in the next section. Recall the definition of our proof calculus, it was an

12
inductive definition, having as its elements sequents and allowing us to derive new sequents
from already derived sequents by the application of finitely many rules. So, if the set of
codes for starting sequents (axioms) is computable, to check whether x ∈ V we have to
ask, does there exist a finite sequence of sequents, one derived from the ones before by
application of rules such that the last sequent ends with φx . Alone from reading this
description we may see that this is Σ01 description for the set of valid sentences in a given
system. We thus obtain as a corollary.

Corollary 4.7. The set of true S∞ formulas is Σ01 complete.

Exercise 4.4. Formalize the above considerations.

We will take a quick detour to give another example of Σ01 complete set.

4.2. Hilbert’s Tenth problem


So far we have seen incomputable sets which arise out of our definitions or out of logic. A
computer scientist or logician might consider these sets natural, but for a common mathe-
matician they must seem quite unnatural and uninteresting. This might lead the working
mathematician to the conclusion that logic and computability are not of importance to
his work. We now turn to an example of a set which is not computable and which most
mathematician would encounter naturally.
The problem we are interested is related to polynomial equations: Let f be a polynomial
equation in one or more variables with integer coefficients (such an equation is usually called
Diophantine, does f have an integer solution?
When Hilbert posed his famous 23 problems at the International Congress of Mathe-
maticians, the following was number 10 on his list:

Question 4.1 (Hilbert’s tenth problem). Find an algorithm that decides whether a given
Diophantine equation has an integer solutions.

It took 70 years and over 30 years of continuous work by several mathematicians to solve
this question in the negative: It is impossible to find such an algorithm.

Theorem 4.8 (Matiyasevitch, Davis ,Putnam, Robinson). There is no algorithm deciding


whether a given Diophantine equation has an integer solution.

Let us state this more formally. Fix a Gödel numbering for Diophantine equations. Then
the set
D = {gn(p) : ∃y1 , . . . , yn p(y1 , . . . , yn ) = 0}
is not computable. Note that this set is naturally c.e., we can evaluate a polynomial at given
values, so we can search for solutions. However one can show that this set Σ01 -complete.
The idea of the proof is the following. We say that a set A is Diophantine if A = {x :
∃y1 , . . . yn pA (x, y1 , . . . , yn ) = 0} where pA is some polynomial with integer coefficients. The

13
idea for a proof of Theorem 4.8 is due to Davis: “Show that any c.e. set is diophantine.”
Why would this give a proof? Consider the set K. If K was Diophantine there would be
a polynomial pK such that

K = {x : ∃y1 , . . . , yn pK (x, y1 , . . . , yn ) = 0}.

Now, consider the function f : n → gn(pK nx = 0). It is a computable function such that
x ∈ K iff f (x) ∈ D, so K ≤m D. Julia Robinson verified for large classes of c.e. sets
that they were indeed Diophantine and in 1960 Putnam and Robinson were able to show
that every c.e. set is Diophantine iff there is one exponentially increasing set (i.e., if we
enumerate it in order, then the sequence is exponential) that is Diophantine. In 1970 the
until then unknown Russian mathematician Yuri Matiyasevitch showed that the Fibonacci
sequence is Diophantine, thus solving Hilbert’s tenth problem in the negative.

5. Gödel’s incompleteness theorems


Remark. On the way to prove the incompleteness theorems we have to prove a couple of
technical lemmas. We will not give the proofs of these theorems in full detail and instead
only provide sketches. We hope that the details provided are sufficient for the interested
reader to fill them out on his own.

5.1. Peano arithmetic


The Peano axioms were formulated by Guiseppe Peano at the end of the 19th century
to formalize arithmetic. They are widely considered to capture arithmetic on the natural
numbers and thus to be a natural axiomatization for the structure N in Sar . The axioms
are:
∀x¬x + 1 ≡ 0 ∀x∀y(x + 1 ≡ y + 1 → x ≡ y)
∀xx + 0 ≡ x ∀x∀yx + (y + 1) ≡ (x + y) + 1
∀xx · 0 ≡ 0 ∀x∀yx · (y + 1) ≡ x · y + x
And the first order induction axiom for every formula φ ∈ LSar and all x1 , . . . , xn , y such
that f ree(φ) ⊆ {x1 , . . . , xn , y}:
( )
0 y+1
∀x1 , . . . xn (φ ∧ ∀y(φ → φ )) → ∀yφ .
y y

We write ΦP A or just P A for the set of axioms, and also call sets of sentences theories. (We
deviate here from Ebbinghaus et al. who assume a theory to be closed under consequence
and consistent.)
As usual let m stand for 1 + · · · + 1 and x̄ for a tuple (x1 , . . . , xn ) for some n.
| {z }
m times

14
Remark. We will use the notation as suggested in Ebbinghaus p37 to deal with free
variables. In particular we will write φ(x, y, z) for a formula φ with free variables x, y, z
and φ(a, b, c) for the formula
abc
φ
xyz
Definition 5.1. A relation R ⊆ Nk is representable in a set of Sar sentences Φ if there is
φ such that

m̄ ∈ R ⇒ Φ ⊢ φ(m̄), and
m̄ ̸∈ R ⇒ Φ ⊢ ¬φ(m̄).

A function f : Nk → N is representable in Φ if the graph of f Graphf = {⟨x̄, y⟩ : f (x̄) = y}


is representable.

Which functions are representable in T h(N) or P A? We will argue that all computable
functions are representable in the standard model of arithmetic, i.e., in T h(N). With some
extra work the avid student could prove that they are indeed representable in P A. We
will state the theorem for this as we will need them for our proof of the incompleteness
theorem but wont give proofs. We refer the reader to [Men09] for details.
When one tries to represent functions in N, one quickly runs into obstacles. For instance
consider exponentiation: xy . Then we would usually define exponentiation inductively by

x0 = 1 xy+1 = xy · x.

So in order to say that xy = z we would have to formulate that there is a sequence of


numbers of length y starting at 1, progressing as in the definition of exponentiation and
ending at z. But in T h(N) or P A we can only talk about numbers and not about sequences
of numbers. So how do we represent sequences?
Gödel solved this problem in order to prove the incompleteness theorem by using the
Chinese remainder theorem, using it to define his β function which codes sequences of
natural numbers.

Lemma 5.1. Let β(x, y, z) = rm(x/(1 + (z + 1) · y)) (rm is the remainder function). Then
β is computable and representable in the standard model of arithmetic (in PA).

Remark. We give definitions using <. By the assignment it is clear that < is definable in
Sar .

Proof. By the Church Turing thesis division with remainder is computable, so β is com-
putable. To see that it is representable in the standard model consider the formula

φβ (x, y, z, u) = ∃w (x ≡ (1 + (z + 1) · y) · w + u ∧ u < (1 + (z + 1)) · y)

We can argue semantically that this indeed represents β in N.

15
Notice that while the definition of φβ as given is Σ1 , the existential quantifier is bounded.
Indeed it is sufficient to look at w which are smaller than x to see whether φβ holds of
given x, y, z, u. This is important because by Exercise 3.1 we obtain that evaluating φβ in
the standard model is computable.
Lemma 5.2 (β-function lemma). For any sequence of natural numbers n0 , . . . nk , there
are natural numbers b and c such that β(b, c, i) = ni for all i ≤ k.
Proof. Let m = max(k, n0 , . . . , nk ) and c = m!. Let ui = 1 + (i + 1) · c. We claim that the
ui are pairwise coprime. Say p|1 + (i + 1)c and p|1 + (j + 1)c with i < j ≤ n, then p|(j − i)c.
Now if p were to divide c, then p would divide (i + 1)c and 1 + (i + 1)c. Also, we have that
p ∤ j − i because (j − i)|c = m!. Therefore, ui and uj are coprime. Furthermore notice that
ni < c < ui for all i. Thus by the chinese remainder theorem there is b < u0 · . . . · uk such
that rm(ui , b) = ki for i ≤ k and β(b, c, i) = rm(1 + (i + 1)c, b) = rm(ui , b) = ki .

Notice that the proof shows that there are computable functions which given n0 , . . . , nk
output b and c, respectively. Using the representability of the β function we can represent
exponentiation as follows.
exp(x, y, z) ⇔ ∃u∃v (φβ (u, v, 0, 1) ∧ φβ (u, v, y, z) ∧
∀w (w < y → ∃v1 (∃v2 (φβ (u, v, w, v1 ) ∧ φβ (u, v, w + 1, v2 ) ∧ v2 ≡ v1 · x)))) .
Having seen that exponentiation is representable in the standard model we can without
much more work represent Gödel numberings and their inverses. This allows us to represent
Turing machines and thus all computable functions.
Lemma 5.3. All computable functions are representable in arithmetic (in PA).
We will not give a full proof of this theorem but instead just sketch the idea on how
one could interpret Turing computations. Usually this theorem is proved by using par-
tial recursive functions as the model of computation (see [Men09]) or register machines
(see [EFT13]).

Proof idea. The idea of the proof is quite similar to the proof of the Entscheidungsproblem,
Theorem 4.4. Recall that the computation of a Turing machine at a given time is specified
by its Turing program, the contents of its tape, the state it is in and the position of its
reading head.
All of these except the tape are finite objects so if we managed to code the tape in a
finite object we could represent them as a sequence of natural numbers using a suitable
Gödel numbering.
However, notice that we can in fact do that. Consider the program Pe running on input
x at the start of its computation. It has x + 1 1′ s on the tape, with the head on the first 1
and otherwise 0’s. We can now represent the tape by a sequence of 3 binary strings, l = 0,
. . 1} 0. So we could specify this state by the tuple (q, l, h, r) where q is the
h = 1, r = 1| .{z
xtimes
Gödel number of the state q0 .

16
Now, given φe we can define a relation θe informally by saying
there is a sequence of states which adheres to the Turing
program Pe , the first being a starting state for input x,
θe (x, y) ⇔ (20)
the last being a halting state and there are y 1’s in l, h, r
at this state
This definition needs to be carefully translated into the language of arithmetic. We will
not do this here, hoping that the reader can see that this could be done with enough time
and dedication.

From our considerations for Lemma 5.3 we can conclude that given Pe we can obtain
a formula θe such that T h(N) ⊢ θe iff Pe (e) halts. Thus getting an m-reduction K ≤m
{i : T h(N) ⊢ φi } where we take φi to be the ith formula in a Gödel numbering of all Sar
formulas.

Corollary 5.4. The standard model of arithmetic is undecidable. P A is undecidable.

5.2. Gödel’s first incompleteness theorem


Recall the set of symbols occuring in formulas in arithmetic:

0, 1, ·, +, ≡, v0 , . . . , (, ), ¬, ∨, ∧, ∃, ∀

We fix a Gödel numbering in similar fashion as the one for Turing machines:

1. gn(0) = 2, gn(1) = 3, gn(+) = 5, gn(·) = 7, . . . , gn(∀) = p11 , and gn(vi ) = pi+12 ,

2. for φ a formula with si being the ith symbol of the formula, gn(φ) = 2gn(s0 ) ·3gn(s1 ) . . .·
gn(s )
pn n where sn is the last symbol of the formula,
gn(φn )
3. for φ0 φ1 . . . φn a sequent gn(φ0 . . . φn ) = 2gn(φ0 ) . . . pn ,
gn(Sn )
4. and for a sequence of sequents S0 . . . Sn , gn(S0 . . . Sn ) = 2gn(S0 ) · . . . pn .

By unique prime factorization given a number n we can compute its prime factorization and
thus obtain a computable inverse gn−1 for gn. Clearly, from the Church-Turing thesis we
can computably tell whether n is the Gödel number of a formula. We can also computably
check whether n is the Gödel number of a formula of the form of the axioms of PA and we
can computably tell whether n is the Gödel number of a correct sequent. By Lemma 5.3
we get the following representations of the relations described in PA above:

1. P A ⊢ F orm(m) iff gn−1 (m) is an S ar formula,

2. P A ⊢ AxP A (m) iff gn−1 (m) is an axiom of P A,

3. P A ⊢ SeqP A (m) iff gn−1 (m) is a correct sequent of P A,

17
4. P A ⊢ P roofP A (m, n) iff gn−1 (m) is a proof of gn−1 (n).

Of course we also get the converse. Since the above formulas represent the correponding
relations on natural numbers we get for example P A ⊢ ¬P roofP A (m, n) iff gn−1 (m) is not
a proof of gn−1 (n).

Exercise 5.1. Show that P roofP A (m, n) is computable and thus representable in P A as
claimed above.

Let TP A be the set of Gödel numbers of all provable formulas in arithmetic, i.e.

TP A = {x : P A ⊢ gn−1 (x)}.

Theorem 5.5. The set TP A is c.e.

Proof. Simply note that


x ∈ TP A iff ∃pP roofP A (p, x).

Recall the following definitions:

Definition 5.2. A theory Φ in a symbol set S is complete if and only if Φ ⊢ φ or Φ ⊢ ¬φ


for all sentences φ ∈ LS . (cf. negation complete)

Definition 5.3. A theory Φ is (computably) axiomatizable if AxΦ is computable.

We can get relations AxΦ , SeqΦ and P roofΦ for any theory Φ. Clearly, if Φ ⊇ P A is
axiomatizable, then AxΦ , F ormΦ and P roofΦ are representable in Φ. To see this just
notice that ⊢ is monotonic and that the relations are already representable in P A. We
furthermore get the following fact.

Lemma 5.6. If Φ ⊇ P A is complete and axiomatizable, then TΦ is computable.

Proof. If Φ is inconsistent then TΦ = N, so it is trivially computable. If Φ is complete


and consistent then for every formula φ either gn(φ) ∈ TΦ or gn(¬φ) ∈ TΦ but not both.
Therefore,
x ∈ T̄Φ iff gn(¬gn−1 (x)) ∈ TΦ
and thus if Φ is axiomatizable it is c.e. As both TΦ and T̄Φ are c.e., TΦ is computable.

Definition 5.4. Let Φ be a theory in the language of arithmetic. We say that Φ is ω-


consistent if for each formula φ(x) in S ar , if Φ ⊢ ∃x¬φ(x), then there is n ∈ N such that
Φ ̸⊢ φ(n).

Exercise 5.2. Show that ω-consistency implies consistency.

18
Proposition 5.7. P A is ω-consistent.

Proof. Note that N |= P A. We prove the proposition by contraposition. Assume that


P A ⊢ φ(m) for every m ∈ N. Then N |= ¬∃x¬φ(x). As N ̸|= ∃x¬φ(x) we have that
P A ̸⊢ ∃x¬φ(x).

Definition 5.5. A set S is semi-representable in a S ar theory Φ if

x ∈ S ⇔ Φ ⊢ φ(x)

for φ a formula in arithmetic.

Theorem 5.8. For each set S the following are equivalent.

1. S is c.e.

2. S is semi-representable in P A.

3. S ≤m TP A .

Proof. (1) ⇒ (2). Assume S is c.e., then it is Σ01 . Thus, let R be a computable relation
such that
m ∈ S ⇔ ∃nR(m, n).
Assume R is represented in P A by ψ and let φ(x) = ∃yψ(x, y). We show that m ∈ S iff
P A ⊢ φ(m).
(⇒). Say m ∈ S, and let n0 such that R(m, n0 ). The following is a valid formula and
thus provable in PA
ψ(m, n0 ) → ∃yψ(m, y)
and as R is representable we have that P A ⊢ ψ(m, n0 ). Thus using the modus ponens rule
we obtain P A ⊢ ∃yψ(m, y) and so P A ⊢ φ(m).
(⇐). Say P A ⊢ φ(m). Hence P A ⊢ ∃y¬¬ψ(m, y). By ω-consistency P A ̸⊢ ¬ψ(m, n)
for some n and therefore R(m, n) must hold as ψ represents R. But then ∃nR(m, n) and
thus m ∈ S.
(2) ⇒ (3). Assume S is semi-representable via φ. So m ∈ S iff P A ⊢ φ(m). Then

m ∈ S ⇔ gn(φ(m)) ∈ TP A .

Hence S ≤m TP A as witnessed by the function x 7→ gn(φ(x)).


(3) ⇒ (1). This is immediate from Theorem 5.5, Proposition 4.1 and Exercise 4.1.

Exercise 5.3. Show that if Φ ⊇ P A is axiomatizable and ω-consistent then for every set
S, S is c.e. iff S is semi-representable in Φ iff S ≤m TΦ .

Corollary 5.9. S is representable in PA iff S is computable.

19
We can now give a computability theoretic proof of Gödel’s first incompleteness theorem.

Theorem 5.10 (Gödel’s first incompleteness theorem). If Φ is an ω consistent axiomati-


zable extension of PA, then Φ is incomplete.

Proof. Assume that Φ was complete, then TΦ is computable by Lemma 5.6. But on the
other hand K ≤m TΦ and thus K would be computable, a contradiction.

5.3. Gödel’s second incompleteness theorem


Our proof deviated from the proof of Gödel in the last steps by using notions from com-
putability theory which were not available when he initially proved his incompleteness the-
orems (in fact the computability theoretic notions were highly influenced by his proofs).
To give a formal proof of his second incompleteness theorem we will go back to what he
did and find a statement that is contradictory, i.e., a formula φ which says “I am not
provable”.
To obtain this we have to prove a theorem very similar to the recursion theorem in
computability theory:

Remark. In what follows we will frequently use x to denote the formal term for x, i.e.,
e
we will use x to denote x.
e
Lemma 5.11 (Fixed-point lemma). Suppose Φ ⊇ P A. Then for every ψ(x), there is a
sentence φ such that
Φ ⊢ φ ↔ ψ(gn(φ)).
e
Proof. Let ψ ∈ LS1 ar and define f as

gn(θ(gn(θ))) if gn(x) = θ(y) is a formula
f (x) = e

0 otherwise

As f is computable it is representable in Φ, say by Γf . Fix θ ∈ LS1 ar . Then

Φ ⊢ ∀y(Γf (gn(θ), y) ↔ y ≡ gn(θ(gn(θ))))


e e
e
Let β(z) be the formula defined as

β(z) = ∀y(Γf (z, y) → ψ(y)).

20
Then Φ ⊢ β(gn(θ)) ↔ ∀y(y ≡ gn(θ(gn(θ))) → ψ(y)). Therefore
e e
e
Φ ⊢ β(gn(θ)) ↔ ψ(gn(θ(gn(θ)))))
e e
e
Now, let φ = β(gn(β)), then
e
Φ ⊢ β(gn(β)) ↔ ψ(gn(β(gn(β)))
e e
e
and hence Φ ⊢ φ ↔ ψ(gn(φ))).
e
In Lemma 5.11 take ψ = ∀y¬P roof (y, x), then there is φ such that
Φ ⊢ φ ↔ ψ(gn(φ)). (21)
e
Then φ intuitively expresses the property ”I am not provable”. And if Φ ⊢ φ, then Φ would
prove that there is no proof of φ which is a contradiction if Φ was consistent. We have just
shown the following.
Lemma 5.12. If Φ ⊇ P A is consistent and axiomatizable then Φ ̸⊢ φ.
Using the ω-consistency of Φ we could get that Φ can not prove the negation of φ as
well and thus obtain an alternative proof of the first incompleteness theorem.
Exercise 5.4. Prove Gödel’s first incompleteness theorem using Lemma 5.11.
Furthermore notice that the consistency of a theory Φ ⊇ P A can be expressed by a Π01
sentence,
ConΦ ⇔ ∀x¬P roofΦ (x, gn(0 ≡ 1)).
Thus, Lemma 5.12 can be formalized as the sentence
ConΦ → ∀x¬P roofΦ (x, gn(φ)).
e
Using additional properties of ⊢ (see [Men09] for details) one can get that
Φ ⊢ ConΦ → ∀x¬P roofΦ (x, gn(φ)) (22)
e
and using this we can prove the second incompleteness theorem.
Theorem 5.13 (Gödel’s second incompleteness theorem). Let Φ be a consistent axioma-
tizable extension of PA. Then Φ ̸⊢ ConΦ .
Proof. Assume Φ ⊢ ConΦ , then by (22) Φ ⊢ ∀x¬P roofΦ (x, gn(φ)). But notice that this
e
formula is just ψ(gn(φ)) from (21) and thus Φ ⊢ φ, a contradiction.
e

21
5.4. Closing thoughts
In our proof of Theorem 5.10 we required ω-consistency. Rosser showed that it is possible
to replace ω-consistency with consistency.
The incompleteness theorems are not unique to the language of arithmetic, they can be
proven in any theory in which one can formalize a large enough part about arithmetic (in
fact one only needs the semiring axioms, often also called Robinson arithmetic). Thus, in
particular, they can be proved for ZF C which is considered to be the foundation of math-
ematics – the theory on which all of mathematics is developed. The second incompleteness
theorem then shows that we can not prove the consistency of mathematics from within
mathematics.
Combining the facts that if ZF C is consistent, then TZF C is Σ01 complete (by Theo-
rem 5.8; if ZF C is inconsistent then it is trivially computable) and the fact that the set
arising from Hilbert’s tenth problem H is Σ01 complete as well one obtains the following
fun fact.
If ZFC is consistent then there is a polynomial p for which we can not prove whether it
has an integer root or not assuming that ZFC is consistent.
The idea behind this is as follows. Take a sentence φ such that by the first incompleteness
theorem ZF C ̸⊢ φ and ZF C ̸⊢ ¬φ. Then as both TZF C and H are Σ01 complete, there
is an m-reduction f from TZF C to H. So, look at f (φ) and assume we could prove hat
f (φ) ∈ H, then as f is computable we could also prove that φ ∈ TZF C , a contradiction. It
also follows that we can prove that f (φ) has an integer root iff ZF C is inconsistent.
Another interesting consequence concerns open problems in mathematics. For some
famous open problems like for example the Riemann hypothesis we can show that if it is
independent of ZF C, i.e. ZF C ̸⊢ φR and ZF C ̸⊢ ¬φR where φR is the formalization of
the Riemann hypothesis, then the Riemann hypothesis is true.
Exercise 5.5. Show that if the Riemann hypothesis is neither provable nor refutable in
ZF C, then it is true. Hint: Look at the statement of the conjecture and see of which
complexity it is. Assume that it was neither provable nor refutable and conclude that then
there is an algorithmic solution to it.

References
[Coo03] S. Barry Cooper. Computability Theory. CRC Press, 2003.
[EFT13] H.-D. Ebbinghaus, Jörg Flum, and Wolfgang Thomas. Mathematical Logic. Springer
Science & Business Media, 2013.
[Men09] Elliott Mendelson. Introduction to Mathematical Logic. CRC press, 2009.

A. Partial recursive functions


We first define the primitive recursive functions.

22
Definition A.1 (Primitive recursive functions). 1. The following functions, called ini-
tial functions are primitive recursive:
a) The zero function 0 : n 7→ 0 for all n ∈ N,
b) the successor function n′ : n 7→ n + 1 for all n ∈ N,
c) the projection functions Uik : (n0 , . . . , nk ) 7→ ni for all i ≤ k, and (n0 , . . . , nk ) ∈
Nk .

2. If g, h, h0 , . . . , hl are primitive recursive, then so is f defined by one of the following


rules
a) Substitution:
f (m̄) = g(h0 (m̄), . . . , hl (m̄))

b) Primitive Recursion:

f (m̄, 0) = g(m̄), f (m̄, n + 1) = h(m̄, n, f (m̄, n)).

The primitive recursive functions are an interesting subclass of functions themselves,


in particular they are all total. However not all total computable functions are primitive
recursive. An example for the interested reader is the Ackermann function. Our main
interest is in a larger class of functions, the partial recursive functions.

Definition A.2 (Partial recursive functions). A function f is partial recursive if it is


primitive recursive or defined using the µ or minimization operator from a partial recursive
function, i.e.
f (x̄) = µy[g(x̄, y) = 0]
where g is partial recursive and

µm[g(x̄, m) = 0 = m0 ⇔ g(x̄, m0 ) = 0 & ∀m < m0 [g(x̄, m) ↓̸= 0].

Thesis 2 (Church’s thesis). A function is partial recursive iff it is intuitively computable.

While one could prove the two notions of computability to be equivalent we will just rely
on Church’s and Turing’s thesis in this lecture. The interested reader can find a proof of
the equivalence in TODO.

Example A.1. Addition, +, is primitive recursive.

Proof. Addition is easily defined by the following recursion scheme:

m+0=m
m + (n + 1) = (m + n) + 1 = (m + n)′

23
If we want to be completely formal we could write it as:

+(m, 0) = U11 (m)


+(m, n + 1) = +(m, n)′ = U33 (m, n, f (m, n))′ .

Exercise A.1. Show that multiplication and exponentiation are primitive recursive.

24

You might also like