Recap lecture 29 Example of prefixes of a language, Theorem: pref(Q in R) is regular, proof, example, Decidablity, deciding whether two languages are equivalent or not ?, method 1, example, method 2, example 1 Example Consider two languages L1 and L2, expressed by the REs r1=a* and r2=+aa* respectively. To determine whether L1 and L2 are equivalent, let the corresponding FAs a be a,b a FA1 p1 r3+ a b p2 FA2 r 1 b a,b b r2 2 Example continued … As discussed earlier, the FA corresponding to the language (L1L2c)U(L1cL2) helps in this regard i.e. if this FA accepts any word then L1 and L2 are not equivalent other wise L1 and L2 are equivalent. Following are the FAs corresponding to c c L1 and L2 3 Example continued … a a,b a FA1 c q1- b q2+ s3 a FA2c s1 - a,b b b s2 + FAs corresponding to (FA1c U FA2)c and (FA2c U FA1)c may be as follows 4 Example continued … c (FA1 UFA2) c a q1 , r3 a q1 , r1 c (FA2 UFA1) c a p 1 , s3 a a,b b b q2 , r2 - p1 , s1 a,b b b p2 , s2 Both the FAs have no final state, so these FAs accept nothing. This implies that their union will not also accept any string. Hence FA corresponding to the language (L1L2c)U(L1cL2) accepts nothing. Thus both the languages are equivalent. 5 Example Following is an FA, for which it is required to decide whether it accepts any string or not? Using steps discussed in method 2, the following FA can be checked whether it accepts any word or not. 6 Example 1b b a a 2 b 5 a b a,b 3 b 4+ a a 6 7 Example continued … 1b b a a 2 b 5 a b a,b 3 b 4+ a a 6 8 Example continued … 1b b a 2 b 5 a a,b 3 b 4+ a a 6 9 Example continued … 1b a 2 b a a,b 3 b 4+ a 5 6 10 Example continued … 1b a 2 b a 3 b 4+ a 5 6 11 Example continued … As no final state of the previous FA is marked, after applying the method, so the given FA accepts no word. 12 Method 3 If the FA has N states, then test the words of length less than N. If no word is accepted by this FA, then it will accept no word. Note: It is to be noted that all the methods discussed above, to determine whether an FA accepts certain word, are effective procedures. Example: To determine whether the following FA accepts certain word, using method 3, all the strings of length less than 4 (i.e. less than the number of states of the FA) are sufficient to be tested 13 Example 2 a a a 1- b a 4+ b b 3 b i.e. , a, b, aa, ab, ba, bb, aaa, aab, aba, abb, baa, bab, bba, bbb are required to be tested. 14 Example continued … It can be observed that the strings aa, baa, aaa are accepted by this FA, hence the language accepted by this FA is not empty. Following is another example, to test whether an FA accepts certain word ? 15 Example Consider the following FA. To determine whether this FA accepts some word, all the strings of length less than 4 (i.e. less than the number of states of this FA) are to be tested a 1- a,b a b b 2 b 3 a,b 4+ 16 Example continued … It can be observed that none of the strings , a, b, aa, ab, ba, bb, aaa, aab, aba, abb, baa, bab, bba, bbb, is accepted by this FA. Thus the given FA cannot accept any word. 17 Observation To find whether a regular expression defines an infinite language or not ? The following possibilities are required to be checked. If a regular expression contains * then it may define an infinite language, with the exception * as *= e.g. (+a*)(*+)* defines finite language. While (*+a*)* (*+)* defines an infinite language. There are so many ways to decide whether an FA accepts a finite language or an infinite. Following is a theorem regarding this 18 Theorem Let F be an FA having N states 1. If F accepts a word w s.t. N length(w) < 2N then F accepts infinite language. 2. If F accepts an infinite language then there are some words w s.t. N length(w) < 2N The first part can be proved, using the pumping lemma version II. Following is a remark regarding this theorem 19 Remark There is an effective procedure to decide whether an FA accepts finite or infinite language. For a machine with N number of states, the total number of strings to be tested, defined over an alphabet of m letters, is mN +mN+1 + mN+2 +… +m2N-1. After testing all these strings on the machine, if any is accepted then the machine accepts infinite language other wise not. e.g. for machine of three states and alphabet of two letters, 2 3 +2 4 +2 5 = 56 strings are to be tested. 20 Summing Up Deciding whether two languages are equivalent or not, example, deciding whether an FA accept any string or not, method 3, examples, finiteness of a language 21
© Copyright 2026 Paperzz