Collapsing Nondeterministic Automata Ashutosh Bhatia Nitin Rai Sep 12, 2005
FACTS of NFA and DFA A nondeterministic finite automaton (NFA) may be smaller than a DFA by an exponential factor [Meyer and Fischer, 1971]. •The minimal DFA is unique upto isomorphism •A state minimal complete DFA is a transition minimal complete DFA, and vice versa. This does not hold for NFA •NFA is most compact if there are no equivalent states. But at the end, it does not mean state minimization, because there are NFA accepting the same language by a smaller number of states.
Nondeterminism and Minimality There may not be a unique minimal NFA for a regular language. 0,1 1 0 0 0,1 0,1 NFAs defining the same language ∑ * 0 ∑ * All are reduced with same number of states but not unique.
Nondeterminism and Minimality (Contd..) 4 NFAs accepting the language ending with “a”
Why not unique minimal NFA ? IN DFA, pair of states p and q can be collapse if they have equivalent relation between them. p ≈ q ⇔ ∀ x ∈ ∑ * ( δ ˆ(p,x) ∈ F ⇔ δ ˆ(q,x) ∈ F ) if p ≈ q ⇔ δ (p,a) ≈ δ (q,a) ( Can be proved by induction) But in NFA, two states p and q may be equivalent even though there are no equivalent state in ∆ (p,a) and ∆ (q,a).
Cont.. What can be said about A and B ? A B G • A and B looks like a equivalent as we can’t find any common distinguishable 0 0 0 string. 0 ∆ (A,00) and ∆ (A,01) ∈ F C D E ∆ (B,00) and ∆ (B,01) ∈ F 1 0 0,1 but they are not equivalent states because no two of C, D and E are F equivalent. Need stronger concept than state equivalence like state bisimilarity, bisimulation, Auto bisimulation .
STATE BISIMILARITY Two states p and q of NFA M are bisimilar p ≈ q, iff • the following conditions are satisfied. For all a ∈ ∑ and all p’ ∈ ∆ (p,a) there exist a state q’ ∈ ∆ 1. (q,a) such that p’ ≈ q’. For all a ∈ ∑ and all q’ ∈ ∆ (q,a) there exist a state p’ ∈ ∆ 3. (p,a) such that p’ ≈ q’. In the automaton, we have A ≈ B but B ≈ G
BISIMULATION Let M, N be two NFA’s. Let ≈ be a binary relation relating states of M with states of N that is ⊆ Q M x Q N . B ⊆ Q N define C ≈ (B) = {p ∈ Q M | ∃ q ∈ B p ≈ q} A ⊆ Q M define C ≈ (A) = {q ∈ Q N | ∃ p ∈ A p ≈ q}. The ≈ can be extended in natural way for A ⊆ Q M B ⊆ Q N A ≈ B ⇔ A ⊆ C ≈ (B) and B ⊆ C ≈ (A) ⇔ ∀ p ∈ A ∃ q ∈ B p ≈ q and ∀ q ∈ B ∃ p ∈ A p ≈ q.
≈ Over Sets A ⊆ Q M B ⊆ Q N A ≈ B A Not ≈ B M M N N A B A B C ≈ (A) C ≈ (A) C ≈ (B) C ≈ (B) C ≈ (A) Every element of A should be related to at least one element of B and vice versa
BISIMULATION ( Contd..) The relation ( ≈ ) is called a bisimulation if the following three condition are met: S M ≈ S N If p ≈ q, then for all a ∈ ∑ , ∆ M (p,a) ≈ ∆ N (q,a); and If p ≈ q, then p ∈ F M , iff q ∈ F N. M and N are bisimilar if there exist a bisimulation between them. The bisimilarity class of M is the family of all NFAs that are bisimilar to M. Bisimilar class contains a unique minimal NFA
BISIMULATION Properties Bisimulation is symmetric: if ≈ is a bisimulation between M 1. and N then its reverse { (q,p) | p ≈ q ) is a bisimulation between N and M. Bisimulation is Transitive: if ≈ 1 is a bisimualtion between M 3. and N and ≈ 2 is a bisimualtion between N and P, then their composition ≈ 1 o ≈ 2 = { (p,r) | ∃ q p ≈ 1 q and q ≈ 2 r } is a bisimulation between M and P. 5. The union of any nonempty family of bisimulations between M and N is a bisimulation between M and N. 7. Bisimilar automaton accepts the same set (Proof)
BISIMULATION of NFA’s 0,1 0 0,1 0 0 0 Y Z X P Q 0 0 0,1 0,1 1 S 1 D 0 0 P Q 0 F 0 1 1 Q 0 S 2 B 0 Accept the Language ends 0,1 0 with a “0”.
AUTOBISIMULATION An autobisimulation is bisimulation between an automaton and itself. Any nondeterministic automaton M has coarsest autobisimulation ≡ M and relation ≡ M is an equivalence relation. Proof : Let B be the set of all autobisimulation on M 4. B is Non empty since it contains identity relation 5. Let ≡ M be the union of all relation in B 6. By definition of bisimulation ≡ M in B (Why) 7. The relation ≡ M is reflexive , since it contains identity element and 8. symmetric and transitive by definition of bisimulation. The ≡ M is an equivalence relation The ≡ M is called maximal autobisimulation ((Why) 9.
IF A ≈ B => ∆ M (A,x) ≈ ∆ N (B,x) Let ≈ be a bisimulation between M and N . If A ≈ B , then for all x ∈ ∑ * , ∆ M (A,x) ≈ ∆ N (B,x) Proof: 3. For x = ε it is trivial 4. For x = a , if p ∈ A there exists q ∈ B s.t p ≈ q (Why) 5. ∆ M (p,a) ⊆ C ≈ ( ∆ N (q,a)) 6. ∪ p ∈ A ∆ M (p,a) ⊆ ∪ q ∈ B C ≈ ( ∆ N (q,a)) 7. ∆ M (A,a) ⊆ C ≈ ( ∆ N (B,a))
Cont……. 5 . ∆ M (A,a) ≈ ∆ N (B,a) 6. By induction. Suppose that ∆ M (A,x) ≈ ∆ N (B,x) 7. ∆ M (A,xa) = ∆ M ( ∆ M (A,x) , a) ≈ ∆ N ( ∆ N (B,x) , a) ) ≈ ∆ N (B,xa)
Bisimilar Automata accepts the same Language 1. Let ≈ is Bisimulation between M and N For any x ∈ ∑ * , ∆ M (S M ,x) ≈ ∆ N (S N ,x) 2. 3. By Definition of Bisimulation ∆ M (S M ,x) ∩ F M ≠ φ ⇔ ∆ N (S N ,x) ∩ F N ≠ φ x ∈ L(M) ⇔ x ∈ L(N) 4. L(M) = L(N)
Quotient automaton M’ (collapsing of states) Let M = (Q, ∑ , ∆ , S ,F ) be a NFA Let ≡ M be the maximal autobisimulation on M For p ∈ Q define [p] denote the equivalence class of p Define A’ = { [p] | p ∈ A } Now M’ be defined the quotient automation M’ = (Q’, ∑ , ∆ ’ , S’ ,F’ ) Where Q’ , S’ and F’ refer to above definition and ∆ ’ ([p],a) defined as ∆ (p,a) ‘ The quotient automaton is the minimal automaton bisimilar to M and is unique up to isomorphism
An Algorithm for computing Maximum bisumlation Write down a table of all pairs, initially unmarked. Mark pair (p,q) if p ∈ F M and p ∉ F N or vice versa. Repeat the following until no more changes occur: if (p,q) is unmarked, and if for some a ∈ ∑ , either There exists p’ ∈ ∆ M (p,a) such that for all q’ ∈ ∆ N (q,a), (p’,q’) is marked, or There exists q’ ∈ ∆ N (q,a) such that for all p’ ∈ ∆ M (p,a), (p’,q’) is marked, then mark (p,q). Define p ≡ q iff (p,q) is never marked. Check whether S M ≡ S N. If so, then ≡ is the maximal bisimulation between M and N.
Example 1 X Y Z 0,1 0,1 0 0 Y Z X X Y 0 0,1 0 Z 0 Y X M x M = {(X,X) , (X,Y) , (X,Z) , (Y,X) , (Y,Y) , (Y,Z) , (Z,X) , (Z,Y) , (Z,Z)} ≈ { (X,X) , (Y,Y), (Z,Z) , (Y,Z) } ≈ is a Bisimulation b.z X ≈ X (Initial states), Y ≈ Z final states And since it is reflexive it ≈ is Autobisimulation
Example 2 0 S1 S2 B D F 0,1 1 S 1 D S1 0 0 S2 F 1 B 0 S 2 B 0 D 0,1 0 F 0 0 0 0 0,1 0 F S All Four S1 , S2 , B , D are Equivalent
Two NFAs accepting same language may not be bisimilar 0,1 X Y Z 0 P Q Q 1 1 0 0,1 P 0 0 0 Z X 0 1 (X,0) -> {X,Z) and (Q,0) -> {Q,P} Don’t Mark Y (X,1) -> {X,Y) and (Q,1) -> {Q} Don’t Mark (Y,0) -> {X) and (Q,0) -> {Q,P} Mark Y and Q Since Initial sates are not equivalent M and N are not Bisimilar
Conclusion 1. Bisimulation doesn’t mean state minimization 2. The Algorithm presented only calculates the maximal autobisimulation/bisimulation among the bisimulation class if it exists 3. The Algorithm doesn’t include the inaccessible states 4. The quotient automaton is unique under isomorphism but only under bisimulation classand it is minimal
Recommend
More recommend