Consider the following identities for regular expressions:
(a) (r + s)* = (s + r)*
(b) (r*)* = r*
(c) (r* s*)* = (r + s)*
Which of the above identities are true?
(A) (a) and (b) only
(B) (b) and (c) only
(C) (c) and (a) only
(D) (a), (b) and (c)
Answer: (D)
Explanation:
- (r + s)* will generate any strings containing r or s or both. We can draw DFA for (r + s)* and it is same as (s + r)*. It is a regular expression.
- (r*)* will generate any string containing r and its DFA can be drawn easily and it is same as r*. It is also a regular expression.
- (r* s*)* will generate any strings containing r or s or both. We can draw DFA for (r* s*)* and it is same as (r + s)*. It is a regular expression. All option are true.
So, option (D) is correct.
Quiz of this Question