0% found this document useful (0 votes)
41 views15 pages

Automata

The document contains a student's assignment submission for a theory of automata course. It includes solutions to 6 questions involving finite automata (FAs), non-deterministic finite automata (NFAs), deterministic finite automata (DFAs), regular expressions, and minimizing DFAs. Key steps include converting NFAs to equivalent DFAs, generating regular expressions and generalized transition graphs from DFAs, and minimizing a given DFA using partitioning.

Uploaded by

meesam2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views15 pages

Automata

The document contains a student's assignment submission for a theory of automata course. It includes solutions to 6 questions involving finite automata (FAs), non-deterministic finite automata (NFAs), deterministic finite automata (DFAs), regular expressions, and minimizing DFAs. Key steps include converting NFAs to equivalent DFAs, generating regular expressions and generalized transition graphs from DFAs, and minimizing a given DFA using partitioning.

Uploaded by

meesam2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 15

NAME: MEESAM IMRAN

ROLL NO: BSCS-2021-01

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:

Convert the following NFA to DFA.

a) Solution:
Transition table of given NFA:

states a b
{1}(-,+) {1,2} {2}
2 null {1}

Converting to DFA Transition Table:

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

Ε-closure(1)={1,2}=A ie A will be initial state of DFA


ε-closure((A,a))={3,1,2}=B
ε-closure((A,b))=null
ε-closure(B,a)={1,2,3}=B
ε-closure(B,b)={2,3}=C
ε-closure(C,a)={1,2}=A
ε-closure(C,b)={2,3}=C
Finally we have the transition table of the DFA below:
state a b
A(-,+) B null
B(+) B C
C(+) A C

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

B- NFA TRANSITION TABLE

states a b
-q0 q0,q1 q0
+q1 null null

C-DFA:

D) DFA TRANSITION TABLE:

state a b
-q0 +q0,q1 -q0
+q0,q1 +q0,q1 -q0
PART 2:
A) NFA

NFA TRANSITION TABLE:

state a b
-q0 q0 Q0,q1
+q1 q1 q1

c) DFA:

d) DFA TRANSITION TABLE:

STATE a b
-q0 q0 Q0,q1
+q0,q1 Q0,q1 Q0,q1
PART 3:
A) NFA:

B) NFA TRANSITION TABLE:

state a b
-q0 q1 q1
+q1 q2 q2
q2 q1 q1

C) DFA:

DFA TRANSITION TABLE:

state a b
-q0 q1 q1
+q1 q2 q2
q2 q1 q1

PART 4:
NFA : (q0 is initial)

NFA TRANSITION TABLE:

state a b
-q0 null q1
q1 q2 null
+q2 q2 q2

DFA:

DFA TRANSITION TABLE:

STATE a b
-q0 q3 q1
q1 q2 q3
+q2 q2 q2
q3 q3 q3
PART 5:
NFA:

NFA TRANSITION TABLE:

state a b
-q0 Q0,q1 q0
q1 null q2
+q2 q2 q2

DFA:

DFA TRANSITION TABLE:

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:

Regular Expression: (abb*a)* +(bb*aa)*

Question # 6: Minimize the given DFA using partitioning method


As there is no unreachable state so skipping the first state of removing unreachable state.
1) TRANSITION TABLE:

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.

3) DFA TRANSITION DIAGRAM (MINIMIZED):

You might also like