Sub topic 18
GATE Problem Patterns and Strategies
Prerequisites and the working model
Assume you know alphabets, strings, regular languages, finite automata, basic set operations, and proof by contradiction. The pumping lemma for regular languages is helpful but not required.
For GATE questions, classify the language before choosing a technique. A finite automaton has only finite memory. A pushdown automaton (PDA) adds one stack, so it can match nested or repeated structure. A context-free grammar (CFG) describes the same class of languages as a nondeterministic PDA.
A reliable solving workflow
- Write the language pattern clearly. Mark which symbols must be counted, matched, or nested.
- Test whether a finite automaton could recognise it. Independent equal-count requirements usually need more memory.
- Try a CFG or PDA construction for a positive result.
- For a non-context-free claim, use the CFL pumping lemma or closure properties.
- Check boundary cases such as the empty string, zero counts, and incorrect symbol order.
- For multiple-choice questions, test every answer against a short string before proving a general claim.
The following decision path is useful:
Common GATE patterns
| Pattern | Likely method | Main warning |
|---|---|---|
| \(a^n b^n\) | CFG or PDA stack matching | Do not accept mixed orders such as \(abab\) |
| Balanced parentheses | CFG or PDA | Matching must be nested, not merely equal in number |
| \(a^n b^n c^n\) | Pumping lemma or closure argument | One stack cannot independently track all three counts |
| \(ww^R\) | Nondeterministic PDA | The midpoint must be guessed |
| \(ww\) | Usually not context-free | Copying an arbitrary string is stronger than reversal |
| Expression syntax | CFG with precedence levels | An ambiguous grammar may still generate the right strings |
Avoiding frequent errors
A pumping-lemma proof must handle every valid decomposition, not just one convenient split. Choose a string with carefully controlled blocks, then use the pumping-length bound to show what the pumped pieces can touch.
Closure claims require the correct operation. CFLs are closed under union, concatenation, and Kleene star, but not under intersection or complement in general. They are closed under intersection with a regular language. Deterministic CFLs have different closure properties, so do not transfer CFL results automatically.
For hierarchy questions, remember the containment:
\[ \text{regular} \subsetneq \text{deterministic CFL} \subsetneq \text{CFL}. \]
Every regular language is context-free, but the reverse implication fails.
Exercise
Which technique is most suitable for showing that \(L=\{a^n b^n c^n\mid n\geq1\}\) is not context-free?
Show answer
Use the CFL pumping lemma or intersect with a suitable language and derive a contradiction. A direct CFG construction cannot establish non-context-freeness.