Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2023/ii/paper-3/4i/d/ii/solution

The grammars are non-equivalent. In the first grammar, terminal derivations without give
After applying any number of times while and remain adjacent, the production also gives
Hence, in particular, and .
In the second grammar, the fixed terminals in prevent and from ever becoming adjacent, so can never be used. The remaining productions give exactly
Thus , proving that the generated languages differ.

New to topics? Read the docs here!