decidability
play

Decidability M Does Machine have three states ? Is string - PDF document

Review Languages and Grammars Alphabets, strings, languages Regular Languages Deterministic Finite and Nondeterministic Automata Equivalence of NFA and DFA Regular Expressions CS 301 - Lecture 25 Regular Grammars


  1. Review • Languages and Grammars – Alphabets, strings, languages • Regular Languages – Deterministic Finite and Nondeterministic Automata – Equivalence of NFA and DFA – Regular Expressions CS 301 - Lecture 25 – Regular Grammars – Properties of Regular Languages – Languages that are not regular and the pumping lemma Computability and Decidability • Context Free Languages – Context Free Grammars – Derivations: leftmost, rightmost and derivation trees – Parsing and ambiguity – Simplifications and Normal Forms – Nondeterministic Pushdown Automata – Pushdown Automata and Context Free Grammars – Deterministic Pushdown Automata Fall 2008 – Pumping Lemma for context free grammars – Properties of Context Free Grammars • Turing Machines – Definition, Accepting Languages, and Computing Functions – Combining Turing Machines and Turing’s Thesis – Turing Machine Variations – Universal Turing Machine and Linear Bounded Automata – Recursive and Recursively Enumerable Languages, Unrestricted Grammars – Context Sensitve Grammars and the Chomsky Hierarchy • Computational Limits and Complexity – Today: Computability and Decidability Consider problems with answer YES or NO Examples: Decidability M • Does Machine have three states ? • Is string a binary number? w M • Does DFA accept any input? 1

  2. The Turing machine that decides (solves) A problem is decidable if some Turing machine a problem answers YES or NO decides (solves) the problem for each input in the problem domain Decidable problems: M • Does Machine have three states ? YES Input Turing Machine problem • Is string a binary number? w instance NO • Does DFA accept any input? M The domain is essential… part 1 The domain is essential… part 2 Problem: is the following context- Problem: is an arbitrary context-free free language ambigous? language ambigous? • Clearly we can decide this problem this problem for some grammars in the domain. • Clearly we can decide this problem. • The problem is decidable only if we can answer this for all grammars in the domain (the above grammar is not ambiguous) 2

  3. Some problems are undecidable: The Halting Problem • Turing Machine M which means: Input: there is no Turing Machine that • String w solves all instances of the problem Question: Does halt on input ? w M A simple undecidable problem: The halting problem H Theorem: Thus, there exists Turing Machine that solves the halting problem The halting problem is undecidable w M (there are and for which we cannot M halts on w M YES w decide whether halts on input ) M H w NO M doesn’t halt on w Proof: Assume for contradiction that the halting problem is decidable 3

  4. Construction of H Construct machine : H ′ H If returns YES then loop forever H Input: YES q y initial tape contents If returns NO then halt H w M w q 0 q NO n Encoding String of M w ˆ Construct machine : H H ′ w M Input: (machine ) M H Loop forever YES q q q y a b w M halts on input If M w M w q 0 Then loop forever NO q n Else halt 4

  5. ˆ Run machine with input itself: H w ˆ ˆ Input: (machine ) H ˆ H H w M w copy M w H ′ M ˆ w ˆ w H halts on input If H M Then loop forever Else halt Therefore, we have contradiction ˆ w ˆ : H on input H ˆ If halts then loops forever H The halting problem is undecidable ˆ If doesn’t halt then it halts H NONSENSE !!!!! END OF PROOF 5

  6. Theorem: Another proof of the same theorem: The halting problem is undecidable If the halting problem was decidable then every recursively enumerable language Proof: Assume for contradiction that would be recursive the halting problem is decidable L H Let be a recursively enumerable language There exists Turing Machine that solves the halting problem Let be the Turing Machine that accepts M L M halts on w M YES H w NO M doesn’t halt on w We will prove that is also recursive: L we will describe a Turing machine that accepts and halts on any input L 6

  7. Turing Machine that accepts L Therefore L is recursive and halts on any input H M L NO Since is chosen arbitrarily, every reject w recursively enumerable language w M halts on ? is also recursive YES w accept w But there are recursively enumerable Halts on final state M Run languages which are not recursive w with input reject w Halts on non-final Contradiction!!!! state The Membership Problem Input: • Turing Machine M Therefore, the halting problem is undecidable • String w Question: M Does accept ? w w ∈ L ( M ) ? END OF PROOF 7

  8. Theorem: H Thus, there exists a Turing Machine that solves the membership problem The membership problem is undecidable w (there are and for which we cannot M M accepts w M YES decide whether ) w ∈ L ( M ) H w NO M rejects w Proof: Assume for contradiction that the membership problem is decidable L Let be a recursively enumerable language Turing Machine that accepts L and halts on any input Let be the Turing Machine that accepts M L H M YES accept w w M accepts ? NO w reject w We will prove that is also recursive: L we will describe a Turing machine that accepts and halts on any input L 8

  9. Therefore, L is recursive L Since is chosen arbitrarily, every recursively enumerable language is also Therefore, the membership problem recursive is undecidable But there are recursively enumerable languages which are not recursive Contradiction!!!! END OF PROOF Are These Problems Undecidable? Some Undecidable Problems State-entry Problem: Halting Problem: q Does machine enter state M w Does machine halt on input ? M on input ? w Blank-tape halting problem: Membership problem: Does machine halt when starting M on blank tape? w Does machine accept string ? M Could start from scratch for each problem… instead could we use our previous results?? 9

  10. A B Problem is reduced to problem If we can solve problem then B Reducibility we can solve problem A B A A B Problem is reduced to problem Example: the halting problem is reduced to If is decidable then is decidable B A the state-entry problem If is undecidable then is undecidable A B 10

  11. Theorem: The state-entry problem The state-entry problem is undecidable Inputs: • Turing Machine M • State q • String w Proof: Reduce the halting problem to Question: Does M enter state q the state-entry problem on input ? w Suppose we have a Decider We want to build a decider for the state-entry algorithm: for the halting problem: YES YES M M q M M enters halts on w state-entry Halting problem w problem decider decider NO doesn’t NO doesn’t w q q w M M enter halt on 11

  12. We want to reduce the halting problem to We need to convert one problem instance the state-entry problem: to the other problem instance Halting problem decider Halting problem decider M M YES YES M ′ M ′ Convert YES YES State-entry State-entry q q Inputs problem problem NO NO w w NO NO ? decider decider w w M M ′ Convert to : q • Add new state w M halts on input • From any halting state of add transitions to q M if and M ′ only if q w M ′ halts on state on input q M Single halting states halt state 12

  13. We reduced the halting problem to the state-entry problem Halting problem decider YES M ′ YES State-entry Since the halting problem is undecidable, Generate q M problem the state-entry problem is undecidable w NO M ′ NO decider w END OF PROOF Another example: The blank-tape halting problem the halting problem Input: Turing Machine M is reduced to the blank-tape halting problem Question: Does M halt when started with a blank tape? 13

  14. We want to reduce the halting problem to Theorem: the blank-tape halting problem: The blank-tape halting problem is undecidable Halting problem decider M YES YES Blank-tape Proof: Reduce the halting problem to the M w halting problem NO NO decider w blank-tape halting problem We need to convert one problem instance What’s Next to the other problem instance • Read – Linz Chapter 1,2.1, 2.2, 2.3, (skip 2.4), 3, 4, 5, 6.1, 6.2, (skip 6.3), 7.1, 7.2, 7.3, (skip 7.4), 8, 9, 10, 11, 12 Halting problem decider – JFLAP Chapter 1, 2.1, (skip 2.2), 3, 4, 5, 6, 7, (skip 8), 9, (skip 10), 11 • Next Lecture Topics – No Lecture on Thurs 11/20 M YES • Quiz 4 in Recitation on Wednesday 12/3 YES Convert Blank-tape – Covers Linz 9, 10 and JFLAP 9, 11 M w halting problem – Closed book, but you may bring one sheet of 8.5 x 11 inch paper with any notes you Inputs NO like. NO decider – Quiz will take the full hour w ? Homework • – Homework Due Tuesday After Thanksgiving 14

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