Top Banner
1 Theory of Automata & Formal Languages
188

Finite automata

Dec 14, 2014

Download

Technology

lavishka_anuj

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Finite automata

1

Theory of Automata &

Formal Languages

Page 2: Finite automata

2

BOOKS

Theory of computer Science: K.L.P.Mishra &

N.Chandrasekharan

Intro to Automata theory, Formal languages and computation: Ullman,Hopcroft

Motwani

Elements of theory of computation Lewis & papadimitrou

Page 3: Finite automata

3

Syllabus

Introduction

Deterministic and non deterministic Finite Automata, Regular Expression,Two way finite automata,Finite automata with output,properties of regular sets,pumping lemma, closure properties,Myhill nerode theorem

Page 4: Finite automata

4

Context free Grammar: Derivation trees, Simplification forms

Pushdown automata: Def, Relationship between PDA and context free language,Properties, decision algorithms

Turing Machines: Turing machine model,Modification of turing machines,Church’s thesis,Undecidability,Recursive and recursively enumerable languages Post correspondence problems recursive functions

Page 5: Finite automata

5

Chomsky Hierarchy: Regular grammars, unrestricted grammar, context sensitive language, relationship among languages

Page 6: Finite automata

6

Page 7: Finite automata

7

Page 8: Finite automata

8

Finite AutomatonInput

String

Output

String

FiniteAutomaton

Page 9: Finite automata

9

Finite Accepter

Input

“Accept” or“Reject”

String

FiniteAutomaton

Output

Page 10: Finite automata

10

Transition Graph

initialstate

final state“accept”state

transition

Abba -Finite Accepter

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

Page 11: Finite automata

11

Initial Configuration

1q 2q 3q 4qa b b a

5q

a a bb

ba,

Input Stringa b b a

ba,

0q

Page 12: Finite automata

12

Reading the Input

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

a b b a

ba,

Page 13: Finite automata

13

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

a b b a

ba,

Page 14: Finite automata

14

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

a b b a

ba,

Page 15: Finite automata

15

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

a b b a

ba,

Page 16: Finite automata

16

0q 1q 2q 3q 4qa b b a

Output: “accept”

5q

a a bb

ba,

a b b a

ba,

Input finished

Page 17: Finite automata

17

Rejection

1q 2q 3q 4qa b b a

5q

a a bb

ba,

a b a

ba,

0q

Page 18: Finite automata

18

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

a b a

ba,

Page 19: Finite automata

19

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

a b a

ba,

Page 20: Finite automata

20

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

a b a

ba,

Page 21: Finite automata

21

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

Output:“reject”

a b a

ba,

Input finished

Page 22: Finite automata

22

Another Example

a

b ba,

ba,

0q 1q 2q

a ba

Page 23: Finite automata

23

a

b ba,

ba,

0q 1q 2q

a ba

Page 24: Finite automata

24

a

b ba,

ba,

0q 1q 2q

a ba

Page 25: Finite automata

25

a

b ba,

ba,

0q 1q 2q

a ba

Page 26: Finite automata

26

a

b ba,

ba,

0q 1q 2q

a ba

Output: “accept”

Input finished

Page 27: Finite automata

27

Rejection

a

b ba,

ba,

0q 1q 2q

ab b

Page 28: Finite automata

28

a

b ba,

ba,

0q 1q 2q

ab b

Page 29: Finite automata

29

a

b ba,

ba,

0q 1q 2q

ab b

Page 30: Finite automata

30

a

b ba,

ba,

0q 1q 2q

ab b

Page 31: Finite automata

31

a

b ba,

ba,

0q 1q 2q

ab b

Output: “reject”

Input finished

Page 32: Finite automata

32

• Deterministic Finite Accepter (DFA)

FqQM ,,,, 0

Q

0q

F

: Finite set of states

: input alphabet

: transition function

: initial state is a member of Q

: set of final states

: Q X Q

Page 33: Finite automata

33

Input Alphabet

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

ba,

Page 34: Finite automata

34

Set of States

Q

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

543210 ,,,,, qqqqqqQ

ba,

