Presentation is loading. Please wait.

Presentation is loading. Please wait.

Non Deterministic Automata

Similar presentations


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

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 AND An NFA accepts a string: when there is a computation of the NFA
that accepts the string AND 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 OR 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 OR 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

34

35

36 (read head does not move)

37

38 all input is consumed “accept” String is accepted

39 Rejection Example

40

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

46

47

48

49 “accept”

50 Another String

51

52

53

54

55

56

57 “accept”

58 Language accepted

59 Another NFA Example

60 Language accepted (redundant state)

61 Remarks: The symbol never appears on the input tape Simple 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

65

66

67

68 Extended Transition Function

69

70

71 Formally : there is a walk from to with label

72 The Language of an NFA

73

74

75

76

77 Formally The language accepted by NFA is: where and there is some
(final state)

78

79 NFAs accept the Regular Languages

80 Equivalence of Machines
Definition for Automata: Machine is equivalent to machine if

81 Example of equivalent machines
NFA DFA

82 same computation power
We will prove: Languages accepted by NFAs Regular Languages Languages accepted by DFAs NFAs and DFAs have the same computation power

83 Step 1 Languages accepted by NFAs Regular Languages Proof: Every DFA is trivially an NFA Any language accepted by a DFA is also accepted by an NFA

84 Step 2 Languages accepted by NFAs Regular Languages Proof: Any NFA can be converted to an equivalent DFA Any language accepted by an NFA is also accepted by a DFA

85 Convert NFA to DFA NFA DFA

86 Convert NFA to DFA NFA DFA

87 Convert NFA to DFA NFA DFA

88 Convert NFA to DFA NFA DFA

89 Convert NFA to DFA NFA DFA

90 Convert NFA to DFA NFA DFA

91 Convert NFA to DFA NFA DFA

92 NFA to DFA: Remarks We are given an NFA We want to convert it
to an equivalent DFA With

93 If the NFA has states the DFA has states in the powerset

94 Procedure NFA to DFA 1. Initial state of NFA: Initial state of DFA:

95 Example NFA DFA

96 Procedure NFA to DFA 2. For every DFA’s state Compute in the NFA
Add transition to DFA

97 Exampe NFA DFA

98 Procedure NFA to DFA Repeat Step 2 for all letters in alphabet, until
no more transitions can be added.

99 Example NFA DFA

100 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

101 Example NFA DFA

102 Theorem Take NFA Apply procedure to obtain DFA
Then and are equivalent :

103 Proof AND

104 First we show: Take arbitrary: We will prove:

105

106 We will show that if

107 More generally, we will show that if in :
(arbitrary string)

108 Proof by induction on Induction Basis:

109 Induction hypothesis:

110 Induction Step:

111 Induction Step:

112 Therefore if

113 We have shown: We also need to show: (proof is similar)


Download ppt "Non Deterministic Automata"

Similar presentations


Ads by Google