Non-Deterministic Finite Automata Costas Busch - LSU
Nondeterministic Finite Automaton (NFA) Alphabet = Costas Busch - LSU
Alphabet = Two choices No transition No transition Costas Busch - LSU
First Choice Costas Busch - LSU
First Choice Costas Busch - LSU
First Choice All input is consumed “accept” Costas Busch - LSU
Second Choice Costas Busch - LSU
Second Choice Input cannot be consumed Automaton Halts “reject” Costas Busch - LSU
if there is a computation path of the NFA that accepts the string A NFA accepts a string: if there is a computation path of the NFA that accepts the string all the symbols of input string are processed and the last is an accepting state Costas Busch - LSU
is accepted by the NFA: “accept” “reject” because this computation accepts this computation is ignored Costas Busch - LSU
Rejection example Costas Busch - LSU
First Choice “reject” Costas Busch - LSU
Second Choice Costas Busch - LSU
Second Choice “reject” Costas Busch - LSU
Another Rejection example Costas Busch - LSU
First Choice Costas Busch - LSU
First Choice Input cannot be consumed “reject” Automaton halts Costas Busch - LSU
Second Choice Costas Busch - LSU
Second Choice Input cannot be consumed Automaton halts “reject” Costas Busch - LSU
OR A NFA rejects a string: if there is no computation of the NFA that accepts the string. For each possible computation path: All the input is consumed and the automaton is in a non accepting state OR The input cannot be consumed Costas Busch - LSU
All possible computations lead to rejection is rejected by the NFA: “reject” “reject” All possible computations lead to rejection Costas Busch - LSU
All possible computations lead to rejection is rejected by the NFA: “reject” “reject” All possible computations lead to rejection Costas Busch - LSU
Language accepted: Costas Busch - LSU
Epsilon Transitions Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
input tape head does not move Automaton changes state Costas Busch - LSU
all input is consumed “accept” String is accepted Costas Busch - LSU
Rejection Example Costas Busch - LSU
Costas Busch - LSU
(read head doesn’t move) Costas Busch - LSU
Input cannot be consumed Automaton halts “reject” String is rejected Costas Busch - LSU
Language accepted: Costas Busch - LSU
Another NFA Example Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
“accept” Costas Busch - LSU
Another String Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
“accept” Costas Busch - LSU
Language accepted Costas Busch - LSU
Another NFA Example Costas Busch - LSU
Language accepted (redundant state) Costas Busch - LSU
Simple Automata Costas Busch - LSU
NFAs are interesting because we can express languages easier than DFAs Costas Busch - LSU
Formal Definition of NFAs Set of states, i.e. Input aplhabet, i.e. Transition function Initial state Accepting states Costas Busch - LSU
Transition Function resulting states reached by following one transition with input symbol Costas Busch - LSU
States reachable from scanning Costas Busch - LSU
States reachable from scanning Costas Busch - LSU
States reachable from with one transition scanning no input symbol Costas Busch - LSU
States reachable from scanning Costas Busch - LSU
Extended Transition Function Similar with but applied on strings Costas Busch - LSU
States reachable from scanning Costas Busch - LSU
States reachable from scanning Costas Busch - LSU
Special case: for any state Costas Busch - LSU
In general : there is a walk from to with label Costas Busch - LSU
The Language of an NFA The language accepted by is: Where for each and there is some (accepting state) Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
Costas Busch - LSU
NFAs accept the Regular Languages Costas Busch - LSU
Equivalence of Machines Definition: Machine is equivalent to machine if Costas Busch - LSU
Example of equivalent machines NFA DFA Costas Busch - LSU
Theorem: Languages accepted Regular by NFAs Languages Languages by DFAs NFAs and DFAs have the same computation power, namely, they accept the same set of languages Costas Busch - LSU
Proof: we need to show Languages accepted Regular by NFAs Languages AND Languages accepted by NFAs Regular Languages Costas Busch - LSU
Every DFA is trivially a NFA Proof-Step 1 Languages accepted by NFAs Regular Languages Every DFA is trivially a NFA Any language accepted by a DFA is also accepted by a NFA Costas Busch - LSU
Any NFA can be converted to an equivalent DFA Proof-Step 2 Languages accepted by NFAs Regular Languages Any NFA can be converted to an equivalent DFA Any language accepted by a NFA is also accepted by a DFA Costas Busch - LSU
Conversion of NFA to DFA Costas Busch - LSU
NFA DFA Costas Busch - LSU
empty set NFA DFA trap state Costas Busch - LSU
NFA union DFA Costas Busch - LSU
NFA union DFA Costas Busch - LSU
NFA DFA trap state Costas Busch - LSU
END OF CONSTRUCTION NFA DFA Costas Busch - LSU
General Conversion Procedure Input: an NFA Output: an equivalent DFA with Costas Busch - LSU
The DFA has states from the power set The NFA has states The DFA has states from the power set Costas Busch - LSU
1. Initial state of NFA: Conversion Procedure Steps step Initial state of DFA: step Costas Busch - LSU
Example NFA DFA Costas Busch - LSU
step 2. For every DFA’s state compute in the NFA Union add transition to DFA Union Costas Busch - LSU
Example NFA DFA Costas Busch - LSU
3. Repeat Step 2 for every state in DFA and symbols in alphabet until no more states can be added in the DFA step Costas Busch - LSU
Example NFA DFA Costas Busch - LSU
if some is accepting state in NFA step 4. For any DFA state if some is accepting state in NFA Then, is accepting state in DFA Costas Busch - LSU
Example NFA DFA Costas Busch - LSU
then the two automata are equivalent: Lemma: If we convert NFA to DFA then the two automata are equivalent: Proof: We need to show: AND Costas Busch - LSU
First we show: We only need to prove: Costas Busch - LSU
NFA Consider symbols Costas Busch - LSU
denotes a possible sub-path like symbol denotes a possible sub-path like symbol …… …… Costas Busch - LSU
We will show that if NFA then DFA state state label label Costas Busch - LSU
More generally, we will show that if in : (arbitrary prefix) NFA then DFA Costas Busch - LSU
is true by construction of Proof by induction on Induction Basis: NFA DFA is true by construction of Costas Busch - LSU
Induction hypothesis: Suppose that the following hold NFA DFA Costas Busch - LSU
Then this is true by construction of Induction Step: Then this is true by construction of NFA DFA Costas Busch - LSU
Therefore if NFA then DFA Costas Busch - LSU
We have shown: With a similar proof we can show: Therefore: END OF PROOF Costas Busch - LSU