You are on page 1of 16

Closure Properties of

Regular Languages
Union, Intersection,
Difference, Concatenation,
Kleene Closure, Reversal,
Homomorphism, Inverse
Homomorphism

1

2 .Homomorphisms  A homomorphism on an alphabet is a function that gives a string for each symbol in that alphabet.  Example: h(01010) = ababab.  Example: h(0) = ab.  Extend to strings by h(a1…an) = h(a1)…h(an). h(1) = ε.

Closure Under Homomorphism  If L is a regular language. and h is a homomorphism on its alphabet. a.  Proof: Let E be a regular expression for L. then h(L) = {h(w) | w is in L} is also a regular language.Apply h to each symbol in E. 3 . b.Language of resulting RE is h(L).

 h(R)  defines the language h(L)  To prove: h(L) is regular. : L(h(E)) = h(L(E)) .  h(E)  replacing each symbol ∑ in E by h(a).e.  Assumptions:  E  RE on ∑. the language of h(E) is same as the language we get.Proof  Given: A regular language. L on ∑ and a homomorphism function. h. In other words. i. when we apply h to the language L(E).

} So. L.S 2nd Method  E = a.S: h(L(E)) = h(E) = h(ε) = ε So.Contd… Basis: 1st Method  E = ε. h(E) = h(ε) = ε  L. h(E) is RE of h(a)  R.H.H.H. where a Є ∑.S = R.H. L(E) = {a}.H.S .H.S: L(h(E)) = {h(a) |…..  L.S = R..S: L(h(E)) = L(E) = L(ε) = ε  R. L.} because . So.H.H. So.S: h(L(E)) = h({a}) = {h(a)| ….

L(E) = L(F) U L(G) {given}  (2) . h(E) = h(F+G) = h(F) + h(G) {from properties of homomorphism}  (1) Also.Contd…. assumption : E=F+G Then.  Induction:  On union  On concatenation  On kleen closure  Considering for union: So.

S Proved for Union .S = R.Contd…  L.H.H.S: h(L(E)) = h(L(F) U L(G)) {from (2)} = h(L(F)) U h(L(G)) {from properties of union} Hence L.H.H.S: L(h(E)) = L(h(F) + h(G)) {from (1)} = L(h(F)) U L(h(G)) {“+” is union} = h(L(F)) U h(L(G)) {proved in basis }  R.

8 . Note: use parentheses to enforce the proper grouping.  Let L be the language of regular expression 01* + 10*.Example: Closure under Homomorphism  Let h(0) = ab. h(1) = ε.  Then h(L) is the language of regular expression abε* + ε(ab)*.

εE = Eε = E for any RE E.  Thus. so abε* = abε. abε* + ε(ab)* = abε + ε(ab)* = ab + (ab)*.  That is.Example – Continued  abε* + ε(ab)* can be simplified. 9 . L(ab) is contained in L((ab)*).  ε is the identity under concatenation.  ε* = ε. so a RE for h(L) is (ab)*.  Finally.

Inverse Homomorphisms  Let h be a homomorphism and L a language whose alphabet is the output language of h.  h-1(L) = {w | h(w) is in L}.  Explanation  Homomorphism: L (h )  Inverse Homomorphism: h-1 (L) (h ) h(L) L 10 .

Solution:  Start with a DFA A for L  Construct a DFA B for h-1(L) with: • The same set of states. then h-1(L) is also a regular language.Closure Proof for Inverse Homomorphism To prove: If h is a homomorphism from alphabet ∑ to alphabet T. 11 . • The same start state. • Input alphabet = the symbols to which homomorphism h applies. • The same final states. and L is a regular language over T.

Input a h Input h(a) to A Start A Accept/Reje ct • The transitions for B are computed by applying h to an input symbol a and seeing where A would go on sequence of input symbols h(a). δB(q. a) = δA(q. h(a)) . Formally.

h(a)) .γ.∑. So. F) ^ where γ(q.a) = δ (q.  DFA A = (Q.q0.δ.F)  Let B be the new DFA.Formally.T. B = (Q.q0.

S 14 .H.H. h(ε)) = δA(q0.S -> γB(q0.H. To prove: ^ ^ γ(q0.S -> δA(q0.H. h(a))  Basis: w = ε.  L. ε) = q0  R. So.So. ε) = q0.a) = δ (q0.S = R. L.

of homomorphism} = R. a). h(x)). assume IH for x. x).S  δB(q0. = δB(δA(q0. w) = δB(δB(q0. h(a)) {by definition of the DFA B} = δA(q0.H.  L.Contd…  Induction: Let w = xa. h(x)). h(x)h(a)) {by definition of the extended delta} = δA(q0.S 15 .H. h(w)) {by def. a) {by the IH} = δA(δA(q0.

Example: Inverse Homomorphism Construction 1 a B a A b 0 A 0 b a B 1 b Since h(1) = ε C h(0) = ab h(1) = ε Since h(0) = ab C 1. 0 16 .