Toc Assignment

  • Uploaded by: manpreetsekhon
  • 0
  • 0
  • March 2021
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Toc Assignment as PDF for free.

More details

  • Words: 1,291
  • Pages: 7
Loading documents preview...
Minimization of DFA Minimization of DFA refers to the construction of finite automata with minimum no. of states which is equivalent to the given finite automata. For any given language, there may be many DFA’s that accept it. To understand the minimization first of all one should be very clear about the dead state, Inaccessible states and indistinguishable states, so let us discuss them first. Dead State: Any transitions to a dead state become undefined. A state is a dead state if it is not accepting state and has no out-going transitions except to itself. For Example: Let ∑= {0, 1}, q0 is the initial state, q1 is final state

Here, In above example q2 is a dead state as there is no such transition from q2 which reach final state i.e. q1 Unreachable / Inaccessible State: All those states which can never be reached from initial state are called inaccessible states. For example:

In above example, q3 is the state which is not reachable from q0 (initial state). So q3 is the unreachable state. Equivalent / Indistinguishable States: Two states q and r of DFA are called distinguishable if δ(q,w) Є F => δ(r,w) Є F and

δ(q,w) ≠ F => δ(r,w) ≠ F

where

w Є ∑*

Non-Equivalent / Distinguishable States: Two states q1 and q2 of DFA are called distinguishable if δ(q1,w) Є F and δ(q2,w) ≠ F where

w Є ∑*

Process of Minimization: 1. Detect unreachable states. 2. Eliminate unreachable states(if any). 3. Indentify equivalent states and merge them. (i) Divide all states into groups. Eg: Group A Final States Group B Non- Final or Rejected States (ii) Repeat for every group and for every state in the group. (iii) Find which groups input leads to differences i.e. if there are differences then partition the group into two sets containing states which go to same group under the input until no partition is required. 4. Detect dead states. 5. Eliminate dead states.

Minimization Algorithm for DFA Construct a partition = { A, Q - A } of the set of states Q ; }; new := new_partition( while (

:=

)

new

; new := new_partition( ; final := new

)

function new_partition( ) for each set S of do partition S into subsets such that two states p and q of S are in the same subset of S if and only if for each input symbol, p and q make a transition to (states of) the same set of .

end

The subsets thus formed are sets of the output partition in place of S. If S is not partitioned in this process, S remains in the output partition.

Minimum DFA M1 is constructed from  

 

final

as follows:

Select one state in each set of the partition final as the representative for the set. These representatives are states of minimum DFA M 1. Let p and q be representatives i.e. states of minimum DFA M 1. Let us also denote by p and q the sets of states of the original DFA M represented by p and q, respectively. Let s be a state in p and t a state in q. If a transition from s to t on symbol a exists in M, then the minimum DFA M1 has a transition from p to q on symbol a. The start state of M1 is the representative which contains the start state of M. The accepting states of M1 are representatives that are in A. Note that the sets of final are either a subset of A or disjoint from A. Remove from M1 the dead states and the states not reachable from the start state, if there are any.

Example 1: Let us try to minimize the number of states of the following DFA.

Step1: Detect Unreachable states. In above example, Q= {q0,q1,q2,q3,q4,q5,q6,q7} U= Q-T ={q0,q1,q2,q3,q4,q5,q6,q7}- {q0,q1,q2,q4,q5,q6,q7} ={q3} Here, we detect q3 as unreachable state. Step2: Eliminate unreachable states. In above example, q3 is unreachable state so eliminate q3. After eliminating unreachable state transition table is: Transition Table: δ\∑ q0 q1 q2 q4 q5 q6 q7

0 q1 q6 q0 q7 q2 q6 q6

1 q5 q2 q2 q5 q6 q4 q2

Step3: Indentify Equivalent staes and merge them. Q01={q2} Q02 = { Q- Q01} = {q0,q1,q4,q5,q6,q7} Π0={{q2},{q0,q1,q4,q5,q6,q7} Π1={{q2},{q0,q4,q6},{q1,q7},{q5}} Π2={{q2},{q0,q4},{q6},{q1,q7},{q5}} Π3={{q2},{q0,q4},{q6},{q1,q7},{q5}} There is no further splitting possible as Π 2 and Π3 becomes same. Now, design minimized DFA

Example 2 : Let us try to minimize the number of states of the following DFA.

Initially

= { { 1 , 5 } , { 2 , 3 , 4 } }.

new_partition is applied to . Since on b state 2 goes to state 1, state 3 goes to state 4 and 1 and 4 are in different sets in , states 2 and 3 are going to be separated from each other in new . Also since on a sate 4 goes to sate 4, state 3 goes to state 5 and 4 and 5 are in different sets in , states 3 and 4 are going to be separated from each other in new. Further, since on b 2 goes to 1, 4 goes to 4 and 1 and 4 are in different sets in , 2 and 4 are separated from each other in new. On the other hand 1 and 5 make the same transitions. So they are not going to be split. Thus the new partition is { { 1 , 5 } , { 2 } , { 3 } , { 4 ] }. This becomes the iteration.

in the second

When new_partition is applied to this new , since 1 and 5 do the same transitions, unchanged. Thus final = { { 1 , 5 } , { 2 } , { 3 } , { 4 ] }.

remains

Select 1 as the representative for { 1 , 5 }. Since the rest are singletons, they have the obvious representatives. Note here that state 4 is a dead state because the only transitionout of it is to itself. Thus the set of states for the minimized DFA is { 1 , 2 , 3 }. For the transitions, since 1 goes to 3 on a, and to 2 on b in the original DFA, in the minimized DFA transitions are added from 1 to 3 on a, and 1 to 2 on b. Also since 2 goes to 1 on b, and 3 goes to 1 on a in the original DFA, in the minimized DFA transitions are added from 2 to 1 on b, and from 3 to 1 on a.

Since the rest of the states are singletons, all transitions between them are inherited for the minimized DFA. Thus the minimized DFA is as given in the following figure:

Example 3 : Let us try to minimize the number of states of the following DFA.

Initially = { { 3 } , { 1 , 2 , 4 , 5 , 6 } }. By applying new_partition to this , new = { { 3 } , { 1 , 4 , 5 } , { 2 , 6 } } is obtained. Applyting new_partition to this , new = { { 3 } , { 1 , 4 } , { 5 } , { 2 } , { 6 } } is obtained. Applyting new_partition again, new = { { 1 } , { 2 } , { 3 } , { 4 } , { 5 } , { 6 } } is obtained. Thus the number of states of the given DFA is already minimum and it can not be reduced any further.

Related Documents

Toc Assignment
March 2021 0
Analisis Pelicula Toc Toc
February 2021 2
Toc Toc.docx
February 2021 0
Assignment
January 2021 0
Brewery Toc
February 2021 2

More Documents from "Hugo Ceballos Tabares"

Toc Assignment
March 2021 0