Download presentation

Presentation is loading. Please wait.

Published byJace Kipps Modified about 1 year ago

1
Exercises for Chapter 2

2
Summary for the Quiz Some numbers –199 less than 100 55 Conclusion –There are students who did read textbook at least for review; –Most submitted answers are actually correct; –Rethinks on teaching method

3
Explanations on RE A regular expression defines a set of strings(language); A regular expression states the common pattern(structure) of the strings that belong to its language; For the same set of strings, there could be several RE definitions for it; Explanation of three operations –( 顺序 ; 选择 ; 重复 );

4
Example of RE {a, b, c} Defining a set of strings, where each string should starts with “a” and ends with “c”; Defining a set of strings, if “a” appears in one string, “c” should appear right after “a”;

5
From RE to NFA The generated NFA could be different, but they are equivalent; –The only criteria for judging whether the generated NFA is correct: L(RE) = L(NFA) You can follow the general rules; There are some shortcuts;

6
Rules ■ is a regular expression ， L( )={ } ■ is a regular expression ， L( )={ } ■ for any c , c is a regular expression, L(c)={c} S0S0 S S0S0 S c

7
Rules ■ ( A ), L( (A) )= L(A), no change; ■ A B ， L( A B )= L(A)L(B) NFA(A) NFA(B)

8
Rules ■ ( A ), L( (A) )= L(A), no change; ■ A | B ， L( A | B )=L(A) L(B) NFA(A) NFA(B)

9
Rules ■ A* ， L( A*)= L(A)* NFA(A)

10
Attention The rules introduced above are effective for those NFAs that have one start state and one terminal state; Any NFA can be extended to meet this requirement; …… NFA ……

11
Quiz (a|b)*abb(a|b)* Follow the rules a b a bb

12
Quiz (a|b)*abb(a|b)* Follow the process in the textbook (a|b)*abb(a|b)* (a|b)* abb (a|b)* bb b a a b a

13
Quiz (a|b)*abb(a|b)* The NFA without edge; 1 a b b a b b a

14
ab {1} 0 {1,2}{1} {1,2} {1,3} {1,2}{1,4}* {1,2,4}*{1,4}* {1,2,4}* {1,3,4}* {1,2,4}*{1,4}*

15
ab {1} 0 {1,2}{1} {1,2} {1,3} {1,2}{1,4}* {1,2,4}*{1,4}* {1,2,4}* {1,3,4}* {1,2,4}*{1,4}* {1} --- S0; {1,2} --- S1; {1,3} --- S2; {1,4} --- S3; {1,2,4} --- S4; {1,3,4} --- S5; ab S0 0 S1S0 S1 S2 S1S3* S4*S3* S4* S5* S4*S3*

16
Minimizing DFA Current groups:{S0,S1,S2}, {S3,S4,S5} Splitting {S0, S1,S2} {S0,S1},{S2} Current groups:{S0,S1},{S2}, {S3,S4,S5} Splitting {S0, S1} {S0},{S1} ab S0 0 S1S0 S1 S2 S1S3*

17
Minimizing DFA Current groups:{S0},{S1},{S2}, {S3,S4,S5} Splitting {S3, S4,S5} {S3,S4,S5} ab S3*S4*S3* S4* S5* S4*S3*

18
Minimized DFA ab S0 0 S1S0 S1 S2 S1S3* S4*S3* S4* S5* S4*S3* {S0},{S1},{S2}, {S3,S4,S5} {S0} ; {S1} ; {S2} ; {S3,S4,S5} --- 3; ab *

19
You should know how to do these problems!!!!

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google