dfa hyper minimisation
play

DFA hyper-minimisation l Gawrychowski 1 Artur Je z 1 Pawe Institute - PowerPoint PPT Presentation

DFA hyper-minimisation l Gawrychowski 1 Artur Je z 1 Pawe Institute of Computer Science, University of Wroc law November 24, 2009 Artur Je z (UWr) DFA hyper-minimisation November 24, 2009 1 / 13 DFA minimisation Definition DFA:


  1. DFA hyper-minimisation l Gawrychowski 1 Artur Je˙ z 1 Pawe� Institute of Computer Science, University of Wroc� law November 24, 2009 Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 1 / 13

  2. DFA minimisation Definition DFA: � Q , Σ , δ, q 0 , F � , where δ : Q × Σ �→ Q . DFA is minimal, if it has the minimal number of states among automata recognising L ( M ). Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 2 / 13

  3. DFA minimisation Definition DFA: � Q , Σ , δ, q 0 , F � , where δ : Q × Σ �→ Q . DFA is minimal, if it has the minimal number of states among automata recognising L ( M ). unique with this property calculated using ≡ L : w ≡ w ′ if and only if ∀ w ′′ ww ′′ ∈ L ⇐ ⇒ w ′ w ′′ ∈ L equivalence classes correspond to ◮ states of the minimal automaton ◮ partition of states of M Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 2 / 13

  4. DFA minimisation Definition DFA: � Q , Σ , δ, q 0 , F � , where δ : Q × Σ �→ Q . DFA is minimal, if it has the minimal number of states among automata recognising L ( M ). unique with this property calculated using ≡ L : w ≡ w ′ if and only if ∀ w ′′ ww ′′ ∈ L ⇐ ⇒ w ′ w ′′ ∈ L equivalence classes correspond to ◮ states of the minimal automaton ◮ partition of states of M Hopcroft’s algorithm: O ( n log n ); refines the partition of states Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 2 / 13

  5. f -equivalence and hyper-minimisation Definition ( f -equivalent) L ∼ L ′ ⇐ ⇒ they differ on finite amount of words. Extend the definition to automata. Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 3 / 13

  6. f -equivalence and hyper-minimisation Definition ( f -equivalent) L ∼ L ′ ⇐ ⇒ they differ on finite amount of words. Extend the definition to automata. Definition (A. Badr, V. Geffert, I. Shipman) M is hyper-minimal, if it has the minimal number of states among the f -equivalent automata.(Not unique) Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 3 / 13

  7. f -equivalence and hyper-minimisation Definition ( f -equivalent) L ∼ L ′ ⇐ ⇒ they differ on finite amount of words. Extend the definition to automata. Definition (A. Badr, V. Geffert, I. Shipman) M is hyper-minimal, if it has the minimal number of states among the f -equivalent automata.(Not unique) Remark For fixed L we extend ∼ to words: w ∼ w ′ ⇐ ⇒ w − 1 L ∼ w ′− 1 L For fixed automata M we extend ∼ to states: q ∼ q ′ ⇐ ⇒ L ( q ) ∼ L ( q ′ ) (where L ( q ) is the language recognised starting from q ). Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 3 / 13

  8. Approach Idea We want a relation on words, such that equivalence classes are states of a hyper-minimal automaton, ∼ is a natural candidate. Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 4 / 13

  9. Approach Idea We want a relation on words, such that equivalence classes are states of a hyper-minimal automaton, ∼ is a natural candidate. Classes of ∼ are groups of classes of ≡ . We cannot greedily merge those groups: w : δ ( q 0 , w ) = q 1 : wL ( q 1 ) changes to wL ( q 3 ) � = wL ( q 1 ). Infinitely many such w — problem! L ( q 1 ) ∼ L ( q 2 ) = ⇒ L ( q 1 ) �≡ L ( q 2 ) L ( q 3 ) L ( q 2 ) L ( q 1 ) No problem occurs if there are only finitely many such w . Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 4 / 13

  10. Approach Idea We want a relation on words, such that equivalence classes are states of a hyper-minimal automaton, ∼ is a natural candidate. Classes of ∼ are groups of classes of ≡ . We cannot greedily merge those groups: w : δ ( q 0 , w ) = q 1 : wL ( q 1 ) changes to wL ( q 3 ) � = wL ( q 1 ). Infinitely many such w — problem! L ( q 1 ) ∼ L ( q 2 ) = ⇒ L ( q 1 ) �≡ L ( q 2 ) L ( q 3 ) L ( q 2 ) L ( q 1 ) No problem occurs if there are only finitely many such w . Definition State q is in preamble if { w : δ ( q 0 , w ) = q } is finite. In kernel otherwise. Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 4 / 13

  11. Heuristic Definition (state merging) Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 5 / 13

  12. Heuristic Definition (state merging) Heuristic Greedily merge q to p whenever q ≡ p or q ∼ p and q is in the preamble Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 5 / 13

  13. Heuristic Definition (state merging) Heuristic Greedily merge q to p whenever q ≡ p or q ∼ p and q is in the preamble and there is no path from p to q Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 5 / 13

  14. Heuristic Definition (state merging) Heuristic Greedily merge q to p whenever q ≡ p or q ∼ p and q is in the preamble and there is no path from p to q Theorem (A. Badr, V. Geffert, I. Shipman) The heuristic is proper, i.e. it results in hyper-minimal automaton f -equivalent to the input one. Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 5 / 13

  15. Data structures Definition (Operational definition of ∼ ) D M ( q , q ′ ) if q = q ′ or, D M ( q , q ′ ) if for all a ∈ Σ D M � � δ M ( q , a ) , δ M ( q ′ , a ) . Lemma If the automaton M is minimised the D coincides with ∼ . Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 6 / 13

  16. Data structures Definition (Operational definition of ∼ ) D M ( q , q ′ ) if q = q ′ or, D M ( q , q ′ ) if for all a ∈ Σ D M � � δ M ( q , a ) , δ M ( q ′ , a ) . Lemma If the automaton M is minimised the D coincides with ∼ . We need a dictionary structure supporting query, if there are q , q ′ such that ( δ ( q , 0) , δ ( q , 1)) = ( δ ( q ′ , 0) , δ ( q ′ , 1)) when q is merged to q ′ , fast update of δ Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 6 / 13

  17. Data structures Definition (Operational definition of ∼ ) D M ( q , q ′ ) if q = q ′ or, D M ( q , q ′ ) if for all a ∈ Σ D M � � δ M ( q , a ) , δ M ( q ′ , a ) . Lemma If the automaton M is minimised the D coincides with ∼ . We need a dictionary structure supporting δ ( q, i ) = q i query, if there are q , q ′ such that ( δ ( q , 0) , δ ( q , 1)) = ( δ ( q ′ , 0) , δ ( q ′ , 1)) q 0 when q is merged to q ′ , fast update of δ Deterministic — tree: the path from root to q 1 the leave is ( δ ( q , 0) , δ ( q , 1)) Randomised — hashing q Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 6 / 13

  18. Algorithm Calculating relation D over states identify q , q ′ with the same successors delete the one with less predecessors update the predecessors Using D greedily merge states. Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 7 / 13

  19. Algorithm Calculating relation D over states identify q , q ′ with the same successors delete the one with less predecessors update the predecessors Using D greedily merge states. Running time: O ( n log n ) times insertion time insertion time: ◮ deterministic: O (log n ) ◮ randomised O (1) Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 7 / 13

  20. Remarks and Questions | Σ | has linear impact on the running time for partial δ , running time O ( | δ | log 2 n ) can be obtained Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 8 / 13

  21. Remarks and Questions | Σ | has linear impact on the running time for partial δ , running time O ( | δ | log 2 n ) can be obtained Done independantly by Markus Holzer and Andreas Maletti, CIAA 2009. Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 8 / 13

  22. Remarks and Questions | Σ | has linear impact on the running time for partial δ , running time O ( | δ | log 2 n ) can be obtained Done independantly by Markus Holzer and Andreas Maletti, CIAA 2009. Deterministic running time O ( n log n )? Checking the f -equivalence of two automata is faster? Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 8 / 13

  23. Refinment Definition (distance between languages) � if L � = L ′ , max {| u | : u ∈ L ( w )∆ L ( w ′ ) } + 1 d ( L , L ′ ) = if L = L ′ . 0 Definition ( k - f -equivalence) L ∼ k L ′ ⇐ ⇒ d ( L , L ′ ) ≤ k Definition M is k -minimal if it has the least number of states among the ∼ k automata. Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 9 / 13

  24. Refinment Definition (distance between languages) � if L � = L ′ , max {| u | : u ∈ L ( w )∆ L ( w ′ ) } + 1 d ( L , L ′ ) = if L = L ′ . 0 Definition ( k - f -equivalence) L ∼ k L ′ ⇐ ⇒ d ( L , L ′ ) ≤ k Definition M is k -minimal if it has the least number of states among the ∼ k automata. Remark Algorithm is similar, but some theoretical work is to be done. Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 9 / 13

  25. Approach Idea Suppose there are w 1 , w 2 with respective q 1 , q 2 and L ( w 1 ) , L ( w 2 ) . We merge state q 1 to q 2 Intuitively, w 1 L ( w 1 ) changes to w 1 L ( w 2 ) If L ( w 1 ) � = L ( w 2 ) we want k ≥ d ( w 1 L ( w 1 ); w 1 L ( w 2 )) = | w 1 | + d ( L ( w 1 ) , L ( w 2 )) Artur Je˙ z (UWr) DFA hyper-minimisation November 24, 2009 10 / 13

Recommend


More recommend