5

I'd like to know if the concatenation between two language (one regular and the other not) is always not regular or it may happen that the output is a regular language. Thanks.

RamsesXVII
  • 295
  • 2
  • 11
  • I'm voting to close this question as off-topic because it not a programming problem. It is a problem in theoretical computer science. – Raymond Chen Nov 21 '16 at 14:44

3 Answers3

4

No, because we can find a counterexample that prove that sometimes it happen:

L1 not regular: (a^2)^n with n>=0
L2 regular: a*

The concatenation produce the language L3= aa* and this is obviously regular.

Hyruma92
  • 836
  • 8
  • 24
1

a^(2^n) n>=0 is non regular except concatenating it with a* which is regular, produces a regular language. It becomes L = {a^(2^n)a*, n>=0} which basically cancels down to L={aa*} which is regular.

Patrick87, (a^2)^n n>1 has regular expression (aaaa)(aa)*

Lewis Kelsey
  • 4,129
  • 1
  • 32
  • 42
1

Remember that the empty language ∅ and the singleton language of the empty string {ε} are both regular. The concatenation of any nonregular language and the empty language is the empty language (regular), and the concatenation of any nonregular language and {ε} is the original language (nonregular). Therefore, the answer depends on the choice of languages.

(@Hyruma92 gives another example of where the concatenation gives a regular language; I added this answer because I think it more directly and simply gets you there. The intuition here is that the empty language is the zero element for language concatenation and {ε} is the identity element, which motivates why you might want to try them out.)

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065