i am asking for help with a question from a course in Logic im reading at university. I am aware that this type of question is frequently asked here(i have looked at alot of other questions/answers) but i think it would be very helpful if i had some tips specific for my problem.
The question is:
Consider the following grammar: S → SS | aSb | ϵ
Prove that the following language is one of its sub-languages. Use induction. $${a^nb^n | n ≥ 0}$$
Im very new to induction and cannot figure out where to begin. Ofcourse you can immediately see that as long as you select the production "aSb", any amount of times, then end with an epsilon, you will indeed get $a^nb^n$. But if you select the production "SS" you will no longer get that language.
So i want to know how to deal with that it asks for a sub-language instead of the full language, and also i would like to know how to use induction make this proof.
I realize that i am pretty much asking for the entire answer here but if you can give me some help without giving away the full answer that would be very helpful.
Thanks
Edit: Thank you for all the help so far. If i use it i come up with something like:
Induction over n: Proving that n=1 generates string "ab".
Do i prove this by this line: $S->aSb->aϵb->ab$
Or by this: $a^1b^1 = ab$ ?
Moving on; Inductive assumption: This holds for n=k.
$a^kb^k$
Now, prove that this holds for k+1.
$a^{k+1}b^{k+1} = a^ka^1b^kb^1$
I now ask for feedback on my attempt. Thanks again.
Your problem is not with this topic but with your understanding of logic and induction. First let me point out what's wrong with your attempt.
Errors
Let $G$ be the given CFG.
This is unfortunately meaningless. What does "generate" mean? How can "$n=1$" do anything? If you want to say "$a^1 b^1$ is generated by $G$", say so. Don't say anything else.
This line is true for $G$. You could say "$a^1 b^1$ is generated by $G$, via S−>aSb−>aϵb−>ab".
$a^k b^k$ is just a string, not a sentence! Just like you can't say "This holds for $n = k$: Elephant!", so also what you wrote is simply meaningless and has no truth value.
Not sure what you're talking about here. Are you referring to proving the following line?
If so, then this has nothing to do with induction, because this very line is always true regardless of $k$.
Correct structure
Now here is the correct proof structure.
Your task is now to fill in the blanks where I put "$\cdots$". You have to figure out how to use the previous line in order to get from starting symbol $S$ to $a^{n+1} b^{n+1}$. This should be easy. Write your solution in a comment and I'll check it.