Problem 1
Grammar
S -> X | Y
X -> aaX | aA
Y -> aaY | bB
B -> bbB | epsilon
Explanation
case 1: X - n is odd and m is even
case 2: Y - n is even and m is odd
Problem 2
1. Regular expression: aaa+(epsilon + b + bb + bbb +
bbbb)
2. Regular expression: (epsilon + a + aa + aaa)(epsilon + b + bb +
bbb + bbbb)
3. Regular expression: (epsilon + a + aa)b* +
a*bbbbb+
4. Regular expression: aaaa+b* + a*bbbbb+
Maximum of 4 sub parts are answered per post but I went ahead and solved one more.
Please post accordingly.
HW03 - 1 to 4 Problem 1 Find a regular expression for the set ^a"bm: (n...
Regular expressions, DFA, NFA, grammars, languages Regular Languages 4 4 1. Write English descriptions for the languages generated by the following regular expressions: (a) (01... 9|A|B|C|D|E|F)+(2X) (b) (ab)*(a|ble) 2. Write regular expressions for each of the following. (a) All strings of lowercase letters that begin and end in a. (b) All strings of digits that contain no leading zeros. (c) All strings of digits that represent even numbers. (d) Strings over the alphabet {a,b,c} with an even number of a's....
UueSLIORS! 1. Find the error in logic in the following statement: We know that a b' is a context-free, not regular language. The class of context-free languages are not closed under complement, so its complement is not context free. But we know that its complement is context-free. 2. We have proved that the regular languages are closed under string reversal. Prove here that the context-free languages are closed under string reversal. 3. Part 1: Find an NFA with 3 states...
4. A regular expression for the language over the alphabet fa, b) with each string having an even number of a's is (b*ab*ab*)*b*. Use this result to find regular expressions for the following languages a language over the same alphabet but with each string having odd number of a's. (3 points) a. b. a language over the same alphabet but with each string having 4n (n >- 0) a's. (3 points)
1. Complete the following exercises a) For Σ = {a, b} find regular expressions for the compliment of the following languages L = L(aa*bb) b) Let Li = L(ab*aa), L2 = L(a"bba"). Find a regular expression for (L1 n Ljl2. c) The symmetric difference of two sets Sı and S2 is defined as sı Θ s,-(x : x E Si or x E S2 but x is not in both S1 and S2). Show that the family of regular languages...
1. Write regular expressions to capture the following regular languages: (a) The set of binary strings which have a 1 in every even position. (Note: odd positions may be either 0 or 1.) (b) The set of binary strings that do not contain 011 as a substring. (c) Comments in Pascal. These are delimited by (* and *) or by { and }, and can contain anything in between; they are NOT allowed to nest, however. 2. Write a DFA...
3" (25%) Give regular expressions for the following languages on {a, b). (a) L,-(a"b": n 4, m 3) (b) The complement of Li. (c) L- (w: w mod 3 03. Note: lw: the length of w (d) L3 w: |w mod 30 naww) appear) 3" (25%) Give regular expressions for the following languages on {a, b). (a) L,-(a"b": n 4, m 3) (b) The complement of Li. (c) L- (w: w mod 3 03. Note: lw: the length of w...
Please show all steps and work. Thanks Find (1) an NFA and (2) a regular expression for the following languages on fa, bj. Tb) imo . L-[w: 2na(w) + 3nb(w) is even) Note: na(w) means the number of a's in the string w, and n is defined in the same way.
Provide a regular expression for the following languages: (a) the set of all strings over {a, b} that start with ab and end with ba, (b) the set of strings over {a, b} where four consecutive occurrences of both letters occur in every word.
THEOREM 3.1 Let r be a regular expression. Then there exists some nondeteministic finite accepter that accepts L (r) Consequently, L () is a regular language. Proof: We begin with automata that accept the languages for the simple regular expressions ø, 2, and a E . These are shown in Figure 3.1(a), (b), and (c), respectively. Assume now that we have automata M (r) and M (r) that accept languages denoted by regular expressions ri and r respectively. We need...
For each of the languages listed below, give a regular expression that generates the lan- guage. Briefly justify your answer. (a) The set of strings over (a, b such that any a in the string is followed by an odd number of b's. Examples: bbbab E L, but abb f L. (b) The set of strings over fa, b in which there is an a in every even position and the total number of b's is odd, where the first...