سوال ۴۸ کنکور ارشد مهندسی کامپیوتر ۱۴۰۳
کدام یک از زبانهای زیر، مستقل از متن نیست؟
پاسخ صحیح: گزینهٔ A —
A pushdown automaton (PDA) has a single stack, so it can enforce at most one unbounded count-matching constraint at a time. A language of the form is context-free exactly when the constraint linking the three blocks can be split into nested or sequentially-resolved pairwise matchings (each released before the next is started). Check each option.
Option 1 — (NOT context-free). Here we must simultaneously enforce and . Matching 's against 's empties the stack, after which the count is gone, so the block cannot be checked. This is the classic pattern (a three-way simultaneous count).
Formally, by the pumping lemma for CFLs, take with pumping length . Any decomposition with touches at most two of the three symbol blocks, so pumping () changes at most two of the three counts and breaks the relation . Hence .
Option 2 — (CFL). Split the block: the first of them pair with the 's, the last pair with the 's. Grammar: Two independent matchings done in sequence — context-free.
Option 3 — (CFL). Split the block: inner 's match the 's, outer 's match the 's — a fully nested structure: Context-free.
Option 4 — with (CFL). Since , the block equals . Split the 's: outer 's match the 's and inner 's match the 's: Context-free.
Only option 1 forces a genuine three-way simultaneous count, so it is the language that is not context-free.
Exam trick: For an language, ask "can the index constraints be resolved as one nested pair plus one sequential pair (stack pushed then fully popped, then reused)?" If yes it is a CFL; if all three counts must be held at once (as in , the family), it is not.