1.2 NONDETERMINISM (briðgeng stöðuvél) Flashcards
In a nondeterministic machine
Several choices may exist for the next state at any point
Nondeterminism is a generalization of determinism, so
every deterministic finite automaton is automatically a nondeterministic finite automaton.
The difference between a deterministic finite automaton, abbreviated DFA, and a nondeterministic finite automaton, abbreviated NFA
First, every state of a DFA always has exactly one exiting transition arrow for each symbol in the alphabet. The NFA violates that rule.
Second, in a DFA, labels on the transition arrows are symbols from the alpha- bet. This NFA has an arrow with the label ε. In general, an NFA may have arrows labeled with members of the alphabet or ε.
How does an NFA compute?
Suppose that we are running an NFA on an input string and come to a state with multiple ways to proceed. After reading that symbol, the machine splits into multiple copies of itself and follows all the possibilities in parallel. Each copy of the machine takes one of the possible ways to proceed and continues as before. If there are subsequent choices, the machine splits again. If the next input symbol doesn’t appear on any of the arrows exiting the state occupied by a copy of the machine, that copy of the machine dies, along with the branch of the computation associated with it. Finally, if any one of these copies of the machine is in an accept state at the end of the input, the NFA accepts the input string.
As we will show, every NFA can be converted into an equivalent DFA, and constructing NFAs is sometimes easier than directly constructing DFAs.
The formal definition of a nondeterministic finite automaton is similar to that of a deterministic finite automaton. Both have states, an input alphabet, a transition function, a start state, and a collection of accept states. However, they differ in one essential way:
in the type of transition function.
In an NFA, the transition function takes a state and an input symbol or the empty string and produces the set of possible next states.
A nondeterministic finite automaton is a 5-tuple (Q,Σ,δ,q0,F), where
- Q is a finite set of states,
- Σ is a finite alphabet,
- δ : Q × Σε −→ P (Q) is the transition function,
- q0 ∈ Q is the start state, and
- F ⊆ Q is the set of accept states.
Every nondeterministic finite automaton has an equivalent deterministic finite
automaton.
If k is the number of states of the NFA, it has 2^k subsets of states. Each subset corresponds to one of the possibilities that the DFA must remember, so the DFA simulating the NFA will have how many states ?
2^k states.
A language is regular if and only if some nondeterministic finite automaton recognizes it.