Page 35: Finite automata

35

Initial State

0q

1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

0q

Page 36: Finite automata

36

Set of Final States

F

0q 1q 2q 3qa b b a

5q

a a bb

ba,

4qF

ba,

4q

Page 37: Finite automata

37

Transition Function

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

QQ :

ba,

Page 38: Finite automata

38

10 , qaq

2q 3q 4qa b b a

5q

a a bb

ba,

ba,

0q 1q

Page 39: Finite automata

39

50 , qbq

1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

0q

Page 40: Finite automata

40

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

32 , qbq

Page 41: Finite automata

41

Transition Function

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

a b

0q

1q

2q

3q

4q

5q

1q 5q

5q 2q

2q 3q

4q 5q

ba,5q5q5q5q

Page 42: Finite automata

42

Extended Transition Function

*

QQ *:*

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

Page 43: Finite automata

43

20 ,* qabq

3q 4qa b b a

5q

a a bb

ba,

ba,

0q 1q 2q

Page 44: Finite automata

44

40 ,* qabbaq

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

Page 45: Finite automata

45

50 ,* qabbbaaq

1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

0q

Page 46: Finite automata

46

50 ,* qabbbaaq

1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

0q

Observation: There is a walk from to with label

0qabbbaa

5q

Page 47: Finite automata

47

