Download Homework 1 for Introduction to Computational Complexity | CS 530 and more Assignments Computer Science in PDF only on Docsity! CS530: Introduction to Computational Complexity Xiang-Yang Li Homework 1 Due: Sept 16, 2008 YanWei Wu Problem 1: Designing DFAs and NFAs. For each of the following, draw a state diagram for a DFA or NFA (as required) that recognizes the specified language. In all cases the alphabet is {0, 1}. (a) Sipser exercise 1.6, part c. L1 = {w|w contains the substring 0101}. Provide a DFA recogniz- ing L1. Notice that you are required to write DFA, not NFA here. (b) Sipser exercise 1.6, part j. L2 = {w|w contains at least two 0s and at most one 1}. Provide a DFA recognizing L2. Notice that you are required to write DFA, not NFA here. (c) Sipser exercise 1.7, part c. L3 = {w|w contains an even number of 0s, or exactly two 1s}. Provide an NFA with at most six states that recognizes L3. Notice that you can use NFA here. Problem 2: Proving an FA recognizes a language. For one of the automata you designed in problem 1, prove that the machine recognizes exactly the specified language. To do this, you will need to prove that your automaton (1) accepts all strings in the language and (2) does not accept any string not in the language. Problem 3: Given two languages A, B that are regular, show that the following languages are regular 1. A † B = {a1b1a2b2a3b3 · · · anbn | n ≥ 1, a1a2a3 · · ·an ∈ A, and b1b2b3 · · · bn ∈ B} 2. A#B = {a1b1a2b2a3b3 · · · anbn | n ≥ 1, a1a2a3 · · · an ∈ A, or b1b2b3 · · · bn ∈ B} 3. A‡B = {a1a2b1a3a4b2a5a6b3 · · · a2n−1a2nbn | n ≥ 1, a1a2a3 · · · a2n−1a2n ∈ A, and b1b2b3 · · · bn ∈ B} Problem 4: Assume that the alphabet is Σ = {a, b, c}. Let N(w, a) denote the number of times that character a appeared in string w. Write regular expressions for each of the following languages 1. L1 = {w | N(w, a) is odd}. 2. L2 = {w | N(w, b) is even}, 3. L3 = {w | N(w, a) is odd, and N(w, b) is even}, Problem 5: Describe the following language by nature language 1. 10∗1 2. (0|1)∗011(0|1)∗ Problem 6: Prove that the following languages are non-regular: 1. L1 = {0i1j0k : j = max{i, k}} 2. L2 = {w|w = xx̄, x ∈ {0, 1}∗, x̄ is the complement of x} 3. Palindrome Lp = {w | w is a palindrome}. Assume that the alphabet is Σ = {0, 1}. A palindrome is a binary string which is equivalent to its reversal. For example, 1, 0110 and 010111010 are palindromes, but 011 is not. 1-1