Download presentation
Presentation is loading. Please wait.
1
Non Deterministic Automata
2
Nondeterministic Finite Accepter (NFA)
Alphabet =
3
Nondeterministic Finite Accepter (NFA)
Alphabet = Two choices
4
Nondeterministic Finite Accepter (NFA)
Alphabet = Two choices No transition No transition
5
First Choice
6
First Choice
7
First Choice
8
First Choice All input is consumed “accept”
9
Second Choice
10
Second Choice
11
Second Choice No transition: the automaton hangs
12
Second Choice Input cannot be consumed “reject”
13
An NFA accepts a string:
when there is a computation of the NFA that accepts the string All the input is consumed and the automaton is in a final state
14
Example is accepted by the NFA: “accept” “reject”
because this computation accepts
15
Rejection example
16
First Choice
17
First Choice “reject”
18
Second Choice
19
Second Choice
20
Second Choice “reject”
21
An 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 The input cannot be consumed
22
Example is rejected by the NFA: “reject” “reject”
All possible computations lead to rejection
23
Rejection example
24
First Choice
25
First Choice No transition: the automaton hangs
26
First Choice Input cannot be consumed “reject”
27
Second Choice
28
Second Choice
29
Second Choice No transition: the automaton hangs
30
Second Choice Input cannot be consumed “reject”
31
is rejected by the NFA: “reject” “reject” All possible computations lead to rejection
32
Language accepted:
33
Lambda Transitions
36
(read head doesn’t move)
38
all input is consumed “accept” String is accepted
39
Rejection Example
41
(read head doesn’t move)
42
No transition: the automaton hangs
43
Input cannot be consumed
“reject” String is rejected
44
Language accepted:
45
Another NFA Example
49
“accept”
50
Another String
57
“accept”
58
Language accepted
59
Another NFA Example
60
Language accepted
61
Remarks: The symbol never appears on the input tape Extreme automata:
62
NFAs are interesting because we can
express languages easier than DFAs NFA DFA
63
Formal Definition of NFAs
Set of states, i.e. Input aplhabet, i.e. Transition function Initial state Final states
64
Transition Function
68
Extended Transition Function
71
Formally It holds if and only if there is a walk from to with label
72
The Language of an NFA
77
Formally The language accepted by NFA is: where and there is some
(final state)
79
Equivalence of NFAs and DFAs
80
Equivalence of Machines
For DFAs or NFAs: Machine is equivalent to machine if
81
Example NFA DFA
82
Since machines and are equivalent NFA DFA
83
Equivalence of NFAs and DFAs
Question: NFAs = DFAs ? Same power? Accept the same languages?
84
Equivalence of NFAs and DFAs
Question: NFAs = DFAs ? YES! Same power? Accept the same languages?
85
We will prove: Languages accepted by NFAs Languages accepted by DFAs NFAs and DFAs have the same computation power
86
Step 1 Languages accepted by NFAs Languages accepted by DFAs Proof: Every DFA is trivially an NFA A language accepted by a DFA is also accepted by an NFA
87
Step 2 Languages accepted by NFAs Languages accepted by DFAs Proof: Any NFA can be converted to an equivalent DFA A language accepted by an NFA is also accepted by a DFA
88
NFA to DFA NFA DFA
89
NFA to DFA NFA DFA
90
NFA to DFA NFA DFA
91
NFA to DFA NFA DFA
92
NFA to DFA NFA DFA
93
NFA to DFA NFA DFA
94
NFA to DFA NFA DFA
95
NFA to DFA: Remarks We are given an NFA We want to convert it
to an equivalent DFA With
96
If the NFA has states the DFA has states in the powerset
97
Procedure NFA to DFA 1. Initial state of NFA: Initial state of DFA:
98
Example NFA DFA
99
Procedure NFA to DFA 2. For every DFA’s state Compute in the NFA
Add transition to DFA
100
Exampe NFA DFA
101
Procedure NFA to DFA Repeat Step 2 for all letters in alphabet, until
no more transitions can be added.
102
Example NFA DFA
103
Procedure 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
104
Example NFA DFA
105
Theorem Take NFA Apply procedure to obtain DFA
Then and are equivalent :
106
Finally We have proven Languages accepted by NFAs Languages accepted
by DFAs
107
We have proven Languages accepted by NFAs Languages accepted by DFAs Regular Languages
108
We have proven Languages accepted by NFAs Languages accepted by DFAs Regular Languages Regular Languages
109
We have proven Languages accepted by NFAs Languages accepted by DFAs Regular Languages Regular Languages Thus, NFAs accept the regular languages
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.