in Theory of Computation
1,783 views
1 vote
1 vote

If r1 and r2 are 2 Regular Expression Such that

r1 = (a+b)*           r2 = (a*+b*+a*b*+b*a*)

What are the different case's in which r1 = r2 ?

Please Explain with an example

in Theory of Computation
1.8k views

4 Comments

Take a string aba is it present in r2 ? .No.And there are many string which are not in r2.

Even all the string of r2 will present in r1 .

So Simply r2⊆r1.

0
0
Should not it be proper subset?
1
1
edited by
Yes you can say but i m using L⊆∑* .
0
0

2 Answers

0 votes
0 votes

the cases in which both r1 and r2 will be equal are as follows

case1: when r1 generates strings which contains only  'a' for ex- a,aa,aaa...

   then r1 will be equal r2 bcoz r2 can also generate it

case2 :

when r1 generates strings which contains only 'b' for ex- b,bb,bbb...

   then r1 will be equal r2 bcoz r2 can also generate it

case3: when r1 generates strings which contains any no. of a's followed by any no. of b's for ex- ab,abb,aaabb...

   then r1 = r2 bcoz r2 can also generate it

case4:  

when r1 generates strings which contains any no. of b's followed by any no. of a's for ex- ba,bba,bbaa...

   then r1 = r2 bcoz r2 can also generate it

case5: when both generate null string then also r1 = r2

4 Comments

r1 and r2 are regular expressions which in turn represents sets. Some elements or subsets inside them are equal does not mean that r1 and r2 are equal.
0
0
dear read the question carefuly and read the answer carefully...who is saying r1 and r2 are equal...he is asking the cases where they can be equal...
0
0
Okay. I think proper way of saying is L(r1)=L(r2) under those conditions of string generation. Not r1=r2
0
0

yes now u got itsmiley

0
0
0 votes
0 votes
R1 will be equal to R2 when

R2 = R2 +(R1-R2).