BCS402 · Theory of Automata and Formal Languages · Unit 1
Basic Concepts and Automata Theory
Unit Scope & Exam Weightage: This unit covers automata and computation basics, alphabet/symbol/string/formal language, DFA definition, representation and acceptability, NFA, DFA–NFA equivalence and subset construction, ε-NFA and its equivalence, Moore and Mealy machines with output, equivalence of Moore/Mealy, and minimization of finite automata. AKTU asks 2-mark definitions plus 7-mark construction questions — every answer needs a state table and a trace.
Importance-Wise Roadmap (BCS402 Unit 1)
| Priority | Exact Syllabus Topic | PYQ Evidence | Marks Pattern | Tag |
|---|---|---|---|---|
| 1 | DFA design & acceptability (ends-with, substring, avoidance) | 2023-24, 2025-26 | 2m + 7m × 2 | Guaranteed construction |
| 2 | NFA design + DFA–NFA equivalence (subset method) | 2024-25, 2025-26 | 7m × 3 | Table method |
| 3 | Moore machine / 1's complement | 2025-26 | 7m | Output automaton |
| 4 | Minimization of finite automata | 2023-24, 2024-25 (predicted cluster) | 7m | Partitioning |
| 5 | DFA vs NFA, formal definition of DFA, alphabet | 2023-24, 2024-25, 2025-26 | 2m × 4 | Quick marks |
| 6 | ε-NFA and equivalence, Mealy machine, computability/complexity | Not directly asked | Predicted | Backup theory |
Automata-specific examiner guidance: A construction answer is incomplete without (i) the set of states with meaning, (ii) a transition table, (iii) the start/final marking, and (iv) one accepted and one rejected trace. Write these four parts in order for every 7-mark design question.
1. Fundamental Definitions
| Term | Definition | Example |
|---|---|---|
| Symbol | A single atomic character | 0, a, # |
| Alphabet (Σ) | Finite non-empty set of symbols | |
| String | Finite sequence of symbols from Σ; length $ | w |
| Empty string (ε) | String of length zero | |
| Language | A set of strings over an alphabet | |
| Automaton | A finite-state machine that reads a string and accepts/rejects it | DFA, NFA, PDA, TM |
PYQ (2024-25, 2 marks): "Define the term 'Alphabet' in the context of automata theory." An alphabet is a finite, non-empty set of symbols used to form strings; conventionally denoted . Example: ; every input string is a member of .
= set of all finite strings over Σ, including ε (Kleene star).
= (at least one symbol).
Computability asks whether a problem can be solved by an algorithm; complexity asks how many resources (time/space) the solution needs.
1.1 DFA — Formal Definition
Deterministic Finite Automaton (DFA): a 5-tuple where is a finite set of states, a finite alphabet, a total transition function (exactly one next state per state-symbol pair), the start state and the set of final/accepting states.
PYQ (2023-24, 2 marks): "Give the mathematical definition of DFA. Differentiate between NFA and DFA." Write the 5-tuple, then the table:
| Feature | DFA | NFA |
|---|---|---|
| Transition | = one state | = set of states |
| Backtracking | Never needed | May explore many paths |
| ε-moves | Not allowed | Allowed in ε-NFA |
| Dead state | Usually shown explicitly | May simply omit undefined transitions |
| Implementation | Deterministic, fast simulation | Needs set-of-states tracking |
| Power | Same — both accept exactly regular languages | Same |
PYQ (2025-26, 2 marks): "Define Deterministic Finite Automata (DFA)." Use the definition-box: five components, one transition per symbol, accepts when the last state after reading the whole string lies in .
Acceptability: A string is accepted iff the unique run ends with . A language is DFA-accepted if every member is accepted and every non-member rejected.
2. DFA Construction Questions (Solved PYQs)
2.1 DFA Ending with 101 (PYQ 2023-24, 2 marks)
Track the longest suffix that is a prefix of 101:
| State | Meaning | 0 | 1 |
|---|---|---|---|
| → | no useful suffix | ||
seen 1 |
|||
seen 10 |
|||
| * | seen 101 (final) |
Trace 1101: ✔ accepted.
Trace 1010: ends in ✘ rejected. Why ? The suffix after ...1011 is 1, a fresh prefix.
2.2 DFA: Contains "00" but Not "000" (PYQ 2025-26, 7 marks)
We need to remember (a) whether 00 has occurred, and (b) whether the current run of zeros has length 2 (dangerous: next 0 gives 000).
| State | Meaning | 0 | 1 |
|---|---|---|---|
| → | no 00 yet, last bit 1/start |
||
no 00 yet, last bit 0 |
|||
| * | 00 seen, last run of zeros = 2 |
||
000 has occurred (dead/trap) |
|||
| * | 00 seen, last run of zeros = 1 |
||
| * | 00 seen, last bit 1 |
Final states: . State is non-final and loops on everything.
Verification traces:
| String | Path | Result |
|---|---|---|
00 |
accepted | |
000 |
rejected | |
1001 |
accepted | |
0010 |
accepted (ends 10, no 000) |
|
010 |
rejected (no 00) |
|
00100 |
accepted |
Examiner note: after seeing 00 in 001, the third 0 of a future run is still forbidden only when two consecutive zeros follow a one. State remembers that 00 already happened, so 00100 must remain accepted.
2.3 DFA with "abb" as Substring (PYQ 2025-26, 2 marks)
| State | Meaning | a | b |
|---|---|---|---|
| → | no prefix matched | ||
seen a |
|||
seen ab |
|||
| * | seen abb |
Trace aabb: ✔. Once in , remain there (substring found forever).
2.4 DFA for Binary Numbers Divisible by 4 (Predicted cluster)
Remainder transition rule: .
| State (remainder) | 0 | 1 | Final? |
|---|---|---|---|
| → * (0) | yes | ||
| (1) | no | ||
| (2) | no | ||
| (3) | no |
Check 1100 (12): ✔. Equivalently, a non-zero binary number is divisible by 4 iff its last two bits are 00.
3. NFA, Equivalence and ε-Moves
3.1 NFA Definition and Substring Design
Nondeterministic Finite Automaton (NFA): with — a symbol may lead to several states or none. A string is accepted if at least one computation path ends in a final state.
PYQ (2025-26, 7 marks): "Define Non-Deterministic Finite Automata. Design an NFA to accept strings over {0,1} containing the substring 1101."
| State | Meaning | 0 | 1 |
|---|---|---|---|
| → | nothing matched yet | ||
seen 1 |
|||
seen 11 |
|||
seen 110 |
|||
| * | seen 1101 |
The nondeterminism appears at on input 1: either stay (this 1 is not the start of the target) or move to (it is). Trace 01101: — is reachable, so accepted.
3.2 Subset Construction: NFA ⇒ DFA
Predicted (bank
PRED, 2023-24 & 2024-25, 7 marks): "Construct a DFA corresponding to the given NFA" / "Prove that for every NFA there exists an equivalent DFA using subset construction." Worked instance from the bank: states , , start , final , , , , .
Theorem: For an NFA define DFA where and . Every NFA path corresponds to a DFA state containing its current NFA states; induction on string length gives . Hence NFA and DFA accept the same class — regular languages.
| DFA state (subset) | 0 | 1 | Final? |
|---|---|---|---|
| → | no | ||
| * | yes | ||
| (dead) | no |
Explanation: from , input 0 gives ; input 1 gives . Once a 0 is seen the DFA stays in , so the accepted language is "all strings containing at least one 0". Accept check: 101 → ✔; 111 → ✘.
3.3 ε-NFA and Its Equivalence
An ε-NFA allows transitions labelled ε, taken without consuming input. Define ε-closure(q) = set of states reachable from using only ε-moves. To convert an ε-NFA to an NFA (then a DFA):
- For every state and symbol, compute .
- Keep the same start state; a state is final if its ε-closure contains an original final state.
- Apply subset construction to the resulting NFA.
Example: , , final. , so on the start reaches ; the machine accepts exactly a, matching the intuitive behaviour. Equivalence follows because every ε-move can be bypassed by the closure computation without changing the set of accepted strings.
3.4 Finite Automata with Output
| Feature | Moore machine | Mealy machine |
|---|---|---|
| Output depends on | Current state only | Current state and current input |
| Output function | ||
| Output changes | At state entry (one step later) | Immediately with input |
| Number of states | Often one more (start/output state) | Often fewer |
| Clock behaviour | Output is synchronous with states | Output may glitch with input changes |
PYQ (2025-26, 7 marks): "Define the Moore machine. Design a Moore machine to generate 1's complement of given binary numbers."
Definition: A Moore machine is a 6-tuple where maps each state to an output symbol; the output is determined solely by the current state.
1's complement design: state outputs 0 (last input bit was 1 or start), state outputs 1 (last input bit was 0).
| Present state | Input 0 → next (output) | Input 1 → next (output) |
|---|---|---|
| → / out 0 | / 1 | / 0 |
| / out 1 | / 1 | / 0 |
Trace input 1011:
| Step | Input | State entered | Output emitted |
|---|---|---|---|
| start | – | 0 (initial) | |
| 1 | 1 | 0 | |
| 2 | 0 | 1 | |
| 3 | 1 | 0 | |
| 4 | 1 | 0 |
Output sequence including the start output: 01010; dropping the leading start output gives 1010, the 1's complement of 1011. Equivalence of Moore and Mealy: for every Moore machine there is an equivalent Mealy machine with the same number of states (attach state output to incoming transitions); for every Mealy machine there is an equivalent Moore machine that may need one extra state to hold the last output. They produce the same output string after aligning the initial symbol.
4. Minimization of Finite Automata
Goal: merge states that cannot be distinguished by any string — the Myhill–Nerode equivalence. Algorithm:
- Partition into final and non-final states.
- For each block, split states whose transitions on each symbol land in different blocks of .
- Repeat until no block splits; merged states form the minimal DFA.
Predicted (bank
PRED, 2023-24 & 2024-25, 7 marks): "Express the minimum state automata equivalent to the DFA described in the given figure." Worked illustration: DFA with start, final: : 0→, 1→; : 0→, 1→; : 0→, 1→.
| Stage | Blocks | Reason |
|---|---|---|
| , | final vs. non-final | |
| , , | on 1 → final , on 1 → non-final |
Minimal DFA (3 states):
| State | 0 | 1 | Final? |
|---|---|---|---|
| → | no | ||
| no | |||
| * | yes |
No two states can be merged, so this is minimal. A classic merge example: and with identical transitions (both non-final, 0→, 1→) stay in one block through all refinements and are merged into a single state.
5. Exam-Ready Questions, Practice and Checklist
Solved 2-mark drills
- DFA definition: 5-tuple with total (see §1.1).
- DFA vs NFA: one next state vs. a set; same language power.
- Alphabet: finite non-empty symbol set, e.g. .
- Ends with 101: four-state table in §2.1.
Practice questions (label: practice, not real PYQs)
- Practice: Design a DFA over accepting strings whose length is divisible by 3.
- Practice: Convert the NFA for substring
1101(§3.1) into a DFA by subset construction; how many subset states appear? - Practice: Build a Mealy machine for 1's complement and compare its state count with the Moore version.
- Practice: Minimise a DFA where states are both final and have identical outgoing transitions; show the partition steps.
- Practice: Write -closure for a graph with and .
6. Last-Night Survival Checklist (Unit 1 only)
- Five-tuple first: every DFA/NFA answer begins with written explicitly.
- State meanings: label each state with the substring/remainder it represents before drawing transitions.
- Four constructions to reproduce: ends-with-101; contains-00-not-000; contains-abb; divisible-by-4.
- Subset construction: DFA state = set of NFA states; final if the set intersects ; include the empty dead set.
- Moore vs Mealy: output from state vs. output from (state, input); trace
1011for 1's complement.
Final automata reminder: In a 7-mark construction, the transition table carries most of the marks. Verify each final state with one accepted string and each trap/dead state with one rejected string — examiners look for this validation line.