1 / 14

Chapter 11: Decidability

Chapter 11: Decidability. Three important questions: Do two regular expressions define the same language? Do two finite automata accept the same language? Does the language defined by a finite automaton have a finite number of words? Infinite? None?. Chapter 11: Decidability.

chaeli
Télécharger la présentation

Chapter 11: Decidability

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 11: Decidability Three important questions: • Do two regular expressions define the same language? • Do two finite automata accept the same language? • Does the language defined by a finite automaton have a finite number of words? Infinite? None? Zaguia/Stojmenovic

  2. Chapter 11: Decidability A problem is called a decision problem if its solution is either YES or NO. Definition: a decision problem is decidable, or effectively solvable, if there is an algorithm that can find the answer for any input in a finite number of steps. Zaguia/Stojmenovic

  3. Chapter 11: Decidability • Do two regular expressions define the same language? • Do two finite automata accept the same language? Problems 1 and 2 are equivalent: It is enough to transfer the two regular expressions into equivalent finite automata (it could be done in a finite number of steps) and then resolve Problem 2. Or we can transfer the two finite automata into regular expressions (it could be done in a finite number of steps) and then resolve Problem 1. Zaguia/Stojmenovic

  4. Chapter 11: Decidability Problem 2: Finite algorithm From two finite automata that accept languages L1 and L2, we construct a finite automaton that accepts (L1 L2’) + (L2 L1’) L1 and L2 are equivalent if and only if this languages is empty. Method 1:Convert this finite automaton into a regular expression (using the finite algorithm defined in the proof of Kleene’s theorem). If you end up with a regular expression then the language is not empty, otherwise it is empty. Zaguia/Stojmenovic

  5. r – + a,b a,b + – Chapter 11: Decidability If the algorithm leads to: Then the finite automaton accepts at least one word If the algorithm leads to: OR similar case Then the finite automaton does not accept any word Zaguia/Stojmenovic

  6. Chapter 11: Decidability Method 2: Answer the question: is there any path from – to +? Algorithm: • Mark the start state. (Paint it blue.) • From every blue state, follow every arrow that goes out of the state, and paint the destination state blue. Delete each arrow that was followed. • Repeat step 2 until there are no new blue states. • If there is any final state that is blue, then there are words in the language accepted by the finite automaton. If not, the language is empty. Zaguia/Stojmenovic

  7. a a b a a b b a,b b + – a b a a b a b b a,b + – a b a b a b + – a b Chapter 11: Decidability Zaguia/Stojmenovic

  8. b a b + – a a b a b + – a b Chapter 11: Decidability The language is empty. Zaguia/Stojmenovic

  9. Chapter 11: Decidability Theorem. Let F be a finite automaton with N states. If the language accepted by F is not empty, then it contains at least one word with N or fewer letters. Method 3. Try all words with N and fewer letters. If the finite automaton accepts none of them, then the language accepted by this automaton is empty. Zaguia/Stojmenovic

  10. a a,b b p1+ p2 a a,b b q1– q2+ b s2+ s1– b r2 r1+ a,b a,b a b a b s3 a r3+ a Chapter 11: Decidability a* FA1 FA1’ FA2’ L+aa* FA2 Zaguia/Stojmenovic

  11. a q1 or r1 p1 or s1 a a a — — q1 or r3 p1 or s3 b b b b a,b a,b q2 or r2 p2 or s2 Chapter 11: Decidability (FA2’ + FA1)’ (FA1’ + FA2)’ (FA1’ + FA2)’ + (FA2’ + FA1)’? FA1 and FA2 represent the same language What if one of these two machines has a final state? Zaguia/Stojmenovic

  12. Chapter 11: Decidability Problem 3. Does the language defined by a finite automaton has a finite number of words? Infinite? None? none? Same algorithms, compare FA1 (or r1) with empty L2 or corresponding FA2. finite or infinite language? Solution 1: Does corresponding RE contain * ? Solution 2: Use the following theorem. Zaguia/Stojmenovic

  13. Theorem. Let F be a finite automaton with N states. F accepts a word w such that N  length(w) < 2N if and only if the language accepted by F is infinite. Proof: Apply Pumping lemma.  If w, N  length(w) is accepted then w created loop while following N states  pumping lemma creates infinite number of accepted words  If language accepted by F is infinite then consider any accepted word with length > N. This word creates loop in FA. Shorten the word by cutting one loop, it will be reduced by length up to N. repeat until length falls between N and 2N. Zaguia/Stojmenovic

  14. Chapter 11: Decidability Theorem. There is an algorithm that can decide whether a finite automaton accepts a finite or infinite language. Algorithm: It is enough to check all words of length between N and 2N. There is a finite number of tests to be done, and every check needs a finite number of steps. Zaguia/Stojmenovic

More Related