1.2 - Nondeterminism
NFA Usefulness
- Every NFA can be converted into an equivalent DFA - Constructing NFAs is sometimes easier than directly constructing DFAs - An NFA may be much smaller than its DFA counterpart - An NFA's function may be easier to understand than its DFA counterpart - NFAs help us understand more powerful computational models that use nondeterminism
NFA/DFA Equivalence
1. Deterministic and Nondeterministic finite automata recognize the same class of languages; this is useful because describing an NFA for a given language is sometimes much easier than describing a DFA for that language. 2. Two machines are equivalent if they recognize the same language. 3. Every NFA has an equivalent DFA. 4. NFAs give an alternative way of characterizing the regular languages.
NFA Computation
1. after reading in a symbol, the machine splits into multiple copies of itself and follows all possibilities in parallel; if there are subsequent choices, the machine splits again. 2. 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 its associated branch of computation). 3. 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. 4. If a state with a λ on an exiting arrow is encountered, the machine splits (forks) into multiple copies for each λ without reading input; so the machine has one copy in its current state, and multiple copies following each λ transition. The machine proceeds nondeterministically as before.
Definition: Nondeterministic Finite Automaton
A 5-tuple where: 1. Q is a finite set of states 2. ∑ is a finite alphabet 3. δ: Q x ∑(sub)λ → P(Q) is the transition function and P(Q) is the power set of Q 4. q₀ ∈ Q is the start state 5. F⊆ Q is the set of accepted states
Nondeterminism
A generalization of determinism in which every finite automaton is automatically a nondeterministic finite automaton. Can be viewed as a sort of parallel computation, wherein multiple independent 'threads' can be running concurrently.
Nondeterministic Machine
A machine in which several choices may exist for the next state at any point.
NFA Computation (Generalized)
A tree of possibilities, where the root corresponds to the start of the computation. Every branching point in the tree corresponds to a point in the computation at which the machine has multiple choices. The machine accepts if at least one of the computation branches ends in an accept state.
Unary Alphabet
An alphabet containing only one symbol.
Difference between NFA and DFA
In a DFA, the transition function takes a state and an input symbol and produces the next state. In an NFA, the transition function takes a state and an input symbol (or the empty string) and produces the SET of next possible states.
Lambda Transition
δ(sub)λ takes a state AND an input symbol or {} to produce the set of possible next states.
Language Regularity
Corollary: A language is regular IFF some NFA recognizes it - any NFA can be converted into an equivalent DFA - if an NFA recognizes some language, so does some DFA - a regular language has a DFA recognizing it and any DFA is also an NFA
DFA
Deterministic Finite Automaton - every state of a DFA always has exactly one exiting transition arrow for each symbol in the alphabet - labels on transition arrows are symbols from the alphabet
NFA→DFA Conversions
Every NFA can be converted into an equivalent DFA, but sometimes that DFA has many more states. If k is the number of states of an 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 must have 2^k states.
NFA
Non-deterministic Finite Automaton - a state may have 0, 1, or many exiting arrows from each state for each alphabet symbol - may have transition arrows labeled with members of the alphabet or λ; 0, 1, or many arrows may exit from each state with the label λ
Closure of Regular Languages
The class of regular languages is closed under the Union (∪) operation. The class of regular languages is closed under the Concatenation (•) operation. The class of regular languages is closed under the Star (*) operation.
Deterministic Computation
When a machine is in a given state and reads the next input symbol, we know what the next state will be (we have the ability to determine it).