0% found this document useful (0 votes)
73 views3 pages

CM Assignment Saurabh 162050011

The document describes minimizing a deterministic finite automaton (DFA) and constructing a non-deterministic finite automaton (NFA) and DFA from a regular expression. It provides the following: 1) A DFA with 6 states and transitions is given to minimize. It applies the partition refinement algorithm, merging equivalent states, to obtain a minimized 3-state DFA. 2) A regular expression (a(a+b)*b + b(a+b)*a) representing strings that begin and end with opposite symbols. It constructs an equivalent 4-state NFA and then a 5-state DFA.

Uploaded by

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

CM Assignment Saurabh 162050011

The document describes minimizing a deterministic finite automaton (DFA) and constructing a non-deterministic finite automaton (NFA) and DFA from a regular expression. It provides the following: 1) A DFA with 6 states and transitions is given to minimize. It applies the partition refinement algorithm, merging equivalent states, to obtain a minimized 3-state DFA. 2) A regular expression (a(a+b)*b + b(a+b)*a) representing strings that begin and end with opposite symbols. It constructs an equivalent 4-state NFA and then a 5-state DFA.

Uploaded by

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

Computational Methods.

Roll No: - 162050011


Name: Saurabh Naik
Assignment 1
Question No 1:- Minimize the following DFA Machine M

M={Q,,,q0,F} here ={a,b} , Q={Q1,Q2,Q3,Q4,Q5,Q6},q0=Q1,F={Q3,Q4}

a b
\
Q1 Q6 Q3
Q2 Q5 Q6
Q4 Q5
Q3 Q2
Q5 Q2 Q1
Q6 Q1 Q4

b Q3
a b
Q1
b b

a
b

Q4 b

a b b

a b

Q6 b
a b

Q5
b Q2 b

Solution:-

Step 1:- Partition states into two groups 1) accepting states or final states 2) Non accepting or non-final
states

0 = [{Q1, Q2, Q5, Q6} {Q3, Q4}]

Step 2:- For each group G of


Do Begin
Partition G into subgroups such that two states S and T of G are in the same subgroup if and only if on all
input symbols a, state S and T have transition on a to states in the same subgroup of .

{Q1, Q2, Q5, Q6} {Q3, Q4}


Q1Q2 Q1Q5 Q1=Q6 Q3=Q4
(Q1,b)=Q3 (Q1,b)=Q3 a b a b
(Q2,b)=Q6 (Q5,b)=Q1
\ \
State Q3 and Q6 are in State Q3 and Q1 are in Q1 Q6 Q3 Q4 Q5
different subgroups. different subgroups. Q6 Q1 Q4 Q3 Q2

Now we found Q1Q2 and Q1Q5

1
Computational Methods.
Roll No: - 162050011
Name: Saurabh Naik
New partition 1 = [{Q1, Q6}{Q2,Q5} {Q3, Q4}]

Q1=Q6 Q2=Q5 Q3=Q4


a b a b a b
\ \ \
Q1 Q6 Q3 Q2 Q5 Q6 Q4 Q5
Q6 Q1 Q4 Q5 Q2 Q1 Q3 Q2

No new partition.
Hence state Q1=Q6, Q2=Q5 and Q3=Q4.

Replacing Q6 with Q1,Q5 with Q2 and Q4 with Q3 in the table

a b
\ a
Q1=Q6 Q1 Q3
Q2=Q5 Q2 Q1
Q3 Q2 a Q3
b

Q1 b
Q1

a
b b

Q2
Q1

Minimized DFA

Question No 2

Give Regular expression for All strings that begin and end with opposite symbols. Construct NFA and
then convert it to DFA.={a,b}

Solution:

R.E. = a(a+b)*b +b(a+b)*a

NFA:-
M = {Q, , , Q0, F}
a,b
Q = {Q0, Q1, Q2, Q3}

a Q1 b = {a,b}
Q1

F={Q3}
Q0
Q3 a b
Q1

\
Q0 Q1 Q2
a
b Q2 Q1 Q1 {Q1, Q3}
Q2 {Q2, Q3} Q2
Q1

2
Q3

a,b
Computational Methods.
Roll No: - 162050011
Name: Saurabh Naik

NFA to DFA:-

Suppose M1 is DFA machine having 1 as transition function.

1({Q0},a)={Q1} and 1({Q0},b)={Q2}


1({Q1},a)={Q1} and 1({Q1},b)={Q1, Q3}
1({Q2},a)={Q2, Q3} and 1({Q2},b)={ Q2}
1({Q1, Q3},a)={Q1} and 1({Q1, Q3},b)={ Q1, Q3}
1({Q2, Q3},a)={ Q2, Q3} and 1({Q2, Q3},b)={ Q2}
a b
1\
Q0 Q1 Q2
Q1 Q1 {Q1, Q3}
Q2 {Q2, Q3} Q2
{Q1, Q3} Q1 Q1, Q3
{Q2, Q3} {Q2, Q3} Q2

a
b

b
a Q1 Q1Q3
Q1

Q0
a
Q1
a
a
b Q2 Q1Q3
Q1

a
b

b DFA

You might also like