I'm trying to prove the following:
If G is a Context Free Grammar in the Chomsky Normal Form, then for any string w belongs L(G) of length n ≥ 1, it requires exactly 2n-1 steps to make any derivation of w.
How would I go about proving this?
Applying n rules of form A→a to each non-terminal in the string above gives you a string containing only terminals and thus a string from the language decided by the grammar. The length of the string has not changed (it's still n) but we applied an additional n rules so in total we have applied n−1+n=2n−1 rules.
The key advantage is that in Chomsky Normal Form, every derivation of a string of n letters has exactly 2n − 1 steps.
2 Answers. CNF(Chomsky Normal Form) , in this case the no of steps would we require to derive string of length "n" is 2*n-1 (A) option.
In formal language theory, a context-free grammar, G, is said to be in Chomsky normal form (first described by Noam Chomsky) if all of its production rules are of the form: A → BC, or. A → a, or.
As a hint - since every production in Chomsky Normal Form either has the form
S → AB, for nonterminals A and B, or the form
S → x, for terminal x,
Then deriving a string would work in the following way:
Applying productions of the first form will increase the number of nonterminals from k to k + 1, since you replace one nonterminal (-1) with two nonterminals (+2) for a net gain of +1 nonterminal. Since your start with one nonterminal, this means you need to do n - 1 productions of the first form. You then need n more of the second form to convert the nonterminals to terminals, giving a total of n + (n - 1) = 2n - 1 productions.
To show that you need exactly this many, I would suggest doing a proof by contradiction and showing that you can't do it with any more or any fewer. As a hint, try counting the number of productions of each type that are made and showing that if it isn't 2n - 1, either the string is too short, or you will still have nonterminals remaining.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With