0

The given language is: B = { aibic2m | i ≥ 0, m ≥ 0 } ∪ { arbsc2t | r ≥ 4, s ≥ 4, t ≥ 0}

My Prof has provided a regular expression for this language which is: a4a* b4b* (c2)* + (epsilon + ab + a2b2 + a3b3)(c2)*

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 arbsc2t part of the language B and seems correct, but the right part seems to refer to the part of B that is aibic2m, and doesn't seem to generate all of the strings in the language.

  • Assuming `epsilon` is the empty string and `+` is alternation, `(epsilon + ab + a^2b^2 + a^3b^3)(c^2)*` actually enumerates all four cases that are covered by `a^ib^ic^2m` but not covered by `a^rb^sc^2t` as defined in language B. As long as there is a finite number of words to enumerate, you can in principle build a regular expression based on them. – oriberu Jan 15 '23 at 10:24

1 Answers1

2

Your teacher is right.

The right part of the solution is indeed intended to deal with aibic2m, and it is also true it does not cover all of that.

But here is the catch: For i >= 4, aibic2m is a subset of arbsc2t! 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.

trincot
  • 317,000
  • 35
  • 244
  • 286
  • Hello, thank you for responding. I'm not sure I understand your response. Going from where I last understand, the language a^ib^i i>=0 is not regular, as we cannot ensure that a and b are in equal number using union, concatenation, and closure (*). Could you please help me understand how aibic2m | i ≥ 0, m ≥ 0 is regular? Thanks. – RipLearning Jan 14 '23 at 23:49
  • The problem of equal numbers of a and b is only a problem when you have an unlimited number of possibilities and have an unknown number of repetitions to be equal. But since only 4 possibilities have to be covered we don't have the problem anymore and can express this without the use of a variable superscript. There is no more need of `i` – trincot Jan 15 '23 at 07:07
  • Oh, I understand your comment now regarding that half with the "balanced string" being a subset of the other. Thank you so much. – RipLearning Jan 15 '23 at 22:40