Properties of Regular Languages: Costas Busch - LSU 1
Properties of Regular Languages: Costas Busch - LSU 1
Properties of Regular Languages: Costas Busch - LSU 1
Regular Languages
Complement: L1
Intersection: L1 L2
Costas Busch - LSU 2
We say Regular languages are closed under
Union: L1 L2
Concatenation: L1L2
*
Star: L1
Reversal: LR
1
Complement: L1
Intersection: L1 L2
Costas Busch - LSU 3
A useful transformation: use one accept state
NFA
a
b 2 accept states
a
b
Equivalent
a
NFA 1 accept state
a b
b
Costas Busch - LSU 4
In General
NFA
Equivalent NFA
Single
accepting
state
Costas Busch - LSU 5
Extreme case
L M1 L1 L M 2 L2
NFA M1 NFA M2
M1
n0
a
n
L1 {a b} b
M2
a
L2 ba b
M2
w L1 L2 w L1 or w L2
Costas Busch - LSU 9
Example
n
NFA for L1 L2 {a b} {ba}
n
L1 {a b}
a
b
L2 {ba}
b a
Costas Busch - LSU 10
Concatenation
NFA for L1L2
change to
regular state
M1 M2
w L1 L2 w w1w2 : w1 L1 and w2 L2
n n
NFA for L1L2 {a b}{ba} {a bba}
n
L1 {a b}
a L2 {ba}
b b a
w w1w2 wk : wi L
w L *
or w
Costas Busch - LSU 13
Example
*
NFA for L {a b}
1
n *
n
L1 {a b}
a
b
Costas Busch - LSU 14
Reverse
R
NFA for L
M M
L( M ) L L( M ) LR
M1
a
n
L1 {a b} b
M 1
a
L {ba }
R
1
n
b
M M
L( M ) L L( M ) L
L1 {a b}
n b a, b
M 1
a a, b
L1 {a, b} {a b}
* n
b a, b
NFA M NFA M
L( M ) {} L( M ) { } L( M )
L( M ) {a, b}
* * it is not the
complement
L( M ) {} L( M ) {a, b}* L( M )
L( M ) {a, b}
* * it is the
complement
L1 regular
we show L1 L2
L2 regular regular
L1 , L2 regular, regular
L1 , L2 regular, regular
L1 L2 regular
L1 L2 regular
L1 L2 regular
Costas Busch - LSU 22
Example
n
L1 {a b} regular
L1 L2 {ab}
L2 {ab, ba} regular regular
Machine M1 Machine M2
DFA for L1 DFA for L2
qi , p j
State in M1 State in M2
q1 a q2 p1 a p2
transition transition
DFA M
q1, p1 a q2 , p2
New transition
Costas Busch - LSU 26
DFA M1 DFA M2
q0 p0
initial state initial state
DFA M
q0 , p0
New initial state
Costas Busch - LSU 27
DFA M1 DFA M2
qi pj pk
DFA M
qi , p j qi , pk
n0 m0
L1 {a b} n m
L2 {ab }
M1 M2
a b
q0 b q1 p0 a p1
a, b b a
q2 p2
a, b a, b
Costas Busch - LSU 29
DFA M for intersection
q0 , p0 a q0 , p1 b q1, p1 a q2 , p2
b a b a
q1, p2 b q0 , p2 q2 , p1
a b
a, b
Costas Busch - LSU 30
Construction procedure for intersection
q0 , p0
initial state
q0 , p0 a q0 , p1
add transition and new state
M1 M2
for symbol a
q0 a q0 p0 a p1
q0 , p0 a q0 , p1
q0 , p0 a q0 , p1
b M1 M2
q0 b q1 p0 b p2
q1, p2
q0 , p0 a q0 , p1 b q1, p1 a q2 , p2
b a b a
q1, p2 b q0 , p2 q2 , p1
a b
a, b
q0 , p0 a q0 , p1 b q1, p1 a q2 , p2
b a b a
q1, p2 b q0 , p2 q2 , p1
a b
a, b
L ( M ) L ( M1 ) L ( M 2 )
Costas Busch - LSU 37