I want Regular Expression for language L defined over {a,b} and L does not contain substring 'bbb'. I tried something but could not get proper answer.
Asked
Active
Viewed 1,320 times
-1
1 Answers
2
We can decompose every string over $\{a,b\}$ as a sequence of runs: $$ a^{n_1} b^{n_2} a^{n_3} b^{n_4} \ldots \text{ or } b^{n_2} a^{n_3} b^{n_4} a^{n_5} \ldots, $$ where $n_1,n_2,n_3,n_4,\ldots \geq 1$. In our case the constraint is $n_2,n_4,n_6,\ldots \leq 2$.
Let us start with the identity $$ (a+b)^* = (a^+b^+)^*a^* + (b^+a^+)b^*, $$ which corresponds to the description above.
Can you think of a way to modify it so that all powers of $b$ are at most 2?
Yuval Filmus
- 280,205
- 27
- 317
- 514