TOC | Designing Deterministic Finite Automata (Set 7)

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 anbmcl, where n, m and l is greater than or equal to 0.
Explanation: The desired language will be like:

L1 = {ε, a, aa, aaa, b, bb, bbb, c, cc, ccc, abc, ab, ac, ...........}

Note: In the above string there should must be order like abc i.e, there should not be any ‘a’ after ‘b’ or any ‘a’ after ‘c’ etc.



Here as we can see that each string of the language containing a, b and c 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, b and c whose power is greater or equal to 0 or they might not follow the format of a, b and c i.e, there should not be any ‘a’ after ‘b’ or any ‘a’ after ‘c’ etc.

L2 = {ba, bac, bbacaa..............}

This language L2 is not accepted by this required DFA because it’s string contain ‘a’ after ‘b’ and ‘a’ after ‘c’ etc.
The state transition diagram of the desired language will be like below:

In the above DFA, the state ‘W’ is the initial and final state which on getting ‘a’ as the input it remains in the state of itself, on getting ‘b’ as the input it transit to the final state ‘X’ and on getting ‘c’ as the input it transits to another final state ‘Y’. The state ‘X’ is the final state which on getting ‘b’ as the input it remains in the state of itself, on getting ‘c’ as the input it transits to another final state ‘Y’ and on getting ‘a’ as the input it transits to a dead state ‘Z’.

Another final state ‘Y’ on getting ‘c’ as the input it remains in the state of itself and on getting input either as ‘a’ or ‘b’ it transits to the same dead state ‘Z’. The state ‘Z’ is called a dead state because it can not go to any of the final states on getting any of the input alphabets.

Problem-2: Construction of a minimal DFA accepting set of strings over {a, b} in which anbmcl, where n, m and l is greater than or equal to 1.
Explanation: The desired language will be like:

L1 = {abc, aabc, aabbc, aabbcc, abbc, ...........}

Note: In the above string there should must be order like abc i.e, there should not be any ‘a’ after ‘b’ or any ‘c’ after ‘a’ etc.

Here as we can see that each string of the language containing a, b and c 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 contain a, b and c whose power is greater or equal to 1 or they might not follow the format of a, b and c i.e, there should not be any ‘a’ after ‘b’ or any ‘c’ after ‘a’ etc.

L2 = {ba, bac, bbacaa..............}

This language L2 is not accepted by this required DFA because it’s string contain ‘a’ after ‘b’ and ‘c’ after ‘a’ etc.
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 transit to a state ‘W’ and on getting ‘b’ or ‘c’ as input it transit to a dead state ‘Z’. The state ‘W’ on getting ‘b’ as the input it either remains in the state itself or transit to a state ‘X’ and on getting ‘a’ or ‘c’ it transit to the same dead state ‘Z’. The state ‘X’ on getting ‘b’ as the input it remains in the state of itself and on getting ‘c’ as the input it transits to the final state ‘Y’ and on getting ‘a’ as the input it transit to the same dead state ‘Z’.

The final state ‘Y’ on getting ‘c’ as the input it remains in the state of itself and on getting ‘a’ or ‘b’ as the input it transits to the same dead state ‘Z’. The state ‘Z’ is called a dead state this is because it can not go to final state ever on getting any of the input alphabets.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.