1. The operation Perm(w), applied to a string w, is all strings that can be constructed by permuting the symbols of w in any order. For example, if w = 101, then Perm(w) is all strings with two 1's and one 0, i.e., Perm(w) = {101, 110,011}. If L is a regular language, then Perm(L) is the union of Perm(w) taken over all w in L. For example, if L is the language L(0*1*), then Perm(L) is all strings of 0's and 1's, i.e., L((0+1)*). If L is regular, Perm(L) is sometimes regular, sometimes context-free but not regular, and sometimes not even context-free. Consider each of the following regular expressions R below, and decide whether Perm(L(R)) is regular, context-free, or neither: 1. (01)* 2.0*+1* 3. (012)* 4. (01+2)* a) Perm(L((01+2)*)) is context-free but not regular. b) Perm(L(0*+1*)) is not context-free. c) Perm(L((012)*)) is context-free but not regular. d) Perm(L(0*+1*)) is context-free but not regular. 2. The language of regular expression (0+10)* is the set of all strings of O's and 1's such that every 1 is immediately followed by a 0. Describe the complement of this language (with respect to the alphabet {0,1}) and identify in the list below the regular expression whose language is the complement of L((0+10)*). a) (0+1)*(1+11)(0+1)* b) (0+10)*(1+11(0+1)*) c) (1+01)* d) (0+1)*(11+1+ɛ)* 3. The homomorphism h is defined by h(a) = 01 and h(b) = 10. What is h(abaa)? a) 011001 ○ b) 01100101 c) abaa d) 01010101 4. h is a homomorphism from the alphabet {a,b,c} to {0,1}. If h(a) = 01, h(b) = 0, and h(c) = 10, which of the following strings is in h¹ (010010)? a) bcab b) cbcb abcb d) bcba 5. If h is the homomorphism defined by h(a) = 0 and h(b) = ε, which of the following strings is in h¨¹ (000)? a) bbb b) babab c) bababab d) abbbabaab 6. The operation DM(L) is defined as follows: 1. Throw away every even-length string from L. 2. For each odd-length string, remove the middle character. For example, if L = {001, 1100, 10101}, then DM(L) = {01, 1001}. That is, even-length string 1100 is deleted, the middle character of 001 is removed to make 01, and the middle character of 10101 is removed to make 1001. It turns out that if L is a regular language, DM(L) may or may not be regular. 6. The operation DM(L) is defined as follows: 1. Throw away every even-length string from L. 2. For each odd-length string, remove the middle character. For example, if L = {001, 1100, 10101}, then DM(L) = {01, 1001}. That is, even-length string 1100 is deleted, the middle character of 001 is removed to make 01, and the middle character of 10101 is removed to make 1001. It turns out that if L is a regular language, DM(L) may or may not be regular. For each of the following languages L, determine what DM(L) is, and tell whether or not it is regular. • • • • L1: the language of regular expression (01)*0. L2: the language of regular expression (0+1)*1(0+1)*. L3: the language of regular expression (101)*. L4: the language of regular expression 00*11*. Now, identify the true statement below. a) DM(L1) is not regular; it consists of all strings of the form (01) (00+ε) (10)". b) DM(L1) is not regular; it consists of all strings of the form (01) (00) (10)". c) DM(L4) is regular; it is the language of regular expression 0*1*. d) DM(L2) is not regular; it consists of all even-length strings with more O's than 1's. 7. Find, in the list below, a regular expression whose language is the reversal of the language of this regular expression: 10*(0+1)*. Recall that the reversal of a language is formed by reversing all its strings, and the reversal of a string a1a2...an is an...a2a1. a) (0+1)*10* b) (0+1)*0*1 c) 1(0+1)*0* d) 0*(0+1)*1 8. Let h be the homomorphism defined by h(a) = 01, h(b) = 10, h(c) = 0, and h(d) = 1. If we take any string w in (0+1)*, h¨¹ (w) contains some number of strings, N(w). For example, h¹ (1100) = {ddcc, dbc}, i.e., N(1100) = 2. We can calculate the number of strings in h¨¹ (w) by a recursion on the length of w. For example, if w= 00x for some string x, then N(w) = N(0x), since the first 0 in w can only be produced from c, not from a. Complete the reasoning necessary to compute N(w) for any string w in (0+1)*. Then, choose the correct value of N(110011001). a) 8 b) 55 256 d) 16

