Download presentation
Presentation is loading. Please wait.
Published byTerence Barnett Modified over 9 years ago
1
CSCI 2670 Introduction to Theory of Computing August 25, 2005
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)
3
Announcement Tutorials will be with Ryan Foster (room TBA) –Monday 2:30 – 3:30 –Friday 10:00 – 11:00 Hint on problem 0.12 –The proof can be done without induction. What can you conclude if all nodes have different degrees? In a graph with n nodes, what are the possible values for the degree of any node?
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 Can also design a DFA by combining two other DFA’s
5
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 *
6
Union is a regular operation Theorem: The class of regular languages is closed under the union operation Proof approach: Assume A 1 and A 2 are both regular languages with A 1 =L(M 1 ) and A 2 =L(M 2 ) and create a DFA M such that L(M) = A 1 A 2 Method: Proof by construction
7
Idea of construction Each state of the new DFA represents both where the same word would be if it was being processed in M 1 and where it would be if it were processed in M 2 –Keeping track of the progress of the string in both DFA’s simultaneously
8
Example q1q1 q2q2 q3q3 00 0,1 1 1 M1M1 q1,q1’q1,q1’q2,q1’q2,q1’ 0 q3,q2’q3,q2’ 1 1 q1’q1’q2’q2’q3’q3’ 10 0 0 M2M2 1 1 etc. q3,q1’q3,q1’0 q1,q2’q1,q2’ 1 Maximum number of states? 9 product of number of states in M 1 and in M 2
9
Formally defining M M = (Q, , ,q 0,F) –Q = Q 1 × Q 2 Q 1 and Q 2 are the states in machines M 1 and M 2, respectively – = 1 2 1 and 2 are the alphabets for machines M 1 and M 2, respectively – ((r 1,r 2 ),a) = ( 1 (r 1,a), 2 (r 2,a)) 1 and 2 are the state transition functions for machines M 1 and M 2, respectively
10
Formally defining M M = (Q, , ,q 0,F) –q 0 = (r 1, r 2 ) r 1 and r 2 are the starting states in machines M 1 and M 2, respectively –F = {(r 1,r 2 ) | r 1 F 1 or r 2 F 2 } F 1 and F 2 are the accepting states for machines M 1 and M 2, respectively
11
q1q1 q2q2 q3q3 00 1 0 1 M1M1 q1’q1’q2’q2’ 1 0 M2M2 0,1 Another Example 1 Q = –{(q 1,q 1 ’), (q 1,q 2 ’), (q 2,q 1 ’), (q 2,q 2 ’), (q 3,q 1 ’), (q 3,q 2 ’)} Σ = {0,1} q0 = –(q 1,q 1 ’) F = –{(q 1,q 1 ’), (q 1,q 2 ’), (q 2,q 2 ’), (q 3,q 2 ’)}
12
q1q1 q2q2 q3q3 00 1 0 1 M1M1 q1’q1’q2’q2’ 1 0 M2M2 0,1 Another Example 1 01 (q 1,q 1 ’)(,) (q 1,q 2 ’)(,) (q 2,q 1 ’)(,) (q 2,q 2 ’)(,) (q 3,q 1 ’)(,) (q 3,q 2 ’)(,) (q 2,) (q 1,) (q 3,) (q 2,) (q 1,) (q 3,) (q 2,q 1 ’) (q 3,q 1 ’) (q 1,q 1 ’) (q 1,q 2 ’) (q 2,q 2 ’) (q 3,q 2 ’) (q 2,q 2 ’) (q 3,q 2 ’) (q 1,q 2 ’) (q 2,q 2 ’) (q 3,q 2 ’)
13
Another example q 1’ q 1 ’ 0 0 1 1 0 0 1 0 1 q 2’ q 1 ’ q 3’ q 1 ’ q 1’ q 2 ’q 2’ q 2 ’ q 3’ q 2 ’ 1 1 1 0 0
14
Concatenation is a regular operation Theorem: The class of regular languages is closed under the concatenation operation Proof approach: Assume A 1 and A 2 are both regular languages with A 1 =L(M 1 ) and A 2 =L(M 2 ) and create a DFA M such that L(M) = A 1 A 2 Method: Proof by construction
15
Idea of construction Any accepting state in M 1 has a copy of M 2 “tacked on” –Problem: if we tack a copy of M 2 on at each accepting states, we lose the deterministic property
16
Example q1q1 q2q2 q3q3 00 0,1 1 1 M1M1 1 q1’q1’q2’q2’q3’q3’ 10 0 0 M2M2 1 q1q1 q2q2 q3q3 00 1 1 1 q1’q1’q2’q2’q3’q3’ 10 0 0 1 ε Can jump to q 1 ’ non- deterministically
17
Next week Non-determinism
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.