1 / 23

CSCI 2670 Introduction to Theory of Computing

CSCI 2670 Introduction to Theory of Computing. September 9, 2004. Agenda. Yesterday Proved correspondence between DFA’s and RE’s Began an example converting a DFA to an RE Today Complete example Learn how to prove languages are not regular. Next week. New method for describing languages

dmaxine
Télécharger la présentation

CSCI 2670 Introduction to Theory of Computing

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. CSCI 2670Introduction to Theory of Computing September 9, 2004

  2. Agenda • Yesterday • Proved correspondence between DFA’s and RE’s • Began an example converting a DFA to an RE • Today • Complete example • Learn how to prove languages are not regular

  3. Next week • New method for describing languages • Context-free grammars • Read Section 2.1 (pages 91 – 101)

  4. Converting a GNFA to a RE • If the GNFA has two states, then the label connecting the states is the RE • Otherwise, remove one state at a time without changing the language accepted by the machine until the GNFA has two states

  5. a12 q2 q1 a32 a13 q3 a33 Removing one state from a GNFA a12a13a33*a32 q1’ q2’

  6. a12 a22 a11 q2 q1 a21 a13 a32 a23 a31 q3 a33 Accounting for loops a22a23a33*a32 a11a13a33*a31 a12a13a33*a32 q1’ q2’ a21a23a33*a31

  7. 1 1 0 q1 q2 0 Example

  8. qs qt Example 1 1 0 q1 q2 0 ε ε Step 1: Add two new states

  9. qs qt Example 1 101*0 1 0 q1 q2 0 ε ε 1*0 Step 2: Remove q1

  10. qs qt Example 101*0 q2 ε 1*0 1*0(101*0)* Step 3: Remove q2

  11. 1 1 0 q1 q2 0 Example So this DFA Is equivalent to the regular expression 1*0(101*0)*

  12. Nonregular languages • So far, we have explored several ways to identify regular languages • DFA’s, NFA’s, GNFA’s, RE’s • There are many nonregular languages • {0n1n | n  0} • {101,101001,1010010001,…} • {w | w has the same number of 0s and 1s} • How can we tell if a language is not regular?

  13. Property of regular languages • All regular languages can be generated by finite automata • States must be reused if the length of a string is greater than the number of states • If states are reused, there will be repetition

  14. The pumping lemma Theorem: If A is a regular language, then there is a number p where, if s is any string in A of length at least p, then s may be divided into three pieces, s = xyz, satisfying the following conditions • for each i  0, xyizis in A • |y| > 0, and • |xy|  p p is called the pumping length

  15. Proof idea • Pumping length is equal to the number of states in the DFA whose language is A • p = |Q| • If A accepts a word w with |w| > p, then some state must be entered twice while processing w • Pigeonhole principle

  16. y x z Proof idea • for each i  0, xyizis in A • |y| > 0, and • |xy|  p

  17. Using the pumping lemma • We can use the pumping lemma to prove a language B is not regular • Assume B is regular • Show that the pumping lemma is not satisfied • Proof by contradiction

  18. Example • B={101,101001,1010010001,…} • The jth and (j+1)th 1’s are separated by j 0’s • Assume B is regular and let w be any string in B • Let w=xyz, where |y|>0 • We cannot make any assumptions on the value of p • We want to show that no matter what y is, there is some i for which xyizB

  19. Example (cont.) • There are 3 possibilities for y • y has no 1’s • y = 0b for some b > 0 • y has one 1 • y = 0b10c for some b,c  0 • y has two or more 1’s • y = 0b10c1v for some b,c  0 and some v* • If y=0b then xy2z  B • The number of 1’s between the last 1 in x and the fist 1 in z has increased

  20. Example (cont.) • There are 3 possibilities for y • y has no 1’s • y = 0b for some b > 0 • y has one 1 • y = 0b10c for some b,c  0 • y has two or more 1’s • y = 0b10c1v for some b,c  0 and some v* • If y = 0b10c then xy3z B • There are two consecutive 1’s with b+c 0’s between them

  21. Example (cont.) • There are 3 possibilities for y • y has no 1’s • y = 0b for some b > 0 • y has one 1 • y = 0b10c for some b,c  0 • y has two or more 1’s • y = 0b10c1v for some b,c  0 and some v* • If y=0b10c1v then xy2z  B • There are c 0’s between a pair of consecutive 1’s twice

  22. Example (cont.) • Therefore, the pumping lemma is not satisfied so B is not a regular language • For every p and every y with |y| > 0, we can show that xyiz  B for some i

  23. Have an excellent weekend

More Related