Question

In: Computer Science

Consider the two languages below: L1 = {w | w є {0,1,2}* and is of the...

Consider the two languages below:
L1 = {w | w є {0,1,2}* and is of the form 0i1j2k where i, j and k ≥ 0 and i = j or j = k}
L2 = {w | w є {0,1,2}* and is of the form 0i1j2k where i, j and k ≥ 0}
One of the languages in the above problem is regular. Which one? Prove it.
Prove that the OTHER one is not regular.
Is the non-regular one context free? Prove it.

Solutions

Expert Solution

1.

L1 = {w | w є {0,1,2}* and is of the form 0i1j2k where i, j and k ≥ 0 and i = j or j = k}

L2 = {w | w є {0,1,2}* and is of the form 0i1j2k where i, j and k ≥ 0}

Among the above L2 is regular the reason is as follows,

L2 says that it comprises all the values of the form 0i1j2k and the restriction on i,j,k is i≥ 0,j≥ 0 and k≥ 0. So acceptable language is,

L2 = { 0*1*2* } says that any number of 0’s , any number of 1’s and any number of 2’s.


One can design a NFA for this type of language. A language which can be solved in DFA/NFA is finite and is Regular.


On the other hand, L1 says that it comprises all the values of the form 0i1j2k and the restriction on i,j,k is along with i≥ 0,j≥ 0 and k≥ 0. there is a comparison given i = j or j = k. So the acceptable language is,

L1 = { 0i1i2* U 0*1j2j }

The DFA / NFA don't have a memory to store and compare so the given L1 cannot be solved by the DFA / NFA also. So L1 is a non-regular language.


2. Is the non-regular one context free? Prove it.



By the above figure we can say that Regular language is a subset of Context Free language. Context Free language is the subset of Context Sensitive Language. Context Sensitive language is the subset of Recursive Language.

A non-regular language might be any of the CFL,CSL,Rec. So the non-regular one need not be necessarily context free but yes it can be possible.







Related Solutions

Consider the two languages below: L1 = {w | w є {0,1,2}* and is of the...
Consider the two languages below: L1 = {w | w є {0,1,2}* and is of the form 0i1j2k where i, j and k ≥ 0 and i = j or j = k} L2 = {w | w є {0,1,2}* and is of the form 0i1j2k where i, j and k ≥ 0} One of the languages in the above problem is regular. Which one? Prove it. Prove that the OTHER one is not regular. Is the non-regular one context...
Give examples of languages L1 and L2 over {a, b} that satisfy the descriptions below: (a)...
Give examples of languages L1 and L2 over {a, b} that satisfy the descriptions below: (a) L1 is regular, L2 is nonregular, and L1 U L2 is regular; (b) L1 is regular, L2 is nonregular, and L1 U L2 is nonregular; (c) L1 is regular, L2 is nonregular, and L1 n L2 is regular; (d) L1 is nonregular, L2 is nonregular, and L1 U L2 is regular. (e) L1 is nonregular, L2 is nonregular, and L1 n L2 is regular.
Consider the following languages: A = {w: |w| > k, where k is a constant integer}...
Consider the following languages: A = {w: |w| > k, where k is a constant integer} B = {ε,0,1, 10, 001} (The complement of A) (The complement of B) (True/False)                    A is regular (True/False)                    B is regular (True/False)                     is regular (True/False)                      is regular   2.  If A is regular, and  A  = A, then B must be not regular. True or False 3. Given three languages A, B, C where . If both A and B are regular, then C must be regular. True or False Automata and...
Draw the NFA for language L2 = { w | w ends in 12}. Alphabet {0,1,2}
Draw the NFA for language L2 = { w | w ends in 12}. Alphabet {0,1,2}
Given two languages A and B, let A/B denote the language {w | w x ∈...
Given two languages A and B, let A/B denote the language {w | w x ∈ A for some x ∈ B}. Show that if A is a context-free language and B is a regular language, then A/B is a context-free language. hint (construct PDAs)
Consider the following languages over {0, 1}: L3 = {w : does not begin and end...
Consider the following languages over {0, 1}: L3 = {w : does not begin and end with same symbol and |w| £ 3} L4 = {w : w = wR, |w| £ 3} Enumerate the first 8 strings in the L-ordering of the following: L3 L4 L3 – L4 L4 – L3 L3L4 L4L3 L33 L4*
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}.
Consider two languages A and B where A is a context free language and B is...
Consider two languages A and B where A is a context free language and B is a regular language. Show that the set difference, A-B, must also be context free. Also show that B-A may not be context free
Create a PDA accepting the following languages: (a) {v$w$v R | w, v ∈ {0, 1}...
Create a PDA accepting the following languages: (a) {v$w$v R | w, v ∈ {0, 1} ∗} (b) {w | in w, the number of 0’s is the same as the number of 1’s}.
The intersection of two lists L1 and L2, L1 ∩ L2, is defined as the list...
The intersection of two lists L1 and L2, L1 ∩ L2, is defined as the list containing elements in both L1 and L2 only. Given two sorted lists L1 and L2, write a function, called intersection, to compute L1 ∩ L2 using only the basic list operations. The intersection function is defined as follows template list intersection( const list & L1, const list & L2); C++
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT