Part IA Michaelmas, Lent Term
NFA: Nondeterministic Finite Automata
Definition
A nondeterministic finite automaton (NFA) is a tuple where:
| Component | Description |
|---|---|
| Finite set of states | |
| Input alphabet (finite) | |
| Transition relation | |
| Start state | |
| Set of accepting states |
Key Feature: Nondeterminism
From a state on input , there may be:
- Zero transitions: no next state
- One transition: one next state (like DFA)
- Multiple transitions: several possible next states
Extended Transition Relation
One-Step Transition
Write if .
Multi-Step Transition
Define (there is a path from to labelled by ) inductively:
Language
The NFA accepts string if there exists an accepting state reachable from the start:
Example: Contains “ab”
NFA that accepts strings over containing substring “ab”:
- Transitions:
- , (stay in until we see ‘a’)
- (transition to if we see ‘a’)
- (transition to accepting on ‘b’)
- , (stay accepting)
- ,
Example: Ends with “ab”
NFA that accepts strings ending in “ab”:
- Transitions:
- ,
- ,
- ,
- Or: more standard construction with , plus ,
- ,
Non-acceptance
An NFA rejects string if:
- No path from reaches any accepting state on input , OR
- The computation “gets stuck” (no valid transition)
Note: Nondeterminism means existential acceptance — if ANY path reaches accepting, the string is accepted.
Size and Complexity
- Number of states:
- Number of transitions:
- For each state-symbol pair, potentially outgoing transitions
Summary
- NFA: with nondeterministic transition relation
- A string is accepted if SOME path reaches an accepting state
- Multiple transitions from a state on the same symbol allowed
- No transition on a symbol means that path dies