Download presentation
Presentation is loading. Please wait.
1
Finite Automata Part Three
FA Algorithms Finite Automata Part Three
2
Kleene Star L = { a } L* = { e, a, aa, aaa, … } L = { a, bb } L* = { e, a, bb, bba, aaa, bbbb, bbabbaaa…}
3
Got it? given L = { ab, aba } Which of the following words are accepted by L*? aaaa abab ababa abaab ababababaab
4
Union Assume L and M are both DFAs. Then Union of L and M (L U M) is How much do we care that this is nondeterministic? L M e L N e M
5
Complement Complement of L is written ∑* - L Convert the FA to a DFA.
Flip favorable states to unfavorable and vice versa.
6
Complement of DFA Example 1
All strings except zero or more a's followed by one or more b's rejected: accepted: accepted: rejected: aaabb abab ab ba bbb a b a b a s q r b a b
7
Intersection L ∩ M = complement of ( ∑* - L ) U ( ∑* - M )
Build the complement of L and complement of M Build union of those complements. Build the complement of that union.
8
Difference L - M = L ∩ ( ∑* - M ) Build complement of M
Build intersection of that FA and L.
9
Concatenation Concatenation of L and M is written LM.
Add an arrow labeled e from every favorable state of L to the initial state of M.
10
Membership If A is an FA, and L(A) is the language (set of words) accepted by A. Then how do we determine if word w is a member of L(A)? w ∈ L(A) Just run w through the FA.
11
Empty Language How do we determine if L(A) is empty?
Are there any paths from the initial state to any favorable state? If all favorable state are unreachable then L(A) is empty.
12
Subset of a Language L(A) ⊆ L(B)
Build language C where L(C) = L(A) - L(B) If L(C) is empty, then L(A) ⊆ L(B)
13
Equality Is L(A) = L(B) ? Language A and B are equal if L(A) ⊆ L(B) and L(B) ⊆ L(A)
14
State Minimization Why do we care about the number of states in a Finite Automata?
15
State Minimization Step 1 : Remove unreachable states.
Step 2 : Remove equivalent states. Sometimes it is obvious looking at the state table that two states have the same outputs. See previously used example of converting an NFA to a DFA.
16
State Minimization Example previous example of e-NFA to DFA
>A A AB AB AD ABCE AD A ABE ABCE ADE ABCE ADE AE ABE ABE ADE ABE AE AE ABE State Minimization Example previous example of e-NFA to DFA accept words of 0 and 1 that contain either 11 or 101 1 A AB 1 AD ABE 1 1 1 1 ABCE ADE AE 1
17
0 1 >A A AB AB AD ABCE AD A ABE ABCE ADE ABCE ADE AE ABE
>A A AB AB AD ABCE AD A ABE ABCE ADE ABCE ADE AE ABE ABE ADE ABE AE AE ABE >A A AB AB AD ABCE AD A ABE ABCE Z ABCE Z Z ABE ABE Z ABE >A A AB AB AD ABCE AD A W ABCE W ABCE W W W accept words of 0 and 1 that contain either 11 or 101 A AB AD 1 1 1 0,1 ABCE W 1
18
FA State Minimization Algorithm
Working backward from each favorable state to determine if two sub-FAs are equivalent: make both states start states determine accepted languages in other words, is L(A) = L(B) ?
19
State Minimization Example continued
accept words of 0 and 1 that contain either 11 or 101 A AB AD 1 1 1 0,1 ABCE W 1 Working backward, we check the two sub-diagrams that start with ABCE and W. Is L(ABCE) = L(W) ? L (W) = { 0,1 }* L (ABCE) = { 0,1 }*
20
State Minimization Example continued
accept words of 0 and 1 that contain either 11 or 101 A AB AD 1 1 1 0,1 W L(W) = {0,1}* L(AD) = 1{0,1}* U 0{0,1}*11{0,1}* U 0{0,1}*101{0,1}* thus, L(W) ≠ L(AD) L(AB) = …… thus, L(AB) ≠ L(W) and L(AB) ≠ L(AD)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.