Hi I am trying to figure out the regular grammar that represents the regular expression L = (a+ab)* as DFA and generates L.
The picture below shows the process of expressing the expression as NFA and then converting it to DFA.
So if you get regular grammar from DFA,
A-> aB | bC | e
B-> aB | bA | e
C-> aC | bC
But the problem is, when you get the regular expression with this grammar, you get a much more complex expression, not (a+b)*.
C = aC + bC = (a+b)*
B = aB + bA + e = a*(bA+e)
A = aB + bC + e = aa* bA + aa* + b(a+b) + e = (aa* b)* (aa* +b(a+b)*+e)
I wonder if there is a problem with my solution.
Actually X = (aa*b)*(aa*+b(a+b)*+e) can be simplified to (a+b)*. Here I tried to explain my steps for simplifying X to (a+b)*:
a) empty string
, b) every possible string starting with b
, c) every possible string starting with a
. If we can obtain these, it will mean that X=(a+b)*.a) empty string
and b) every possible string starting with b
. We only need to obtain c) every possible string starting with a
.Although it was complicated (and probably unnecessary), this is a proof that X=(a+b)*. As a result, your solution was correct.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.