Presentation is loading. Please wait.

Presentation is loading. Please wait.

Non-Deterministic Finite Automata

Similar presentations


Presentation on theme: "Non-Deterministic Finite Automata"— Presentation transcript:

1 Non-Deterministic Finite Automata
Costas Busch - LSU

2 Nondeterministic Finite Automaton (NFA)
Alphabet = Costas Busch - LSU

3 Alphabet = Two choices No transition No transition Costas Busch - LSU

4 First Choice Costas Busch - LSU

5 First Choice Costas Busch - LSU

6 First Choice All input is consumed “accept” Costas Busch - LSU

7 Second Choice Costas Busch - LSU

8 Second Choice Input cannot be consumed Automaton Halts “reject”
Costas Busch - LSU

9 if there is a computation path of the NFA that accepts the string
A NFA accepts a string: if there is a computation path of the NFA that accepts the string all the symbols of input string are processed and the last is an accepting state Costas Busch - LSU

10 is accepted by the NFA: “accept” “reject” because this computation
accepts this computation is ignored Costas Busch - LSU

11 Rejection example Costas Busch - LSU

12 First Choice “reject” Costas Busch - LSU

13 Second Choice Costas Busch - LSU

14 Second Choice “reject” Costas Busch - LSU

15 Another Rejection example
Costas Busch - LSU

16 First Choice Costas Busch - LSU

17 First Choice Input cannot be consumed “reject” Automaton halts
Costas Busch - LSU

18 Second Choice Costas Busch - LSU

19 Second Choice Input cannot be consumed Automaton halts “reject”
Costas Busch - LSU

20 OR A NFA rejects a string: if there is no computation of the NFA
that accepts the string. For each possible computation path: All the input is consumed and the automaton is in a non accepting state OR The input cannot be consumed Costas Busch - LSU

21 All possible computations lead to rejection
is rejected by the NFA: “reject” “reject” All possible computations lead to rejection Costas Busch - LSU

22 All possible computations lead to rejection
is rejected by the NFA: “reject” “reject” All possible computations lead to rejection Costas Busch - LSU

23 Language accepted: Costas Busch - LSU

24 Epsilon Transitions Costas Busch - LSU

25 Costas Busch - LSU

26 Costas Busch - LSU

27 input tape head does not move
Automaton changes state Costas Busch - LSU

28 all input is consumed “accept” String is accepted Costas Busch - LSU

29 Rejection Example Costas Busch - LSU

30 Costas Busch - LSU

31 (read head doesn’t move)
Costas Busch - LSU

32 Input cannot be consumed
Automaton halts “reject” String is rejected Costas Busch - LSU

33 Language accepted: Costas Busch - LSU

34 Another NFA Example Costas Busch - LSU

35 Costas Busch - LSU

36 Costas Busch - LSU

37 “accept” Costas Busch - LSU

38 Another String Costas Busch - LSU

39 Costas Busch - LSU

40 Costas Busch - LSU

41 Costas Busch - LSU

42 Costas Busch - LSU

43 Costas Busch - LSU

44 “accept” Costas Busch - LSU

45 Language accepted Costas Busch - LSU

46 Another NFA Example Costas Busch - LSU

47 Language accepted (redundant state) Costas Busch - LSU

48 Simple Automata Costas Busch - LSU

49 NFAs are interesting because we can express languages easier than DFAs
Costas Busch - LSU

50 Formal Definition of NFAs
Set of states, i.e. Input aplhabet, i.e. Transition function Initial state Accepting states Costas Busch - LSU

51 Transition Function resulting states reached
by following one transition with input symbol Costas Busch - LSU

52 States reachable from scanning
Costas Busch - LSU

53 States reachable from scanning
Costas Busch - LSU

54 States reachable from with one transition scanning no input symbol
Costas Busch - LSU

55 States reachable from scanning
Costas Busch - LSU

56 Extended Transition Function
Similar with but applied on strings Costas Busch - LSU

57 States reachable from scanning
Costas Busch - LSU

