lecture 7 from nfa to dfa n.
Download
Skip this Video
Download Presentation
Lecture 7 From NFA to DFA

Loading in 2 Seconds...

play fullscreen
1 / 18

Lecture 7 From NFA to DFA - PowerPoint PPT Presentation


  • 266 Views
  • Uploaded on

Lecture 7 From NFA to DFA. DFA. For every string x , there is a unique path from initial state and associated with x . x is accepted if and only if this path ends at a final state. . x. NFA.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Lecture 7 From NFA to DFA' - andrew


Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide2
DFA
  • For every string x, there is a unique path from initial state and associated with x.

x is accepted if and only if this path ends at a final state.

x

slide3
NFA
  • For any string x, there may exist none or more than one path from initial state and associated with x.
nfa dfa
NFA  DFA
  • Consider an NFA M=(Q, Σ, δ, s, F).
  • For x in Σ*, define

[x] = {q in Q | there exists a path s q}

  • Define DFA M’=(Q’, Σ, δ’, s’, F’}:

Q’ = { [x] | x in Σ* },

δ ([x], a) = [xa] for x in Σ* and a in Σ,

s’ = [ε],

F’ = { [x] | x in L(M) }

x

construction of m
Construction of M’

Special Case: M has no ε-move.

  • [ε] = {s}
  • Suppose [x] is known. How to get [xa] for

a in Σ?

from x to xa
From [x] to [xa]

a

  • [xa] = { p | there exists a path q p for

some q in [x] }

= { p | there exists q in [x],

q p }

= U

path

a

edge

δ(q,a)

q in [x]

construction of m1
Construction of M’
  • F’ = {[x] | x in L(M)}

= {[x] | [x] ∩ F ≠ Ǿ }

example 1
Example 1
  • Construct DFA to accept 00(0+1)*

0

0, 1

0

0

0

0

q

s

p

s

q

p

1

1

Ǿ

1

0,1

example 2
Example 2
  • Design DFA to accept (0+1)*11

0

0

1

1

0

s

1

1

s

1

q

s

p

s

p

p

q

0

1

example 3
Example 3
  • Design DFA to accept 00(0+1)*11

0

0

0

1

1

t

s

p

q

r

0,1

Ǿ

1

1

1

0

1

q

1

q

1

0

0

s

r

q

p

t

r

0

0

example 4
Example 4
  • Construct DFA M for L(M)=ε.

Is this a DFA?

s

0,1

0

s

Ǿ

1

example 5
Example 5
  • Construct DFA M for L(M)=Ǿ.

Is it a DFA?

s

0

s

0,1

Ǿ

0,1

1

construction of m2
Construction of M’
  • For q in Q, define

ε-closure(q) = {p | there exists a path q p}

  • [ε] = {q | there is a path s q}

= ε-closure(s)

  • Suppose [x] is known. How to get [xa] for

a in Σ?

ε

path

ε

path

from x to xa1
From [x] to [xa]

a

  • [xa] = { p | there exists a path q p for

some q in [x] }

= { p | there exists q in [x],

q r p }

= { p | for some q in [x] and r in δ(q,a),

p in ε-closure(r) }

= U U ε-closure(r)

path

a

ε

edge

path

r in δ(q,a)

q in [x]

construction of m3
Construction of M’
  • F’ = {[x] | x in L(M)}

= {[x] | [x] ∩ F ≠ Ǿ }

example 6
Example 6
  • Construct DFA M for L(M)=(0+1)*.

0,1

ε

ε

s

p

q

0,1

0,1

s

0

p

p

q

q

1

example 7
Example 7
  • Convert the following NFA to DFA.

0

q

0

0

s

ε

q

r

0

1

ε

s

0

r

s

ε

p

p

r

p

1

1

1

0

0

q, r, p

1

slide18

0

0,1

0

0

0

0

1

1

1

1

e

s

a

b

c

d

1

0

0

0

0

0

s,a

s,a,b

s,a,b,c

s,a,b,c,d

s,a,b,c,d,e

s

1

5

s,b

2 =32

How many states?

1

s,c

4

How many final states?

2 = 16

1

s,d

1

No, it is minimum!

Can we simplify it?

s,e

ad