Closure Properties - RL PDF
Closure Properties - RL PDF
Closure Properties - RL PDF
• Union: L ∪ M
• Intersection: L ∩ M
• Complement: N
• Difference: L \ M
• Reversal: LR = {wR : w ∈ L}
• Closure: L∗.
• Concatenation: L.M
• Inverse homomorphism:
h−1(L) = {w ∈ Σ : h(w) ∈ L, h : Σ → ∆* is a homom. }
97
Theorem 4.4. For any regular L and M , L∪M
is regular.
A = (Q, Σ, δ, q0, F ).
Let B = (Q, Σ, δ, q0, Q \ F ). Now L(B) = L.
98
Example:
1 0
Start
0 1
{q0} {q0, q1} {q0, q2}
Then L is recognized by
1 0
Start
0 1
{q0} {q0, q1} {q0, q2}
100
Theorem 4.8. If L and M are regular, then
s L ∩ M.
so in
AM = (QM , Σ, δM , qM , FM )
101
If AL goes from state p to state s on reading a,
and AM goes from state q to state t on reading
a, then AL∩M will go from state (p, q) to state
(s, t) on reading a.
Input a
AL
AM
102
Formally
Question: Why?
103
Example: (c) = (a) × (b)
Start 0 0,1
p q
(a)
0
Start 1 0,1
r s
(b)
1
Start 1
pr ps
0 0
0,1
qr qs
1
0
(c)
Another example?
104
Theorem 4.10. If L and M are regular lan-
S L \ M.
guages, then so in
105
Theorem 4.11. If L is a regular language,
then so is LR .
106
Theorem 4.11. If L is a regular language,
then so is LR .
Basis: If E is , ∅, or a, then E R = E.
Induction:
1. E = F + G. Then E R = F R + GR
2. E = F.G. Then E R = GR .F R
3. E = F ∗. Then E R = (F R )∗
L(E R ) = (L(E))R
107
Homomorphisms
108
Theorem 4.14: h(L) is regular, whenever L
is.
E.g., h(0*1+(0+1)*0) = h(0)*h(1)+(h(0)+h(1))*h(0)
Proof:
Induction:
Case 2: L
G = E.F . Now L(h(E.F )) = L(h(E)).L(h(F ))
= h(L(E)).h(L(F )) = h(L(E).L(F )) = h(L(E.F))
109
Inverse Homomorphism
and define
h−1(L) = {w ∈ Σ∗ : h(w) ∈ L}
L h h(L)
(a)
h-1 (L) h L
(b)
110
Example: Let h : {a, b} → {0, 1}∗ be defined by
h(a) = 01, and h(b) = 10. If L = L((00 + 1)∗),
then h−1(L) = L((ba)∗).
/ L((ba)∗). There
Let h(w) ∈ L, and suppose w ∈
are four cases to consider.
111
Theorem 4.16: Let h : Σ∗ → Θ∗ be a ho-
mom., and L ⊆ Θ∗ regular. Then h−1(L) is
regular.
Input a
h
Input
Start h(a) to A
Accept/reject
A
112
Decision Properties
2. Is L = ∅?
3. Is w ∈ L?
113
From NFA’s to DFA’s
114
From DFA to NFA
From FA to regex
118
Example:
0 1
Start 0 1 0
A B C D
1 0 1
0 1
1 1 0
E K G H
1 0
δ̂(C, ) ∈ F, δ̂(G, ) ∈
/ F ⇒ C 6≡ G
119
What about A and E?
0 1
Start 0 1 0
A B C D
1 0 1
0 1
1 1 0
E K G H
1 0
δ̂(A, ) = A ∈
/ F, δ̂(E, ) = E ∈
/F
δ̂(A, 1) = F
K = δ̂(E, 1)
Conclusion: A ≡ E.
120
We can compute distinguishable pairs with the
following inductive table filling algorithm:
B x
C x x
D x x x
E x x x
K x x x x
G x x x x x x
H x x x x x x
A B C D E K G
F
121
Theorem 4.20: If p and q are not distin-
guished by the TF-algo, then p ≡ q.
1. ∃w : δ̂(p, w) ∈ F, δ̂(q, w) ∈
/ F , or vice versa.
122
Consider states r = δ(p, a1) and s = δ(q, a1).
Now {r, s} cannot be a bad pair since {r, s}
would be indentified by a string shorter than w.
Therefore, the TF-algo must have discovered
that r and s are distinguishable.
123
Testing Equivalence of Regular Languages
To test if L = M
124
Example:
0 1
Start 1
A B
0
0
Start 0
C D
1 0
1
B x
C x
D x
E x x x
A B C D
126
Theorem 4.23: If p ≡ q and q ≡ r, then p ≡ r.
127
Assume A has no inaccessible states.
128
Example: We can minimize
0 1
Start 0 1 0
A B C D
1 0 1
0 1
1 1 0
E K G H
1 0
to obtain
1
0
1
G D,K
1
Start
A,E 0 0
1
B,H C
1
0
129
NOTE: We cannot apply the TF-algo to NFA’s.
0,1
Start 0
A B
1 0
However, A 6≡ C.
130
Why the Minimized DFA Can’t Be Beaten
131
Claim: For each state p in B there is at least
one state q in C, s.t. p ≡ q.
132