Download presentation
Presentation is loading. Please wait.
1
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata
2
Fall 2006Costas Busch - RPI2 Alphabet = Nondeterministic Finite Automaton (NFA)
3
Fall 2006Costas Busch - RPI3 Two choices Alphabet =
4
Fall 2006Costas Busch - RPI4 No transition Two choices No transition Alphabet =
5
Fall 2006Costas Busch - RPI5 First Choice
6
Fall 2006Costas Busch - RPI6 First Choice
7
Fall 2006Costas Busch - RPI7 “accept” First Choice All input is consumed
8
Fall 2006Costas Busch - RPI8 Second Choice
9
Fall 2006Costas Busch - RPI9 Second Choice “reject” Input cannot be consumed Automaton Halts
10
Fall 2006Costas Busch - RPI10 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
Fall 2006Costas Busch - RPI11 is accepted by the NFA: “accept” “reject” because this computation accepts this computation is ignored
12
Fall 2006Costas Busch - RPI12 Rejection example
13
Fall 2006Costas Busch - RPI13 First Choice “reject”
14
Fall 2006Costas Busch - RPI14 Second Choice
15
Fall 2006Costas Busch - RPI15 Second Choice “reject”
16
Fall 2006Costas Busch - RPI16 Another Rejection example
17
Fall 2006Costas Busch - RPI17 First Choice
18
Fall 2006Costas Busch - RPI18 “reject” First Choice Input cannot be consumed Automaton halts
19
Fall 2006Costas Busch - RPI19 Second Choice
20
Fall 2006Costas Busch - RPI20 Second Choice “reject” Input cannot be consumed Automaton halts
21
Fall 2006Costas Busch - RPI21 An NFA rejects a string: if 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 OR For each computation:
22
Fall 2006Costas Busch - RPI22 is rejected by the NFA: “reject” All possible computations lead to rejection
23
Fall 2006Costas Busch - RPI23 is rejected by the NFA: “reject” All possible computations lead to rejection
24
Fall 2006Costas Busch - RPI24 Language accepted:
25
Fall 2006Costas Busch - RPI25 Lambda Transitions
26
Fall 2006Costas Busch - RPI26
27
Fall 2006Costas Busch - RPI27
28
Fall 2006Costas Busch - RPI28 input tape head does not move
29
Fall 2006Costas Busch - RPI29 “accept” String is accepted all input is consumed
30
Fall 2006Costas Busch - RPI30 Rejection Example
31
Fall 2006Costas Busch - RPI31
32
Fall 2006Costas Busch - RPI32 (read head doesn’t move)
33
Fall 2006Costas Busch - RPI33 “reject” String is rejected Input cannot be consumed Automaton halts
34
Fall 2006Costas Busch - RPI34 Language accepted:
35
Fall 2006Costas Busch - RPI35 Another NFA Example
36
Fall 2006Costas Busch - RPI36
37
Fall 2006Costas Busch - RPI37
38
Fall 2006Costas Busch - RPI38 “accept”
39
Fall 2006Costas Busch - RPI39 Another String
40
Fall 2006Costas Busch - RPI40
41
Fall 2006Costas Busch - RPI41
42
Fall 2006Costas Busch - RPI42
43
Fall 2006Costas Busch - RPI43
44
Fall 2006Costas Busch - RPI44
45
Fall 2006Costas Busch - RPI45 “accept”
46
Fall 2006Costas Busch - RPI46 Language accepted
47
Fall 2006Costas Busch - RPI47 Another NFA Example
48
Fall 2006Costas Busch - RPI48 Language accepted (redundant state)
49
Fall 2006Costas Busch - RPI49 Remarks: The symbol never appears on the input tape Simple automata:
50
Fall 2006Costas Busch - RPI50 NFADFA NFAs are interesting because we can express languages easier than DFAs
51
Fall 2006Costas Busch - RPI51 Formal Definition of NFAs Set of states, i.e. Input aplhabet, i.e. Transition function Initial state Accepting states
52
Fall 2006Costas Busch - RPI52 Transition Function resulting states with following one transition with symbol
53
Fall 2006Costas Busch - RPI53
54
Fall 2006Costas Busch - RPI54
55
Fall 2006Costas Busch - RPI55
56
Fall 2006Costas Busch - RPI56
57
Fall 2006Costas Busch - RPI57 Extended Transition Function Same with but applied on strings
58
Fall 2006Costas Busch - RPI58
59
Fall 2006Costas Busch - RPI59
60
Fall 2006Costas Busch - RPI60 Special case: for any state
61
Fall 2006Costas Busch - RPI61 : there is a walk from to with label In general
62
Fall 2006Costas Busch - RPI62 The Language of an NFA The language accepted by is: where and there is some (accepting state)
63
Fall 2006Costas Busch - RPI63
64
Fall 2006Costas Busch - RPI64
65
Fall 2006Costas Busch - RPI65
66
Fall 2006Costas Busch - RPI66
67
Fall 2006Costas Busch - RPI67
68
Fall 2006Costas Busch - RPI68
69
Fall 2006Costas Busch - RPI69 NFAs accept the Regular Languages
70
Fall 2006Costas Busch - RPI70 Equivalence of Machines Definition: Machine is equivalent to machine if
71
Fall 2006Costas Busch - RPI71 NFA DFA Example of equivalent machines
72
Fall 2006Costas Busch - RPI72 Theorem: Languages accepted by NFAs Regular Languages NFAs and DFAs have the same computation power, accept the same set of languages Languages accepted by DFAs
73
Fall 2006Costas Busch - RPI73 Languages accepted by NFAs Regular Languages accepted by NFAs Regular Languages we only need to show Proof: AND
74
Fall 2006Costas Busch - RPI74 Languages accepted by NFAs Regular Languages Proof-Step 1 Every DFA is trivially an NFA Any language accepted by a DFA is also accepted by an NFA
75
Fall 2006Costas Busch - RPI75 Languages accepted by NFAs Regular Languages Proof-Step 2 Any NFA can be converted to an equivalent DFA Any language accepted by an NFA is also accepted by a DFA
76
Fall 2006Costas Busch - RPI76 Conversion NFA to DFA NFA DFA
77
Fall 2006Costas Busch - RPI77 NFA DFA
78
Fall 2006Costas Busch - RPI78 NFA DFA empty set trap state
79
Fall 2006Costas Busch - RPI79 NFA DFA union
80
Fall 2006Costas Busch - RPI80 NFA DFA union
81
Fall 2006Costas Busch - RPI81 NFA DFA trap state
82
Fall 2006Costas Busch - RPI82 NFA DFA END OF CONSTRUCTION
83
Fall 2006Costas Busch - RPI83 General Conversion Procedure Input: an NFA Output: an equivalent DFA with
84
Fall 2006Costas Busch - RPI84 The NFA has states The DFA has states from the power set
85
Fall 2006Costas Busch - RPI85 1. Initial state of NFA: Initial state of DFA: Conversion Procedure Steps step
86
Fall 2006Costas Busch - RPI86 NFA DFA Example
87
Fall 2006Costas Busch - RPI87 2. For every DFA’s state compute in the NFA add transition to DFA Union step
88
Fall 2006Costas Busch - RPI88 NFA DFA Example
89
Fall 2006Costas Busch - RPI89 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
Fall 2006Costas Busch - RPI90 NFA DFA Example
91
Fall 2006Costas Busch - RPI91 4. For any DFA state if some is accepting state in NFA Then, is accepting state in DFA step
92
Fall 2006Costas Busch - RPI92 NFA DFA Example
93
Fall 2006Costas Busch - RPI93 If we convert NFA to DFA then the two automata are equivalent: Lemma: Proof: AND We only need to show:
94
Fall 2006Costas Busch - RPI94 First we show: We only need to prove:
95
Fall 2006Costas Busch - RPI95 symbols Consider NFA
96
Fall 2006Costas Busch - RPI96 denotes a possible sub-path like symbol
97
Fall 2006Costas Busch - RPI97 We will show that if then NFA DFA state label state label
98
Fall 2006Costas Busch - RPI98 More generally, we will show that if in : (arbitrary string) then NFA DFA
99
Fall 2006Costas Busch - RPI99 Proof by induction on Induction Basis: is true by construction of NFA DFA
100
Fall 2006Costas Busch - RPI100 Induction hypothesis: NFA DFA Suppose that the following hold
101
Fall 2006Costas Busch - RPI101 Induction Step: NFA DFA Then this is true by construction of
102
Fall 2006Costas Busch - RPI102 Therefore if NFA DFA then
103
Fall 2006Costas Busch - RPI103 We have shown: With a similar proof we can show: END OF LEMMA PROOF Therefore:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.