CSCI 2670 Introduction to Theory of Computing October 26, 2005
Agenda Yesterday Today Test Begin Chapter 5 Pages 187 – 192 Old text pages 171 – 176) October 26, 2005
Announcement In Chapter 5 we will skip from page 192 to page 206 Old text skip from 176 to 183 Homework due next Wednesday (11/3) Show the following languages are not decidable T = {<M> | M is a TM with L(M)R = L(M)} i.e., wRL(M) whenever wL(M) (prob. 5.9) G = {<M> | M is a TM s.t. L(M) is context-free} F = {<M> | M is a TM with |L(M)| = 5} October 26, 2005
Classes of languages We have shown some language falls within each of the following classes Regular Context-free Decidable Turing recognizable Co-Turing recognizable (ATM) Today we will show some languages are undecidable The fact that ATM is not Turing recognizable means there is no computer algorithm that recognizes it! October 26, 2005
Undecidable languages Turing recognizable Co-Turing recognizable Decidable October 26, 2005
Undecidable languages We can prove a problem is undecidable by contradiction Assume the problem is decidable Show that this implies something impossible October 26, 2005
The halting problem HALTTM 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 HALTTM is undecidable because there’s no single strategy that will work for all TM’s October 26, 2005
Proof (cont.) Assume R decides HALTTM Let S be the following TM S = “on input <M,w> Run R on <M,w> If R rejects, reject If R accepts, simulate M on w until it halts If M accepts, accept; if M rejects, reject” October 26, 2005
Proof (cont.) If HALTTM is decidable then S decides ATM Since ATM is not decidable, HALTTM cannot be decidable October 26, 2005
Proving language L is undecidable Assume L is decidable Let N be a TM that decides L 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 I.e., the language L is not decidable Trick: Figuring out which undecidable language to use October 26, 2005
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? Make new TM, M1, with L(M1) = iff M accepts w October 26, 2005
Proof (cont.) New TM: Reject everything other than w, do whatever M does on input w. M1 = “On input x If x ≠ w, reject If x = w, run M on input w Accept if M accepts” L(M1) ≠ if and only if M accepts w October 26, 2005
Use R and M1 to decide ATM Consider the following TM S = “On input <M,w> Construct M1 that rejects all but w and simulates M on w Run R on <M1> If R accepts, reject; if R rejects, accept” S decides ATM – a contradiction Therefore, ETM is not decidable October 26, 2005
Recap Assume R decides ETM Create Turing machine M1 such that L(M1) ≠ iff M accepts w Create Turing machine S that decides ATM by running R on input M1 Conclude R cannot exist ETM cannot be decidable October 26, 2005
Another undecidable language Let REGULARTM = {<M> | M is a TM and L(M) is a regular language} Theorem: REGULARTM is undecidable Proof: Assume R decides REGULARTM and use R to decide ATM (reduce the ATM problem to the REGULARTM problem). As before, make a new TM, M2, that accepts a regular language iff M accepts w. October 26, 2005
Proof (cont.) If M accepts w, then L(M2) = Σ* Otherwise, L(M2) = 0n1n M2 = “On input x If x = 0n1n for some n, accept Otherwise, run M on w. If M accepts w, accept” If M accepts w, then L(M2) = Σ* A regular language Otherwise, L(M2) = 0n1n Not a regular language L(M2) = 0n1n if M does not accept w L(M2) = all strings if M accepts w October 26, 2005
Proof (cont.) Assuming R decides REGULARTM consider the following TM S = “On input <M,w> Construct M2 s.t. L(M2) is regular iff M accepts w Run R on M2 If R accepts, accept; if R rejects, reject” S decides ATM iff R decides REGULARTM L(M2) = 0n1n if M does not accept w L(M2) = all strings if M accepts w October 26, 2005
Have a fantastic fall break!