Use R and M 1 to decide A TM

CSCI 2670
Introduction to Theory of
Computing
October 27, 2004
Agenda
• Yesterday
– Revisit the ATM proof
– Finish Chapter 4
– Problems
• Today
– Begin Chapter 5 (pp. 171 – 176)
October 27, 2004
2
Announcements
Announcements
• No tutorials this week -- extra office
hours instead
– Tuesday & Wednesday 3:00 – 5:00
– Or by appointment
October 27, 2004
3
Some decidable languages
•
•
•
•
FDFA = {<A> | A is a DFA and L(A) is finite}
PRIME = { n | n is a prime number}
CONN = {<G> | G is a connected graph}
L10DFA = {D | D is a DFA that accepts every
string w with |w| = 10}
• INTCFG = {<G1, G2, w> | G1 and G2 are CFG’s
and w is accepted by both}
• INTLCFG = L(G1  G2), where G1 and G2 are
CFG’s
October 27, 2004
4
Classes of languages
• We have shown some language falls
within each of the following classes
–
–
–
–
Regular
Context-free
Decidable
Non-Turing recognizable (ATM)
• Today we will show some languages
are undecidable
October 27, 2004
5
Undecidable languages
• We can prove a problem is
undecidable by contradiction
– Assume the problem is decidable
– Show that this implies something
impossible
October 27, 2004
6
The halting problem HALT TM
•
HALTTM = {<M,w> | M is a TM and M
halts on input w}
Theorem: HALTTM is undecidable
Proof: (by contradiction)
• Show that if HALTTM is decidable
then ATM is also decidable
–
–
If M does not halt on w, then reject
If M halts on w, then run M on w and
return result
October 27, 2004
7
Proof (cont.)
• Assume R decides HALTTM
• Let S be the following TM
S = “on input <M,w>
1. Run R on <M,w>
2. If R rejects, reject
3. If R accepts, simulate M on w until it
halts
4. If M accepts, accept; if M rejects,
reject”
October 27, 2004
8
Recap
• If HALTTM is decidable then ATM is
decidable
• Since ATM is not decidable, HALTTM
cannot be decidable
October 27, 2004
9
Proving language L is undecidable
• Assume L is decidable
– Let N be a TM that decides the language
• Show that a known undecidable
language L’ will be decidable if it can
use N to make decisions
– This is called reducing problem L’ to
problem L
• Conclude N cannot exist
– The language L is not decidable
Trick: Figuring out which undecidable
language to useOctober 27, 2004
10
Undecidability of ETM
• ETM = {<M> | M is a TM and L(M) = }
Theorem: ETM is undecidable
Proof: Assume ETM is decidable with
decider TM R. Use R to decide ATM.
Recall ATM = {<M,w> | M is a TM that
accepts w}.
How can we use R (which takes <M> as
input) to determine if M accepts w?
Hint: make new TM
October 27, 2004
11
Proof (cont.)
New TM: Reject everything other than
w, do whatever M does on input w.
M1 = “On input x
1. If x ≠ w, reject
2. If x = w, run M on input w
 Accept if M accepts”
L(M1) ≠  if and only if M accepts w
October 27, 2004
12
Use R and M1 to decide ATM
Consider the following TM
S = “On input <M,w>
1. Construct M1 that rejects all but w and
simulates M on w
2. Run R on <M1> that accepts iff L(M1)=
3. If R accepts, reject; if R rejects, accept”
S decides ATM – a contradiction
Therefore, ETM is not decidable
October 27, 2004
13
October 27, 2004
14