Designing Deterministic Finite Automata (Set 7) - GeeksforGeeks

20 Nov, 2019
Prerequisite: Designing finite automataIn 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.
GATE CS
Theory of Computation & Automata
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Page Replacement Algorithms in Operating Systems
Normal Forms in DBMS
Differences between TCP and UDP
Semaphores in Process Synchronization
Caesar Cipher in Cryptography
Difference between DFA and NFA
Difference between Mealy machine and Moore machine
Turing Machine in TOC
Conversion from NFA to DFA
Converting Context Free Grammar to Chomsky Normal Form