Question

In: Computer Science

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

Solutions

Expert Solution

Solution ::

Given language L is regular if we can draw a finite automata or give a regular expression or a regular grammar to L.

a- is the regular expression for given language.Hence regular

d- is the regular expression for given language.Hence regular

j-is the regular expression for given language.Hence regular

pumping lemma:

For any regular language L, there exists an integer k, such that for all x ∈ L with |x| ≥ k, there exists u, v, w ∈ Σ∗, such that x = uvw, and
(1) |uv| ≤ k
(2) |v| ≥ 1
(3) for all i ≥ 0: uviw ∈ L

if a language doesnot satisfy pumping lemma properties, then it is not a regular language.

b--let the language is regular, then there is a constant k>0 and let where x=uvw.

As ,it means that for some .and

Now if we pump v, then (i.e,uvvw),then which doesn't belong to language since .

Hence this is violating the 3rd condition of pumping lemma.Hence not regular.

one can also prove that this is not regular in other way.

first we have to count number of a's and make sure that,number of b's is double the number of a's.

Hence we need stack to do that.in stack,for every a in input,we push 2a's and for every b in input ,we pop one 'a ' from top of stack.if the stack is empty by the end of input, we can say that word belongs to language.

Here no stack is available in Finite automata,we need push down automata for that.Hence this is not a regular.(This is a non formal approach).

e-let the language is regular, then there is a constant k.let where p is a prime number>k.

We don't know the decomposition of x into uvw, but since |uv| k, it follows that |w| > 1. As usual, |v| > 0.

let i = |uw|. Then |uviw|= |uw| + |v||uw| = (1 + |v|)|uw|. Since (1 + |v|) and |uw| are each greater than 1, the product must be a composite number. Thus |xyiz| is a composite number.

There fore it is not a prime and hence,it doesn't belong to language.

Therefore third condition of pumping lemma is violated.

Hence not a regular language.

Thank you::::


Related Solutions

Use Myhill-Nerode Theorem to prove the following languages are not regular A1 = {0n1n2n| n >=...
Use Myhill-Nerode Theorem to prove the following languages are not regular A1 = {0n1n2n| n >= 0} A2 = {www| w E {a, b}*}
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...
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.
Determine whether or not the following languages are regular. If the language is regular then give...
Determine whether or not the following languages are regular. If the language is regular then give an NFA or regular expression for the language. Otherwise, use the pumping lemma for regular languages or closure properties to prove the language is not regular. 1) L = { 0 n1 k : k ≤ n ≤ 2k} 2) L = { 0 n1 k : n > 0, k > 0 } È { 1 k0 n : k > 0, n...
(a) How Context Free languages are different from Regular languages. (b) What are the automata accepting...
(a) How Context Free languages are different from Regular languages. (b) What are the automata accepting those languages and how they are different from DFA and NFA. (c) How the grammar of Context Free Languages looks different from those in Regular languages.
Formal Languages Give a regular expression for each of the following languages: L2a = {w ?...
Formal Languages Give a regular expression for each of the following languages: L2a = {w ? {0,1}* | w corresponds to the binary encoding of non-negative integers that are evenly divisible by 4 L2b = {w ? {a,b}* | w contains at least one 'a' and exactly two b's} L2c = {w ? {0, 1, 2}* | w starts with a 2, ends with a 1 and contains an even number of 0's}.
Prove that all regular languages are context free. Note: Proof must proceed by structural induction on...
Prove that all regular languages are context free. Note: Proof must proceed by structural induction on regular expressions Please prove by Structural Induction. Will Upvote for correct answer. Thanks
Prove whether the following are regular (include the file) or not regular (attach a proof). The...
Prove whether the following are regular (include the file) or not regular (attach a proof). The alphabet is {0, 1}. 1. The set of strings that start with N 0's which are directly followed by 2N 1's. 2. The set of strings start with two 0's, followed by N 1's, followed by N 1's and end with three 0's. 3. The set of strings where every substring of length 5 has more 0's than 1's. Strings less than length five...
Use the pumping lemma to show that the following languages are not regular. A a. A1={0^n...
Use the pumping lemma to show that the following languages are not regular. A a. A1={0^n 1^n 2^n | n≥0} b. A2 = {www | w ∈ {a,b}∗} A c. A3 ={a^2^n | n≥0} (Here, a^2^n means a string of 2^n a’s.) A ={a3n |n > 0 }
Use the pumping lemma to show that the following languages are not regular (c) (5 pts)...
Use the pumping lemma to show that the following languages are not regular (c) (5 pts) Let Σ = {0, 1, −, =} and SUB = {x = y − z | x, y, z are binary integers, and x is the result of the subtraction of z from y}. For example: 1 = 1 − 0, 10 = 11 − 01 are strings in SUB but not 1 = 1 − 1 or 11 = 11 − 10.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT