Professional Documents
Culture Documents
• Then
89
Constructing r1fi
90
Definitions and Notation
k
Define Rij to be the set (not regular expression) of strings leading from
qi to qj such that any intermediate state is ≤ k
91
k
Constructing set Rij : Base Case
8<
{a | δ(qi , a) = qj } if i 6= j
:
0
Rij =
{a | δ(qi , a) = qj } ∪ {ǫ} if i = j
92
k
Constructing set Rij : Inductive Step
k−1
k−1
Assume we have Rij
93
Constructing the Regular Expression
k k k
Task: Construct expression rij such that L(rij ) = Rij .
Base Case
8>
<∅ 0
if Rij =∅
>: a + a + · · · a
0 0
rij = 1 2 m if Rij = {a1 , a2 , . . . am }
0
ǫ + a + ···a
1 m if Rij = {ǫ, a1 , . . . am }
94
Constructing the Regular Expression: Inductive step
k−1 k−1
Assume inductively, rij is the regular expression for Rij
95
Completing the Proof
96
Example
1 1
0
q1 q2
0
0 0
r11 = 1+ǫ r22 = 1+ǫ
0 0
r12 = 0 r21 = 0
1 0 0 0 ∗ 0 1 0 0 0 ∗ 0
r12 = r12 + r11 (r11 ) r12 r22 = r22 + r21 (r11 ) r12
= 0 + (1 + ǫ)+ 0 = (1 + ǫ) + 0(1 + ǫ)∗ 0
2 1 1 1 ∗ 1
r12 = r12 + r12 (r22 ) r22
+ + ∗ +
= (0 + (1 + ǫ) 0) + (0 + (1 + ǫ) 0)((1 + ǫ) + 0(1 + ǫ) 0)
+ ∗ ∗
= (0 + (1 + ǫ) 0)(1 + ǫ + 0(1 + ǫ) 0)
= (1 + ǫ)∗ 0(1 + ǫ + 01∗ 0)∗
∗ ∗ ∗
= 1 0(1 + 01 0)
2
L(M ) = L(r12 )
97
Analysis of the Translation
98
Thus far . . .
NFA DFA
99
Regular Expression Identities
L+M =M +L
(L + M ) + N = L + (M + N )
(LM )N = L(M N )
Note: LM 6= M L
Distributivity
L(M + N ) = LM + LN
(M + N )L = M L + N L
100
More Identities
Idempotent Law
L+L=L
Closure Laws
(L∗ )∗ = L∗
(∅)∗ = ǫ
ǫ∗ = ǫ
L+ = LL∗ = L∗ L
L∗ = L+ + ǫ
101
Testing Regular Expression Identities
102
However, caution!!
• Concretizing we get {a} ∩ {b} ∩ {c} and {a} ∩ {b}, which are clearly
equal!!
103