Full version - Villanova Computer Science

Giorgi Japaridze
Theory of Computability
Decidability
Episode 2
2.1.a
Giorgi Japaridze
Theory of Computability
Examples of decidable problems (sets)
Decidable:
•{1,3,5}
•
•{x | x is even}
•{x | x is a perfect square}
•{x | x2-10x = 0}
•{x | x=y*z for some integers y,z>1 (i.e. x is not prime)}
•{x | x is a prime (i.e. x is not divisible by anything except 1 and
itself)}
•{<G> | G is a connected graph}
•{<P> | P is a one-variable polynomial expression with an integral root}
Undecidable:
•{<P> | P is a two-variable polynomial expression with an integral root}
2.2.a
Giorgi Japaridze
Theory of Computability
The universal Turing machine
Let ATM = {<M,w> | M is a TM and M accepts string w}
We call the above set the acceptance problem.
Theorem 2.1: ATM is recognizable.
Proof idea.
The following TM U, called the universal TM, recognizes ATM:
U = “On input <M,w>, where M is a TM and w is a string:
1. Simulate M on input w.
2. If M ever enters its accept state, accept;
if M ever enters its reject state, reject.”
Does U also decide ATM?
No!
2.2.b
Giorgi Japaridze
Theory of Computability
ATM is undecidable
Theorem 2.2: ATM is undecidable.
Proof idea. Suppose, for a contradiction, that ATM is decidable.
That is, there is a TM H that decides ATM.
Thus, that machine H behaves as follows:
accept if M accepts w
H(<M,w>) = reject if M does not accept w
Using H as a subroutine, we can construct the following TM D:
D = “On input <M>, where M is a TM:
1. Run H on input <M,<M>>.
2. Do the opposite of what H does.
That is, if H accepts, reject, and if H rejects, accept.”
Thus, D(<M>) =
accept if M does not accept <M>
reject if M accepts <M>
2.2.b
Giorgi Japaridze
Theory of Computability
ATM is undecidable
Theorem 2.2: ATM is undecidable.
Proof idea. Suppose, for a contradiction, that ATM is decidable.
That is, there is a TM H that decides ATM.
Thus, that machine H behaves as follows:
accept if M accepts w
H(<M,w>) = reject if M does not accept w
Using H as a subroutine, we can construct the following TM D:
D = “On input <M>, where M is a TM:
1. Run H on input <M,<M>>.
2. Do the opposite of what H does.
That is, if H accepts, reject, and if H rejects, accept.”
Thus, D(<D>) =
accept if D does not accept <D>
Contradiction!
reject if D accepts <D>
2.2.c
Giorgi Japaridze
Theory of Computability
A Turing-unrecognizable problem
ATM = {<M,w> | M is a TM and M accepts string w}
ATM = {<M,w> | M is a TM and M does not accept string w}
Theorem 2.3: ATM is unrecognizable.
Proof idea. Suppose, for a contradiction, that ATM is recognizable.
That is, there is a TM U that recognizes ATM.
• U recognizes ATM (slide 2.2.a)
Thus,
• U recognizes ATM
Let K = “On input <M,w>:
1. Run both U and U on input <M,w> in parallel;
2. If U accepts, accept; if U accepts, reject.”
It can bee seen that K decides ATM, which contradicts Theorem 2.2.
2.2.d
Giorgi Japaridze
Theory of Computability
There are uncountably many problems
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
Set of even numbers
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Empty set
0
0
1
1
0
1
0
1
0
0
0
1
0
1
0
0
Set of prime numbers
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Set of all numbers
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
0
1
0
1
1
1
…
2.2.d
Giorgi Japaridze
Theory of Computability
There are uncountably many problems
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
Set of even numbers
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Empty set
0
0
1
1
0
1
0
1
0
0
0
1
0
1
0
0
Set of prime numbers
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Set of all numbers
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
0
1
0
1
1
1
Reverse the diagonal
…
2.2.d
Giorgi Japaridze
Theory of Computability
There are uncountably many problems
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
Set of even numbers
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Empty set
0
0
1
1
0
1
0
1
0
0
0
1
0
1
0
0
Set of prime numbers
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Set of all numbers
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
0
1
0
1
1
1
Reverse the diagonal
…
2.2.d
Giorgi Japaridze
Theory of Computability
There are uncountably many problems
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
Set of even numbers
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Empty set
0
0
1
1
0
1
0
1
0
0
0
1
0
1
0
0
Set of prime numbers
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Set of all numbers
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
0
1
0
1
1
1
Reverse the diagonal
…
2.2.d
Giorgi Japaridze
Theory of Computability
There are uncountably many problems
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
Set of even numbers
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Empty set
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
0
Set of prime numbers
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Set of all numbers
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
0
1
0
1
1
1
Reverse the diagonal
…
2.2.d
Giorgi Japaridze
Theory of Computability
There are uncountably many problems
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
Set of even numbers
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Empty set
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
0
Set of prime numbers
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
Set of all numbers
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
0
1
0
1
1
1
Reverse the diagonal
…
2.2.d
Giorgi Japaridze
Theory of Computability
There are uncountably many problems
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
Set of even numbers
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Empty set
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
0
Set of prime numbers
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
Set of all numbers
1
0
0
1
1
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
0
1
0
1
1
1
Reverse the diagonal
…
2.2.d
Giorgi Japaridze
Theory of Computability
There are uncountably many problems
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
Set of even numbers
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Empty set
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
0
Set of prime numbers
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
Set of all numbers
1
0
0
1
1
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
1
1
1
…
Every set of numbers can be represented as an infinite bit string. However, as we see,
not all such strings can be listed (the new diagonal string is not on the list!).
On the other hand, all TMs can be encoded as bit strings and hence listed.
To summarize, the set of TMs is countable (可数的) but the set of problems is not
(there are more problems than TMs). So, some problems have no TMs.