Let's say we have a language of form: $L =$ {$a^nb^n: n∈N$}. I want to prove that $L^*$ is a context-free language. How do I approach this problem?
I know that $L$ generates CFG (context-free grammar) of form: $S→aSb$ ∣ $ϵ$.
On the other hand, I'm not sure what CFG does $L^*$ generate and generally how to prove that this is a context free language. I know that it will spawn words like $aabbaabbaabb...$ but don't know how to continue.
Thank you!
You already did half the work by creating a context-free grammar for L. Now ask yourself what exactly are the words in $L^*$? Any word in $L^*$ is of the form $$w_1 \dots w_n$$ for some $w_i \in L$. So to produce words of $L^*$ we can do it in two steps. First we decide what $n$ should be. For that we have the rule
$$S \to SS$$
After that, you want to swap any $S$ with a word from $L$. How do you do this? You add another rule $S \to T$ and then have the production rules for your language $L$, in this case
$$T \to aTb | \varepsilon.$$
Those Rules ($S\to SS|T, \quad T \to aTb|\varepsilon$) are a context-free grammar for $L^*$. Example
Say we want to produce $a^3b^3aba^2b^2 \in L^*$. For that we first apply $S \to SS$ twice to get $SSS$, then apply $S \to T$ yielding $TTT$ and then, for each $T$ apply the last rules to produce each $a^nb^n$, giving $a^3b^3aba^2b^2$.