1
$\begingroup$

So, I have to solve for the following set of equations

$q_1$ = $q_1$a + $q_2$b + $\epsilon$

$q_2$ = $q_1$a + $q_2$b + $q_3$a

$q_3$ = $q_2$a

There are two ways to do this.

I did this

$q_1$ = $q_2$b + $\epsilon$ + $q_1$a

$q_1$ = ($q_2$b + $\epsilon$)a* Applying Arden's theorem

Now substituting in $q_2$ the values of $q_1$ and $q_3$

$q_2$ = $q_2$ba*a + a*a + $q_2$b + $q_2$aa

$q_2$ = a*a + $q_2$(ba*a+b+aa)

$q_2$ = a*a(ba*a+b+aa)* Applying Arden's theorem

$q_2$ = a*a(ba*+aa)*

Now substituting in $q_3$, the answer should be

$q_3$ = a*a(ba*+aa)*a

However, the correct answer is

(a + a(b+aa)*b)*a(b+aa)*a

which can be obtained by first substituting $q_3$ in $q_2$, and then substituting $q_2$ in $q_1$, and finally solving $q_2$, $q_3$ from the obtained regular expression for $q_1$.

Can someone tell where I have gone wrong in the above method, or am I applying ardens theorem in the wrong way ?

$\endgroup$
2
  • $\begingroup$ Every regular language can be described by infinitely many regular expressions. $\endgroup$ Commented Nov 26, 2019 at 9:04
  • 1
    $\begingroup$ You stumbled across something really interesting: The ordering in which you eliminate the q's can have a large effect on the size of the resulting regular expressions. See e.g. here for more background: arxiv.org/abs/1008.1656 $\endgroup$ Commented Nov 27, 2019 at 11:57

2 Answers 2

1
$\begingroup$

The two regular expressions describe the same language.

enter image description here

$\endgroup$
0
$\begingroup$

Using various Kleene algebraic properties, such as the following $$ (u + v)^* = v^* (u v^*)^* = (v^* u)^* v^* = u^* (v u^*)^* = (u^* v)^* u^*,\\ u u^* = u^* u,\quad (u v)^* u = u (v u)^*,\quad u^* φ(u)^* = u^*,\\ u + v = v + u,\quad (u + v) w = u w + v w,\quad u 1 = u,\quad 1 + u u^* = u^*, $$ where $φ(u)$ denotes an arbitrary Kleene-algebraic polynomial in $u$, we can write $$\begin{align} a (a + b)^* a &= a a^* (b a^*)^* a\\ &= a a^* (a a)^* (b a^* (a a)^*)^* a\\ &= a^* a (a a)^* (b a^* (a a)^*)^* a\\ &= a^* a (b a^* + a a)^* a,\\ \end{align}$$ and $$\begin{align} a (a + b)^* a &= a a^* (b a^*)^* a\\ &= a a^* (a a)^* (b a^* (a a)^*)^* a\\ &= a a^* (b a^* + a a)^* a\\ &= a a^* (b (1 + a a^*) + a a)^* a\\ &= a a^* (b + a a + b a a^*)^* a\\ &= a a^* ((b + a a)^* b a a^*)^* (b + a a)^* a\\ &= (a a^* (b + a a)^* b)^* a a^* (b + a a)^* a\\ &= (a^* a (b + a a)^* b)^* a^* a (b + a a)^* a\\ &= (a + a (b + a a)^* b)^* a (b + a a)^* a. \end{align}$$

So, actually, you could have said it was $a (a + b)^* a$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.