I was solving a problem on CFG and saw this "simplification" in two of the rules. I believe these two grammars produce the same language, however I was not able to prove it.
Grammar 1 :
S -> A|B
A -> B | aAb | epsilon
B -> A | bBa
Grammar 2 :
Z -> aZb | bZa | epsilon
Any help will be appreciated
EDIT : fixed terminal symbols so they are correct now
Hint you can try to prove that the language produced by this grammar is the set of words of even length with as many
ais the first half asbin the second part. You can prove that with an induction on the size of the words that are produced.