in Theory of Computation recategorized by
10,479 views
32 votes
32 votes

Which of the following definitions below generate the same language as $L$, where $L=\{x^ny^n \text{ such that } n\geq 1 \}$?

  1. $E \rightarrow xEy\mid xy$

  2. $x y \mid (x^+xyy^+$)

  3. $x^+y^+$

    1. I only

    2. I and II

    3. II and III

    4. II only

in Theory of Computation recategorized by
10.5k views

4 Comments

@teluguenglish,

when n=1,string would be ''xy",

and in (Ⅰ),you can get "xy" because"xy" given as stopper.
1
1
Nice approach
0
0

@vaibhav101 Just to add something to your logic, L is Context Free but not regular.

0
0

8 Answers

0 votes
0 votes

(I) is the correct definition and the other two is wrong because the other two can have any no. of x and y. There is no such restriction over the number of both being equal.

0 votes
0 votes

In 2ND OPTION, least length string can be xxyy, but we can generate a string as xy according to question so rejected. 

In 3rd option, number of x and y can vary but here as per the grammar given in question we are getting equal nos. of x and y.

So only option 1 gives correct result.

0 votes
0 votes
The language $L=\{x^ny^n \text{such that }n\geq 1\}$ has following set of strings:

$L=(xy,xxyy,xxxyyy…….\infty)$

1) $E\rightarrow xEy \mid xy$: This grammar can generate all possible string which is generated by language $L.$

 Following strings can be generated by the above grammar: $xy,xxyy,xxxyyy….\infty$  

so this option is correct.

​​​​​​​2) $xy\mid x^+xyy^+$: the minimum length of the string that can be generated by this regular expression is $xy$. it can generate all the string which is generated by language $L$ but it can also generate additional string which is not generated by language $L$ such as $xxxyy,xxyyy$. these are invalid strings for language $L.$

so this option is wrong here.

​​​​​​​3) $x^+y^+$: this regular expression generate strings like $xy,xxy,xyy,xxxy,xyyy….\infty$ which is not generated by language $L.$

so this option is also wrong.

$\therefore \text{Option A is correct.}$
0 votes
0 votes

Grammar 1 generates exact same language.

Grammar 2 & 3 CAN generate all the strings of the given language but it CAN also generate other strings that doesn't belongs to L. Hence Option A is correct.

Answer:

Related questions