Finite Automata
Why Study Automata Theory
Automata are the mathematical model of computers and computing systems. They are essential for studying:
- Computability (Decidability): What can a computer do at all?
- Complexity (Intractability): What can a computer do efficiently?
Other applications:
- Design and verification of circuits and communication protocols
- Text-processing applications (lexical analysis, pattern matching)
- Important component of compilers
- Describing simple patterns of events
Central Concepts
Alphabets
An alphabet is any finite set of symbols. Examples: ASCII, Unicode,
Strings
A string over alphabet
= set of all strings over alphabet . - The length of a string is its number of positions.
denotes the empty string (length 0).
Languages
A language is a subset of
Example:
Problems
A problem is the question of deciding whether a given string is a member of some particular language. Languages and problems are really the same thing. When we assign semantics to strings (e.g., strings coding graphs, logical expressions, or integers), we tend to think of a set of strings as a problem.
Deterministic Finite Automata (DFA)
A DFA consists of:
- A finite set of states (
) - An input alphabet (
) - A transition function (
) - A start state (
) - A set of final/accepting states (
)
The Transition Function
Graph Representation of DFA
- Nodes = states.
- Arcs represent transition function — arc from state
to state labeled by all input symbols with transitions from to . - Arrow labeled "Start" points to the start state.
- Final states indicated by double circles.
Examples
Recognizing Strings Ending in "ing":
- State "nothing" → "saw i" → "saw in" → "saw ing" (accepting)
- On 'i': transition from nothing to "saw i". On 'n': "saw i" to "saw in". On 'g': "saw in" to "saw ing".
Strings with No 11 (3 states):
- State A: string so far has no 11, does not end in 1 (start + accept state)
- State B: string so far has no 11, but ends in a single 1 (accept state)
- State C: consecutive 1's have been seen (dead state)
Transition Table Representation
An alternative to the graph: rows = states, columns = input symbols, each entry is
For the "No 11" example:
| State | 0 | 1 |
|---|---|---|
| A | B | |
| *B | A | C |
| C | C | C |
Extended Transition Function
We extend
- Basis:
- Induction:
Language of a DFA
Proving Set Equivalence
To prove that the language of a DFA equals a given description, we prove two directions:
: Every string accepted by the DFA satisfies the description (induction on state reached) : Every string satisfying the description is accepted by the DFA (often via contrapositive)
Example proof for "No 11" language:
- Part 1 (
): Induction on string length — show or implies has no 11 and is in the correct ending state - Part 2 (
): Contrapositive — if a string is NOT accepted, then it has consecutive 1's. Induction on the first violation.
Nondeterministic Finite Automata (NFA)
A nondeterministic finite automaton has the ability to be in several states at once. You may think of it as "branching" computation.
Formal NFA
- Finite set of states
- Input alphabet
- Transition function
returns a set of states (not a single state) - Start state
- Final states
Language of an NFA
A string
Example: Chessboard NFA
States = squares. Input
Equivalence of DFA and NFA
Surprising result: For any NFA, there is a DFA that accepts the same language.
Subset Construction (Rabin-Scott)
Given NFA with states
- States: subsets of
( possible states) - Start state:
- Final states: any subset containing at least one NFA final state
- Transition:
Critical point: DFA state names are sets of NFA states. But the DFA is a real DFA — its transition function takes one state and one symbol to exactly one state.
Proof of Equivalence
We prove by induction on
So
NFA with -Transitions ( -NFA)
We can allow state-to-state transitions on
-Closure
Extended for -NFA
- Basis:
- Induction:
Removing -Transitions
For every pair of states, if there is a path with
Full Equivalence
All three FA models accept exactly the same class of languages: regular languages.
Regular Languages
A language
Examples of Nonregular Languages
— equal number of 0's and 1's (requires "memory") — nested structure
Examples of Regular Languages
— 5-state DFA (remainders 0–4) — 3-state DFA — 4-state DFA