Example:
Construct a DFA, that accept set of all strings over {a, b} of length 2?
Solution:
Step 1:
First construct the set of strings that are accepted:
L = {aa, ab, ba, bb}
These four strings should be accepted by our automaton.
Step 2:
Take the smallest string, and draw the skeleton our DFA.
Here we can take any,
Let u take aa,
Step 3:
Then complete all state transaction for each symbol in the alphabet.
Here, {a, b}
Step 4:
Now we have get all the strings which need to be accepted, so for strings that need not to be accepted has to be send to some state from where it cannot lead to final state. State ‘C’ in our case. That state is called trap state or dead state. (state ‘D’ here).
Number of states are 4 (2 + 2) (So for two symbols we have 2+2 states).
In same consideration, if |w| is the length of the string and
|w|>= 2 then the DFA is,
here number of states are 3 (2+1).
|w|<=2 then the DFA is,
here the number of states are 4 (2+2).
Conclusion
If |w| = n then n+2 states will be used for minimal DFA.
|w| >= n then n+1 states will be used for minimal DFA.
|w| <= n then n+2 states will be used for minimal DFA.
No comments:
Post a Comment