For the formal grammar ,Thus contains exactly the finite terminal words reachable from the start symbol by a finite grammar derivation.
Two formal grammars over the same terminal alphabet are equivalent when they generate the same language:
Two formal grammars over the same terminal alphabet are isomorphic when there is a bijection between their nonterminals such that andwhere is extended to words by fixing each terminal and acting symbol by symbol.
The grammars are isomorphic. The bijectionmaps every production of to the corresponding production of . They are therefore equivalent. Notice that in the first grammar and in the second are unreachable; the isomorphism also preserves this irrelevant component.
The grammars are non-equivalent. In the first grammar, terminal derivations without giveAfter applying any number of times while and remain adjacent, the production also givesHence, 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 exactlyThus , proving that the generated languages differ.
In the second grammar, is a nonproductive nonterminal: every right-hand side of a -production still contains a . Consequently the branch never yields a terminal word. Every terminal derivation from instead uses repeatedly and ends with , soThe grammars are therefore equivalent, although they are not isomorphic.
Articles by others on the same topic
There are currently no matching articles.