Chapter recap
Closure: regular languages are closed under every finite operation in the syllabus (∪ ∩ − complement, concatenation, star, reversal, homomorphism, inverse homomorphism, quotient, prefix), not under infinite union or taking subsets. Algorithms exist for membership, emptiness, finiteness, universality, equivalence, containment. The pumping lemma (|xy| ≤ p, |y| ≥ 1, pump all i) proves non-regularity; it is necessary, not sufficient. Fast intuition: bounded facts are regular; exact unbounded comparisons are not; finite and eventually periodic unary sets are regular; a free middle x absorbs the hard part.
Merged rule card
From 2.4.1 Closure properties of regular languages
- Closed: ∪ ∩ − complement, concat, *, ⁺, reversal, homomorphism, inverse homomorphism, quotient (by any language), prefix, suffix, substring, substitution, finite ∪/∩.
- Not guaranteed: infinite ∪/∩, subset, superset.
- Prove non-regular: L ∩ R non-regular (R regular) ⇒ L non-regular.
From 2.4.2 Algorithms for regular languages
- Membership: run. Emptiness: reachable F? Finiteness: trim + cycle (or lengths n..2n−1). Universality: complement + emptiness. Equivalence: minimize & compare, or symmetric difference empty. Containment: L₁ ∩ L̅₂ = ∅.
- All these have always-terminating algorithms for regular languages.
From 2.4.3 Pumping lemma for regular languages
- L regular ⇒ ∃p ∀w ∈ L, |w| ≥ p, ∃ xyz: |xy| ≤ p, |y| ≥ 1, ∀i ≥ 0: xyⁱz ∈ L. p = #states.
- Game: they pick p and split; you pick w and i. Beat every split.
- Standard picks: aᵖbᵖ; a^{p²}; aᵖbaᵖb (ww); prime q ≥ p+2 with i = q+1.
- Necessary, not sufficient. Finite languages pass vacuously.
From 2.4.4 Drill: regular or not?
- Bounded fact (mod, flag, last k, capped count, bounded difference) ⇒ regular.
- Exact comparison of two unbounded counts, ww, wwᴿ, squares, primes, 2ⁿ ⇒ not regular.
- Finite ⇒ regular. Unary: regular ⇔ lengths eventually periodic.
- wxwᴿ, wxw (x ∈ Σ⁺) regular. #ab = #ba regular. ww over one letter regular.
Practice questions
- MSQ
If L is regular, which are regular?
- Lᴿ ∩ L
- Prefix(L)
- L / { aⁿbⁿ }
- { w : w ∈ L and |w| is prime }
- MCQ
{ aⁱbʲ : i ≥ j } is:
- regular
- not regular
- finite
- a*b*
- NAT
Minimum states of a DFA for strings over {a,b} where every prefix satisfies |#a − #b| ≤ 1?
Write your answer before opening the key.
- MCQ
To prove L non-regular by the pumping lemma, you choose:
- p and the split
- w and i
- p and i
- the split and w
- MSQ
Which questions about regular languages have always-terminating algorithms?
- emptiness
- finiteness
- equivalence of two DFAs
- universality
- MCQ
{ ww : w ∈ {a}* } is:
- regular — it equals (aa)*
- not regular
- finite
- equal to a*
- MCQ
L₁ = {aⁿbⁿ}, L₂ = complement of L₁. L₁ ∪ L₂ is:
- not regular
- regular (Σ*)
- undefined
- empty
- MSQ
Which are not regular?
- { a^{n!} }
- { aⁿbᵐcⁿ⁺ᵐ }
- { w : w = wᴿ } over {a,b}
- { w : |w| ≡ 0 mod 7 }
- MCQ
h(a) = ab, h(b) = ε. h⁻¹({ab}) contains:
- only a
- a with any number of b’s around it
- only ab
- nothing
- NAT
Pumping length guaranteed by a 9-state DFA?
Write your answer before opening the key.
Answer key
Reveal answers when you’re ready
- ABC — Closure properties; quotient by any language.
- D: L = a* gives primes, not regular.
- B — Unbounded comparison.
- A: Needs i − j unbounded.
- C: Infinite.
- D: Not all of a*b*.
- 4 — Difference −1, 0, +1 and dead.
- B — Opponent picks p and split.
- A: Opponent’s moves.
- C: p is the opponent’s.
- D: Split is the opponent’s.
- ABCD — All.
- A — Unary: ww = a²ⁿ.
- B: Unary copies collapse.
- C: Infinite.
- D: Odd lengths excluded.
- B — Union with complement is Σ*.
- A: Σ* is regular.
- C: Defined.
- D: Everything.
- ABC — Unbounded structure.
- D: A 7-cycle.
- B — h(w) = (ab)^{#a} — need exactly one a; b’s vanish.
- A: bab also maps to ab.
- C: h(ab) = ab, but it is not the only one.
- D: a maps to ab.
- 9 — Number of states.