Question

In: Computer Science

4. Construct regular expressions for the following languages over the alphabet {a, b}: a. Strings that...

4. Construct regular expressions for the following languages over the alphabet {a, b}: a. Strings that do not begin with an “a”.

b. Strings that contain both aa and bb as substrings.

5. Let ? = {? ?? ?? ? | ? > ? + ?}. a. List all strings of length 7. (use power notation: i.e. aabbbbaaaaaaaa is a2b 4a 8 )

b. Use the Pumping Lemma for Regular Languages to prove that L is not regular.

Solutions

Expert Solution

4.a) Given,

Since the string should not be starting with an "a",
Therefore, it must start with a "b" and after wich it can have
any number of a or b.

so the regular expersion will be

4.b)
Since the string should contain "aa" and "bb" as its substring,
so it can start with either "a" or "b".

5.a).

There will be 5 distinct string of length exactly equal to 7.

String n l k
bbaaaaa 0 2 5
bbbaaaa 0 3 4
abbaaaa 1 2 4
aabaaaa 2 1 4
aaaaaaa 2 0 5
aaaaaaa 3 0 4


You see that the last two string are same, therefore total 5 distinct strings.

5.b) To prove L is not regular by using Pumping Lemma.

Let us assume L is regular,

then there will be  w such that

let w = aabbbbaaaaaaaa.

consider x = aa, y =bbbb, z = aaaaaaaa.

Now for any i,

Let i =2

then .

which gives n =2, l =8, k =8.

This will contradict the fact that n+l < k.

Hence, language L is not a regular.


Related Solutions

Describe the languages specified by the following regular expressions: 1. \\(_+)/ 2. (\(740\)...-...)|(...-...) (The alphabet is...
Describe the languages specified by the following regular expressions: 1. \\(_+)/ 2. (\(740\)...-...)|(...-...) (The alphabet is {1,2,3,4,5,6,7,8,9,0})
Are the following languages over {a, b} regular? If they are then prove it. If they...
Are the following languages over {a, b} regular? If they are then prove it. If they are not prove it with the Pumping Lemma a) {ap | p is a prime number} b) {xax | x Î{a,b}*} (start by listing some strings in, not in, the language
3. Are the following languages A and B over the alphabet Σ = {a, b, c,...
3. Are the following languages A and B over the alphabet Σ = {a, b, c, d} regular or nonregular? • For a language that is regular, give a regular expression that defines it. • For a nonregular language, using the pumping lemma prove that it is not regular. (a) A = {d 2j+1c k+1 | j ≥ k ≥ 0} · {c r+2b 2s+3 | r ≥ 0 and s ≥ 0} (b) B = {a 2j+2b k+3c j+1...
2. Let S be the set of strings over the alphabet Σ = {a, b, c}...
2. Let S be the set of strings over the alphabet Σ = {a, b, c} defined recursively by (1) λ ∈ S and a ∈ S; and (2) if x ∈ S, then bxc ∈ S. Recall that λ denotes the empty string which has no letters and has length 0. List all strings of S which are length at most seven. 3. Prove the following theorem by induction: For every integer n ≥ 1, 1 · 2 +...
1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L...
1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L = { aib2i : i > 0} 2) Prove the language M is not regular, over the alphabet Σ = {a, b}. M = { wwR : w is an element of Σ* i.e. w is any string, and wR means the string w written in reverse}. In other words, language M is even-length palindromes.
Write a regular expression for the language of all strings over {a,b} in which every b...
Write a regular expression for the language of all strings over {a,b} in which every b is directly preceded by a, and may not be directly followed by more than two consecutive a symbols.
Draw PDA transition diagram for the following language: The set of strings over the alphabet {x,...
Draw PDA transition diagram for the following language: The set of strings over the alphabet {x, y} where 2 * (# of x's) = 3 * (#y's) That is, if we let nx be the number of x's and ny be the number of y's, then the strings in these language are those where 2nx = 3ny Try to find a PDA that is as simple and elegant as possible (do not convert from CFG). ------------------------------------------------------------------------------------------------------------------ USE Notation between transition:...
Problem 4 (Sets defined inductively) [30 marks] Consider the set S of strings over the alphabet...
Problem 4 (Sets defined inductively) [30 marks] Consider the set S of strings over the alphabet {a, b} defined inductively as follows: • Base case: the empty word λ and the word a belong to S • Inductive rule: if ω is a string of S then both ω b and ω b a belong to S as well. 1. Prove that if a string ω belongs to S, then ω does not have two or more consecutive a’s. 2....
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is...
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is finite? How many such languages exist?
Use Context-Free Pumping Lemma to prove that that following languages over the alphabet {'x', 'y', 'z'}...
Use Context-Free Pumping Lemma to prove that that following languages over the alphabet {'x', 'y', 'z'} are NOT context-free (a) {xjy2jzj : j > 0} (b) { xmynzk : m, n, k ≥ 0 and k = min(m,n) }
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT