Automata
Automata
THEORY OF AUTOMATA
ASSIGNMENT NO 2
Question # 1 (Chapter # 6): For each of the five FAs pictured in Problems 1 7, I 9, and 20 in
Chapter 5, build a transition graph that accepts the same language but has fewer states.
SOLUTION:
17:
The given Finite Automata accepts the string containing a’s and b’s and the string ending with a.
The transition graph with reduced number of states is as follows:
Answer:
17(2):
answer:
17(iii)
Answer:
19:
answer:
QUESTION NO 2:
a) Solution:
Transition table of given NFA:
states a b
{1}(-,+) {1,2} {2}
2 null {1}
states a b
{1}(-,+) {1,2} {2}
{1,2}(+) {1,2} {1,2}
{2} null {1}
Transition Diagram:
b)
states a b ε
1 {3} null {2}
2 {1} null null
3 {2} {2,3} null
Transition Diagram:
Question # 3:Show that any language that can be accepted by a TG can be accepted by a TG
with an even number of states.
Solution:
Any language that can be accepted by a TG can be accepted by a TG with an even number of states.
This can be shown by the following TG:
Explanation:
Explanation:
• The given Transition Graph contains an even pair of letters at every edge. So, for a string to
be accepted, the TG must have even number of states.
• In this TG, even number of a's and b's are accepted at the loops followed by the even pairs
'ab' and then again, the loop of 'aa' and 'bb'.
• Here, when a pair of unmatched letters (ab or ba) is read, it is known as unbalanced state,
which means that an odd number of a's and b's are read.
• Since, there are two unmatched pairs, so the total number of a's and b's read from the input
string become even again.
• This language is also known as EVEN-EVEN
This TG can be converted to another TG with single initial and final state as follows:
Question # 4:
First draw NFA of all following languages. After convert all the N FA to DFA by using proper
method which we have discussed in the class. Note: For every part you have to do the
following four steps:
1. For every part first draw NFA state diagram.
2. Draw transition table for NFA state diagram.
3. Draw transition table of DFA using NFA diagram and NFA transition table.
4. Draw the DFA state diagram from DFA transition table.
Parts: 1. Language of all those string end with a?
2. Language of all those string which contain at least one b?
3. Language of all odd length string?
4. Language of all those string begin with ba? 5. Language of all those string which contain ab
anywhere in the language?
SOLUTION:
PART 1:
A) NFA
states a b
-q0 q0,q1 q0
+q1 null null
C-DFA:
state a b
-q0 +q0,q1 -q0
+q0,q1 +q0,q1 -q0
PART 2:
A) NFA
state a b
-q0 q0 Q0,q1
+q1 q1 q1
c) DFA:
STATE a b
-q0 q0 Q0,q1
+q0,q1 Q0,q1 Q0,q1
PART 3:
A) NFA:
state a b
-q0 q1 q1
+q1 q2 q2
q2 q1 q1
C) DFA:
state a b
-q0 q1 q1
+q1 q2 q2
q2 q1 q1
PART 4:
NFA : (q0 is initial)
state a b
-q0 null q1
q1 q2 null
+q2 q2 q2
DFA:
STATE a b
-q0 q3 q1
q1 q2 q3
+q2 q2 q2
q3 q3 q3
PART 5:
NFA:
state a b
-q0 Q0,q1 q0
q1 null q2
+q2 q2 q2
DFA:
state a b
-q0 Q0,q1 q0
Q0,q1 Q0,q1 Q1,q2
+q1,q2 Q1,q2 Q1,q2
Question # 5: Generate the regular expression and GTG from the given DFA’s. For creating
GTG, you have to write the steps followed for DFA to GTG conversion.
STEP 1:
STEP 2:
state 0 1
A B C
B B F
C B C
F B E
E B C
2) FINDING EQUIVALENCE:
● Equivalence 0: ○ {A,B,C,F} ,{E}
● Equivalence 1: ○ {A,B,C} ,{F}, {E}
● Equivalence 2: ○ {A,C} ,{B}, {F}, {E}
● Equivalence 3: ○ {A,C}, {B} ,{F} ,{E}
Equivalence 2 and 3 is same so they are the minimized states.