a) Given a string w of 0s and 1s, the flip of w is obtained by changing all 0s in w to 1s and all 1s in w to 0s. Given a language A, the flip of A is the language {w | the flip of w is in A}. Prove that the class of regular languages is closed under the flip operation.
Problem 3.3: For a string x € {0,1}*, let af denote the string obtained by changing all 0's to l's and all l's to O's in x. Given a language L over the alphabet {0,1}, define FLIP-SUBSTR(L) = {uvFw: Uvw E L, U, V, w € {0, 1}*}. Prove that if L is regular, then FLIP-SUBSTR(L) is regular. (For example, (1011)F = 0100. If 1011011 e L, then 1000111 = 10(110) F11 € FLIP-SUBSTR(L). For another example, FLIP-SUBSTR(0*1*) = 0*1*0*1*.)...
Define nor operation for the language as follows. nor(L1, L2) = {w : w E L1 or w E L2} Show that the family of regular languages is closed under the nor operation. Define nor operation for the language as follows. nor(L1, L2) = {w : w E L1 or w E L2} Show that the family of regular languages is closed under the nor operation.
1(a)Draw the state diagram for a DFA for accepting the following language over alphabet {0,1}: {w | the length of w is at least 2 and has the same symbol in its 2nd and last positions} (b)Draw the state diagram for an NFA for accepting the following language over alphabet {0,1} (Use as few states as possible): {w | w is of the form 1*(01 ∪ 10*)*} (c)If A is a language with alphabet Σ, the complement of A is...
Given an array A containing 0s and 1s, such that all the 0s appear in the array before all the 1s. Write an algorithm with worst-case time complexity O(log(n)), which finds the smallest index i such that A[i] = 1. Describe your algorithm, and analyze its worst-case time complexity.
Given any string w ∈ {0, 1}∗, let n0(w) = number of 0′s in w and n1(w) = number of 1′s in w. Prove, by using the pumping lemma, that the language {w | 0 ≤ n0(w) ≤ 2∗n1(w)+1.} is not a regular language.
Problem 3 [20 points Prove that the class of regular languages is closed under reverse. That is, show that if A is a regular language, then AR -[wR | w e A is also regular. [Hint: given a DFA M = (Q,Σ, δ, q0,F) that recognizes A, construct a new NFA (Q', Σ,8,6, F') that recognizes AR.]
5. (20 pt.) Prove that the class of regular languages is closed under reverse. That is, show that if A is a regular language, then AR = {wR W E A} is also regular. Hint: given a DFA M = (Q,2,8,90, F) that recognizes A, construct a new NFA N = (Q', 2,8', qo',F') that recognizes AR and justify why your construction is correct.
Question 1: Every language is regular T/F Question 2: There exists a DFA that has only one final state T/F Question 3: Let M be a DFA, and define flip(M) as the DFA which is identical to M except you flip that final state. Then for every M, the language L(M)^c (complement) = L( flip (M)). T/F Question 4: Let G be a right linear grammar, and reverse(G)=reverse of G, i.e. if G has a rule A -> w B...
12. [10 bonus points) Let us define an operation truncate, which removes the rightmost symbol from any string. For example, truncate (aaaba) is aaab. The operation can be extended to languages by truncate(L) = {truncate (w): WE L} Show how, given a DFA for any regular language L, one can construct a DFA for truncate(L). From this, prove that if L is a regular language not containing 1, then truncate(L) is also regular.
(20 pt.) Prove that the class of regular languages is closed under reverse. That is, show that if A is a regular language, then AR = {wR WE A} is also regular. Hint: given a DFA M = (Q,2,8,90, F) that recognizes A, construct a new NFA N = (Q', 2,8', qo',F') that recognizes AR and justify why your construction is correct.