sol03

# sol03 - CS 154 Intro to Automata and Complexity Theory...

This preview shows pages 1–2. Sign up to view the full content.

CS 154 Intro. to Automata and Complexity Theory Handout 17 Autumn 2009 David Dill October 20, 2009 Solution Set 3 Problem 1a We want to come up with a decision algorithm for the decision property P : | L | ≥ 100. | L | ≥ 100 can be split into two cases: 1. | L | is inFnite. 2. | L | is Fnite, but 100. If either case 1 or 2 hold, then the decision algorithm returns Yes , else it returns No . Case 1: Theorem: L is inFnite i± there exists a string w L such that n ≤ | w | < 2 n , where n is the number of states in the dfa for L . Proof: ( ) Suppose we are given a string w L such that n ≤ | w | < 2 n . By the pumping lemma, w = xyz, | y | > 0 such that for all k 0, xy k z is in L . Since there are an inFnite number of possible values for k , there are an inFnite number of strings in L . Hence, L is inFnite. ( ) We are given that L is inFnite. This implies that there exists at least one string w L such that | w | ≥ n . (If every string in L had a length < n , there would only be a Fnite number of them, which we could easily enumerate. But L is given to be inFnite.) Let w be the shortest string in L of length n . Claim: | w | < 2 n . Proof by contradiction: Assume that | w | ≥ 2 n . By the pumping lemma, w = xyz , with | xy | ≤ n and | y | > 0. Since | y | ≤ n , if we choose a value of 0 for k , then xy k z = xz , whose length must be n (since the eliminated piece y had a length n ). Also, xz L . But in that case, w could not be the shortest string in L with length n . Contradiction! Therefore, n ≤ | w | < 2 n . So in order to check if L is inFnite, we can enumerate all the strings with lengths in the range [ n, 2 n ) and test if any of them is in L . If we do not get even one string in L , then L is Fnite. Else L is inFnite. If L is inFnite, then answer to our decision problem is Yes . If L is Fnite, then the answer depends on the outcome of case 2. Case 2: Test if | L | ≥ 100. If L is Fnite, then we know from the above proof that all strings in L must necessarily have lengths < n . We can enumerate all strings with lengths in the range [0 ,n ), since there are only a Fnite number of them. We test each enumerated string to see if it is in L , and count the number of strings that belong to L . If, after the enumeration is over, we counted

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

sol03 - CS 154 Intro to Automata and Complexity Theory...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online