190 likes | 314 Vues
This document provides a summary of key concepts and exercises from Chapter 2, focusing on regular expressions (RE) and their relationship to non-deterministic finite automata (NFA). It discusses defining sets of strings, operations on RE, and criteria for determining the equivalence of generated NFAs. Additionally, it includes practical quizzes for applying learned concepts, emphasizing the rules for constructing NFAs and minimizing deterministic finite automata (DFA). Students are encouraged to review and understand these topics to excel in quizzes and exams.
E N D
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
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 • (顺序;选择;重复);
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”;
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;
S0 S0 S S Rules ■ is a regular expression,L()={ } ■ is a regular expression,L()={ } ■ for any c , c is a regular expression, L(c)={c} c
Rules ■ ( A ), L( (A) ) = L(A), no change; ■ A B, L( A B )= L(A)L(B) NFA(B) NFA(A)
Rules ■ ( A ), L( (A) ) = L(A), no change; ■ A | B,L( A | B )=L(A)L(B) NFA(A) NFA(B)
Rules ■ A* ,L( A*) = L(A)* NFA(A)
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 ……
Quiz • (a|b)*abb(a|b)* • Follow the rules a b b b a
Quiz • (a|b)*abb(a|b)* • Follow the process in the textbook (a|b)*abb(a|b)* (a|b)* (a|b)* abb a a a b b b b
Quiz • (a|b)*abb(a|b)* • The NFA without edge; a a b a b 3 4 2 1 b b
{1} --- S0; {1,2} --- S1; {1,3} --- S2; {1,4} --- S3; {1,2,4} --- S4; {1,3,4} --- S5;
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}
Minimizing DFA • Current groups:{S0},{S1},{S2}, {S3,S4,S5} • Splitting {S3, S4,S5} {S3,S4,S5}
Minimized DFA • {S0},{S1},{S2}, {S3,S4,S5} • {S0} ---- 0; {S1} --- 1 ; • {S2} ---- 2; {S3,S4,S5} --- 3; a b 00 1 00 1 2 1 2 1 3 3 3 3*