Is the given language M regular?

40 Views Asked by At

Let $REG$ be a regular language and $M$ be a language consisting of only even length strings from $REG$ . Then, What can be said about language $M$ - Is it regular or non regular ?


I took language $REG$ as $(a + b)*$ and $M$ as $a^nb^n$.

Now, clearly $M$ contains all even length strings but the language is $DCFL$ and not regular.

But if I take $M$ as $(aa)*$, then it also contains even length strings and is also regular.

So, I get final conclusion as that $M$ is not regular always.

Am I right here or missing something ?

1

There are 1 best solutions below

2
On

I think you're misunderstanding the problem, possibly because it was badly phrased or translated from a different language. You quote

[let] $M$ be a language consisting of only even length strings from $\mathit{REG}$.

and you seem to interpret that such that $M$ can be any language as long as all words in it have even length and it is a subset of $\mathit{REG}$.

It would make more sense if the problem said

Let $M$ be the language consisting of all even-length strings from $\mathit{REG}$.

Or, in symbols, $M$ is the specific language $\{w\in\mathit{REG}: |w|\text{ is even}\}$.

If that is the case, there is a definite answer to whether $M$ is regular. (Hint: the intersection of regular languages is regular).