Title: Non-Deterministic Finite Automata
1Non-Deterministic Finite Automata
2Nondeterministic Finite Automaton (NFA)
Alphabet
3Alphabet
Two choices
4Alphabet
Two choices
No transition
No transition
5First Choice
6First Choice
7First Choice
All input is consumed
accept
8Second Choice
9Second Choice
Input cannot be consumed
Automaton Halts
reject
10An 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
11is accepted by the NFA
accept
reject
because this computation accepts
this computation is ignored
12Rejection example
13First Choice
reject
14Second Choice
15Second Choice
reject
16Another Rejection example
17First Choice
18First Choice
Input cannot be consumed
reject
Automaton halts
19Second Choice
20Second Choice
Input cannot be consumed
Automaton halts
reject
21An 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 final state
OR
- The input cannot be consumed
22is rejected by the NFA
reject
reject
All possible computations lead to rejection
23is rejected by the NFA
reject
reject
All possible computations lead to rejection
24Language accepted
25Lambda Transitions
26(No Transcript)
27(No Transcript)
28input tape head does not move
29all input is consumed
accept
String is accepted
30Rejection Example
31(No Transcript)
32(read head doesnt move)
33Input cannot be consumed
Automaton halts
reject
String is rejected
34Language accepted
35Another NFA Example
36(No Transcript)
37(No Transcript)
38accept
39Another String
40(No Transcript)
41(No Transcript)
42(No Transcript)
43(No Transcript)
44(No Transcript)
45accept
46Language accepted
47Another NFA Example
48Language accepted
(redundant state)
49Remarks
- The symbol never appears on the
- input tape
50- NFAs are interesting because we can
- express languages easier than DFAs
NFA
DFA
51Formal Definition of NFAs
Set of states, i.e.
Input aplhabet, i.e.
Transition function
Initial state
Accepting states
52Transition Function
resulting states with following one transition
with symbol
53(No Transcript)
54(No Transcript)
55(No Transcript)
56(No Transcript)
57Extended Transition Function
Same with but applied on strings
58(No Transcript)
59(No Transcript)
60Special case
for any state
61In general
there is a walk from to with label
62The Language of an NFA
- The language accepted by is
- where
- and there is some
(accepting state)
63 64 65 66 67 68 69NFAs accept the Regular Languages
70Equivalence of Machines
- Definition
- Machine is equivalent to machine
- if
-
71Example of equivalent machines
NFA
DFA
72Theorem
Languages accepted by NFAs
Regular Languages
Languages accepted by DFAs
NFAs and DFAs have the same computation
power, accept the same set of languages
73Proof
we only need to show
Languages accepted by NFAs
Regular Languages
AND
Languages accepted by NFAs
Regular Languages
74Proof-Step 1
Languages accepted by NFAs
Regular Languages
Every DFA is trivially an NFA
Any language accepted by a DFA is also
accepted by an NFA
75Proof-Step 2
Languages accepted by NFAs
Regular Languages
Any NFA can be converted to an equivalent DFA
Any language accepted by an NFA is also
accepted by a DFA
76Conversion NFA to DFA
NFA
DFA
77NFA
DFA
78empty set
NFA
DFA
trap state
79NFA
union
DFA
80NFA
union
DFA
81NFA
DFA
trap state
82END OF CONSTRUCTION
NFA
DFA
83General Conversion Procedure
- Input an NFA
- Output an equivalent DFA
- with
84- The NFA has states
- The DFA has states from the power set
-
85Conversion Procedure Steps
-
- 1. Initial state of NFA
-
- Initial state of DFA
step
86Example
NFA
DFA
87step
- 2. For every DFAs state
- compute in the NFA
-
-
- add transition to DFA
Union
88Example
NFA
DFA
89- 3. Repeat Step 2 for every state in DFA and
symbols in alphabet until no more states can be
added in the DFA
step
90Example
NFA
DFA
91step
- 4. For any DFA state
- if some is accepting state in NFA
- Then,
- is accepting state in DFA
-
92Example
NFA
DFA
93Lemma
If we convert NFA to DFA then the two
automata are equivalent
Proof
We only need to show
AND
94First we show
We only need to prove
95NFA
Consider
symbols
96symbol
denotes a possible sub-path like
symbol
97We will show that if
NFA
then
DFA
state label
state label
98More generally, we will show that if in
(arbitrary string)
NFA
then
DFA
99Proof by induction on
Induction Basis
NFA
DFA
is true by construction of
100Induction hypothesis
Suppose that the following hold
NFA
DFA
101Induction Step
Then this is true by construction of
NFA
DFA
102Therefore if
NFA
then
DFA
103We have shown
With a similar proof we can show
Therefore
END OF LEMMA PROOF