1.04k likes | 1.22k Views
Non-Deterministic Finite Automata. Nondeterministic Finite Automaton (NFA). Alphabet =. Alphabet =. Two choices. No transition. No transition. First Choice. First Choice. First Choice. All input is consumed. “accept”. Second Choice. Second Choice. Input cannot be consumed.
E N D
Non-Deterministic Finite Automata Prof. Busch - LSU
Nondeterministic Finite Automaton (NFA) Alphabet = Prof. Busch - LSU
Alphabet = Two choices No transition No transition Prof. Busch - LSU
First Choice Prof. Busch - LSU
First Choice Prof. Busch - LSU
First Choice All input is consumed “accept” Prof. Busch - LSU
Second Choice Prof. Busch - LSU
Second Choice Input cannot be consumed Automaton Halts “reject” Prof. Busch - LSU
An NFA accepts a string: if there is a computation of the NFA that accepts the string i.e., all the input string is processed and the automaton is in an accepting state Prof. Busch - LSU
is accepted by the NFA: “accept” “reject” because this computation accepts this computation is ignored Prof. Busch - LSU
Rejection example Prof. Busch - LSU
First Choice “reject” Prof. Busch - LSU
Second Choice Prof. Busch - LSU
Second Choice “reject” Prof. Busch - LSU
Another Rejection example Prof. Busch - LSU
First Choice Prof. Busch - LSU
First Choice Input cannot be consumed “reject” Automaton halts Prof. Busch - LSU
Second Choice Prof. Busch - LSU
Second Choice Input cannot be consumed Automaton halts “reject” Prof. Busch - LSU
An NFA rejects a string: if there is no computation of the NFA that accepts the string. For each computation: • All the input is consumed and the • automaton is in a non accepting state OR • The input cannot be consumed Prof. Busch - LSU
is rejected by the NFA: “reject” “reject” All possible computations lead to rejection Prof. Busch - LSU
is rejected by the NFA: “reject” “reject” All possible computations lead to rejection Prof. Busch - LSU
Language accepted: Prof. Busch - LSU
Lambda Transitions Prof. Busch - LSU
input tape head does not move Automaton changes state Prof. Busch - LSU
all input is consumed “accept” String is accepted Prof. Busch - LSU
Rejection Example Prof. Busch - LSU
(read head doesn’t move) Prof. Busch - LSU
Input cannot be consumed Automaton halts “reject” String is rejected Prof. Busch - LSU
Language accepted: Prof. Busch - LSU
Another NFA Example Prof. Busch - LSU
“accept” Prof. Busch - LSU
Another String Prof. Busch - LSU
“accept” Prof. Busch - LSU
Language accepted Prof. Busch - LSU
Another NFA Example Prof. Busch - LSU
Language accepted (redundant state) Prof. Busch - LSU
Remarks: • The symbol never appears on the • input tape • Simple automata: Prof. Busch - LSU
NFAs are interesting because we can • express languages easier than DFAs NFA DFA Prof. Busch - LSU
Formal Definition of NFAs Set of states, i.e. Input aplhabet, i.e. Transition function Initial state Accepting states Prof. Busch - LSU