Presentation is loading. Please wait.

Presentation is loading. Please wait.

Costas Busch - LSU1 Non-Deterministic Finite Automata.

Similar presentations


Presentation on theme: "Costas Busch - LSU1 Non-Deterministic Finite Automata."— Presentation transcript:

1 Costas Busch - LSU1 Non-Deterministic Finite Automata

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

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

4 Costas Busch - LSU4 First Choice

5 Costas Busch - LSU5 First Choice

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

7 Costas Busch - LSU7 Second Choice

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

9 Costas Busch - LSU9 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

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

11 Costas Busch - LSU11 Rejection example

12 Costas Busch - LSU12 First Choice “reject”

13 Costas Busch - LSU13 Second Choice

14 Costas Busch - LSU14 Second Choice “reject”

15 Costas Busch - LSU15 Another Rejection example

16 Costas Busch - LSU16 First Choice

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

18 Costas Busch - LSU18 Second Choice

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

20 Costas Busch - LSU20 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 accepting state The input cannot be consumed OR For each computation:

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

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

23 Costas Busch - LSU23 Language accepted:

24 Costas Busch - LSU24 Lambda Transitions

25 Costas Busch - LSU25

26 Costas Busch - LSU26

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

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

29 Costas Busch - LSU29 Rejection Example

30 Costas Busch - LSU30

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

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

33 Costas Busch - LSU33 Language accepted:

34 Costas Busch - LSU34 Another NFA Example

35 Costas Busch - LSU35

36 Costas Busch - LSU36

37 Costas Busch - LSU37 “accept”

38 Costas Busch - LSU38 Another String

39 Costas Busch - LSU39

40 Costas Busch - LSU40

41 Costas Busch - LSU41

42 Costas Busch - LSU42

43 Costas Busch - LSU43

44 Costas Busch - LSU44 “accept”

45 Costas Busch - LSU45 Language accepted

46 Costas Busch - LSU46 Another NFA Example

47 Costas Busch - LSU47 Language accepted (redundant state)

48 Costas Busch - LSU48 Remarks: The symbol never appears on the input tape Simple automata:

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

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

51 Costas Busch - LSU51 Transition Function resulting states with following one transition with symbol

52 Costas Busch - LSU52 States reachable from scanning

53 Costas Busch - LSU53 States reachable from scanning

54 Costas Busch - LSU54 States reachable from scanning nothing

55 Costas Busch - LSU55 States reachable from scanning

56 Costas Busch - LSU56 Extended Transition Function Same with but applied on strings

57 Costas Busch - LSU57 States reachable from scanning

58 Costas Busch - LSU58 States reachable from scanning

59 Costas Busch - LSU59 Special case: for any state

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

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

62 Costas Busch - LSU62

63 Costas Busch - LSU63

64 Costas Busch - LSU64

65 Costas Busch - LSU65

66 Costas Busch - LSU66

67 Costas Busch - LSU67

68 Costas Busch - LSU68 NFAs accept the Regular Languages

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

70 Costas Busch - LSU70 NFA DFA Example of equivalent machines

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

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

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

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

75 Costas Busch - LSU75 Conversion of NFA to DFA NFA DFA

76 Costas Busch - LSU76 NFA DFA

77 Costas Busch - LSU77 NFA DFA empty set trap state

78 Costas Busch - LSU78 NFA DFA union

79 Costas Busch - LSU79 NFA DFA union

80 Costas Busch - LSU80 NFA DFA trap state

81 Costas Busch - LSU81 NFA DFA END OF CONSTRUCTION

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

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

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

85 Costas Busch - LSU85 NFA DFA Example

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

87 Costas Busch - LSU87 NFA DFA Example

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

89 Costas Busch - LSU89 NFA DFA Example

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

91 Costas Busch - LSU91 NFA DFA Example

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

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

94 Costas Busch - LSU94 symbols Consider NFA

95 Costas Busch - LSU95 denotes a possible sub-path like symbol

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

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

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

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

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

101 Costas Busch - LSU101 Therefore if NFA DFA then

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


Download ppt "Costas Busch - LSU1 Non-Deterministic Finite Automata."

Similar presentations


Ads by Google