Designing Deterministic Finite Automata (Set 9)
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 a set of strings over {a, b} in which {abwa / wΞ΅{a, b}*}.
Here βwβ is the substring containing alphabets over any number of βaβ and βbβ ranging from zero to infinity.
Explanation: The desired language will be like:
L1 = {abΞ΅a, abaaaa, ababaaa, abaabbaaa}
Here as we can see that each string of the above language having constant initial i.e, {ab} and final {a} substring but βwβ having a substring over {a, b} whose alphabets ranging from zero to infinity but the below language is not accepted by this DFA because itβs strings are not following the format of string.
L2 = {baa, aabaa, baabaaa..............}
The state transition diagram of the desired language will be like below:
In the above DFA, the initial state βVβ on getting βaβ as the input it transits to a state βWβ and on getting βbβ as the input it transits to a dead state βZβ. The state βWβ on getting βaβ as the input it transits to the dead state βZβ and on getting βbβ as the input it transits to a state βXβ. The state βXβ on getting βbβ as the input it remains in the state of itself and on getting βaβ as the input it transits to a final state βYβ.
The final state βYβ on getting βaβ as the input it remains in the state of itself and on getting βbβ as the input it transits to the state βXβ. The state βZβ is called as the dead state because it can not go to the final state ever on getting any of the input alphabets.
Problem-2: Construction of a minimal DFA accepting a set of strings over {a, b} in which {a2bwa2 / wΞ΅{a, b}*}.
Here βwβ is the substring containing alphabets over any number of βaβ and βbβ ranging from zero to infinity.
Explanation: The desired language will be like:
L1 = {aabΞ΅aaa, aabaaaa, aababaaa, aabaabbaaa}
Here as we can see that each string of the above language having constant initial i.e, {a2b} and final {a2} substring but βwβ having a substring over {a, b} whose alphabets ranging from zero to infinity but the below language is not accepted by this DFA because itβs strings are not following the format of string.
L2 = {baa, abaa, baabaaa..............}
The state transition diagram of the desired language will be like below:
In the above DFA, The initial state βAβ on getting βaβ as the input it transits to a state βBβ and on getting βbβ as the input it transit to a dead state βGβ. The state βBβ on getting βaβ as the input it transits to a state βCβ and on getting βbβ as the input it transit to a dead state βGβ. The state βCβ on getting βbβ as the input it transits to a state βDβ and on getting βaβ as the input it transit to a dead state βGβ. The state βDβ on getting βaβ as the input it transits to a state βEβ and on getting βbβ as the input it remains in the state of itself. The state βEβ on getting βaβ as the input it transits to a final state βFβ and on getting βbβ as the input it transits to the state βDβ.
The final state βFβ on getting βaβ as the input it remains in the state of itself and on getting βbβ as the input it transits to the state βDβ. The dead state βGβ is called dead because it can not go to the final state on getting any of the input alphabets.