Download presentation
Presentation is loading. Please wait.
Published byBritney Phelps Modified over 9 years ago
1
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at http://peerinstruction4cs.org. Permissions beyond the scope of this license may be available at http://peerinstruction4cs.org.
2
A TM IS UNDECIDABLE What we did last time 2
3
A TM is undecidable Proof by contradiction Assume A TM is decidable – There’s a TM M ATM that decides it Use M ATM to create another TM D in a clever way: – Running D( ) creates a paradox – D accepts if and only if D rejects 3
4
Proof: Thm: A TM = { | M is a TM, M accepts w} is undecidable Assume (towards contradiction) that A TM is decidable, so some TM M ATM decides A TM. Construct a TM D as follows: – D( ): //input is a string description of a TM M ATM ( >)– M ATM is a decider, so it will either accept or reject (no infinite looping) If M ATM accepts, we reject If M ATM rejects, we accept // we do the opposite of M ATM Run D( ). Observe that D( ) should accept when D( ) rejects, and D( ) should reject when D( ) accepts, a contradiction. Therefore the assumption is false, and A TM is undecidable. 4
5
THE HALTING PROBLEM HALT TM Proving it is undecidable 5
6
The Halting Problem HALT TM = { | M is a TM and M halts on input w} – Doesn’t say if M accepts or rejects w, just that it halts Imagine we have a hypothetical TM M halt that decides HALT TM. – Could we use M halt to build a decider for A TM ? – recall A TM = { | M is a TM and M accepts w} 6
7
Thm. HALT TM is undecidable. Proof by contradiction. Assume that HALT TM is decidable, and some TM M halt decides it. Construct a TM M ATM that decides A TM : But is A TM is undecidable, a contradiction. So the assumption is false and HALT TM is undecidable. 7
8
We just did a reduction! 8 We showed that *if* we have a solution to HALT TM, then we have a solution to A TM. What did we show exactly? a)A TM reduces to HALT TM. b)HALT TM reduces to A TM. c)HALT TM and A TM reduce to each other. d)None of the above or more than one of the above.
9
…ARE THERE LANGUAGES THAT ARE NOT TURING-RECOGNIZABLE? We showed some languages are not decidable… 9
10
Are there languages that are NOT recognizable? YES, based on diagonalization and comparing infinite sets |Languages| > |TM’s|, so there must be a language not recognized by a TM 10
11
Could A TM be not recognizable? { | M is a TM, M accepts w} No. We proved it was recognizable on Thurs. – B( ): Run M(w) and accept if it accepts, reject if it rejects (If it loops that’s ok) Thought experiment: – What about the complement of A TM ? – Lets just guess that it is also recognizable, and has a TM C that recognizes it – Could we use B and C to build a decider(!) for A TM ? 11
12
Thm.: A TM is not recognizable Proof by contradiction Assume A TM is recognizable, so some TM C recognizes it. We know that A TM is recognizable, so let B be a TM that recognizes it. M ATM-Decider ( ): But A TM is undecidable, a contradiction. So the assumption is false and A TM is not recognizable 12
13
Recognizable and co-recognizable Same method for arbitrary L: – L is recognizable but not decidable => L is not recognizable – Class of recognizable languages is not closed under complement Same construction for arbitrary L: – L is recognizable AND co-recognizable => L is decidable 13
14
So, what does the Venn Diagram look like? 14 Decidable Co-recognizable Decidable Recognizable Co-recognizable Recognizable Co-recognizable AB CD
15
REDUCTIONS MORE EXAMPLES Changing one problem into another 15
16
E TM = { | M is a TM, and L(M) = {} } Undecidable! Proven in textbook 16
17
EQ TM = { | M 1, M 2 are TMs and L(M 1 ) = L(M 2 ) } Thm. EQ TM is undecidable. Proof by contradiction. Assume that EQ TM is decidable, and some TM M EQ decides it. Construct a TM M ETM that decides E TM : M ETM ( ): – Run M EQ ( ) If M EQ accepts, then accept. If it rejects, then reject. But is E TM is undecidable, a contradiction. So the assumption is false and EQ TM is undecidable. 17 What M x makes this proof work? (a) L(M x ) = { w | w is in Σ* } (b) L(M x ) = EQ TM (c) L(M x ) = {} (d) L(M X ) = E TM
18
We showed that *if* we have a solution to EQ TM, then we have a solution to E TM. What did we show exactly? a)E TM reduces to EQ TM. b)EQ TM reduces to E TM. c)EQ TM and E TM reduce to each other. d)None of the above or more than one of the above. 18 We just did a reduction!
19
REDUCTIONS USING A TM MORE EXAMPLES Changing one problem into another 19
20
Thm.: TWO = { | for all w in L(M), w has exactly two 1s} is undecidable Proof by contradiction: Assume TWO is decidable by TM D TWO. Use D TWO to construct TM D ATM that decides A TM. D ATM ( ): – Construct M'(x): Count the number of 1s in x. If it is 2, accept. Simulate M(w). If M(w) accepts, accept. If it rejects, reject. (might loop) – Call D TWO ( ) //D TWO is a decider for TWO – If D TWO ( ) accepts, reject, else accept. But A TM is undecidable, a contradiction. So the assumption is false and T is undecidable. QED. 20 What is L(M’)? (a) Σ* (b) {x | x has exactly two 1s} (c) Σ * if M(w) accepts, and {x|x has exactly two 1s} if M(w) does not accept (d) Σ * if M(w) accepts, and the empty set if M(w) rejects.
21
We showed that if we have a solution to TWO, then we have a solution to A TM. What did we show exactly? a)A TM reduces to TWO. b)TWO reduces to A TM. c)TWO and A TM reduce to each other. d)None of the above or more than one of the above. 21 We just did a reduction!
22
Thm. T = { | M is a TM and both “101” and “111” are in L(M)} is undecidable Proof by contradiction: (Reduce from A TM.) Assume T is decidable by TM M T. Use M T to construct TM X that decides A TM. X( ): – Construct Z(m): If m != “111” and m != “101” then reject. Else: Run M(w), if it accepts then accept. If it rejects then reject (might loop in which case obviously Z loops). – Run M T ( ). If it accepts then accept, otherwise reject. But A TM is undecidable, a contradiction. So the assumption is false and T is undecidable. QED. 22 What is L(Z)? (a) Σ * (b) {“101”, “111”} (c) empty set if M(w) rejects, and {“101”,”111”} if M(w) accepts. (d) Σ * if M(w) accepts, and {“101”,”111”} if M(w) does not accept
23
We showed that if we have a solution to T, then we have a solution to A TM. What did we show exactly? a)A TM reduces to T. b)T reduces to A TM. c)T and A TM reduce to each other. d)None of the above or more than one of the above. 23 We just did a reduction!
24
Thm. T = { | M is a TM that accepts w R whenever it accepts w} is undecidable Proof by contradiction: (Reduce from A TM.) Assume T is decidable by TM M T. Use M T to construct TM X that decides A TM. X( ): – Construct Z(m): If m != “01” and m!= “10” then reject If m == “01” accept ??? – Run M T ( ). If it accepts then accept, otherwise reject. But A TM is undecidable, a contradiction. So the assumption is false and T is undecidable. QED. 24 How do we finish Z? (a)Run M(w), if it accepts then accept. If it rejects then reject (might loop in which case obviously Z loops). (b)Run M(w), if it accepts then reject. If it rejects then accept (might loop in which case obviously Z loops).
25
We showed that if we have a solution to T, then we have a solution to A TM. What did we show exactly? a)A TM reduces to T. b)T reduces to A TM. c)T and A TM reduce to each other. d)None of the above or more than one of the above. 25 We just did a reduction!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.