58 States reachable from scanning
Costas Busch - LSU

59 Special case: for any state Costas Busch - LSU

60 In general : there is a walk from to with label Costas Busch - LSU

61 The Language of an NFA The language accepted by is: Where for each
and there is some (accepting state) Costas Busch - LSU

62 Costas Busch - LSU

63 Costas Busch - LSU

64 Costas Busch - LSU

65 Costas Busch - LSU

66 Costas Busch - LSU

67 Costas Busch - LSU

68 NFAs accept the Regular Languages
Costas Busch - LSU

69 Equivalence of Machines
Definition: Machine is equivalent to machine if Costas Busch - LSU

70 Example of equivalent machines
NFA DFA Costas Busch - LSU

71 Theorem: Languages accepted Regular by NFAs Languages Languages
by DFAs NFAs and DFAs have the same computation power, namely, they accept the same set of languages Costas Busch - LSU

72 Proof: we need to show Languages accepted Regular by NFAs Languages
AND Languages accepted by NFAs Regular Languages Costas Busch - LSU

73 Every DFA is trivially a NFA
Proof-Step 1 Languages accepted by NFAs Regular Languages Every DFA is trivially a NFA Any language accepted by a DFA is also accepted by a NFA Costas Busch - LSU

74 Any NFA can be converted to an equivalent DFA
Proof-Step 2 Languages accepted by NFAs Regular Languages Any NFA can be converted to an equivalent DFA Any language accepted by a NFA is also accepted by a DFA Costas Busch - LSU

75 Conversion of NFA to DFA
Costas Busch - LSU

76 NFA DFA Costas Busch - LSU

77 empty set NFA DFA trap state Costas Busch - LSU

78 NFA union DFA Costas Busch - LSU

79 NFA union DFA Costas Busch - LSU

80 NFA DFA trap state Costas Busch - LSU

81 END OF CONSTRUCTION NFA DFA Costas Busch - LSU

82 General Conversion Procedure
Input: an NFA Output: an equivalent DFA with Costas Busch - LSU

83 The DFA has states from the power set
The NFA has states The DFA has states from the power set Costas Busch - LSU

84 1. Initial state of NFA: Conversion Procedure Steps step
Initial state of DFA: step Costas Busch - LSU

85 Example NFA DFA Costas Busch - LSU

86 step 2. For every DFA’s state compute in the NFA Union
add transition to DFA Union Costas Busch - LSU

87 Example NFA DFA Costas Busch - LSU

88 3. Repeat Step 2 for every state in DFA and symbols in alphabet until no more states can be added in the DFA step Costas Busch - LSU

89 Example NFA DFA Costas Busch - LSU

90 if some is accepting state in NFA
step 4. For any DFA state if some is accepting state in NFA Then, is accepting state in DFA Costas Busch - LSU

91 Example NFA DFA Costas Busch - LSU

92 then the two automata are equivalent:
Lemma: If we convert NFA to DFA then the two automata are equivalent: Proof: We need to show: AND Costas Busch - LSU

93 First we show: We only need to prove: Costas Busch - LSU

94 NFA Consider symbols Costas Busch - LSU

95 denotes a possible sub-path like
symbol denotes a possible sub-path like symbol …… …… Costas Busch - LSU

96 We will show that if NFA then DFA state state label label
Costas Busch - LSU

97 More generally, we will show that if in :
(arbitrary prefix) NFA then DFA Costas Busch - LSU

98 is true by construction of
Proof by induction on Induction Basis: NFA DFA is true by construction of Costas Busch - LSU

99 Induction hypothesis:
Suppose that the following hold NFA DFA Costas Busch - LSU

100 Then this is true by construction of
Induction Step: Then this is true by construction of NFA DFA Costas Busch - LSU

101 Therefore if NFA then DFA Costas Busch - LSU

102 We have shown: With a similar proof we can show: Therefore:
END OF PROOF Costas Busch - LSU


Download ppt "Non-Deterministic Finite Automata"

Similar presentations


Ads by Google