1 / 19

CSCI 2670 Introduction to Theory of Computing

CSCI 2670 Introduction to Theory of Computing. August 26, 2004. Agenda. Last class Defined regular languages Discussed creating DFA’s This class Finish Section 1.1 Next week Section 1.2 (pages 47 – 63) Read pages 47 – 54 this weekend. Announcement.

wilsonjames
Download Presentation

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 August 26, 2004

  2. Agenda • Last class • Defined regular languages • Discussed creating DFA’s • This class • Finish Section 1.1 • Next week • Section 1.2 (pages 47 – 63) • Read pages 47 – 54 this weekend

  3. Announcement • Tutorials will be in room 524 with Junfeng Qu • Monday 8:00 – 9:00 AM • Thursday 4:00 – 5:00 PM

  4. Designing finite automata • Select states specifically to reflect some important concept • Ensure this meaning is relevant to the language you are trying to define • Try to get “in the head” of the automaton

  5. Example • Design a DFA accepting all strings over {0,1,2,3} such that the sum of the symbols in the string is equivalent to 2 modulo 4 or 3 modulo 4

  6. Step 1 • What states do we need? • One state for each value modulo 4 • q1 represents 1 modulo 4 • q2 represents 2 modulo 4 • q3 represents 3 modulo 4 • q4 represents 0 modulo 4

  7. Step 2 • Create the state transition table

  8. Step 3 • What do we know? • Q, , and  • So we still need q0 and F • q0 = q4 • F = {q2, q3}

  9. 3 1 0 q1 q2 0 2 2 3 1 1 3 2 2 q4 q3 0 0 1 3 Draw DFA

  10. Combining regular languages • We can create a regular language from other regular languages A and B using specific allowable operations called regular operations • Union: AB • Concatenation: AB • Kleene star: A*

  11. Union is a regular operation Theorem: The class of regular languages is closed under the union operation Proof approach: Assume A1 and A2 are both regular languages with A1=L(M1) and A2=L(M2) and create a DFA M such that L(M) = A1A2 Method: Proof by construction

  12. Idea of construction • Each state of the new DFA represents both where the same word would be if it was being processed in M1and where it would be if it were processed in M2 • Keeping track of the progress of the string in both DFA’s simultaneously

  13. 0,1 0 0 1 q1’ q2’ q3’ q1 q2 q3 1 0 0 0 1 1 1 M1 M2 0 q3,q1’ q2,q1’ 0 1 q1,q2’ q1,q1’ 1 1 q3,q2’ Example Maximum number of states? 9 product of number of states in M1 and in M2 etc.

  14. Formally defining M • M = (Q,,,q0,F) • Q = Q1 × Q2 • Q1 and Q2 are the states in machines M1and M2, respectively •  = 1 2 • 1 and 2 are the alphabets for machines M1and M2, respectively • ((r1,r2),a) = (1(r1,a), 2(r2,a)) • 1 and 2 are the state transition functions for machines M1and M2, respectively

  15. Formally defining M • M = (Q,,,q0,F) • q0= (r1, r2) • r1 and r2 are the starting states in machines M1and M2, respectively • F = {(r1,r2) | r1F1orr2F2} • F1 and F2 are the accepting states for machines M1and M2, respectively

  16. Concatenation is a regular operation Theorem: The class of regular languages is closed under the concatenation operation Proof approach: Assume A1 and A2 are both regular languages with A1=L(M1) and A2=L(M2) and create a DFA M such that L(M) = A1A2 Method: Proof by construction

  17. Idea of construction • Any accepting state in M1 has a copy of M2 “tacked on” • Problem: if we tack a copy of M2 on at each accepting states, we lose the deterministic property

  18. 0,1 0 0 0 0 1 q1’ q1’ q2’ q2’ q3’ q3’ q1 q2 q3 1 1 0 0 0 0 1 1 1 1 1 M1 M2 0,1 1 q1 q2 q3 0 0 ε 1 Example Can jump to q1’ non-deterministically

  19. Next week • Non-determinism Have a great weekend!

More Related