CS Atlas GATE 2027
TOC course
0 / 91 complete

TOC/Phase 3 · CFG, PDA & Context-Free Languages

Phase bridge B3 · Item 46 of 91

Regular languages, recalled

Read at your own pace. Try the questions before opening the answers.

On this page

Where you are in the story

Phase 2 ended at a wall: aⁿbⁿ, balanced brackets and palindromes are not regular. Phase 3 climbs over it with two tools — grammars that grow strings from both ends, and machines with a stack. Before that, lock in what regular languages can do, because GATE’s classification questions always start with “is it regular?”.

Previous phase in pictures

Four faces of one family

DFA / NFA
check
regular expression
describe
right/left-linear grammar
generate
regular language
one family
Kleene: every face converts into every other.

Regex shortest-strings check

length(a+b)*a*b*(ab)*
0εεε
1a, ba, b—
2aa ab ba bbaa ab bbab
Compare the first rows and most “are these equal?” options collapse.

Conversions

regex
ε-NFA
Thompson: +2 states per union/star
DFA
subset construction ≤ 2ⁿ
regex
state elimination / Arden R = QP*

Closure: everything finite

closed
∪ ∩ − complement · concat · * · reversal · h · h⁻¹ · quotient · prefix
not guaranteed
infinite union · subset · superset

The pumping slider

Pumping y breaks aⁿbⁿ: a finite machine cannot match counts. A stack can.
Pumping y breaks aⁿbⁿ: a finite machine cannot match counts. A stack can.

Carry these forward

Regex precedence?

Star, then concatenation, then union. (2.1.1)

Is (a+b)* = a* + b*?

No — ab separates them. (2.1.2)

Strict Thompson states for (a+b)*?

8. (2.2.1)

Arden’s theorem?

R = Q + RP with ε ∉ L(P) ⇒ R = QP*. (2.2.2)

Which grammars are regular?

Right-linear or left-linear, not mixed. (2.3.2)

Is a subset of a regular language regular?

Not necessarily. (2.4.1)

How do you test finiteness of a DFA’s language?

Trim useless states; infinite iff a cycle remains. (2.4.2)

Pumping lemma conditions?

|xy| ≤ p, |y| ≥ 1, xyⁱz ∈ L for all i ≥ 0. (2.4.3)

Is { w x wᴿ : w, x ∈ Σ⁺ } regular?

Yes. (2.4.4)

Unary regular languages?

Exactly those with eventually periodic length sets. (2.4.4)

Quick refresher

  1. MSQ

    Which are regular?

    1. { aⁿbᵐ : n ≡ m (mod 2) }
    2. { aⁿbⁿ }
    3. { w : |w|ₐ − |w|_b ≡ 0 (mod 3) }
    4. { ww : w ∈ {a,b}* }
  2. NAT

    Minimal DFA states for strings over {a,b} with exactly 2 b’s?

    Write your answer before opening the key.

  3. MCQ

    Arden: R = b + Ra gives

    1. ba*
    2. a*b
    3. (ba)*
    4. b*a
  4. MCQ

    Which grammar generates a non-regular language?

    1. S → aS | b
    2. S → Sa | b
    3. S → aSb | ε
    4. S → abS | ε

What the next phase adds

finite memory
DFA
+ one stack
PDA
grammars with any single variable on the left
CFG
context-free languages
aⁿbⁿ, palindromes, balanced brackets
Phase 3: the first unbounded memory, and the grammars that match it.

Answer Vault

Reveal answers when you’re ready
  1. AC — Remainders only.
    • B: Exact count comparison.
    • D: Copy language over two letters.
  2. 4 — k + 2.
  3. A — R = QP* with Q = b, P = a.
    • B: That solves R = b + aR.
    • C: Wrong.
    • D: Wrong.
  4. C — aⁿbⁿ.
    • A: a*b.
    • B: ba*.
    • D: (ab)*.

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.