The given context-free grammar G has the rules:
S→aS
S→aSbS
S→c
Let's derive some strings in L(G) and analyze the counts of a,b,c.
-
S→c:
w=c. na(w)=0,nb(w)=0,nc(w)=1.
Check options:
(A) na(w)>nb(w): 0>0 is false.
(B) na(w)>nc(w)−2: 0>1−2=−1. 0>−1 is true.
(C) nc(w)=nb(w)+1: 1=0+1. 1=1 is true.
(D) nc(w)=nb(w)∗2: 1=0∗2=0. 1=0 is false.
-
S→aS→ac:
w=ac. na(w)=1,nb(w)=0,nc(w)=1.
(A) na(w)>nb(w): 1>0 is true.
(B) na(w)>nc(w)−2: 1>1−2=−1. 1>−1 is true.
(C) nc(w)=nb(w)+1: 1=0+1. 1=1 is true.
(D) nc(w)=nb(w)∗2: 1=0. False.
-
S→aSbS→acbS→acbc:
w=acbc. na(w)=2,nb(w)=1,nc(w)=2.
(A) na(w)>nb(w): 2>1 is true.
(B) na(w)>nc(w)−2: 2>2−2=0. 2>0 is true.
(C) nc(w)=nb(w)+1: 2=1+1. 2=2 is true.
(D) nc(w)=nb(w)∗2: 2=1∗2. 2=2 is true.
From these examples, (A), (B), (C) appear to be true, and (D) appears true for acbc. However, the question asks "Which of the following statements is/are TRUE?". This implies statements that are always true for all w∈L(G).
Let's re-examine S→aS,S→aSbS,S→c.
Each 'S' can be replaced by 'c' or 'aS' or 'aSbS'.
Each 'b' is introduced only with an 'a' (as aSbS).
When S→aS, na increases by 1, nb by 0, nc by 0.
When S→aSbS, na increases by 1, nb by 1, nc by 0.
When S→c, na by 0, nb by 0, nc by 1.
Let's use the property that in every derivation, the number of 'b's must be less than or equal to the number of 'a's. Specifically, each 'b' is accompanied by an 'a'.
Let N(X) be the number of X non-terminals.
A string is generated by starting with S and repeatedly applying rules until only terminals remain.
Each S→c adds one c.
Each S→aS adds one a.
Each S→aSbS adds two a's and one b.
Let's consider the balance of a and b. The aSbS rule generates one b and two as. The aS rule generates one a.
The number of as must always be greater than or equal to the number of bs.
Let k be the number of times the rule S→aSbS is applied.
Let j be the number of times the rule S→aS is applied.
Let m be the number of times the rule S→c is applied.
For a valid string w, the initial S must eventually derive a terminal string.
Each application of S→c terminates a non-terminal S.
Each application of S→aS replaces an S with S. So NS is unchanged.
Each application of S→aSbS replaces an S with two S's. So NS increases by 1.
This implies nc(w) is the number of times the rule S→c is applied to replace a non-terminal S.
If NaSbS is the number of times S→aSbS is used, then NaSbS is exactly nb(w).
Each S→aSbS adds two 'a's. Each S→aS adds one 'a'.
na(w) = 2×NaSbS + NaS (where NaS is count of S→aS rule application).
nb(w) = NaSbS.
nc(w) = total S non-terminals replaced by c.
In any derivation tree, the number of 'a's at the leaves will be related to 'b's.
Consider a string w.
The rule S→c terminates a branch, contributing one 'c'.
The rule S→aS expands, contributing one 'a'.
The rule S→aSbS expands, contributing two 'a's and one 'b'.
Let's analyze the balance of S's.
Each use of S→aSbS increases the count of S-terminals by one.
Each use of S→aS leaves it unchanged.
Each use of S→c reduces it by one.
A derivation starts with one S and ends with zero S.
So, the number of S→c derivations must be 1+(number of S→aSbS derivations).
Therefore, nc(w)=nb(w)+1. This is statement (C).
Let's check this again.
Start with S.
The number of S non-terminals that eventually produce 'c' terminals, let's call it Nc. This Nc is nc(w).
Each S→aSbS takes one S and produces two S's. So it adds one S.
Each S→aS takes one S and produces one S. So it adds zero S.
Each S→c takes one S and produces zero S. So it removes one S.
Let k1 be the number of times S→aS is used.
Let k2 be the number of times S→aSbS is used. (k2=nb(w))
Let k3 be the number of times S→c is used. (k3=nc(w))
The total number of S non-terminals produced must equal total consumed.
Initial S: 1.
Final S: 0.
So, number of S produced by aSbS (k2) must equal number of S consumed by c (k3) MINUS 1 for the initial S.
So k3−k2=1. This means nc(w)−nb(w)=1, or nc(w)=nb(w)+1.
This statement (C) is ALWAYS TRUE.
Let's verify (A): na(w)>nb(w).
na(w)=k1+2k2. nb(w)=k2.
So we need k1+2k2>k2⟹k1+k2>0.
Since w must be derived, at least one S→c rule must be used, or S→aS or S→aSbS.
If w=c, then k1=0,k2=0,k3=1. 0>0 is false. So (A) is not always true.
Let's verify (B): na(w)>nc(w)−2.
From nc(w)=nb(w)+1, we have nb(w)=nc(w)−1.
na(w)=k1+2k2.
So we need k1+2k2>(k2+1)−2⟹k1+2k2>k2−1⟹k1+k2>−1.
Since k1,k2≥0, k1+k2≥0, so k1+k2>−1 is always true.
So statement (B) is always TRUE.
Let's verify (D): nc(w)=nb(w)∗2.
For w=c, nc=1,nb=0. 1=0×2. So (D) is not always true.
For w=acbc, nc=2,nb=1. 2=1×2. This is true for acbc. But not for c. So not always true.
The PDF solution for Q.32 is (b). So this corresponds to na(w)>nc(w)−2.
But nc(w)=nb(w)+1 (statement C) is also always true.
If it is a single choice answer, then there might be some interpretation for (B) that makes it more fundamentally true or a nuance.
However, if it is multiple select, then both (B) and (C) are true.
Let's recheck the problem source. Often, problems like this have a unique true statement.
nc(w)=nb(w)+1. This is a very strong structural property for this type of grammar.
na(w)>nc(w)−2⟹na(w)>nb(w)+1−2⟹na(w)>nb(w)−1.
This means na(w)≥nb(w).
If na(w)=0,nb(w)=0 for w=c. Then 0>0−1 (0>−1) is true.
If na(w)=1,nb(w)=0 for w=ac. Then 1>0−1 (1>−1) is true.
If na(w)=2,nb(w)=1 for w=acbc. Then 2>1−1 (2>0) is true.
So (B) is also always true.
The PDF solution lists (b) as the correct answer. This suggests it's a single correct answer question, or option (c) from the problem description is not among the options or considered less true.
If it's single correct option, both (B) and (C) are always true. This is problematic.
Let's assume the question maps to (a, b, c, d) options in the PDF. So (b) is na(w)>nc(w)−2.
And option (c) nc(w)=nb(w)+1 is also true.
This can be an issue with the question itself. However, I must choose what the PDF marks.
The PDF mentions "Answer is option (d)." but "Ans. (b)" is listed. This is inconsistent. I will use the (b) provided in "Ans. (b)".
This means it is na(w)>nc(w)−2.
===END_Q52===