Non-Deterministic Finite Automata - PowerPoint PPT Presentation

About This Presentation
Title:

Non-Deterministic Finite Automata

Description:

Non-Deterministic Finite Automata Lambda Transitions Another NFA Example Formal Definition of NFAs Extended Transition Function The Language of an NFA The ... – PowerPoint PPT presentation

Number of Views:110
Avg rating:3.0/5.0
Slides: 104
Provided by: Costas1
Learn more at: http://www.cs.rpi.edu
Category:

less

Transcript and Presenter's Notes

Title: Non-Deterministic Finite Automata


1
Non-Deterministic Finite Automata
2
Nondeterministic Finite Automaton (NFA)
Alphabet
3
Alphabet
Two choices
4
Alphabet
Two choices
No transition
No transition
5
First Choice
6
First Choice
7
First Choice
All input is consumed
accept
8
Second Choice
9
Second Choice
Input cannot be consumed
Automaton Halts
reject
10
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
11
is accepted by the NFA
accept
reject
because this computation accepts
this computation is ignored
12
Rejection example
13
First Choice
reject
14
Second Choice
15
Second Choice
reject
16
Another Rejection example
17
First Choice
18
First Choice
Input cannot be consumed
reject
Automaton halts
19
Second Choice
20
Second Choice
Input cannot be consumed
Automaton halts
reject
21
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 final state

OR
  • The input cannot be consumed

22
is rejected by the NFA
reject
reject
All possible computations lead to rejection
23
is rejected by the NFA
reject
reject
All possible computations lead to rejection
24
Language accepted
25
Lambda Transitions
26
(No Transcript)
27
(No Transcript)
28
input tape head does not move
29
all input is consumed
accept
String is accepted
30
Rejection Example
31
(No Transcript)
32
(read head doesnt move)
33
Input cannot be consumed
Automaton halts
reject
String is rejected
34
Language accepted
35
Another NFA Example
36
(No Transcript)
37
(No Transcript)
38
accept
39
Another String
40
(No Transcript)
41
(No Transcript)
42
(No Transcript)
43
(No Transcript)
44
(No Transcript)
45
accept
46
Language accepted
47
Another NFA Example
48
Language accepted
(redundant state)
49
Remarks
  • The symbol never appears on the
  • input tape
  • Simple automata

50
  • NFAs are interesting because we can
  • express languages easier than DFAs

NFA
DFA
51
Formal Definition of NFAs

Set of states, i.e.
Input aplhabet, i.e.
Transition function
Initial state
Accepting states
52
Transition Function
resulting states with following one transition
with symbol
53
(No Transcript)
54
(No Transcript)
55
(No Transcript)
56
(No Transcript)
57
Extended Transition Function

Same with but applied on strings
58
(No Transcript)
59
(No Transcript)
60
Special case
for any state
61
In general
there is a walk from to with label
62
The Language of an NFA
  • The language accepted by is
  • where
  • and there is some

(accepting state)
63

64

65

66

67

68

69
NFAs accept the Regular Languages

70
Equivalence of Machines
  • Definition
  • Machine is equivalent to machine
  • if

71
Example of equivalent machines

NFA
DFA
72
Theorem
Languages accepted by NFAs
Regular Languages
Languages accepted by DFAs
NFAs and DFAs have the same computation
power, accept the same set of languages
73
Proof
we only need to show
Languages accepted by NFAs
Regular Languages
AND
Languages accepted by NFAs
Regular Languages
74
Proof-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
75
Proof-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
76
Conversion NFA to DFA

NFA
DFA
77

NFA
DFA
78
empty set

NFA
DFA
trap state
79

NFA
union
DFA
80

NFA
union
DFA
81

NFA
DFA
trap state
82
END OF CONSTRUCTION

NFA
DFA
83
General Conversion Procedure
  • Input an NFA
  • Output an equivalent DFA
  • with

84
  • The NFA has states
  • The DFA has states from the power set

85
Conversion Procedure Steps
  • 1. Initial state of NFA
  • Initial state of DFA

step
86
Example

NFA
DFA
87
step
  • 2. For every DFAs state
  • compute in the NFA
  • add transition to DFA

Union
88
Example

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
90
Example

NFA
DFA
91
step
  • 4. For any DFA state
  • if some is accepting state in NFA
  • Then,
  • is accepting state in DFA

92
Example

NFA
DFA
93
Lemma

If we convert NFA to DFA then the two
automata are equivalent
Proof
We only need to show
AND
94
First we show
We only need to prove
95
NFA
Consider
symbols
96
symbol
denotes a possible sub-path like
symbol
97
We will show that if
NFA
then
DFA
state label
state label
98
More generally, we will show that if in
(arbitrary string)
NFA
then
DFA
99
Proof by induction on
Induction Basis
NFA
DFA
is true by construction of
100
Induction hypothesis
Suppose that the following hold
NFA
DFA
101
Induction Step
Then this is true by construction of
NFA
DFA
102
Therefore if
NFA
then
DFA
103
We have shown
With a similar proof we can show
Therefore
END OF LEMMA PROOF
Write a Comment
User Comments (0)
About PowerShow.com