11.07.2015 Views

Grundlagen der Theoretischen Informatik - Universität Bamberg

Grundlagen der Theoretischen Informatik - Universität Bamberg

Grundlagen der Theoretischen Informatik - Universität Bamberg

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Professur <strong>Grundlagen</strong> <strong>der</strong> <strong>Informatik</strong>Universität <strong>Bamberg</strong>Feldkirchenstr. 2196047 <strong>Bamberg</strong>http://www.gdi.wiai.uni-bamberg.de/Machines and Languages(<strong>Grundlagen</strong> <strong>der</strong> <strong>Theoretischen</strong> <strong>Informatik</strong>)Notes on Minimizing Finite AutomataThe transition function δ specifies the action of a machine for a given state and a element from thealphabet Σ. This function can be extended to a function ˆδ whose input is a state and a string overΣ. The function ˆδ(q, x) describes concisely "the state in which the DFA ends up, if it starts in stateq and receives the string x of input symbols". ˆδ(q, x) is then the extension of δ from Q × Σ → Q toQ × Σ ∗ → Q. We define ˆδ by recursive definition.Definition 1. The extended transition function ˆδ of a DFA with transition function δ is a functionQ × Σ ∗ → Q defined by recursion on the length of the input string.i Basis: length(w) =0.Thenw =Λand ˆδ(q, Λ) = q.length(w) =1.Thenw = a, forsomea ∈ Σ, andˆδ(q, a) =δ(q, a).ii Recursive step: Let w be a string of length n>1. Thenw = ua and ˆδ(q, ua) =δ(ˆδ(q, u),a)Before we describe the minimization algorithm, we have to introduce the notion of equivalent statesin a DFA.Definition 2. Let M =(Q, Σ,q 0 ,A,δ) be a DFA. States p and q are equivalent if ˆδ(p, u) ∈ A if, andonly if, ˆδ(q, u) ∈ A for all u ∈ Σ ∗ .Two states that are equivalent are called indistinguishable (nicht unterscheidbar). Two states that arenot equivalent are called distinguishable (unterscheidbar). States p and q are distinguishable if thereexists a string x such that ˆδ(p, x) ∈ A and ˆδ(q, x) /∈ A, orviceversa.The table filling algorithm 1 constructs a table whose entries are indexed by pairs of states. It is basedon the idea to identify all distinguishable pairs of states. If a pair of states is distinguishable thealgorithm marks the corresponding index in the table. Every unmarked index corresponds to a pairof indistinguishable states which are equivalent.1 see Thomas A. Sudkamp. Languages and Machines. Addison-Wesley. 1998. pages 182–188


Algorithm 1: DFA Minimization: Determination of equivalent States of DFAInput: DFAM =(Q, Σ,δ,q 0 ,A), whereQ = {q 0 ,q 1 ,q 2 ,...,q k−1 }Output: DFA Min M ′ =(Q ′ , Σ,δ ′ ,q 0 ′ ,A′ )1. Remove from Q, A and δ all states that cannot be reached from q 0 .2. Generate a |k|×|k|-table T whose entries are indexed by pairs of states of Q. Leaveallentries T [q i ,q j ] unmarked (this means all pairs are assumed to be equivalent in the beginning).3. Initialization:forall pairs q i , q j , i


q 0 q 1 q 2 q 3 q 4q 0× ×q 1×q 2q 3××××Again we look at each unmarked pair. We start with the pair {q 0 ,q 2 }. Over the input symbol 1 weget the pair of following sucessor states {δ(q 0 , 1),δ(q 2 , 1)} = {q 4 ,q 1 }, which is already marked, so wealso mark {q 0 ,q 2 }. The pair {q 0 ,q 4 } is marked as well since over the input symbol 1 the pair of thesuccessor states {δ(q 0 , 1),δ(q 4 , 1)} = {q 4 ,q 1 } is already marked. For the pair {q 2 ,q 4 } over input 1 weget {q 1 ,q 1 }, over input 0 the result is {q 0 ,q 0 } and therefore {q 2 ,q 4 } are indistinguishable. At thisstate T is saturated, that means no more changes can be made to T .q 0 q 1 q 2 q 3 q 4q 0× ×q 1×q 2q 3× ×× ×××3. We are not able to find for any input symbol a pair of marked successor states for the pair {q 2 ,q 4 }.Therefore q 2 ≡ q 4 .By applying the algorithm we gained the equivalence classes of M.K 0 := [q 2 ]=[q 4 ]={q 2 ,q 4 }K 1 := [q 1 ]K 2 := [q 3 ]K 3 := [q 0 ]L(q 2 )=L(q 4 )={w|w ends in 11 }, whereL(q i ) is the set of words accepted from initial state q i inM.By merging equivalent states we gain the minimal DFA M ′ :0, 11 K 1q 0 q 2 ,q 4 q 1 q 310 K 00K 20K 31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!