undecidability and reductions
play

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

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


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

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

  3. Proof of Turing’s Theorem Proof by contradiction: H accept if M accepts w reject if M rejects or loops on w Construct a new TM D (that uses H as a subroutine): On input M (i.e. the description of a Turing machine M ), 1. Run H on input M M 2. Output the opposite of H : If H accepts, D rejects; if H rejects, D accepts 3/32 Suppose A TM is decidable, then some TM H decides A TM : � M , w �

  4. Proof of Turing’s Theorem Proof by contradiction: H accept if M accepts w reject if M rejects or loops on w Construct a new TM D (that uses H as a subroutine): 2. Output the opposite of H : If H accepts, D rejects; if H rejects, D accepts 3/32 Suppose A TM is decidable, then some TM H decides A TM : � M , w � On input � M � (i.e. the description of a Turing machine M ), 1. Run H on input � M , � M ��

  5. Proof of Turing’s theorem D D H never loops indefjnitely, 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! 4/32 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 �

  6. Proof of Turing’s theorem D D H never loops indefjnitely, neither does D Contradiction! D cannot exist! H cannot exist! 4/32 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 � If D rejects � D � , then D accepts � D � If D accepts � D � , then D rejects � D �

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

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

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

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

  11. Diagonalization acc . . . . . . D rej rej acc rej . . . . . . D does the opposite of the diagonal entries D inputs w acc acc rej … all possible Turing machines loop acc loop M 1 rej … M 2 M 3 9/32 rej acc rej rej � M 1 � � M 2 � � M 3 � � M 4 � 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 �

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

  13. Unrecognizable languages How about languages that are not recognizable? Claim 11/32 The language A TM is recognizable but not decidable 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

  14. Unrecognizable languages Theorem If L and L are both recognizable, then L is decidable Proof of Claim from Theorem: 12/32 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

  15. Problem: If M loops on w , we will never go to step 2 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. 13/32 Let M = TM recognizing L , M ′ = TM recognizing L 2. Simulate M ′ on input w . If M ′ accepts, N rejects.

  16. 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. 13/32 Let M = TM recognizing L , M ′ = TM recognizing L 2. Simulate M ′ on input w . If M ′ accepts, N rejects. Problem: If M loops on w , we will never go to step 2

  17. 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 fjrst t transitions of M on input w . If M accepts, N accepts. 14/32 Let M = TM recognizing L , M ′ = TM recognizing L For t = 0 , 1 , 2 , 3 , . . . Simulate fjrst t transitions of M ′ on input w . If M ′ accepts, N rejects.

  18. Reductions

  19. Another undecidable language We’ll show: We will argue that 15/32 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

  20. 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 16/32 If HALT TM can be decided, so can A TM � M , w � � M , w �

  21. 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 17/32 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 universal TM U on input � M , w �

  22. 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 18/32 But A TM is undecidable, so R cannot exist

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

  24. Example 1 Undecidable! Intuitive reason: But then we need to know whether M halts Let’s justify this intuition 19/32 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

  25. Example 1: Figuring out the reduction We want to build a TM S S reject otherwise accept if M accepts w ? R reject otherwise R 20/32 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

  26. 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 21/32 � M , w � � M ′ � M ′ should be a Turing machine such that M ′ on input ε = M on input w Description of the machine M ′ :

  27. ? R accept if M accepts w reject otherwise S Description of S : Simulate M on input w and accept/reject according to M 22/32 � 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

  28. Example 1: The formal proof Simulate M on input w and accept/reject according to M So S decides A TM , which is impossible 23/32 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

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

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

Recommend


More recommend