I need to find a grammar that generates the language composed by all words that have more $a$ than $b$ given an alphabet $\{a,b\}$
I tried the following production rules:
S->B
B->b | ABB | BAB | BAB | BBA
A->a
with this rules it's fairly simple to proof that all the words that the grammar generates are made up with more $a$ than $b$.
How can I proof that all words made up with more $a$ than $b$ can be generated that way?
b
s thana
s, not vice versa. It's also rather redundant. You could just use the ruleS -> a | aS | bSS | SbS | SSb
. – TLW Oct 01 '15 at 02:20