Title: Computer Science 500 Theory of Computation Spring, 2000 Feb' 21
1Computer Science 500Theory of ComputationSpring,
2000Feb. 21 1. Tests returned, solutions 2. HW
4 additions3. Reductions!
2Decidability
A Language L is decidable iff there is a Turing
Machine M such that M accepts every string in L
and rejects every string in L A recursive
language is a decidable language
3Recognizability
A Language L is recognizable iff there is a
Turing Machine M such that M accepts every string
in L and either rejects or fails to halt on every
string in L A recursively enumerable language is
a recognizable language
4Co-Recognizability
A Language L is co-recognizable iff there is a
Turing Machine M such that M accepts every string
in L and either rejects or fails to halt on every
string in L A co-r.e. language is a
co-recognizable language
5Church/Turing Thesis - expanded
1. Any language that an algorithm can decide can
be decided by a Turing machine and vica-a-versa.
2. Any language that an algorithm can recognize
can be recognized by a Turing machine and
vica-a-versa. 3 Any function that an algorithm
can compute can be computed by a Turing machine
and vica-a-versa 4. Time bounds, non-determinism
also apply
6The Universal Turing Machine
Universal Turing Machine MUniversal Input
(M,I) where M is a Turing Machine
Description I is the input to the machine
M Results If M accepts I, then
MUniversal accepts (M,I) If M rejects I, then
MUniversal rejects (M,I) If M does not halt on
I, MUniversal does not halt on (M,I)
7Universal Turing Machine(visualization)
Muniversals initial configuration
M (Q, ???????? q0, qaccept, qreject), Input to
M
U U U U ...
M is described in binary
8Universal Turing Machine(visualization)
Muniversals general configuration
q
0 1 0 0 1 0 U U
M (Q, ???????? q0, qaccept, qreject),
Ms state
Ms tape configuration
M is described in binary
9There is a language LU that is unrecognizable
Proof by Diagonalization (special case of proof
by contradiction)
10Let Mi be the ith Turing MachineLet Mi(j) 1 if
Mi accepts input j0 otherwise
j
Mi(j)
1 2 3 4 5 .
1 0 1 1 0 1 0
1 0 1 1 0 1 0
1 0 1 1 0 1 0
1 0 1 1 0 1 0
1 0 1 1 0 1 0
. . . . . .
. . . . . .
. . . . . .
. . .
1 2 3 4 5 . . .
i
11Let LU i Mi(i) 0Suppose LU were
recognizableby some T.M. KThen MK(K) 1 iff
MK(K) 0
12Details of that argumentK ?Lu ? MK does not
accept K ? MK(K) 0 ? K ? L(K) ? K ? Lu
13Definition Computable function
A function f is computable iff there is a Turing
machine that, on input x, halts with f(x) on the
tape.
14Definition mapping Reduction
A computable function f reduces language L1 to
language L2 iff for all x, x in L1 f(x)
in L2
15notation
L1 reduces to L2
L1 ltm L2
16Theorem
? L1 , L2 , if L1 ltm L2 then L2 is decidable ?
L1 is decidable
17Proof idea -- construct a T.M. For L1 based on
one for L2
M1
w
f(w)
accept/reject
Mf
M2
18Proof
- Let Mf be a Turing Machine that reduces L1 to
L2 - Let M2 decide L2
- Define M1. On input w,
- First, run Mf
- Second, run M2 on f(w)
- Accept iff M2 accepts
19Contrapositive
Assume that L1 reduces to L2. If L1 is
undecidable and then L2 is undecidable
20Example
Let L M M is a T.M. s.t. for all w, if M
accepts w, then M accepts wR Then L is not
decidable
21Proof (by reduction)
We will show that
LUltm L
22- Define the reduction fZ T.M.s
- f(j) a machine M such that
- On input w,
- M rejects all w ? 01
- If w 01, then M runs Mj on j, accepting w
iff Mj accepts j.
23LU j Mj(j) 0
j in LU f(j) in L
Mj(j) 0 f(Mj) is not in L
24Reduction Idea
MU
j
f(w) M
accept/reject
Mf
ML
L(M) ??if Mj does not accept j L(M) 01 if Mj
does accept j
25Second ExampleProving L undecidable by reducing
and undecidable problem to L
Let L M M is a T.M. such that M accepts
no inputs Then L is not decidable
26Proof (by mapping reduction)
We will show that
Lu ltm L
27Reduction Idea
MU
i
f(i) M
accept/reject
Mf
ML
L(M) ??if Mi does not accept i L(M) S if Mi
does accept i
28- Define reduction f Z TMs
- f(i) a machine M such that
- on any input w,
- M runs Mi on i, accepting w iff Mi accepts i.
29Enumerator E like a Turing Machine except that
it takes no input and has an output. That output
sequence is the language L(E)
Scratch Work
Printer
A
w1, w2, w3 ...
R
L(E)
30Definition A language L is recursively
enumerable iff L is the output of an enumerator
Theorem
A language L is recursively enumerable iff L is
recognizable
31Proof
( )
Assume L is recursively enumerable by E. Then to
construct a Turing Machine T that recognizes
L On input w, T runs E and accepts if E ever
outputs w
( )
Assume L is recognizable by T. Then to construct
an enumerator E 1) I 1 2) Run T on the
first I inputs for I steps, output those that are
accepted on the Ith step 3) I I1 goto (1)
32Homework 4Due Monday, Feb 28
1. Are the following languages (i) decidable?
(ii) recognizable? (iii) co-recognizable? -
prove your answers A) L i Mi-1(i) 0 j
ltj-1gt does not accept j B) L (M,?) M a
T.M. and ? a letter in Ms tape alphabet such
that there exists input w s.t. M ever writes ? on
the tape while computing on w C) L (M,w) M
ever attempts to move its tape head to the left
when it is in the left-most square of the tape
while computing on w
33 D) L (M1,M2) there exists a string w s.t.
T.M.s M1 and M2 both halt on w E) L Ldrift
(M,w) T.M. M never halts and never enters
the same configuration twice on input w 2.
Prove that L is decidable iff there is an
enumerator E that outputs the elements of L in
lexicographic order. 3.. Two sets have the same
cardinality iff there is a 1-to-1, onto map f
between the two. Show that the integers (Z) and
the rationals (Q) have the same cardinality
344.a Prove that ? L1 , L2 , if L1 ltm L2 then
L2 is recognizable ? L1 is recognizable and
state the contrapositive 4b Prove the above
statement replacing recognizable with co-
recognizable