icon
Related questions
Question
1. The operation Perm(w), applied to a string w, is all strings that can be
constructed by permuting the symbols of w in any order. For example, if w =
101, then Perm(w) is all strings with two 1's and one 0, i.e., Perm(w) = {101,
110,011}. If L is a regular language, then Perm(L) is the union of Perm(w)
taken over all w in L. For example, if L is the language L(0*1*), then Perm(L)
is all strings of 0's and 1's, i.e., L((0+1)*).
If L is regular, Perm(L) is sometimes regular, sometimes context-free but not
regular, and sometimes not even context-free. Consider each of the following
regular expressions R below, and decide whether Perm(L(R)) is regular,
context-free, or neither:
1. (01)*
2.0*+1*
3. (012)*
4. (01+2)*
a) Perm(L((01+2)*)) is context-free but not regular.
b) Perm(L(0*+1*)) is not context-free.
c) Perm(L((012)*)) is context-free but not regular.
d) Perm(L(0*+1*)) is context-free but not regular.
2. The language of regular expression (0+10)* is the set of all strings of O's and
1's such that every 1 is immediately followed by a 0. Describe the complement
of this language (with respect to the alphabet {0,1}) and identify in the list
below the regular expression whose language is the complement of
L((0+10)*).
a) (0+1)*(1+11)(0+1)*
b) (0+10)*(1+11(0+1)*)
c) (1+01)*
d) (0+1)*(11+1+ɛ)*
3. The homomorphism h is defined by h(a) = 01 and h(b) = 10. What is h(abaa)?
a) 011001 ○ b) 01100101
c) abaa
d) 01010101
4. h is a homomorphism from the alphabet {a,b,c} to {0,1}. If h(a) = 01, h(b) = 0,
and h(c) = 10, which of the following strings is in h¹ (010010)?
a) bcab
b) cbcb
abcb
d) bcba
5. If h is the homomorphism defined by h(a) = 0 and h(b) = ε, which of the
following strings is in h¨¹ (000)?
a) bbb
b) babab
c) bababab
d) abbbabaab
6. The operation DM(L) is defined as follows:
1. Throw away every even-length string from L.
2. For each odd-length string, remove the middle character.
For example, if L = {001, 1100, 10101}, then DM(L) = {01, 1001}. That is,
even-length string 1100 is deleted, the middle character of 001 is removed to
make 01, and the middle character of 10101 is removed to make 1001.
It turns out that if L is a regular language, DM(L) may or may not be regular.
Transcribed Image Text:1. The operation Perm(w), applied to a string w, is all strings that can be constructed by permuting the symbols of w in any order. For example, if w = 101, then Perm(w) is all strings with two 1's and one 0, i.e., Perm(w) = {101, 110,011}. If L is a regular language, then Perm(L) is the union of Perm(w) taken over all w in L. For example, if L is the language L(0*1*), then Perm(L) is all strings of 0's and 1's, i.e., L((0+1)*). If L is regular, Perm(L) is sometimes regular, sometimes context-free but not regular, and sometimes not even context-free. Consider each of the following regular expressions R below, and decide whether Perm(L(R)) is regular, context-free, or neither: 1. (01)* 2.0*+1* 3. (012)* 4. (01+2)* a) Perm(L((01+2)*)) is context-free but not regular. b) Perm(L(0*+1*)) is not context-free. c) Perm(L((012)*)) is context-free but not regular. d) Perm(L(0*+1*)) is context-free but not regular. 2. The language of regular expression (0+10)* is the set of all strings of O's and 1's such that every 1 is immediately followed by a 0. Describe the complement of this language (with respect to the alphabet {0,1}) and identify in the list below the regular expression whose language is the complement of L((0+10)*). a) (0+1)*(1+11)(0+1)* b) (0+10)*(1+11(0+1)*) c) (1+01)* d) (0+1)*(11+1+ɛ)* 3. The homomorphism h is defined by h(a) = 01 and h(b) = 10. What is h(abaa)? a) 011001 ○ b) 01100101 c) abaa d) 01010101 4. h is a homomorphism from the alphabet {a,b,c} to {0,1}. If h(a) = 01, h(b) = 0, and h(c) = 10, which of the following strings is in h¹ (010010)? a) bcab b) cbcb abcb d) bcba 5. If h is the homomorphism defined by h(a) = 0 and h(b) = ε, which of the following strings is in h¨¹ (000)? a) bbb b) babab c) bababab d) abbbabaab 6. The operation DM(L) is defined as follows: 1. Throw away every even-length string from L. 2. For each odd-length string, remove the middle character. For example, if L = {001, 1100, 10101}, then DM(L) = {01, 1001}. That is, even-length string 1100 is deleted, the middle character of 001 is removed to make 01, and the middle character of 10101 is removed to make 1001. It turns out that if L is a regular language, DM(L) may or may not be regular.
6. The operation DM(L) is defined as follows:
1. Throw away every even-length string from L.
2. For each odd-length string, remove the middle character.
For example, if L = {001, 1100, 10101}, then DM(L) = {01, 1001}. That is,
even-length string 1100 is deleted, the middle character of 001 is removed to
make 01, and the middle character of 10101 is removed to make 1001.
It turns out that if L is a regular language, DM(L) may or may not be regular.
For each of the following languages L, determine what DM(L) is, and tell
whether or not it is regular.
•
•
•
•
L1: the language of regular expression (01)*0.
L2: the language of regular expression (0+1)*1(0+1)*.
L3: the language of regular expression (101)*.
L4: the language of regular expression 00*11*.
Now, identify the true statement below.
a) DM(L1) is not regular; it consists of all strings of the form (01) (00+ε)
(10)".
b) DM(L1) is not regular; it consists of all strings of the form (01) (00)
(10)".
c) DM(L4) is regular; it is the language of regular expression 0*1*.
d) DM(L2) is not regular; it consists of all even-length strings with more O's
than 1's.
7. Find, in the list below, a regular expression whose language is the reversal of
the language of this regular expression: 10*(0+1)*. Recall that the reversal of a
language is formed by reversing all its strings, and the reversal of a string
a1a2...an is an...a2a1.
a) (0+1)*10*
b) (0+1)*0*1
c) 1(0+1)*0*
d) 0*(0+1)*1
8. Let h be the homomorphism defined by h(a) = 01, h(b) = 10, h(c) = 0, and h(d)
= 1. If we take any string w in (0+1)*, h¨¹ (w) contains some number of strings,
N(w). For example, h¹ (1100) = {ddcc, dbc}, i.e., N(1100) = 2. We can
calculate the number of strings in h¨¹ (w) by a recursion on the length of w. For
example, if w= 00x for some string x, then N(w) = N(0x), since the first 0 in w
can only be produced from c, not from a.
Complete the reasoning necessary to compute N(w) for any string w in (0+1)*.
Then, choose the correct value of N(110011001).
a) 8
b) 55
256
d) 16
Transcribed Image Text:6. The operation DM(L) is defined as follows: 1. Throw away every even-length string from L. 2. For each odd-length string, remove the middle character. For example, if L = {001, 1100, 10101}, then DM(L) = {01, 1001}. That is, even-length string 1100 is deleted, the middle character of 001 is removed to make 01, and the middle character of 10101 is removed to make 1001. It turns out that if L is a regular language, DM(L) may or may not be regular. For each of the following languages L, determine what DM(L) is, and tell whether or not it is regular. • • • • L1: the language of regular expression (01)*0. L2: the language of regular expression (0+1)*1(0+1)*. L3: the language of regular expression (101)*. L4: the language of regular expression 00*11*. Now, identify the true statement below. a) DM(L1) is not regular; it consists of all strings of the form (01) (00+ε) (10)". b) DM(L1) is not regular; it consists of all strings of the form (01) (00) (10)". c) DM(L4) is regular; it is the language of regular expression 0*1*. d) DM(L2) is not regular; it consists of all even-length strings with more O's than 1's. 7. Find, in the list below, a regular expression whose language is the reversal of the language of this regular expression: 10*(0+1)*. Recall that the reversal of a language is formed by reversing all its strings, and the reversal of a string a1a2...an is an...a2a1. a) (0+1)*10* b) (0+1)*0*1 c) 1(0+1)*0* d) 0*(0+1)*1 8. Let h be the homomorphism defined by h(a) = 01, h(b) = 10, h(c) = 0, and h(d) = 1. If we take any string w in (0+1)*, h¨¹ (w) contains some number of strings, N(w). For example, h¹ (1100) = {ddcc, dbc}, i.e., N(1100) = 2. We can calculate the number of strings in h¨¹ (w) by a recursion on the length of w. For example, if w= 00x for some string x, then N(w) = N(0x), since the first 0 in w can only be produced from c, not from a. Complete the reasoning necessary to compute N(w) for any string w in (0+1)*. Then, choose the correct value of N(110011001). a) 8 b) 55 256 d) 16
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer