Designing Deterministic Finite Automata (Set 6)
Prerequisite: Designing finite automata
In this article, we will see some designing of Deterministic Finite Automata (DFA).
Problem-1: Construction of a minimal DFA accepting set of strings over {a, b} in which anbm, where n and m is greater than or equal to 1.
Explanation: The desired language will be like:
L1 = {ab, aab, abb, aabb, aaabbb, aaabbbb, ...........}
Note: In the above string there should not be any βaβ after βbβ.
Here as we can see that each string of the language containing a and b whose power is greater or equal to 1 but the below language is not accepted by this DFA because some of the string of the below language does not containing a and b whose power is greater or equal to 1.
L2 = {Ξ΅, a, b, ..............}
This language L2 is not accepted by this required DFA.
The state transition diagram of the desired language will be like below:
In the above DFA, the state βWβ is the initial state and which on getting βaβ as the input it transit to the normal state βXβ which on getting βaβ as the input it remains in the state of itself and on getting βbβ as the input it transit to the final state βYβ which on getting βbβ as the input it remains in the state of itself and on getting as the input it transit to the dead state βZβ and when initial state βWβ gets βbβ as the input then it transit to the dead state βZβ.
The state βZβ is called dead state because it can not go to the final state on getting any input.
Problem-2: Construction of a minimal DFA accepting set of strings over {a, b} in which anbm, where n and m is greater than or equal to 0.
Explanation: The desired language will be like:
L1 = {Ξ΅, a, b, ab, aab, abb, aabb, aaabbb, aaabbbb, ...........}
Note: In the above string there should not be any βaβ after βbβ.
Here as we can see that each string of the language containing a and b whose power is greater or equal to 0 but the below language is not accepted by this DFA because some of the string of the below language does not contain a and b whose power is greater or equal to 0 or they might not follow the format of a and b i.e, there should not be any βaβ after βbβ.
L2 = {ba, baa, bbaaa..............}
This language L2 is not accepted by this required DFA because itβs string contain βaβ after βbβ.
The state transition diagram of the desired language will be like below:
In the above DFA, the state βXβ is the initial and final state which on getting βaβ as the input it remains in the state of itself and on getting βbβ as the input it transit to the final βYβ which on getting βbβ as the input it remains in the state of itself and on getting βaβ as the input it transit to dead state βZβ.
The state βZβ is called a dead state because it can not go to the final state on getting any input alphabet.