# Is there a context free, non-regular language $L$, for which $L^*$ is regular?

I know that there are non-regular languages, so that $L^*$ is regular, but all examples I can find are context-sensitive but not context free.

In case there are none how do you prove it?

• Can be answered with the same techniques as cs.stackexchange.com/questions/1549 May 25, 2012 at 20:54
• Hint: all languages which contain the alphabet have a very simple Kleene closure.
– Raphael
Dec 15, 2014 at 22:58

## 1 Answer

$L = \{a^n b^n \mid n\in\mathbb{N}\}$ is context-free but not regular (classical example). So is $L' = \{a^n b^n \mid n\in\mathbb{N}\} \cup \{a,b\}$.

$L'^\ast = \{a,b\}^\ast$ is regular.

• Brute-force, but valid.
– Raphael
May 25, 2012 at 22:51
• $L' = L$, actually... Nov 30, 2016 at 1:48
• @vonbrand ... actually not. Oct 8, 2020 at 19:00