0

Give the regular expression for the set of strings $\{a, b, c\}$ that do not contain substring $aa$.

How to solve this regular expression? I've been thinking for a long time to generalize that. But unfortunately, I couldn't.

What I've tried:

$(a(b \cup c))^{*}$ $\cup$ $(a (c \cup b))^{*}$

  • 1
    What have you tried so far? – manooooh Jun 19 '21 at 18:01
  • 1
    @manooooh Added. – Mohamed Magdy Jun 19 '21 at 18:07
  • 1
    The expression $b\cup c$ is the same as $c\cup b$ so you’ve written the same thing twice. In any case, I think you meant ${b, c}$. – shoteyes Jun 19 '21 at 19:41
  • Also, do you mean that ${a, b, c}$ is an alphabet as opposed to a set of strings? The latter would introduce issues, for example, if $b = a a$, so we would need more information. – shoteyes Jun 19 '21 at 19:51
  • 1
    There may be an easier way, but one way is to note that the complement of your set is easy to describe by a regular expression (e.g., $(a|b|c){}aa(a|b|c|){}$) and you can convert that into a regular expression for your set, see https://math.stackexchange.com/questions/685182/complement-of-a-regular-expression. – Rob Arthan Jun 20 '21 at 01:17
  • The answer to this question should help you. – J.-E. Pin Jun 20 '21 at 21:51

0 Answers0