140 likes | 156 Views
Learn about decidable and undecidable languages, including examples and proofs. Explore the theory of computing in this insightful lecture.
E N D
CSCI 2670Introduction 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
Announcements Announcements • No tutorials this week -- extra office hours instead • Tuesday & Wednesday 3:00 – 5:00 • Or by appointment October 27, 2004
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
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
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
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 • 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
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 27, 2004
Recap • If HALTTM is decidable then ATM is decidable • Since ATM is not decidable, HALTTM cannot be decidable October 27, 2004
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 use October 27, 2004
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
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 27, 2004
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> that accepts iff L(M1)= • If R accepts, reject; if R rejects, accept” S decides ATM – a contradiction Therefore, ETM is not decidable October 27, 2004
Have a fantastic fall break! October 27, 2004