undecidability and reductions
play

Undecidability and Reductions CSCI 3130 Formal Languages and - PowerPoint PPT Presentation

1/35 Undecidability and Reductions CSCI 3130 Formal Languages and Automata Theory Siu On CHAN Chinese University of Hong Kong Fall 2015 2/35 Undecidability Turings Theorem A TM = { M , w | Turing machine M accepts input w } The


  1. 1/35 Undecidability and Reductions CSCI 3130 Formal Languages and Automata Theory Siu On CHAN Chinese University of Hong Kong Fall 2015

  2. 2/35 Undecidability Turing’s Theorem A TM = {� M , w � | Turing machine M accepts input w } The language A TM is undecidable Note that a Turing machine M may take as input its own description � M �

  3. 3/35 Proof of Turing’s Theorem Proof by contradiction: H accept if M accepts w reject if M rejects or loops on w If w M , H M M accept if M accepts M reject if M rejects or loops on M Suppose A TM is decidable, then some TM H decides A TM : � M , w �

  4. 3/35 Proof of Turing’s Theorem Proof by contradiction: H accept if M accepts w reject if M rejects or loops on w H Suppose A TM is decidable, then some TM H decides A TM : � M , w � If w = � M � , accept if M accepts � M � � M , � M �� reject if M rejects or loops on � M �

  5. 4/35 Proof of Turing’s theorem H accept if M accepts � M � � M , � M �� reject if M rejects or loops on � M � Let H ′ be a TM that does the opposite of H accept states in H becomes reject states in H ′ , and vice versa accept if M rejects or loops on � M � � M , � M �� H ′ reject if M accepts � M �

  6. 5/35 Proof of Turing’s theorem Let D be the following TM: copy accept if M rejects or loops on � M � � M , � M �� H ′ reject if M accepts � M � � M , � M �� � M � H ′

  7. 6/35 Proof of Turing’s theorem D D H never loops indefinitely, neither does D If D rejects D , then D accepts D If D accepts D , then D rejects D Contradiction! D cannot exist! H cannot exist! accept if M rejects or loops on � M � � M � reject if M accepts � M � What happens when M = D ? accept if D rejects or loops on � D � � D � reject if D accepts � D �

  8. 6/35 D H never loops indefinitely, neither does D Proof of Turing’s theorem Contradiction! D cannot exist! H cannot exist! D accept if M rejects or loops on � M � � M � reject if M accepts � M � What happens when M = D ? or loops on � D � ✘ accept if D rejects ✘✘✘ � D � reject if D accepts � D � If D rejects � D � , then D accepts � D � If D accepts � D � , then D rejects � D �

  9. 7/35 Proof of Turing’s theorem: conclusion Proof by contradiction But D cannot exist! Conclusion Assume A TM is decidable Then there are TM H , H ′ and D The language A TM is undecidable

  10. 8/35 acc . . . loop acc rej acc rej rej loop rej … rej Diagonalization loop rej Turing machines all possible inputs w … all possible (Entries in this table are all made up for illustration) acc rej rej acc 0 1 00 ε M 1 M 2 M 3 M 4 Write an infinite table for the pairs ( M , w )

  11. 9/35 Diagonalization . . . acc loop acc acc acc acc acc loop … rej acc rej rej Turing machines inputs w … all possible Only look at those w that describe Turing machines acc loop rej rej � M 1 � � M 2 � � M 3 � � M 4 � M 1 M 2 M 3 M 4

  12. 10/35 rej acc . . . . . . D acc acc rej rej . . . . . . acc loop Diagonalization rej inputs w … all possible Turing machines loop acc rej rej rej acc rej … � M 1 � � M 2 � � M 3 � � M 4 � M 1 M 2 M 3 If A TM is decidable, then TM D is in the table

  13. 11/35 acc . . . . . . D rej rej Diagonalization rej . . . . . . D does the opposite of the diagonal entries D acc acc acc rej … all possible Turing machines loop acc loop rej rej rej acc rej … inputs w � M 1 � � M 2 � � M 3 � � M 4 � M 1 M 2 M 3 D on � M i � = opposite of M i on � M i � accept if D rejects or loops on � D � � D � reject if D accepts � D �

  14. 12/35 . acc acc acc rej . . . . . D Diagonalization rej acc rej rej ? . . . . loop acc . rej inputs w … all possible Turing machines … loop acc rej loop rej rej acc rej . � M 1 � � M 2 � � M 3 � � M 4 � � D � M 1 M 2 M 3 We run into trouble when we look at ( D , � D � )

  15. 13/35 Unrecognizable languages Claim The language A TM is recognizable but not decidable How about languages that are not recognizable? A TM = {� M , w � | M is a TM that does not accept w } = {� M , w � | M rejects or loops on input w } The language A TM is not recognizable

  16. 14/35 Unrecognizable languages Theorem If L and L are both recognizable, then L is decidable Proof of Claim from Theorem: We know A TM is recognizable if A TM were also, then A TM would be decidable But Turing’s Theorem says A TM is not decidable

  17. Problem: If M loops on w , we will never go to step 2 15/35 Unrecognizable languages Theorem If L and L are both recognizable, then L is decidable Proof idea: The following Turing machine N decides L : On input w , 1. Simulate M on input w . If M accepts, N accepts. Let M = TM recognizing L , M ′ = TM recognizing L 2. Simulate M ′ on input w . If M ′ accepts, N rejects.

  18. 15/35 Unrecognizable languages Theorem If L and L are both recognizable, then L is decidable Proof idea: The following Turing machine N decides L : On input w , 1. Simulate M on input w . If M accepts, N accepts. Problem: If M loops on w , we will never go to step 2 Let M = TM recognizing L , M ′ = TM recognizing L 2. Simulate M ′ on input w . If M ′ accepts, N rejects.

  19. 16/35 Unrecognizable languages Theorem If L and L are both recognizable, then L is decidable Proof idea (2nd attempt): The following Turing machine N decides L : On input w , Simulate first t transitions of M on input w . If M accepts, N accepts. Let M = TM recognizing L , M ′ = TM recognizing L For t = 0 , 1 , 2 , 3 , . . . Simulate first t transitions of M ′ on input w . If M ′ accepts, N rejects.

  20. 17/35 Reductions

  21. 18/35 Another undecidable language We’ll show: We will argue that HALT TM = {� M , w � | M is a TM that halts on input w } HALT TM is an undecidable language If HALT TM is decidable, then so is A TM …but by Turing’s theorem, A TM is not

  22. 19/35 Undecidability of halting Suppose H decides HALT TM H accept if M halts on w reject if M loops on w We want to construct a TM S that decides A TM ? accept if M accepts w reject if M rejects or loops on w If HALT TM can be decided, so can A TM � M , w � � M , w �

  23. 20/35 Undecidability of halting Let H be a TM that decides HALT TM The following TM S decides A TM If H rejects, reject If U accepts, accept; else reject HALT TM = {� M , w � | M is a TM that halts on input w } A TM = {� M , w � | M is a TM that accepts input w } Suppose HALT TM is decidable On input � M , w � : Run H on input � M , w � If H accepts, run U on input � M , w �

  24. 21/35 Reductions Steps for showing that a language L is undecidable: 1. If some TM R decides L 2. Using R , build another TM S that decides A TM But A TM is undecidable, so R cannot exist

  25. seems to require simulating M 22/35 Example 1 Undecidable! Intuitive reason: To know whether M accepts But then we need to know whether M halts Let’s justify this intuition A ′ TM = {� M � | M is a TM that accepts input ε } Is A ′ TM decidable? Why?

  26. 22/35 Example 1 Undecidable! Intuitive reason: But then we need to know whether M halts Let’s justify this intuition A ′ TM = {� M � | M is a TM that accepts input ε } Is A ′ TM decidable? Why? To know whether M accepts ε seems to require simulating M

  27. 23/35 We want to build a TM S S reject otherwise accept if M accepts w R Example 1: Figuring out the reduction ? reject otherwise R Suppose A ′ TM can be decided by a TM R accept if M ′ accepts ε � M ′ � � M ′ � � M , w � M ′ should be a Turing machine such that M ′ on input ε = M on input w

  28. 24/35 Example 1: Implementing the reduction ? On input z 1. Simulate M on input w 2. If M accepts w , accept 3. If M rejects w , reject � M , w � � M ′ � M ′ should be a Turing machine such that M ′ on input ε = M on input w Description of the machine M ′ :

  29. 25/35 ? R accept if M accepts w reject otherwise S Description of S : Simulate M on input w and accept/reject according to M � M ′ � � M , w � On input � M , w � where M is a TM 1. Construct the following TM M ′ : M ′ = a TM such that on input z , 2. Run R on input � M ′ � and accept/reject according to R

  30. 26/35 Example 1: The formal proof Simulate M on input w and accept/reject according to M So S decides A TM , which is impossible A ′ TM = {� M � | M is a TM that accepts input ε } A TM = {� M , w � | M is a TM that accepts input w } Suppose A ′ TM is decidable by a TM R . Consider the TM S : On input � M , w � where M is a TM 1. Construct the following TM M ′ : M ′ = a TM such that on input z , 2. Run R on input � M ′ � and accept/reject according to R Then S accepts � M , w � if and only if M accepts w

  31. To know whether M accepts some strings seems to require simulating M 27/35 Example 2 Undecidable! Intuitive reason: But then we need to know whether M halts Let’s justify this intuition A ′′ TM = {� M � | M is a TM that accepts some input strings } Is A ′′ TM decidable? Why?

Recommend


More recommend