Open In App

GATE | GATE-CS-2001 | Question 31

Like Article
Like
Save
Share
Report

Consider the following languages L1=\\left \\{ ww|w\\in \\left \\{ a,b \\right \\}*\\right \\} L2=\\left \\{ ww^{R}|w\\in \\left \\{ a,b \\right \\}*, w^{R} is\\ the\\ reverse\\ of\\right\\ w \\} L3=\\left \\{ 0^{2i}| i\\ is\\ an\\ integer \\} L4=\\left \\{ 0^{i^{2}}| i\\ is\\ an\\ integer \\} Which of the languages are regular?

(A)

Only L1 and L2

(B)

Only L2, L3 and L4

(C)

Only L3 and L4

(D)

Only L3



Answer: (D)

Explanation:

A language is known as regular language if there exists a finite automaton (no matter whether it is deterministic or non-deterministic) which recognizes it. So if for a given language, we can come up with an finite automaton, we can say that the language is regular. But sometimes, it is not quite obvious to design an automaton corresponding to a given language but it surely exists. In that case, we should not start thinking that the given language is not regular. We should use pumping lemma to decide whether the given language is regular or not. According to pumping lemma, “Suppose L is a regular language, then there exists a l ≥ 1 such that for all string s ∈ L, where |s| ≥ l, we can always split s (there exists at least one such splitting) in such a way that s can be written as xyz with |xy| ≤ l and y ≠ ε  and for all i ≥ 0 , xyiz ∈ L”. l is known as pumping length. Let’s rephrase the given Lemma for non regular languages. Suppose L is a language, if for all l ≥ 1 there exist a string s ∈ L with |s| ≥ l such that for all splitting (there doesn’t exists a single splitting which doesn’t follow this rule) of s in form of xyz such that |xy| ≥ l and y ≠ ε , there exists an i≥ 0 such that xyiz ∉ L, then L is not regular. Notice that here we stress on finding such s if we want to prove that a language is not regular. Choice of the Questions: (a) In choice 1, Lets first consider w being of length n and containing only a. In this case the language represents anan. The length of the string represented by language should be Even. Consider l = n, then xyz = anan with xy = an. lets assume y = a, then consider the membership of xyiz with i = 0. This will simply be of odd length which doesn’t belongs to L. So L is not regular. To discuss it in more detail, let’s consider another example. Suppose w = apb, then string formed by L will be apbapb which is of length 2p + 2. Assume l = p, then xy = ap. suppose y = a, then consider the membership of xyiz with i = 0. This certainly doesn’t belongs to L. So L is not regular. (b) In choice 2, The first example will work as above. In the second example, the string will be apbbap, and there will be no changes in process for proving it to be non regular. (c) In choice 3, Assuming that we are considering integer from 0 and 02∗n results in empty string, Which is also accepted, We can simply construct a DFA as given below. It simply accepts a string if it is either empty or contain even number of zeros. So the language is regular.           

 

(d) In choice 4, We can simply assume that the pumping length l =i2/2. Now consider the xy = 0l with y = 0, Now if we check the membership of xy2z, we can find that this will represent 0i^2+1, and corresponding to which there exists no j such that j2 = i2 + 1 where i and j are integer except j = 1 and i = 0. But since i can’t be zero. In Short, using pumping lemma, we can generate 0i^2+1 as well as 0i^2-1, which won’t be available in L. So L is not regular. This explanation has been contributed by Durgesh Pandey.



Quiz of this Question
Please comment below if you find anything wrong in the above post

Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads