Title: Non Deterministic Automata
1Non Deterministic Automata
2Nondeterministic Finite Accepter (NFA)
Alphabet
3Nondeterministic Finite Accepter (NFA)
Alphabet
Two choices
4Nondeterministic Finite Accepter (NFA)
Alphabet
Two choices
No transition
No transition
5First Choice
6First Choice
7First Choice
8First Choice
All input is consumed
accept
9Second Choice
10Second Choice
11Second Choice
No transition the automaton hangs
12Second Choice
Input cannot be consumed
reject
13An NFA accepts a string when there is a
computation of the NFA that accepts the string
AND
all the input is consumed and the automaton is in
a final state
14Example
is accepted by the NFA
accept
reject
because this computation accepts
15Rejection example
16First Choice
17First Choice
reject
18Second Choice
19Second Choice
20Second Choice
reject
21An NFA rejects a string when there is no
computation of the NFA that accepts the string
- All the input is consumed and the
- automaton is in a non final state
OR
- The input cannot be consumed
22Example
is rejected by the NFA
reject
reject
All possible computations lead to rejection
23Rejection example
24First Choice
25First Choice
No transition the automaton hangs
26First Choice
Input cannot be consumed
reject
27Second Choice
28Second Choice
29Second Choice
No transition the automaton hangs
30Second Choice
Input cannot be consumed
reject
31is rejected by the NFA
reject
reject
All possible computations lead to rejection
32Language accepted
33Lambda Transitions
34(No Transcript)
35(No Transcript)
36(read head does not move)
37(No Transcript)
38all input is consumed
accept
String is accepted
39Rejection Example
40(No Transcript)
41(read head doesnt move)
42No transition the automaton hangs
43Input cannot be consumed
reject
String is rejected
44Language accepted
45Another NFA Example
46(No Transcript)
47(No Transcript)
48(No Transcript)
49accept
50Another String
51(No Transcript)
52(No Transcript)
53(No Transcript)
54(No Transcript)
55(No Transcript)
56(No Transcript)
57accept
58Language accepted
59Another NFA Example
60Language accepted
(redundant state)
61Remarks
- The symbol never appears on the
- input tape
62- NFAs are interesting because we can
- express languages easier than DFAs
NFA
DFA
63Formal Definition of NFAs
Set of states, i.e.
Input aplhabet, i.e.
Transition function
Initial state
Final states
64Transition Function
65(No Transcript)
66(No Transcript)
67(No Transcript)
68Extended Transition Function
69(No Transcript)
70(No Transcript)
71Formally
there is a walk from to with label
72 73Inductive Definition
Basis Induction Suppose w x a. Also Let Then
74The Language of an NFA
75 76 77 78 79Formally
- The language accepted by NFA is
- where
- and there is some
(final state)
80 81NFAs accept the Regular Languages
82Equivalence of Machines
- Definition for Automata
- Machine is equivalent to machine
- if
-
83Example of equivalent machines
NFA
DFA
84We will prove
Languages accepted by NFAs
Regular Languages
Languages accepted by DFAs
NFAs and DFAs have the same computation power
85Step 1
Languages accepted by NFAs
Regular Languages
Proof
Every DFA is trivially an NFA
Any language accepted by a DFA is also
accepted by an NFA
86Step 2
Languages accepted by NFAs
Regular Languages
Any NFA can be converted to an equivalent DFA
Proof
Any language accepted by an NFA is also
accepted by a DFA
87Convert NFA to DFA
NFA
DFA
88Convert NFA to DFA
NFA
DFA
89Convert NFA to DFA
NFA
DFA
90Convert NFA to DFA
NFA
DFA
91Convert NFA to DFA
NFA
DFA
92Convert NFA to DFA
NFA
DFA
93Convert NFA to DFA
NFA
DFA
94NFA to DFA Remarks
- We are given an NFA
- We want to convert it
- to an equivalent DFA
- With
95- If the NFA has n states
- the DFA has 2n states in the power set of QN
- i.e.
96Procedure NFA to DFA
-
- 1. Initial state of NFA
-
- Initial state of DFA
97Example
NFA
DFA
98Procedure NFA to DFA
- 2. For every DFAs state
- Compute in the NFA
-
- Add transition to DFA
99Exampe
NFA
DFA
100Procedure NFA to DFA
- Repeat Step 2 for all letters in alphabet,
- until
- no more transitions can be added.
101Example
NFA
DFA
102Procedure NFA to DFA
- 3. For any DFA state
- If some is a final state in the NFA
- Then,
- is a final state in the DFA
-
103Example
NFA
DFA
104Theorem
Take NFA
Apply procedure to obtain DFA
Then and are equivalent
105Proof
AND
106First we show
Take arbitrary
We will prove
107(No Transcript)
108We will show that if
109More generally, we will show that if in
(arbitrary string)
110Proof by induction on
Induction Basis
111Induction hypothesis
112Induction Step
113Induction Step
114Therefore if
115We have shown
We also need to show
(proof is similar)