Вы находитесь на странице: 1из 16

Closure Properties of

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

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

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

Proof
Given: A regular language, L on and a
homomorphism function, h.
Assumptions:
E RE on .
h(E) replacing each symbol in E by h(a).
h(R) defines the language h(L)

To prove: h(L) is regular. In other words, the


language of h(E) is same as the language we
get, when we apply h to the language L(E), i.e. :
L(h(E)) = h(L(E))

Contd
Basis: 1st Method E = . So, h(E) = h() =
L.H.S: L(h(E)) = L(E) = L() =
R.H.S: h(L(E)) = h(E) = h() =

So. L.H.S = R.H.S


2nd Method E = a, where a .
So, L(E) = {a}.
L.H.S: L(h(E)) = {h(a) |..}
because , h(E) is RE of h(a)
R.H.S: h(L(E)) = h({a}) = {h(a)| ..}
So. L.H.S = R.H.S

Contd.
Induction:
On union
On concatenation
On kleen closure
Considering for union:
So, assumption : E=F+G
Then, h(E) = h(F+G)
= h(F) + h(G)

{from properties of

homomorphism}

(1)
Also, L(E) = L(F) U L(G)

{given}

(2)

Contd
L.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.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.S = R.H.S


Proved for Union

Example: Closure under


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

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

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

Closure Proof for Inverse


Homomorphism
To prove: If h is a homomorphism from alphabet
to alphabet T, and L is a regular language
over T, then h-1(L) is also a regular language.
Solution:
Start with a DFA A for L

Construct a DFA B for h-1(L) with:


The same set of states.
The same start state.
The same final states.
Input alphabet = the symbols to which
homomorphism h applies.

11

Input a

h
Input
h(a) to A

Start

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).
Formally, B(q, a) = A(q, h(a))

Formally,
DFA A = (Q,T,,q0,F)
Let B be the new DFA,
So, B = (Q,,,q0, F)
^

where (q,a) = (q, h(a))

So,
To prove:
^

(q0,a) = (q0, h(a))


Basis: w = .
L.H.S -> B(q0, ) = q0
R.H.S -> A(q0, h())
= A(q0, ) = q0.
So, L.H.S = R.H.S
14

Contd
Induction: Let w = xa; assume IH for x.
L.H.S B(q0, w) = B(B(q0, x), a).
= B(A(q0, h(x)), a) {by the IH}
= A(A(q0, h(x)), h(a)) {by
definition of the DFA B}

= A(q0, h(x)h(a)) {by definition


of the extended delta}

= A(q0, h(w)) {by def. of


homomorphism}
= R.H.S
15

Example: Inverse
Homomorphism Construction
1

a
B
a

A
0

b
a

1
b

Since
h(1) =

h(0) = ab
h(1) =

Since
h(0) = ab

C
1, 0

16

Вам также может понравиться