Nondeterministic Automata#
The definition of nondeterministic automata(NFA) just means that at a given character and state, the next state could be ambiguous. More formally, in state , on symbol , the choice of next state is not unique: could be either or . What follows is that some states can have no next states, and will not process additional symbols.
We know that the deterministic function of a deterministic automata will give you the next state when given the current state and processed character. However, a nondeterministic function will return a set of multiple possible future states(or none) given a current state and character.
When a nondeterministic automata comes to a fork, where it has multiple possible ways it could go, we treat those as separate execution paths. This means that a nondeterministic automata could possibly have multiple execution paths, all of which need to be considered when analyzing it.
We consider a string to be in the language of an NFA if and only if there exists at least one successful execution of on . Generally we simulate this by simulating an execution tree on a string. You can also instead compute the set of all possible states after processing each input symbol(think of it like a BFS).
Defining an NFA#
A nondeterministic finite automata consists of:
- A finite set of states
- A finite alphabet
- An initial state that belongs to
- A subset of , called accepting states
- A transition function
Note that NFAs don’t follow computational models of Turing machines, which can only execute one path at a time. Despite this, NFAs are important to study as they are critical to the theory of NP-complete problems and regular expressions.