1 Regular Languages
1.2 Nondeterminism
Nondeterminism
• When a machine is in a given state and reads the next input symbol, if
we know what the next state will be (it is determined) we call this
deterministic computation.
• In a nondeterministic machine, several choices may exist for the next
state at any point.
• Deterministic finite automaton is abbreviated DFA.
• Nondeterministic finite automaton is abbreviated NFA.
Nondeterminism
• Every state of a DFA always has exactly one exiting transition arrow for
each symbol in the alphabet. The NFA shown above violates that rule. In an
NFA, a state may have zero, one, or many exiting arrows for each alphabet
symbol.
• In a DFA, labels on the transition arrows are symbols from the alphabet.
This NFA has an arrow with the label ε. In general, an NFA may have
arrows labeled with members of the alphabet or ε. Zero, one, or many
arrows may exit from each state with the label ε.
The computation of the above NFA on
input 010110 is depicted on the figure
right.
Example NFAs
L = {w | w contains a 1 in the third position from the end}, Σ = {0, 1}
Let us first try to build a DFA:
Example NFAs
Here is the NFA:
Example NFAs
L = {0k | k is a multiple of 2 or 3}, Σ = {0}
Formal Definition of a Nondeterministic Finite
Automaton
Formal Definition of Computation
Equivalence of NFAs and DFAs
Equivalence of NFAs and DFAs
• Proof by construction:
• To construct a DFA that is
equivalent to an NFA, we first
determine DFA’s states.
• The NFA on the right has three
states, {1, 2, 3}, so we construct
DFA with eight states, one for each
subset of NFA’s states.
• We label each of DFA’s states with
the corresponding subset.
Equivalence of NFAs and DFAs
Then determine the start and accept states and the transitions
Equivalence of NFAs and DFAs
• We may simply the machine by removing unreachable states.
Closure under regular operations
Closure under regular operations
• Proof by construction
Closure under regular operations
Closure under regular operations
• Proof by construction
Closure under regular operations
Closure under regular operations
• Proof by construction