简体   繁体   中英

Can this language be expressed with a regular expression?

The given language is: B = { a i b i c 2m | i ≥ 0, m ≥ 0 } ∪ { a r b s c 2t | r ≥ 4, s ≥ 4, t ≥ 0}

My Prof has provided a regular expression for this language which is: a 4 a* b 4 b* (c 2 )* + (epsilon + ab + a 2 b 2 + a 3 b 3 )(c 2 )*

I believe that this is incorrect and that this language is not regular. Is there a possible regex for this language, if not this one?

As far as I'm aware (i) Any language with balanced strings is not regular as it cannot be expressed as a regular expression/DFA/NFA and is instead context free so it can be represented as a PDA/CF-grammar (ii) The union of a non-regular CF language and a regular language is CF

So the first half of the union should not be regular, while the second half is regular as none of the superscripts on the tokens are related to each other. Thus the overall language B is non-regular, correct?

Regarding my Prof's solution, the left part refers to the a r b s c 2t part of the language B and seems correct, but the right part seems to refer to the part of B that is a i b i c 2m , and doesn't seem to generate all of the strings in the language.

Your teacher is right.

The right part of the solution is indeed intended to deal with a i b i c 2m , and it is also true it does not cover all of that.

But here is the catch: For i >= 4, a i b i c 2m is a subset of a r b s c 2t , So the only cases that that second expression does not cover is when i < 4, which means there are just 4 specific cases to deal with. and by listing them separately the "problem" with the equal superscripts disappears.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM