Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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)
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() =
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}
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
11
Input a
h
Input
h(a) to A
Start
Accept/Reje
ct
Formally,
DFA A = (Q,T,,q0,F)
Let B be the new DFA,
So, B = (Q,,,q0, F)
^
So,
To prove:
^
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}
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