I am going through exercises regarding regular expressions, and I am really unsure on how to do this.
The regular expression is:
((a*)(b*))* ∪ (a*)
I am really bad at this, but I think that ((a*)(b*))*
can be simplified to (a ∪ b)*
But if this is right, than the last ∪ (a*)
is really just a repetition, so I figure the whole expression can be simplified to (a ∪ b)*.
Does this seem correct?
Edit: ∪ stands for union
You are right. (a*b*)*
can match any string of a's and b's, so can (a U b)*
, therefore they are equivalent. (a U b)*
intersect a*
is a*
so a*
is a subset of (a U b)*
. Consequently, the whole expression can be simplified to (a U b)*
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With