NFAs are DFAs but with a less restricted transition function:
- it can accept the empty string as an input i.e. it can transition without reading a symbol
- its output is a set of states i.e. it can transition to a number of states
A 5-tuple where where
Runs
Informal: Given an NFA and a …
Given NFA and , a run of on is a sequence s.t. there exists s.t. and:
- is the initial state () of
A run is accepting if it ends in a final state i.e. .
Tree
You can draw a tree for determining whether there is an NFA accepting run.
Extended Transition Function
.
Case :
Case : and . Then
Example:
.
NFA has an accepting run on iff
Theorem: For every -free NFA , there exists a DFA s.t. .
Proof Sketch: The NFA essentially has a transition function that goes from some set of states, to some other set of states.
The DFA will encode these possible sets of states as elements of a single set. Then, the transition function will tell you how to go from one element to another element i.e. how to go from one set of states to another set of states (just like in the NFA).
Then, any accepting state in the DFA is any subset with an accepting state from the NFA.
Proof: Let .
Now, to adapt the proof for epsilon transitions.
Def: The -closure of , notated , is the set of states that can be reached from by following only -transitions.
We also define for sets.
- Call EClose at the start
- Call EClose after w=0 transition
- Call EClose on set from w > 1 transition
- Call EClose in DFA-NFA proof
Converting NFAs into DFAs
This is sometimes called the “powerset construction”.
Intuition: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Closure Properties
Languages are closed under certain operations, and we can see why using NFAs!
Since we’ve proved that NFAs have the same expressive power as DFAs (since every DFA can be trivially converted into an NFA, and every NFA can be converted into a DFA), we can prove that these properties hold for regular languages by using NFAs.
Complementation
If a language is regular, then is also regular.
Empty String
Be careful about what the complement of a language actually is.
For instance, if .
It’s tempting to say that obviously .However, this is WRONG!
The complement of includes everything not in ; this specific does not include the empty string, and so its complement includes .
It’s very easy to forget about , so please be careful!