Recursive Definition

)),,(*(,*

,*

awqwaq

qq

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

Page 48: Finite automata

48

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

2

1

0

0

0

0

,

,,

,,,*

),,(*

,*

q

bq

baq

baq

baq

abq

Page 49: Finite automata

49

Languages Accepted by DFAs• Take DFA

• Definition:

– The language contains – all input strings accepted by

– = { strings that drive to a final state}

M

MLM

M ML

Page 50: Finite automata

50

Example

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

abbaML M

accept

Page 51: Finite automata

51

Another Example

0q 1q 2q 3q 4qa b b a

5q

a a bb

ba,

ba,

abbaabML ,, M

acceptacceptaccept

Page 52: Finite automata

52

Formally

• For a DFA Language accepted by :

FqQM ,,,, 0

M

FwqwML ,*:* 0

alphabet transitionfunction

initialstate

finalstates

Page 53: Finite automata

53

Observation

• Language accepted by :

• Language rejected by :

FwqwML ,*:* 0M

FwqwML ,*:* 0M

Page 54: Finite automata

54

More Examples•

a

b ba,

ba,

0q 1q 2q

}0:{ nbaML n

accept trap state or dead state

Page 55: Finite automata

55

ML = { all strings with prefix }ab

a b

ba,

0q 1q 2q

accept

ba,3q

ab

Page 56: Finite automata

56

ML = { all strings without substring }001

0 00 001

1

0

1

10

0 1,0

Page 57: Finite automata

57

Regular Languages

• A language is regular if there is

• a DFA such that

• All regular languages form a language family–

LM MLL

Page 58: Finite automata

58

Example

• The language

• is regular:

*,: bawawaL

a

b

ba,

a

b

ba

0q 2q 3q

4q

Page 59: Finite automata

59

Non Deterministic Automata

Page 60: Finite automata

60

Non Deterministic Finite Accepter

FqQM ,,,, 0

: 2QQ

Page 61: Finite automata

61

1q 2q

3q

a

a

a

0q

}{aAlphabet =

Nondeterministic Finite Accepter (NFA)

Page 62: Finite automata

62

1q 2q

3q

a

a

a

0q

Two choices

}{aAlphabet =

Nondeterministic Finite Accepter (NFA)

Page 63: Finite automata

63

No transition

1q 2q

3q

a

a

a

0q

Two choices No transition

}{aAlphabet =

Nondeterministic Finite Accepter (NFA)

Page 64: Finite automata

64

a a

0q

1q 2q

3q

a

a

First Choice

a

Page 65: Finite automata

65

a a

0q

1q 2q

3q

a

a

a

First Choice

Page 66: Finite automata

66

a a

0q

1q 2q

3q

a

a

First Choice

a

Page 67: Finite automata

67

a a

0q

1q 2q

3q

a

a

a “accept”

First Choice

All input is consumed

Page 68: Finite automata

68

a a

0q

1q 2q

3q

a

a

Second Choice

a

Page 69: Finite automata

69

a a

0q

1q 2qa

a

Second Choice

a

3q

Page 70: Finite automata

70

a a

0q

1q 2qa

a

a

3q

Second Choice

No transition:the automaton hangs

Page 71: Finite automata

71

a a

0q

1q 2qa

a

a

3q

Second Choice

“reject”

Input cannot be consumed

Page 72: Finite automata

72

An NFA accepts a string:

when there is a computation of the NFAthat accepts the string

•All the input is consumed and the automaton is in a final state

Page 73: Finite automata

73

An NFA rejects a string:

when there is no computation of the NFAthat accepts the string

• All the input is consumed and the automaton is in a non final state

• The input cannot be consumed

Page 74: Finite automata

74

Example

aa is accepted by the NFA:

0q

1q 2q

3q

a

a

a

“accept”

0q

1q 2qa

a

a

3q “reject”

because this computationaccepts aa

Page 75: Finite automata

75

a

0q

1q 2q

3q

a

a

Rejection example

a

Page 76: Finite automata

76

a

0q

1q 2q

3q

a

a

a

First Choice

Page 77: Finite automata

77

a

0q

1q 2q

3q

a

a

a

First Choice

“reject”

Page 78: Finite automata

78

Second Choice

a

0q

1q 2q

3q

a

a

a

Page 79: Finite automata

79

Second Choice

a

0q

1q 2qa

a

a

3q

Page 80: Finite automata

80

Second Choice

a

0q

1q 2qa

a

a

3q “reject”

Page 81: Finite automata

81

Examplea is rejected by the NFA:

0q

1q 2qa

a

a

3q “reject”

0q

1q 2qa

a

a

3q

“reject”

All possible computations lead to rejection

Page 82: Finite automata

82

Rejection example

a a

0q

1q 2q

3q

a

a

a

a

Page 83: Finite automata

83

a a

0q

1q 2q

3q

a

a

a

First Choice

a

Page 84: Finite automata

84

a a

0q

1q 2q

3q

a

a

First Choice

a

a

No transition:the automaton hangs

Page 85: Finite automata

85

a a

0q

1q 2q

3q

a

a

a “reject”

First Choice

a

Input cannot be consumed

Page 86: Finite automata

86

a a

0q

1q 2q

3q

a

a

Second Choice

a

a

Page 87: Finite automata

87

a a

0q

1q 2qa

a

Second Choice

a

3q

a

Page 88: Finite automata

88

a a

0q

1q 2qa

a

a

3q

Second Choice

No transition:the automaton hangs

a

Page 89: Finite automata

89

a a

0q

1q 2qa

a

a

3q

Second Choice

“reject”

a

Input cannot be consumed

Page 90: Finite automata

90

aaais rejected by the NFA:

0q

1q 2q

3q

a

a

a

“reject”

0q

1q 2qa

a

a

3q “reject”

All possible computations lead to rejection

Page 91: Finite automata

91

1q 2q

3q

a

a

a

0q

Language accepted: }{aaL

Page 92: Finite automata

92

Lambda →Transitions

1q 3qa0q

2q a

Page 93: Finite automata

93

a a

1q 3qa0q

2q a

Page 94: Finite automata

94

a a

1q 3qa0q

2q a

Page 95: Finite automata

95

a a

1q 3qa0q

2q a

(read head doesn’t move)

Page 96: Finite automata

96

a a

1q 3qa0q

2q a

Page 97: Finite automata

97

a a

1q 3qa0q

2q a

“accept”

String is acceptedaa

all input is consumed

Page 98: Finite automata

98

a a

1q 3qa0q

2q a

Rejection Example

a

Page 99: Finite automata

99

a a

1q 3qa0q

2q a

a

Page 100: Finite automata

100

a a

1q 3qa0q

2q a

(read head doesn’t move)

a

Page 101: Finite automata

101

a a

1q 3qa0q

2q a

a

No transition:the automaton hangs

Page 102: Finite automata

102

a a

1q 3qa0q

2q a

“reject”

String is rejectedaaa

a

Input cannot be consumed

Page 103: Finite automata

103

Language accepted: }{aaL

1q 3qa0q

2q a

Page 104: Finite automata

104

Another NFA Example

0q 1q 2qa b

3q

Page 105: Finite automata

105

a b

0q 1q 2qa b

3q

Page 106: Finite automata

106

0q 2qa b

3q

a b

1q

Page 107: Finite automata

107

a b

0q 1qa b

3q2q

Page 108: Finite automata

108

a b

0q 1qa b

3q2q

“accept”

Page 109: Finite automata

109

0qa b

a b

Another String

a b

1q 2q 3q

Page 110: Finite automata

110

0qa b

a b a b

1q 2q 3q

Page 111: Finite automata

111

0qa b

a b a b

1q 2q 3q

Page 112: Finite automata

112

0qa b

a b a b

1q 2q 3q

Page 113: Finite automata

113

0qa b

a b a b

1q 2q 3q

Page 114: Finite automata

114

0qa b

a b a b

1q 2q 3q

Page 115: Finite automata

115

0qa b

a b a b

1q 2q 3q

Page 116: Finite automata

116

a b a b

0qa b

1q 2q 3q

“accept”

Page 117: Finite automata

117

ab

ababababababL ...,,,

Language accepted

0q 1q 2qa b

3q

Page 118: Finite automata

118

Another NFA Example

0q 1q 2q0

11,0

Page 119: Finite automata

119

{ }{ } *10=

...,101010,1010,10,λ=)(ML

0q 1q 2q0

11,0

Language accepted

Page 120: Finite automata

120

Remarks:

•The symbol never appears on the input tape

0q2M

0q1M

{}=)M(L 1 }λ{=)M(L 2

•Extreme automata:

Page 121: Finite automata

121

0q

2q

1qa

0q 1qa

}{=)( 1 aML

2M1M

}{=)( 2 aML

NFA DFA

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

ba,b

a,b

Page 122: Finite automata

122

Formal Definition of NFAs

FqQM ,,,, 0

:Q

::0q

:F

Set of states, i.e. 210 ,, qqq

: Input alphabet, i.e. ba,

Transition function

Initial state

Final states

Page 123: Finite automata

123

10 1, qq

0

11,0

Transition Function

0q 1q 2q

Page 124: Finite automata

124

0q

0

11,0

},{)0,( 201 qqq

1q 2q

Page 125: Finite automata

125

0q

0

11,0

1q 2q

},{),( 200 qqq

Page 126: Finite automata

126

0q

0

11,0

1q 2q

)1,( 2q

Page 127: Finite automata

127

Extended Transition Function

*

0q

5q4q

3q2q1qa

aa

b

10 ,* qaq

Page 128: Finite automata

128

540 ,,* qqaaq

0q

5q4q

3q2q1qa

aa

b

Page 129: Finite automata

129

0320 ,,,* qqqabq

0q

5q4q

3q2q1qa

aa

b

Page 130: Finite automata

130

Formally

wqq ij ,*

It holdsif and only if

there is a walk from towith label

iq jqw

Page 131: Finite automata

131

The Language of an NFA

0q

5q4q

3q2q1qa

aa

b

540 ,,* qqaaq

M

)(MLaa

50 ,qqF

Page 132: Finite automata

132

0q

5q4q

3q2q1qa

aa

b

0320 ,,,* qqqabq MLab

50 ,qqF

Page 133: Finite automata

133

0q

5q4q

3q2q1qa

aa

b

50 ,qqF

540 ,,* qqabaaq )(MLaaba

Page 134: Finite automata

134

0q

5q4q

3q2q1qa

aa

b

50 ,qqF

10 ,* qabaq MLaba

Page 135: Finite automata

135

0q

5q4q

3q2q1qa

aa

b

aaababaaML *

Page 136: Finite automata

136

Formally

• The language accepted by NFA is:

• where

• and there is some

M

,...,, 321 wwwML

,...},{),(* 0 jim qqwq

Fqk (final state)

Page 137: Finite automata

137

0q kq

w

w

w

),(* 0 wq MLw

Fqk

iq

jq

Page 138: Finite automata

138

Equivalence of NFAs and DFAs

Page 139: Finite automata

139

Equivalence of Machines

• For DFAs or NFAs:

• Machine is equivalent to machine

• if

1M 2M

21 MLML

Page 140: Finite automata

140

• 0q 1q 2q

0

11,0

0q 1q 2q

0

11

0

1,0

NFA

DFA

*}10{1 ML

*}10{2 ML

1M

2M

Page 141: Finite automata

141

• Since

• machines and are equivalent

*1021 MLML

1M 2M

0q 1q 2q

0

11,0

0q 1q 2q

0

11

0

1,0

DFA

NFA 1M

2M

Page 142: Finite automata

142

Equivalence of NFAs and DFAs

Question: NFAs = DFAs ?

Same power?Accept the same languages?

Page 143: Finite automata

143

Equivalence of NFAs and DFAs

Question: NFAs = DFAs ?

Same power?Accept the same languages?

YES!

Page 144: Finite automata

144

We will prove:

Languages acceptedby NFAs

Languages acceptedby DFAs

NFAs and DFAs have the same computation power

Page 145: Finite automata

145

Languages acceptedby NFAs

Languages acceptedby DFAs

Step 1

Proof: Every DFA is trivially an NFA

A language accepted by a DFAis also accepted by an NFA

Page 146: Finite automata

146

Languages acceptedby NFAs

Languages acceptedby DFAs

Step 2

Proof: Any NFA can be converted to anequivalent DFA

A language accepted by an NFAis also accepted by a DFA

Page 147: Finite automata

147

NFA to DFA

a

b

a

0q 1q 2q

NFA

DFA

0q

M

M

Page 148: Finite automata

148

a

b

a

0q 1q 2q

NFA

DFA

0q 21,qqa

M

M

Page 149: Finite automata

149

a

b

a

0q 1q 2q

NFA

DFA

0q 21,qqa

b

M

M

Page 150: Finite automata

150

a

b

a

0q 1q 2q

NFA

DFA

0q 21,qqa

b

a

M

M

Page 151: Finite automata

151

a

b

a

0q 1q 2q

NFA

DFA

0q 21,qqa

b

ab

M

M

Page 152: Finite automata

152

a

b

a

0q 1q 2q

NFA

DFA

0q 21,qqa

b

ab

ba,

M

M

Page 153: Finite automata

153

a

b

a

0q 1q 2q

NFA

DFA

0q 21,qqa

b

ab

ba,

M

M

)(MLML

Page 154: Finite automata

154

NFA to DFA: Remarks

• We are given an NFA

• We want to convert it to an equivalent DFA

M

M

)(MLML

Page 155: Finite automata

155

• If the NFA has states

• the DFA has states in the power set

,...,, 210 qqq

,....,,,,,,, 7432110 qqqqqqq

Page 156: Finite automata

156

Procedure NFA to DFA

• 1. Initial state of NFA:

• Initial state of DFA:

0q

0q

Page 157: Finite automata

157

a

b

a

0q 1q 2q

NFA

DFA

0q

M

M

Page 158: Finite automata

158

Procedure NFA to DFA

• 2. For every DFA’s state

• Compute in the NFA

• Add transition to DFA

},...,,{ mji qqq

...

,,*

,,*

aq

aq

j

i

},...,,{ mji qqq

},...,,{},,...,,{ mjimji qqqaqqq

Page 159: Finite automata

159

a

b

a

0q 1q 2q

NFA

0q 21,qqa

DFA

},{),(* 210 qqaq

210 ,, qqaq

M

M

},{),(* 210 qqaq

Page 160: Finite automata

160

Procedure NFA to DFA

• Repeat Step 2 for all letters in alphabet,

• until

• no more transitions can be added.

Page 161: Finite automata

161

a

b

a

0q 1q 2q

NFA

DFA

0q 21,qqa

b

ab

ba,

M

M

Page 162: Finite automata

162

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•

},...,,{ mji qqq

jq

},...,,{ mji qqq

Page 163: Finite automata

163

a

b

a

0q 1q 2q

NFA

DFA

0q 21,qqa

b

ab

ba,

Fq 1

Fqq 21,

M

M

Page 164: Finite automata

164

Theorem

• Take NFA M

Apply procedure to obtain DFA M

Then and are equivalent :M M

MLML

Page 165: Finite automata

165

FinallyWe have proven

Languages acceptedby NFAs

Languages acceptedby DFAs

Page 166: Finite automata

166

Languages acceptedby NFAs

Languages acceptedby DFAs

We have proven

Regular Languages

Page 167: Finite automata

167

Languages acceptedby NFAs

Languages acceptedby DFAs

We have proven

Regular LanguagesRegular Languages

Page 168: Finite automata

168

Languages acceptedby NFAs

Languages acceptedby DFAs

We have proven

Regular LanguagesRegular Languages

Thus, NFAs accept the regular languages

Page 169: Finite automata

169

Single Final State for NFAs and DFAs

Page 170: Finite automata

170

Observation

• Any Finite Automaton (NFA or DFA)

• can be converted to an equivalent NFA

• with a single final state

Page 171: Finite automata

171

a

b

b

aNFA

Equivalent NFA

a

b

b

a

Example

Page 172: Finite automata

172

NFAIn General

Equivalent NFA

Singlefinal state

Page 173: Finite automata

173

Extreme Case

NFA without final state

Add a final stateWithout transitions

Page 174: Finite automata

174

Some Properties of Regular Languages

Page 175: Finite automata

175

1L2L

21LLConcatenation:

*1LStar:

21 LL Union:

Are regularLanguages

For regular languages and we will prove that:

properties

Page 176: Finite automata

176

We Say:Regular languages are closed under

21LLConcatenation:

*1LStar:

21 LL Union:

Page 177: Finite automata

177

Properties

1L 2L

21LLConcatenation:

*1LStar:

21 LL Union:

Are regularLanguages

For regular languages and we will prove that:

Page 178: Finite automata

178

1LRegular language

11 LML

1M

Single final state

NFA 2M

2L

Single final state

22 LML

Regular language

NFA

Page 179: Finite automata

179

Example

}{1 baL na

b 1M

baL 2ab

2M

Page 180: Finite automata

180

Union

• NFA for 1M

2M

21 LL

Page 181: Finite automata

181

• a

b

ab

}{1 baL n

}{2 baL

}{}{21 babaLL n NFA for

Page 182: Finite automata

182

Concatenation

• NFA for

21LL

1M 2M

Page 183: Finite automata

183

Example

• NFA for

a

b ab

}{1 baL n}{2 baL

}{}}{{21 bbaababaLL nn

Page 184: Finite automata

184

Star Operation• NFA for *1L

1M

*1L

Page 185: Finite automata

185

Example

• NFA for

*}{*1 baL n

a

b

}{1 baL n

N>= 0

Page 186: Finite automata

186

Procedure: NFA to DFA

1 Create a graph with vertex {q0}.Identify this vertex as initial vertex of DFA.

2 Repeat the following steps until no more edges are missing.Take any vertex {qi,qj,….qk} of G that has no outgoing edge for some symbol a of the alphabet.Compute (qi, a), (qj, a)…. (qk, a)Then form the union of all these yielding the set {ql, qm, …qn}.Create a vertex for G labeled {ql, qm,…qn} if it does not already exist.Add to G an edge from {qi, qj,…qk} to {ql,qm…qn} and label it with a.

3 Every state of G whose label contains any qf of F is identified as a final vertex of DFA.

4 If NFA accepts then vertex {q0} in G is also made a final vertex.

**

*

*

Page 187: Finite automata

187

q0 q2q10,1 0,1

10

Page 188: Finite automata

188

q0

{q0,q1}

q1

q0,q1,q2q1,q2

q2

0

01

1

0

0,1

0,1

1

1

0,1

Equivalent DFA

Start

0