Trying to make a context free grammar for the above language. The base for this is a common enough problem and I've done some similar ones, but been having trouble with this one.
What a friend and I put together is:
$V = \{a,b,S,A,B\}$
$\Sigma = \{a,b\}$
$R = \{s \to AB|bB, B \to \epsilon, A \to aA|\epsilon \}$
Another friend offered:
$R = \{s \to B|A, A \to aB, B \to bS|\epsilon \}$
I'm not happy with either of them but not sure why. A confirmation, advice, better answer, anything would be appreciated. Thanks.
You're right to be suspicious of those two attempts.
The first grammar will produce
aaawhich should not be in the language.The second one will produce
abawhich is not in the language either.Hint. Note that $\{a^mb^n \mid m+1 \le n\} = \{a^mb^mb^k \mid 1 \le k\} $.