inf2080
play

INF2080 Church Turing Thesis and Decidability Daniel Lupp - PowerPoint PPT Presentation

INF2080 Church Turing Thesis and Decidability Daniel Lupp Universitetet i Oslo 1st March 2018 Department of University of Informatics Oslo INF2080 Lecture :: 1st March 1 / 43 Short Recap We have looked at Turing machines as a


  1. Acceptance problem - NFA/RE What about NFAs and REs? We have seen that they have equivalent expressive power to DFAs So are the languages A NFA and A RE decidable? We can use the known procedures to convert NFA → DFA and RE → NFA! A NFA = {� B , w � | B is an NFA that accepts w } Theorem The language A NFA is decidable. Proof: M NFA = On input � B , w � 1 . Convert B to an equivalent DFA C . Simulate M DFA on input � B , w � 2 . if it accepts, accept ; if it rejects, reject . INF2080 Lecture :: 1st March 10 / 43

  2. Acceptance problem - NFA/RE A RE = {� R , w � | B is a regular expression that generates w } Theorem The language A RE is decidable. INF2080 Lecture :: 1st March 11 / 43

  3. Acceptance problem - NFA/RE A RE = {� R , w � | B is a regular expression that generates w } Theorem The language A RE is decidable. Proof: Similar to before, however now we reduce to NFA case: M RE = On input � R , w � 1 . Convert R to an equivalent NFA B . 2 . Simulate M NFA on input � B , w � if it accepts, accept ; if it rejects, reject . INF2080 Lecture :: 1st March 11 / 43

  4. Acceptance problem - Regular languages So we see that it is does not matter which computational model we use to represent the regular language; this has no effect on decidabillity INF2080 Lecture :: 1st March 12 / 43

  5. Acceptance problem - Regular languages So we see that it is does not matter which computational model we use to represent the regular language; this has no effect on decidabillity Recall the Church-Turing thesis: intuitive notion of algorithm/procedure ⇔ Turing machine algorithm INF2080 Lecture :: 1st March 12 / 43

  6. Acceptance problem - Regular languages So we see that it is does not matter which computational model we use to represent the regular language; this has no effect on decidabillity Recall the Church-Turing thesis: intuitive notion of algorithm/procedure ⇔ Turing machine algorithm Our “procedures” of converting NFA → DFA, RE → NFA, CFG ↔ PDA can be formally described using a decidable TM! INF2080 Lecture :: 1st March 12 / 43

  7. Emptiness problem - Regular languages Next “decision problem:” Given a DFA A , is the language generated by A empty? INF2080 Lecture :: 1st March 13 / 43

  8. Emptiness problem - Regular languages Next “decision problem:” Given a DFA A , is the language generated by A empty? ⇔ � A � ∈ E DFA = {� A � | A is a DFA and L ( A ) = ∅} ? INF2080 Lecture :: 1st March 13 / 43

  9. Emptiness problem - Regular languages Next “decision problem:” Given a DFA A , is the language generated by A empty? ⇔ � A � ∈ E DFA = {� A � | A is a DFA and L ( A ) = ∅} ? When does a DFA accept a string w ? INF2080 Lecture :: 1st March 13 / 43

  10. Emptiness problem - Regular languages Next “decision problem:” Given a DFA A , is the language generated by A empty? ⇔ � A � ∈ E DFA = {� A � | A is a DFA and L ( A ) = ∅} ? When does a DFA accept a string w ? When it reaches an accept state! INF2080 Lecture :: 1st March 13 / 43

  11. Emptiness problem - Regular languages Next “decision problem:” Given a DFA A , is the language generated by A empty? ⇔ � A � ∈ E DFA = {� A � | A is a DFA and L ( A ) = ∅} ? When does a DFA accept a string w ? When it reaches an accept state! So all the TM has to do is check whether an accept state is reachable from the start state. INF2080 Lecture :: 1st March 13 / 43

  12. Emptiness problem - Regular languages Next “decision problem:” Given a DFA A , is the language generated by A empty? ⇔ � A � ∈ E DFA = {� A � | A is a DFA and L ( A ) = ∅} ? When does a DFA accept a string w ? When it reaches an accept state! So all the TM has to do is check whether an accept state is reachable from the start state. We use the “marking” technique we have previously seen to keep track of the DFA’s states that have been reached. INF2080 Lecture :: 1st March 13 / 43

  13. Emptiness problem - Regular languages Theorem The language E DFA is decidable. Proof: N DFA = On input � A � 1 . Mark the start state of A . 2 . Repeat 3. until no new states are marked: 3 . Mark any state with an incoming transition from a marked state. 4 . If no accept state is reached, accept ; else, reject . INF2080 Lecture :: 1st March 14 / 43

  14. Equality problem - Regular languages What if we have two regular languages, accepted by DFAs A and B , and want to check whether they are equal? INF2080 Lecture :: 1st March 15 / 43

  15. Equality problem - Regular languages What if we have two regular languages, accepted by DFAs A and B , and want to check whether they are equal? ⇔ � A , B � ∈ EQ DFA = {� A , B � | A and B are DFAs and L ( A ) = L ( B ) } ? INF2080 Lecture :: 1st March 15 / 43

  16. Equality problem - Regular languages What if we have two regular languages, accepted by DFAs A and B , and want to check whether they are equal? ⇔ � A , B � ∈ EQ DFA = {� A , B � | A and B are DFAs and L ( A ) = L ( B ) } ? Now we use the set theoretic notion of symmetric difference to help us! INF2080 Lecture :: 1st March 15 / 43

  17. Equality problem - Regular languages What if we have two regular languages, accepted by DFAs A and B , and want to check whether they are equal? ⇔ � A , B � ∈ EQ DFA = {� A , B � | A and B are DFAs and L ( A ) = L ( B ) } ? Now we use the set theoretic notion of symmetric difference to help us! The symmetric difference of two languages L ( A ) and L ( B ) is defined as ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) INF2080 Lecture :: 1st March 15 / 43

  18. Equality problem - Regular languages What if we have two regular languages, accepted by DFAs A and B , and want to check whether they are equal? ⇔ � A , B � ∈ EQ DFA = {� A , B � | A and B are DFAs and L ( A ) = L ( B ) } ? Now we use the set theoretic notion of symmetric difference to help us! The symmetric difference of two languages L ( A ) and L ( B ) is defined as ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) L ( A ) L ( B ) INF2080 Lecture :: 1st March 15 / 43

  19. Equality problem - Regular languages What if we have two regular languages, accepted by DFAs A and B , and want to check whether they are equal? ⇔ � A , B � ∈ EQ DFA = {� A , B � | A and B are DFAs and L ( A ) = L ( B ) } ? Now we use the set theoretic notion of symmetric difference to help us! The symmetric difference of two languages L ( A ) and L ( B ) is defined as ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) L ( A ) L ( A ) L ( B ) L ( B ) INF2080 Lecture :: 1st March 15 / 43

  20. Equality problem - Regular languages What if we have two regular languages, accepted by DFAs A and B , and want to check whether they are equal? ⇔ � A , B � ∈ EQ DFA = {� A , B � | A and B are DFAs and L ( A ) = L ( B ) } ? Now we use the set theoretic notion of symmetric difference to help us! The symmetric difference of two languages L ( A ) and L ( B ) is defined as ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) L ( A ) L ( A ) L ( B ) L ( B ) Two sets are equal if and only if their symmetric difference is empty! INF2080 Lecture :: 1st March 15 / 43

  21. Equality problem - Regular languages What if we have two regular languages, accepted by DFAs A and B , and want to check whether they are equal? ⇔ � A , B � ∈ EQ DFA = {� A , B � | A and B are DFAs and L ( A ) = L ( B ) } ? Now we use the set theoretic notion of symmetric difference to help us! The symmetric difference of two languages L ( A ) and L ( B ) is defined as ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) L ( A ) L ( A ) L ( B ) L ( B ) Two sets are equal if and only if their symmetric difference is empty! → emptiness problem! INF2080 Lecture :: 1st March 15 / 43

  22. Equality problem - Regular languages ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) Recall closure properties of regular languages: closed under union, intersection, and complement (among other things) INF2080 Lecture :: 1st March 16 / 43

  23. Equality problem - Regular languages ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) Recall closure properties of regular languages: closed under union, intersection, and complement (among other things) have seen procedures for constructing the DFA for unions/intersections/complements of regular languages. INF2080 Lecture :: 1st March 16 / 43

  24. Equality problem - Regular languages ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) Recall closure properties of regular languages: closed under union, intersection, and complement (among other things) have seen procedures for constructing the DFA for unions/intersections/complements of regular languages. Using these, we can construct a DFA that accepts the symmetric difference of two regular languages. INF2080 Lecture :: 1st March 16 / 43

  25. Equality problem - Regular languages Theorem The language EQ DFA is decidable. INF2080 Lecture :: 1st March 17 / 43

  26. Equality problem - Regular languages Theorem The language EQ DFA is decidable. Proof: S DFA = On input � A , B � 1 . Construct C , the DFA of the symmetric difference of L ( A ) and L ( B ) . 2 . Run N DFA on C . (checks whether L ( C ) is empty) 3 . If N DFA accepts, accept ; if N DFA rejects, reject . INF2080 Lecture :: 1st March 17 / 43

  27. Summary - Regular languages Regular languages are decidable: INF2080 Lecture :: 1st March 18 / 43

  28. Summary - Regular languages Regular languages are decidable: the acceptance problem (does A accept w ?) is decidable, independent of the computational model in which we chose to describe regular languages; INF2080 Lecture :: 1st March 18 / 43

  29. Summary - Regular languages Regular languages are decidable: the acceptance problem (does A accept w ?) is decidable, independent of the computational model in which we chose to describe regular languages; the emptiness problem (is L ( A ) empty?) is decidable; INF2080 Lecture :: 1st March 18 / 43

  30. Summary - Regular languages Regular languages are decidable: the acceptance problem (does A accept w ?) is decidable, independent of the computational model in which we chose to describe regular languages; the emptiness problem (is L ( A ) empty?) is decidable; the equality problem (are L ( A ) and L ( B ) equal?) is decidable. INF2080 Lecture :: 1st March 18 / 43

  31. Summary - Regular languages Regular languages are decidable: the acceptance problem (does A accept w ?) is decidable, independent of the computational model in which we chose to describe regular languages; the emptiness problem (is L ( A ) empty?) is decidable; the equality problem (are L ( A ) and L ( B ) equal?) is decidable. in each case: we reduced the question to checking membership in a language. INF2080 Lecture :: 1st March 18 / 43

  32. Decision problems - CFLs What about the decision problems for context-free languages? INF2080 Lecture :: 1st March 19 / 43

  33. Decision problems - CFLs What about the decision problems for context-free languages? Are the languages A CFG = {� G , w � | G is a CFG that generates w } E CFG = {� G � | G is a CFG and L ( G ) = ∅} EQ CFG = {� G , H � | G and H are CFGs and L ( G ) = L ( H ) } decidable? INF2080 Lecture :: 1st March 19 / 43

  34. Acceptance problem - CFLs Theorem The language A CFG is decidable. Proof: INF2080 Lecture :: 1st March 20 / 43

  35. Acceptance problem - CFLs Theorem The language A CFG is decidable. Proof: We cannot do the proof analogously to the DFA case: PDAs do not necessarily always terminate (they can endlessly loop, writing on to the stack). INF2080 Lecture :: 1st March 20 / 43

  36. Acceptance problem - CFLs Theorem The language A CFG is decidable. Proof: We cannot do the proof analogously to the DFA case: PDAs do not necessarily always terminate (they can endlessly loop, writing on to the stack). Instead, we use the fact that every CFG can be converted to a grammar in Chomsky Normal Form. INF2080 Lecture :: 1st March 20 / 43

  37. Acceptance problem - CFLs Theorem The language A CFG is decidable. Proof: We cannot do the proof analogously to the DFA case: PDAs do not necessarily always terminate (they can endlessly loop, writing on to the stack). Instead, we use the fact that every CFG can be converted to a grammar in Chomsky Normal Form. One can show (Problem 2.38 in Sipser) that if a grammar is CNF, then every derivation of w has length 2 n − 1, where n is the length of w . INF2080 Lecture :: 1st March 20 / 43

  38. Acceptance problem - CFLs Theorem The language A CFG is decidable. Proof: We cannot do the proof analogously to the DFA case: PDAs do not necessarily always terminate (they can endlessly loop, writing on to the stack). Instead, we use the fact that every CFG can be converted to a grammar in Chomsky Normal Form. One can show (Problem 2.38 in Sipser) that if a grammar is CNF, then every derivation of w has length 2 n − 1, where n is the length of w . That way we only need to check all derivations of length 2 n − 1 to see if any generates w ! INF2080 Lecture :: 1st March 20 / 43

  39. Acceptance problem - CFLs Theorem The language A CFG is decidable. Proof: M CFG = On input � G , w � 1 . Convert G to a CFG in Chomsky Normal Form. 2 . If n = 0, where n is the length of w , list all derivations with 1 step. Else, list all derivations with 2 n − 1 steps. 3 . If any of the derivations generate w accept ; otherwise, reject . INF2080 Lecture :: 1st March 21 / 43

  40. Decidability of CFLs As in the regular language case, we can use this last result to show: Corollary Every context-free language is decidable. INF2080 Lecture :: 1st March 22 / 43

  41. Decidability of CFLs As in the regular language case, we can use this last result to show: Corollary Every context-free language is decidable. Proof: completely analogous to the DFA/regular case: M L = On input w 1 . Simulate M CFG on � B , w � . 2 . If M CFG accepts, accept , if it rejects, reject . INF2080 Lecture :: 1st March 22 / 43

  42. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Proof idea: In the DFA case, we checked reachability of accept states from the start state through a marking procedure. INF2080 Lecture :: 1st March 23 / 43

  43. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Proof idea: In the DFA case, we checked reachability of accept states from the start state through a marking procedure. Can we do the same here? INF2080 Lecture :: 1st March 23 / 43

  44. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Proof idea: In the DFA case, we checked reachability of accept states from the start state through a marking procedure. Can we do the same here? Yes! but slightly differently. Consider the grammar consisting of only S → S . If we were to start with S and iteratively generate all derivations, we would never terminate. INF2080 Lecture :: 1st March 23 / 43

  45. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Proof idea: In the DFA case, we checked reachability of accept states from the start state through a marking procedure. Can we do the same here? Yes! but slightly differently. Consider the grammar consisting of only S → S . If we were to start with S and iteratively generate all derivations, we would never terminate. We’re interested in finding out whether a string of terminals can be generated from S . So why not first mark terminals, then mark a variable A if there is a rule A → s where s consists of marked symbols? INF2080 Lecture :: 1st March 23 / 43

  46. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Proof idea: In the DFA case, we checked reachability of accept states from the start state through a marking procedure. Can we do the same here? Yes! but slightly differently. Consider the grammar consisting of only S → S . If we were to start with S and iteratively generate all derivations, we would never terminate. We’re interested in finding out whether a string of terminals can be generated from S . So why not first mark terminals, then mark a variable A if there is a rule A → s where s consists of marked symbols? → go through derivations “backwards”. If S is marked, then a string of terminals can be generated. INF2080 Lecture :: 1st March 23 / 43

  47. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Example: Grammar S → ARB A → a B → b R → aRb | ε INF2080 Lecture :: 1st March 24 / 43

  48. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Example: Grammar S → ARB A → ˙ a B → ˙ b aR ˙ R → ˙ b | ˙ ε INF2080 Lecture :: 1st March 25 / 43

  49. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Example: Grammar S → ˙ A ˙ R ˙ B ˙ A → ˙ a B → ˙ ˙ b ˙ a ˙ R ˙ R → ˙ b | ˙ ε INF2080 Lecture :: 1st March 26 / 43

  50. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Example: Grammar S → ˙ ˙ A ˙ R ˙ B ˙ A → ˙ a B → ˙ ˙ b ˙ a ˙ R ˙ R → ˙ b | ˙ ε INF2080 Lecture :: 1st March 27 / 43

  51. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Example: Grammar S → ˙ ˙ A ˙ R ˙ B ˙ A → ˙ a B → ˙ ˙ b ˙ a ˙ R ˙ R → ˙ b | ˙ ε → S is marked, so language is not empty! INF2080 Lecture :: 1st March 27 / 43

  52. Emptiness problem - CFLs Theorem The language E CFG = {� G � | G is a CFG and L ( G ) = ∅} is decidable. Proof: N CFG = On input � G � 1 . Mark all terminal symbols in G . 2 . Repeat 3. until no new variables are marked: 3 . Mark any variable A where G has a rule A → U 1 . . . U k and each symbol U i has been marked. 4 . If the start variable is not marked, accept . otherwise, reject . INF2080 Lecture :: 1st March 28 / 43

  53. Equality problem - CFLs So what about EQ CFG = {� G , H � | G and H are CFGs and L ( G ) = L ( H ) } ? Is it decidable? Before we used the symmetric difference ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) to use the emptiness decider. INF2080 Lecture :: 1st March 29 / 43

  54. Equality problem - CFLs So what about EQ CFG = {� G , H � | G and H are CFGs and L ( G ) = L ( H ) } ? Is it decidable? Before we used the symmetric difference ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) to use the emptiness decider. But context-free languages are not closed under complementation or intersection! INF2080 Lecture :: 1st March 29 / 43

  55. Equality problem - CFLs So what about EQ CFG = {� G , H � | G and H are CFGs and L ( G ) = L ( H ) } ? Is it decidable? Before we used the symmetric difference ( L ( A ) ∩ L ( B )) ∪ ( L ( A ) ∩ L ( B )) to use the emptiness decider. But context-free languages are not closed under complementation or intersection! in fact, EQ CFG is not decidable. Tomorrow we’ll see techniques to show this. INF2080 Lecture :: 1st March 29 / 43

  56. Summary- CFLs the acceptance and emptiness decision problems are decidable for context-free languages hence, each context-free language is decidable. checking equivalence of two grammars (in the sense of languages generated) is not decidable! INF2080 Lecture :: 1st March 30 / 43

  57. Acceptance problems - TMs What about Turing-recognizable languages? Are they also decidable? INF2080 Lecture :: 1st March 31 / 43

  58. Acceptance problems - TMs What about Turing-recognizable languages? Are they also decidable? If they were, every Turing machine could be converted into an equivalent TM that is guaranteed to halt on every input! INF2080 Lecture :: 1st March 31 / 43

  59. Acceptance problem - TMs First things first... Theorem The language A TM = {� M , w � | M is a TM that accepts w } is Turing-recognizable. INF2080 Lecture :: 1st March 32 / 43

  60. Acceptance problem - TMs First things first... Theorem The language A TM = {� M , w � | M is a TM that accepts w } is Turing-recognizable. Proof: U = On input � M , w � 1 . Simulate M on w . 2 . If M ever enters its accept state, accept ; if M ever enters its reject state, reject . INF2080 Lecture :: 1st March 32 / 43

  61. Acceptance problem - TMs First things first... Theorem The language A TM = {� M , w � | M is a TM that accepts w } is Turing-recognizable. Proof: U = On input � M , w � 1 . Simulate M on w . 2 . If M ever enters its accept state, accept ; if M ever enters its reject state, reject . U is an example of a universal Turing machine ! INF2080 Lecture :: 1st March 32 / 43

  62. Acceptance problem - TMs So what about decidability? INF2080 Lecture :: 1st March 33 / 43

  63. Acceptance problem - TMs So what about decidability? Let’s assume there exists a decider H for A TM , i.e., H ( � M , w � ) = accept if M accepts w , and H ( � M , w � ) = reject if M does not accept w . INF2080 Lecture :: 1st March 33 / 43

  64. Acceptance problem - TMs So what about decidability? Let’s assume there exists a decider H for A TM , i.e., H ( � M , w � ) = accept if M accepts w , and H ( � M , w � ) = reject if M does not accept w . We are going to use a standard mathematical trick in order to create a contradiction INF2080 Lecture :: 1st March 33 / 43

  65. Diagonalization method Let’s write all Turing machines into the following table: � M 1 � � M 2 � � M 3 � . . . M 1 accept accept M 2 accept M 3 accept accept accept . . . Each cell ( i , j ) represents whether M i accepts the string � M j � (the string representation of machine M j ). accept means that it accepts, blank means it loops or rejects. INF2080 Lecture :: 1st March 34 / 43

  66. Diagonalization method Let’s write all Turing machines into the following table: � M 1 � � M 2 � � M 3 � . . . M 1 accept accept M 2 accept M 3 accept accept accept . . . Each cell ( i , j ) represents whether M i accepts the string � M j � (the string representation of machine M j ). accept means that it accepts, blank means it loops or rejects. The decider H let’s us fill out the blank cells with reject . INF2080 Lecture :: 1st March 34 / 43

  67. Diagonalization method Result of H with input M i , � M j � : � M 1 � � M 2 � � M 3 � . . . M 1 accept reject accept M 2 reject reject accept M 3 accept accept accept . . . Each cell ( i , j ) represents H ( � M i , � M j �� ) INF2080 Lecture :: 1st March 35 / 43

  68. Diagonalization method Result of H with input M i , � M j � : � M 1 � � M 2 � � M 3 � . . . M 1 accept reject accept M 2 reject reject accept M 3 accept accept accept . . . Each cell ( i , j ) represents H ( � M i , � M j �� ) We create a new decider D that considers the diagonal INF2080 Lecture :: 1st March 36 / 43

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend