Presentation is loading. Please wait.

Presentation is loading. Please wait.

Decidable Questions About Regular languages 1)Membership problem: “Given a specification of known type and a string w, is w in the language specified?”

Similar presentations


Presentation on theme: "Decidable Questions About Regular languages 1)Membership problem: “Given a specification of known type and a string w, is w in the language specified?”"— Presentation transcript:

1 Decidable Questions About Regular languages 1)Membership problem: “Given a specification of known type and a string w, is w in the language specified?” 2) Emptiness problem: “Given a specification of known type, does it specify the empty set?” 3) Finiteness problem: “Given a specification of known type, does it specify finite set?” 4)Equivalence problem: “Given two specifications of the same known type, do they specify the same language?”

2 Algorithm: (Decision of membership problem for DFA) Input: A DFA M=(Q, , , q 0, F) and w in  *. Output: “YES” if w is in L(M), “NO’ otherwise. Method: If  (q 0, w) is in F, say “YES”; If not say “NO”.

3 Algorithm: (Decision of emptiness problem for finite automata.) Input: A DFA M=(Q, , , q 0, F). Output: “YES” if L(M) = , “NO’ otherwise. Method: Compute the set of states accessible from q 0. {p | (q 0, w) = p } If this contains NO final state, say “YES”; If not say “NO”.

4 Algorithm: (Decision of finiteness problem for finite automata.) Input: A DFA M=(Q, , , q 0, F). Output: “YES” if L(M) = is a finite set, “NO’ otherwise. Method: Test if there are any cycles. Answer “YES” if there are no cycles, otherwise “NO”.

5 Definition: let M = (Q, , , q 0, F) be a DFA, and let q 1 and q 2 be two distinct states. We say that a string x in  * distinguishes q 1 from q 2 if exactly one of (q 1, x) and (q 2, x) is in F. We say q 1 and q 2 are k-indistinguishable if and only if there is no x, with |x|  k, which distinguishes q 1 and q 2.

6 Definition: We say q 1 and q 2 are (q 1  q 2 ) indistinguishable if and only if they are k-indistinguishable for all k  0. q 1 and q 2 are equivalent states.

7 start 0 A B D C E F G 0 0 1 1 1 11 0 0 1 0 0 1

8 Table filling algorithm (p157) Basis: If p is an accepting state and q is a nonaccepting state, then (p, q) is a distinguishable pair of states. Induction: Let p and q be states such that  (p,a) = r and  (q,a) = s for some input symbol a. If (r, s) is a known pair of distinguishable states, then (p,q) is also a pair of distinguishable states.

9 Table of state inequivalences B C D E F G ABCDEF

10 Theorem 4.20: It two states are not distinguished by the table-filling algorithm, then the states are equivalent Theorem4.24: If we create for each state q of a DFA a block consisting of q and all the states equivalent to q, then the different blocks of states form a partition of the set of states. State minimization algorithm (p162)

11 Algorithm: (Decision of equivalence problem for DFA) Input: Two DFA M 1 = (Q 1,  1,  1, q 1, F 1 ) and M 2 = (Q 2,  2,  2, q 2, F 2 ) such that Q 1  Q 2 = . Output: “YES” if L(M 1 ) = L(M 2 ), “NO” otherwise Method: Construct the FA M = (Q 1  Q 2,  1   2,  1   2, q 1, F 1  F 2 ). Determine if q 1  q 2. If so say “YES”; otherwise say “NO”.

12 Observation: L(M 1 ) = L(M 2 ) if and only if (L(M 1 )  L(M 2 ))  (L(M 1 )  L(M 2 )) = .


Download ppt "Decidable Questions About Regular languages 1)Membership problem: “Given a specification of known type and a string w, is w in the language specified?”"

Similar presentations


Ads by Google