A context-free grammar is in Chomsky normal form when every production is of one of the forms
where are nonterminal symbols and is a terminal symbol. The conventional exceptional production may be allowed when the language contains the empty word, with excluded from right-hand sides.
The length is
Indeed, the parse tree has terminal-production nodes and, as a full binary tree with leaves, binary-production nodes. This is the Chomsky-normal-form derivation length.
One parse tree can be recorded unambiguously by the nested expression
Every internal node uses one of the given productions, and the leaves read from left to right are
Equivalently, the corresponding leftmost grammar derivation is
Hence the required word is generated by the grammar.
Take
where
This grammar is in Weak Chomsky normal form. In the original grammar, occurs only in and has the sole production . Thus every use of
is replaced in by , while every later production is unchanged. Conversely, the ternary production can always be expanded into those two original steps. Therefore is equivalent to in the sense of an equivalent grammar.
The compressed initial production gives the leftmost derivation
It has steps, whereas part (b) gives for every derivation in Chomsky normal form. The Weak Chomsky normal form ternary rule has compressed exactly one pair of binary productions, so the derivation is strictly shorter as required.

Articles by others on the same topic (0)

There are currently no matching articles.