207k views
2 votes
Suppose G = (V, Σ, R, S) is in Chomsky normal form and there is a derivation in G from S of the form S ⇒ x1 ⇒ x2 ⇒ x3. How long is x3?

User Neolaser
by
7.4k points

1 Answer

2 votes

Final answer:

In a Chomsky normal form grammar, the string x3 resulting from three derivation steps starting from S will have a length of 2, since each non-terminal in the normal form production rule doubles the length of the string minus one, with the final step resulting in a terminal symbol.

Step-by-step explanation:

If G = (V, Σ, R, S) is a grammar in Chomsky normal form, and there is a derivation from S of the form S ⇒ x1 ⇒ x2 ⇒ x3, we are trying to determine the length of the string x3. Chomsky normal form means that each production rule is either of the form A → BC or A → a, where A, B, and C are non-terminal variables and a is a terminal symbol. Given that a derivation in this form involves a binary tree structure, after each production, the length of the string doubles minus one, since each non-terminal produces exactly two non-terminals or one terminal symbol.

After the first step, the length is, intuitively, one, since we start with a single variable S. After the second step, we apply one production rule, so the length doubles and we subtract one (2 * 1 - 1 = 1). At the third step, we apply the rule again to each non-terminal, doubling the length of x2 (2 * 1 - 1 = 1), resulting in the length of x3 being (2 * 1) = 2 since the second x2 would have been a terminal symbol due to the normal form constraints.

User Mohamed ALOUANE
by
8.3k points