BCS402 · Theory of Automata and Formal Languages · Unit 2
Regular Expressions and Languages
Unit Scope & Exam Weightage: This unit covers regular expressions, transition graphs, Kleene's theorem, Arden's theorem and the algebraic method, closure properties of regular languages, Pigeonhole principle, Pumping Lemma and its applications, decision properties, and the equivalence finite automata ↔ regular languages. AKTU asks 2-mark RE-writing and 7-mark Arden/pumping-lemma proofs.
Importance-Wise Roadmap (BCS402 Unit 2)
| Priority | Exact Syllabus Topic | PYQ Evidence | Marks Pattern | Tag |
|---|---|---|---|---|
| 1 | Regular expression construction | 2023-24, 2024-25, 2025-26 | 2m × 3 + predicted 7m | Guaranteed |
| 2 | Arden's theorem / algebraic method | 2024-25, 2025-26 (predicted clusters) | 7m × 4 | Derivation steps |
| 3 | Closure properties of regular languages | 2023-24 | 7m | Proof constructions |
| 4 | Pumping lemma & non-regularity | 2023-24, 2024-25, 2025-26 (predicted) | 7m | Standard proof |
| 5 | Pigeonhole principle | 2025-26 | 2m | Quick marks |
| 6 | Kleene's theorem, decision properties | Not directly asked | Predicted | Theory backup |
Regular-language examiner guidance: For Arden's theorem questions, number the state equations, substitute one equation into another, and state the condition before applying . For pumping-lemma proofs always choose , split with , and pump to a contradiction.
1. Regular Expressions — Syntax and Constructions
Regular expression (RE): a symbolic description of a regular language built from symbols of using the operators union (+ or ∪), concatenation and Kleene star (*). denotes the empty language and the language containing only the empty string.
| Operator | Meaning | Precedence |
|---|---|---|
* (star) |
zero or more repetitions | highest |
| concatenation | one string followed by another | middle |
+ / ∪ (union) |
either language | lowest |
1.1 Solved PYQs
PYQ (2024-25, 2 marks): "Write the regular expression for the language containing strings over {0,1} ending with 01." All strings over the alphabet, then the required suffix:
Check: 01, 101, 00101 match; 10 does not.
PYQ (2025-26, 2 marks): "Find the shortest string not in the language of the regular expression ." Generated strings: — every generated string either is all
as or ends ina, and abis always immediately followed by ana. The single symbolbcannot be generated; nor canab. Length-1 candidates area(in L) andb(not in L). Shortest string not in L =b(length 1).
PYQ (2023-24, 2 marks): "Give regular expressions that represent the language L of all binary strings having two consecutive 0s and two consecutive 1s over Σ={0,1}." Both substrings must occur, in either order:
The factor in parentheses guarantees 00 then 11 or 11 then 00; arbitrary prefixes/suffixes complete the string. Examples: 0011 ✔, 110100 ✔, 0101 ✘.
Predicted (bank
PRED, 2025-26, 7 marks): "Write the regular expression for (i) all strings of 0s and 1s; (ii) strings starting with 10101." (i) . (ii) — the fixed prefix consumes exactly10101, then any suffix is allowed.
1.2 Transition Graphs and Kleene's Theorem
A transition graph is a directed labelled graph for an automaton: vertices are states, edge means ; start state has an incoming unlabelled arrow, finals are double circles.
Kleene's theorem: A language is regular iff it is accepted by some finite automaton iff it is described by some regular expression. The three formalisms — DFA, NFA (with ε), RE — have exactly the same expressive power.
Conversions: RE → ε-NFA by induction on operators (union branches, concatenation links, star loops); FA → RE by the state-elimination method (generalised transition graph) or Arden's equations.
2. Arden's Theorem and the Algebraic Method
Arden's theorem: If and are regular expressions over and , then the equation has the unique solution . If , the solution is not unique and the method must first eliminate ε-cycles.
2.1 Worked Example A (Predicted 2024-25, 7 marks)
Predicted question: states A (start), B (final); transitions A --a→ A, A --b→ B, B --a→ B.
Write one equation per state; the final-state equation includes because the machine may stop there:
From (2), by Arden: . Substitute into (1): . Apply Arden again: .
Regular expression = . Check: b, ab, bba? bba has two b's — not generated; correct, since after the first b only as occur.
2.2 Worked Example B (Predicted 2024-25, 7 marks)
Predicted: "Prove that is a regular language using Arden's theorem." Build a DFA: start (no a seen), on a→ (final), on b→; loops on both a and b (once an a has been seen the string stays accepted).
From (1): .
Substitute: .
By Arden: , which equals because any trailing b* can be absorbed into the final . Hence the language is regular. ✔
2.3 Worked Example C (Predicted FA → RE, 7 marks)
For a DFA with start, , , , , final:
RE for accepted strings , i.e. strings ending in b with an even number of bs plus ε. This illustrates the full algebraic elimination pattern.
3. Closure Properties of Regular Languages
PYQ (2023-24, 7 marks): "Discuss closure properties (i.e. union, concatenation, complement, intersection and difference) of regular language."
Regular languages are closed under all these operations. For each, construct an automaton from the constituent DFAs and :
| Operation | Construction | Resulting language |
|---|---|---|
| Union | Product automaton ; final if state's first component ∈ or second ∈ | Either accepted |
| Intersection | Product automaton; final if both components final | Both accepted |
| Difference | Product; final if first ∈ and second ∉ | Accepted by only |
| Complement | Complete DFA; swap final and non-final states | Everything not in |
| Concatenation | ε-NFA: start of ; ε-edges from every state of to start of | Split string into |
| Kleene star | ε-NFA: new start final, ε from new start to and from back to | Zero or more copies |
| Reversal | Reverse every transition, make old start the only final | String reversed |
Proof template for union (7 marks): define with and . Induct on the input: after reading , is in , so accepts iff one of the machines accepts. The finite product state set proves regularity. Intersection/difference change only ; complement requires to be deterministic and complete.
4. Pigeonhole Principle and Pumping Lemma
Pigeonhole principle (PYQ 2025-26, 2 marks): If or more items are placed into boxes, at least one box contains two or more items. In automata theory, a DFA with states reading a string of length must visit some state twice (repetition ⇒ a loop).
4.1 Pumping Lemma for Regular Languages
If is infinite and regular, there exists a pumping length (number of DFA states) such that every with can be written satisfying:
- ,
- ,
- for all .
Reason: the first symbols force a repeated state; the block between the two visits is a loop that can be repeated or removed.
4.2 Solved: Is Not Regular
Predicted (bank
PRED, asked 2023-24, 2024-25, 2025-26, 7 marks): "Using the pumping lemma, show that is not a regular language."
Proof (by contradiction):
- Assume is regular with pumping length .
- Choose ; clearly .
- Because , the prefix consists solely of
as. Write with . - Pump with : . For membership we need , i.e. .
- But — contradiction. Hence is not regular. ∎
Alternative pick: also breaks for (, requiring ). Always choose a string whose counting relationship is destroyed by adding symbols to only one side.
4.3 Decision Properties (syllabus topic)
| Problem | Decidable? | Method |
|---|---|---|
| Is ? | Yes | Simulate on |
| Is ? | Yes | Search reachable states from start to any final |
| Is finite? | Yes | Detect a reachable cycle that can reach a final state |
| Are ? | Yes | Test emptiness of symmetric difference |
| Is ? | Yes | Test |
5. Exam-Ready Question Set and Practice
Model answer map
| Question (source) | Core answer |
|---|---|
| RE ending with 01 (2024-25, 2m) | |
RE with 00 and 11 (2023-24, 2m) |
|
| Shortest string outside (2025-26, 2m) | b |
| Closure properties (2023-24, 7m) | product/ε-NFA constructions table |
| Pigeonhole (2025-26, 2m) | items in boxes |
| Arden examples (predicted, 7m) | numbered equations → → simplify |
| Pumping lemma (predicted, 7m) | five-step contradiction |
Practice questions (label: practice, not real PYQs)
- Practice: Write an RE for binary strings with an even number of 0s. (Hint: .)
- Practice: Use Arden's theorem to convert a DFA where , , , final.
- Practice: Prove closure under reversal by describing the construction on transitions.
- Practice: Show via pigeonhole why a DFA with 3 states cannot remember a count up to 5.
- Practice: Use the pumping lemma to show is not regular.
6. Last-Night Survival Checklist (Unit 2 only)
- Operator precedence:
*> concatenation >+; write fixed-prefix/suffix questions asprefix + Σ* + suffix. - Arden's rule: only when ; number equations and substitute.
- Closure table: union OR, intersection AND, difference AND-NOT, complement swap finals, concatenation ε-bridge, star loop.
- Pumping lemma five steps: assume regular → choose → constrain to first block → pump → contradiction.
- Pigeonhole = repeated state = loop; this one sentence justifies the pumping lemma.
Final RE reminder: A regular expression answer is verified by listing one string that matches and one that does not. In pumping-lemma answers, explicitly state why contains only as — that single line is often the deciding step for full marks.