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. Under this strict convention there is no epsilon production, so such a grammar cannot generate the empty word. Conversion of an arbitrary grammar therefore gives
If , the two languages are equal. An alternative extended convention permits the exceptional start production ; under that convention conversion preserves the whole language.
Use the CYK algorithm. For a nonempty input word , let be the set of nonterminals that derive the substring . Initialize
For increasing substring lengths, compute
Accept exactly when the start symbol belongs to . The proof is a mathematical induction on substring length: a one-letter derivation uses a terminal production, while every longer parse tree has a root production whose two subtrees yield two adjacent nonempty substrings. The recurrence considers every possible split point and therefore finds exactly all possible roots. For a fixed grammar the algorithm uses time. Under the strict form in part (a), it rejects immediately.
Introduce nonterminals for the terminals and one for the pair :
Because the original start symbol occurs on a right-hand side, take a fresh start symbol . After eliminating the unit production , one grammar in Chomsky normal form is
The original grammar generates exactly
The displayed grammar generates the same set: adds an on the left, adds one pair on the right, and terminates the derivation with . Since the original grammar does not generate ,

Articles by others on the same topic (0)

There are currently no matching articles.