Design FA With
Design FA With
INSTITUTE OF TECHNOLOGY
School Of Information Technology
and Engineering
Compiler Design
Finite Automation
Asignment
Prepared By: -
1. Emebet Sisay ID ATE/8784/12
2. Minasie Simon ID ATE/0818/12
3. Sefesilasse Hailu ID ATE/7785/12
4. Tamrat Demeke ID ATE/9737/12
5. Yonas Buzuayehu ID ATE/6357/12
Submitted to : Yared Y.
August 2024
1. Design FA with ∑ = {0, 1} accepts even number of 0's and even number of 1’s.
∑ = {0, 1}, that accepts:
1. Odd number of 0’s or even number of 1’s
2. Odd number of 0’s and even number of 1’s
3. Either odd number of 0’s or even number of 1’s but not the both together
Solution – Let first design two separate machines for the two conditions:
Accepting only odd number of 0’s
Accepting only even number of 1’s
Odd number of 0’s and even number of 1’s: This machine accept that languages which
contains odd no. of 0’s and even no. of 1’s. As we know that q1 indicates odd no. of 0’s
and q2 indicates even no. of 1’s. So, the final states of the required DFA will contain both
q1 and q2. .’. Final state = {(q1q2)}
2. Design a Finite Automaton (FA) that accepts strings over the alphabet Σ={a,b}
where the string contains the substring "ab" exactly twice, and no other substring
"ab".
Given a binary string S, the task is to write a program for DFA Machine that accepts a set of all
strings over w ∈ (a, b)* which contains “aba” as a substring.
Output : Accepted
Input-2 : abbbb
Approach : Below is the designed DFA Machine for the given problem. Construct a transition
table for DFA states and analyze the transitions between each state. Below are the steps –
Desired Language:
Explanation:
1. Firstly, there will be 4states.(say q0, q1, q2, q3) , with q0 being initial state and q3
being final state.
2. Initially we will be in q0 state, now we start reading the given string.
When we read ‘b’, we will remain in the same state
If we read ‘a’, then it transits to state q1.
6. All strings which are accepted by this DFA will have “aba” as its substring.
Transition Table :
3. Design a Finite Automaton (FA) that accepts strings over the alphabet Σ={0,1}
where the string contains an even number of 0's and an odd number of 1's, and
Construct DFA for the language accepting strings starting with ‘101’