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.