NFA/DFA: Closure Properties, Relation to Regular Languages
Lecture 5
1
NFA/DFA: Closure Properties, Relation to Regular Languages - - PowerPoint PPT Presentation
NFA/DFA: Closure Properties, Relation to Regular Languages Lecture 5 1 Today NFAs recap : Determinizing an NFA Closure Properties of class of languages accepted by NFAs/DFAs Towards proving equivalence of regular languages and
1
CS 374
2
CS 374
Σ: alphabet Q: state space s: start state F: set of accepting states"
3
By default, NFA can have ε-moves
ε ε
r
3 4 5 6
c
1 2
a-z ε ε ε
w e.g., δ(1,o) = {2}, δ(1,x)=Ø, δ(1,ε)={2}. ε-closure Cε({1}) = { 1, 2, 3, 0 }
w
CS 374
4
a ∈ Σ
ε ε
r
3 4 5 6
c
1 2
a-z ε ε ε
a
w w q N p ⇔ p ∈ Cε({q}), q Nnew p ⇔ p=q,
ε ε
Prove!
CS 374
5
q C a δ
a { a, b, d } { a, b, c } { a, b, c, d } 1 { b, d } { b, d } b { b, d } { b, c } { b, c, d } 1 { d } { d } c { c } Ø Ø 1 { d } { d } d { d } Ø Ø 1 { d } { d }
c d b a
1,ε ε 1 1
CS 374
6
q a
a { a, b, c, d } 1 { b, d } b { b, c, d } 1 { d } c Ø 1 { d } d Ø 1 { d }
c d b a
1,ε ε 1 1 ,1 ,1 ,1
c d b a
1 1
Fnew = F, if Cε({s})∩F = Ø F ∪ {s}, otherwise.
CS 374
7
q a
a { a, b, c, d } 1 { b, d } b { b, c, d } 1 { d } c Ø 1 { d } d Ø 1 { d } ,1 ,1 ,1
c d b a
1 1 {a} {a,b,c,d} {b,d} {b,c,d} {d} Ø To avoid errors, first, remove ε-moves 1 1 1 1 1 1 Ø Ø Ø { d } { b,c,d } { d } { b,c,d } { d } { a,b,c,d } { b,d } { a,b,c,d } { b,d }
T a
a
Remember to specify final states
d bcd
1
bd abcd
1 0,1 1
Ø
1 1
CS 374
8
ε-moves already removed
CS 374
9
w
w
Prove!
CS 374
10
w
w
Prove!
CS 374
11
CS 374
12
CS 374
13
CS 374
14
CS 374
15
CS 374
16
CS 374
17
CS 374
18
CS 374
19
CS 374
20
CS 374
21
From the definition of regular languages (or from NFA closure properties) By considering DFAs for the languages and using the complement construction for DFAs By De Morgan’s Law (or by the cross-product construction for DFAs) Skipped from this course
CS 374
22
CS 374
23
w w x ε
CS 374
24
ε ε ε
CS 374
25
a h(a) a
h(a) a 1
1 a