# Prove a subset of a regular language is regular, context-free but not regular or not context free

I've been tasked with solving this problem, but I'm not sure where to begin:

Let $$L$$ be a context-free language. $$L'$$ contains all the words that belong to $$L$$ which can't be defined as $$z=uvwxy$$, for which $$|vx|>0$$ so that $$\forall i \ge0$$ we get $$uv^iwx^iy\in L$$.

Is $$L'$$ a regular language, context free but not regular or not context free? Prove your answer.

So the immediate thought that occurs to me, this doesn't follow the pumping lemma for context free languages, but I suppose the answer isn't THAT immediate, right?

EDIT: I see now that they omitted the part where exists a natural number $$n$$ for which $$|vwx|, but I cannot seem to connect this information with the proof.

Can you please give me some more insight to the problem? Thanks!

• As mentioned in a comment to a different question: please don't double post.
– rici
Jul 14 at 18:45
• – D.W.
Jul 14 at 20:01

Since $$L$$ is a context-free language, there must be some integer $$p \ge 1$$ such that any word $$z \in L$$ such that $$|z| \ge p$$ can be written as $$z = uvwxy$$ with $$|vx|>0$$ and $$uv^iwx^iy \in L$$ for all $$i \ge 0$$.
This means that no word $$z$$ with $$|z| \ge p$$ can be in $$L'$$ and hence $$|L'| \le \sum_{i=0}^{p-1} |\Sigma|^i \le p |\Sigma|^{p-1}$$. Therefore $$L'$$ is a finite language and, as such, it is regular (and context-free).
• I was thinking it might only be context-free, as $L'=L \cap \{ w \in \Sigma^* | |w| < n \}$ but your tip regarding $L'$ being a finite language saved me. Thanks, Steven. Jul 14 at 16:00