Automata and Formal Languages - CM0081
Closure Properties of Regular Languages
Andrés Sicard-Ramírez
EAFIT University
Semester 2017-1
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
2/67
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Union: πΏ βͺ π
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
3/67
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Union: πΏ βͺ π
Intersection: πΏ β© π
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
4/67
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Union: πΏ βͺ π
Intersection: πΏ β© π
Complement: πΏ
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
5/67
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Union: πΏ βͺ π
Intersection: πΏ β© π
Complement: πΏ
Difference: πΏ β π
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
6/67
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Union: πΏ βͺ π
Intersection: πΏ β© π
Complement: πΏ
Difference: πΏ β π
Reversal: πΏπ
= {π€π β Ξ£β β£ π€ β πΏ}
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
7/67
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Union: πΏ βͺ π
Intersection: πΏ β© π
Complement: πΏ
Difference: πΏ β π
Reversal: πΏπ
= {π€π β Ξ£β β£ π€ β πΏ}
Closure: πΏβ
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
8/67
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Union: πΏ βͺ π
Intersection: πΏ β© π
Complement: πΏ
Difference: πΏ β π
Reversal: πΏπ
= {π€π β Ξ£β β£ π€ β πΏ}
Closure: πΏβ
Concatenation: πΏπ
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
9/67
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Union: πΏ βͺ π
Intersection: πΏ β© π
Complement: πΏ
Difference: πΏ β π
Reversal: πΏπ
= {π€π β Ξ£β β£ π€ β πΏ}
Closure: πΏβ
Concatenation: πΏπ
Homomorphism: β(πΏ) = {β(π€) β£ π€ β πΏ and β is a homomorphism}
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
10/67
Introduction
Let πΏ and π be regular languages. The following languages are regular:
Union: πΏ βͺ π
Intersection: πΏ β© π
Complement: πΏ
Difference: πΏ β π
Reversal: πΏπ
= {π€π β Ξ£β β£ π€ β πΏ}
Closure: πΏβ
Concatenation: πΏπ
Homomorphism: β(πΏ) = {β(π€) β£ π€ β πΏ and β is a homomorphism}
Inverse homomorphism:
ββ1 (πΏ) = {π€ β Ξ£ β£ β(π€) β πΏ and β is a homomorphism}
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
11/67
Closure Under Union and Complementation
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.4)
If πΏ and π are regular languages, then so is πΏ βͺ π .
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
12/67
Closure Under Union and Complementation
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.4)
If πΏ and π are regular languages, then so is πΏ βͺ π .
Proof
(Using regular expressions)
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
13/67
Closure Under Union and Complementation
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.5)
Let πΏ = Ξ£β βπΏ be the complement of a language πΏ. If πΏ is regular language,
then so is πΏ.
β
Hopcroft, J. E., Motwani, R. and Ullman, J. D. (2007). Introduction to Automata
theory, Languages, and Computation, p. 136.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
14/67
Closure Under Union and Complementation
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.5)
Let πΏ = Ξ£β βπΏ be the complement of a language πΏ. If πΏ is regular language,
then so is πΏ.
Proof.
Let π΄ = (π, Ξ£, πΏ, π0 , πΉ ) be a DFA such that πΏ(π΄) = πΏ. Then π΅ =
(π, Ξ£, πΏ, π0 , π β πΉ ) is a DFA such πΏ(π΅) = πΏ.
β
Hopcroft, J. E., Motwani, R. and Ullman, J. D. (2007). Introduction to Automata
theory, Languages, and Computation, p. 136.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
15/67
Closure Under Union and Complementation
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.5)
Let πΏ = Ξ£β βπΏ be the complement of a language πΏ. If πΏ is regular language,
then so is πΏ.
Proof.
Let π΄ = (π, Ξ£, πΏ, π0 , πΉ ) be a DFA such that πΏ(π΄) = πΏ. Then π΅ =
(π, Ξ£, πΏ, π0 , π β πΉ ) is a DFA such πΏ(π΅) = πΏ.
Question: βDo you see how to take a regular expression and change it into
one that defines the complement language?ββ
β
Hopcroft, J. E., Motwani, R. and Ullman, J. D. (2007). Introduction to Automata
theory, Languages, and Computation, p. 136.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
16/67
Closure Under Union and Complementation
Using the closure properties we can prove that a language is not regular.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
17/67
Closure Under Union and Complementation
Using the closure properties we can prove that a language is not regular.
Example
Given that
πΏ= = {π€ β {0, 1}β β£ π€ has an equal numbers of 0βs and 1βs}
is a language not regular. Prove that
πΏβ = {π€ β {0, 1}β β£ π€ has an unequal numbers of 0βs and 1βs}
is a language not regular.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
18/67
Closure Under Union and Complementation
Using the closure properties we can prove that a language is not regular.
Example
Given that
πΏ= = {π€ β {0, 1}β β£ π€ has an equal numbers of 0βs and 1βs}
is a language not regular. Prove that
πΏβ = {π€ β {0, 1}β β£ π€ has an unequal numbers of 0βs and 1βs}
is a language not regular.
Proof
Whiteboard.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
19/67
Product Construction
Let π΄πΏ , π΄π and π΄ be DFAs given by
π΄πΏ = (ππΏ , Ξ£, πΏπΏ , ππΏ , πΉπΏ ),
π΄π = (ππ , Ξ£, πΏπ , ππ , πΉπ ),
π΄ = (ππΏ × ππ , Ξ£, πΏ, (ππΏ , ππ ), πΉπΏ × πΉπ ),
where πΏ((π, π), π) = (πΏπΏ (π, π), πΏπ (π, π)).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
20/67
Product Construction
Let π΄πΏ , π΄π and π΄ be DFAs given by
π΄πΏ = (ππΏ , Ξ£, πΏπΏ , ππΏ , πΉπΏ ),
π΄π = (ππ , Ξ£, πΏπ , ππ , πΉπ ),
π΄ = (ππΏ × ππ , Ξ£, πΏ, (ππΏ , ππ ), πΉπΏ × πΉπ ),
where πΏ((π, π), π) = (πΏπΏ (π, π), πΏπ (π, π)).
Theorem (Hopcroft, Motwani and Ullman [2007], Exercise 4.2.15)
For all π€ β Ξ£β ,
Μ
Μ
Μ
πΏ((π
πΏ , ππ ), π€) = (πΏπΏ (ππΏ , π€), πΏπ (ππ , π€)).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
21/67
Product Construction
Proof by induction on π€.
1. Basis step
Μ
πΏ((π
πΏ , ππ ), π) = (ππΏ , ππ )
Μ (π , π), πΏ Μ (π , π))
= (πΏπΏ
πΏ
π π
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
(def. of πΏ)Μ
Μ and πΏ Μ )
(def. of πΏπΏ
π
22/67
Product Construction
Proof by induction on π€.
1. Basis step
Μ
πΏ((π
πΏ , ππ ), π) = (ππΏ , ππ )
Μ (π , π), πΏ Μ (π , π))
= (πΏπΏ
πΏ
π π
(def. of πΏ)Μ
Μ and πΏ Μ )
(def. of πΏπΏ
π
2. Inductive step
Μ
πΏ((π
πΏ , ππ ), π₯π)
Μ
= πΏ(πΏ((π
, π ), π₯), π)
πΏ
π
Μ (π , π₯), πΏ Μ (π , π₯)), π)
= πΏ((πΏπΏ
πΏ
π π
Μ
Μ (π , π₯), π))
= (πΏπΏ (πΏπΏ (ππΏ , π₯), π), πΏπ (πΏπ
π
Μ
Μ
= (πΏ (π , π₯π), πΏ (π , π₯π))
πΏ
πΏ
π
π
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
(def. of πΏ)Μ
(by IH)
(def. of πΏ)
(def. of πΏπΏΜ and πΏπΏΜ )
23/67
Closure Under Intersection
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.8)
If πΏ and π are regular languages, then so is πΏ β© π .
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
24/67
Closure Under Intersection
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.8)
If πΏ and π are regular languages, then so is πΏ β© π .
Proof.
Let π΄πΏ and π΄π be DFAs accepting πΏ and π . The product construction
of π΄πΏ and π΄π accepts πΏ β© π .
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
25/67
Closure Under Intersection
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.8)
If πΏ and π are regular languages, then so is πΏ β© π .
Proof.
Let π΄πΏ and π΄π be DFAs accepting πΏ and π . The product construction
of π΄πΏ and π΄π accepts πΏ β© π .
Different proof.
The regular languages are closure under union and complement, and
πΏ β© π = πΏ βͺ π.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
26/67
Closure Under Reversal
Definition (Reversal of a language)
If π€ = π1 π2 β― ππ then the reversal of π€ is defined by π€π
= ππ ππβ1 β― π1 .
πΏπ
= {π€π
β Ξ£β β£ π€ β πΏ} is the reversal of the language πΏ on the
alphabet Ξ£.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
27/67
Closure Under Reversal
Definition (Reversal of a language)
If π€ = π1 π2 β― ππ then the reversal of π€ is defined by π€π
= ππ ππβ1 β― π1 .
πΏπ
= {π€π
β Ξ£β β£ π€ β πΏ} is the reversal of the language πΏ on the
alphabet Ξ£.
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.11)
If πΏ is regular language, then so is πΏπ
(proof using automata or regular
expressions).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
28/67
Closure Under Reversal
Proof using automata.
Let πΏ be recognized by a finite automaton π΄. Turn π΄ into finite automaton
for πΏπ
, by
1. Reversing all arcs.
2. Make the start state of π΄ be the only accepting state.
3. Create a new start state π0 with transitions πΏ(π0 , π) = π,
where π β πΉ are the accepting states of π΄.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
29/67
Closure Under Reversal
Example
A NFA accepting all the binary strings that end in 01.
0, 1
start
π0
0
π1
1
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
π2
30/67
Closure Under Reversal
Example
A NFA accepting all the binary strings that end in 01.
0, 1
0
π0
start
1
π1
π2
A NFA accepting all the binary strings that start with 10.
0, 1
π0
0
π1
1
π2
π
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
π0
start
31/67
Homomorphisms
Definition (Algebraic structure)
An algebraic structure on a set π΄ β β
is essentially a collection of π-ary
operations on π΄ [Cohn 1981, p. 41].
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
32/67
Homomorphisms
Definition (Algebraic structure)
An algebraic structure on a set π΄ β β
is essentially a collection of π-ary
operations on π΄ [Cohn 1981, p. 41].
Example (Semigroup)
A semigroup (π, β) is a set π with an associative binary operation
β βΆ π × π β π.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
33/67
Homomorphisms
Definition (Algebraic structure)
An algebraic structure on a set π΄ β β
is essentially a collection of π-ary
operations on π΄ [Cohn 1981, p. 41].
Example (Semigroup)
A semigroup (π, β) is a set π with an associative binary operation
β βΆ π × π β π.
Example (Monoid)
A monoid (π , β, π) is a semigroup (π , β) with an element π β π which is
an unit for β, i.e. βπ₯. π₯ β π = π β π₯ = π₯.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
34/67
Homomorphisms
Definition (homomorphism)
A homomorphism is a structure-preserving map between two algebraic structures.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
35/67
Homomorphisms
Definition (homomorphism)
A homomorphism is a structure-preserving map between two algebraic structures.
Example
A homomorphism between two semigroups (π, β) and (π β² , ββ² ) is a function
π βΆ π β π β² such that:
βπ₯ π¦. π(π₯ β π¦) = π(π₯) ββ² π(π₯).
Graphically (see whiteboard).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
36/67
Homomorphisms
Example
A homomorphism between two monoids (π , β, π) and (π β² , ββ² , πβ² ) is a
function π βΆ π β π β² such that:
βπ₯ π¦. π(π₯ β π¦) = π(π₯) ββ² π(π₯),
π(π) = πβ² .
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
37/67
Homomorphisms
A homomorphism between two algebraic structures is a:
Monomorphism if π is an injection
Epimorphism if π is an surjection
Isomorphism if π is bijection
Endomorphism if the homomorphism is from an algebraic structure to
itself
Automorphism if the homomorphism is a bijective endomorphism
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
38/67
Closure Under Homomorphism
Definition
Let Ξ£ and Ξ be two alphabets. A homomorphism between (Ξ£β , ·, π) and
(Ξβ , ·, π) is a function
β βΆ Ξ£β β Ξ β
π1 π2 β― ππ β¦ β(π1 )β(π2 ) β― β(ππ )
πβ¦π
Note: For this reason the textbook talk about a homomorphism β βΆ Ξ£ β Ξβ .
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
39/67
Closure Under Homomorphism
Example
Let β βΆ {0, 1}β β {π, π}β be a homomorphism defined by
β(0) = ππ,
β(1) = π.
Then
β(0011) = β(0)β(0)β(1)β(1)
= ππππ.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
40/67
Closure Under Homomorphism
Inverse Homomorphism
Definition (Application of a homomorphism to a language)
If πΏ is a language
alphabet
Ξ£ and β isLet
a homomorphism
on Ξ£,
β be a homom.
Let h :over
Ξ£β the
β Ξ
L β Ξβ ,
thenβ
and define
β(πΏ) = {β(π€) β£ π€ β πΏ}.
hβ1(L) = {w β Ξ£β : h(w) β L}
L
h
h(L)
(a)
β
-1
(L)
h
Hopcroft, Motwani and Ullmanh [2007,
Fig. 4.5a].L
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
41/67
Closure Under Homomorphism
Example
Let β βΆ {0, 1}β β {π, π}β be a homomorphism defined by
β(0) = ππ,
β(1) = π.
If πΏ = πΏ(10β 1), then β(πΏ) = πΏ((ab)β ).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
42/67
Closure Under Homomorphism
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.14)
If πΏ is a regular language over the alphabet Ξ£ and β is a homomorphism
on Ξ£, then β(πΏ) is also regular.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
43/67
Closure Under Homomorphism
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.14)
If πΏ is a regular language over the alphabet Ξ£ and β is a homomorphism
on Ξ£, then β(πΏ) is also regular.
Proof plan
Let πΈ be a regular expression such πΏ = πΏ(πΈ).
Let β(πΈ) be the regular expression replacing each symbol π β Ξ£
by β(π) in the regular expression πΈ.
We need to prove that πΏ(β(πΈ)) = β(πΏ(πΈ)).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
44/67
Closure Under Homomorphism
Proving πΏ(β(πΈ)) = β(πΏ(πΈ)).
Basis step
πΈ is π or β
.
1. β(πΈ) = πΈ (β does not affect πΈ)
2. β(πΏ(πΈ)) = πΏ(πΈ) (πΏ(πΈ) is empty or only contains π)
3. πΏ(β(πΈ)) = πΏ(πΈ) = β(πΏ(πΈ)) (by 1 and 2)
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
45/67
Closure Under Homomorphism
Proving πΏ(β(πΈ)) = β(πΏ(πΈ)).
Basis step
πΈ is π or β
.
1. β(πΈ) = πΈ (β does not affect πΈ)
2. β(πΏ(πΈ)) = πΏ(πΈ) (πΏ(πΈ) is empty or only contains π)
3. πΏ(β(πΈ)) = πΏ(πΈ) = β(πΏ(πΈ)) (by 1 and 2)
πΈ=a
1. πΏ(πΈ) = {π}
2. β(πΏ(πΈ)) = {β(π)}
3. β(πΈ) is the regular expression that is the string of symbols β(π)
4. πΏ(β(πΈ)) = {β(π)}
5. πΏ(β(πΈ)) = β(πΏ(πΈ)) (by transitivity between 2 and 4)
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
46/67
Closure Under Homomorphism
Proving πΏ(β(πΈ)) = β(πΏ(πΈ)).
Inductive step
πΈ =πΉ +πΊ
1. πΏ(πΈ) = πΏ(πΉ ) βͺ πΏ(πΊ) (def. of +)
2. β(πΈ) = β(πΉ + πΊ) = β(πΉ ) + β(πΊ) (def. of β(πΈ))
3. πΏ(β(πΈ)) = πΏ(β(πΉ ) + β(πΊ)) = πΏ(β(πΉ )) βͺ πΏ(β(πΊ)) (def. of +)
4. β(πΏ(πΈ)) = β(πΏ(πΉ ) βͺ πΏ(πΊ)) = β(πΏ(πΉ )) βͺ β(πΏ(πΊ)) (β is applied
to a language by application to each of its strings)
5. πΏ(β(πΉ )) = β(πΏ(πΉ ) and πΏ(β(πΊ)) = β(πΏ(πΊ) (IH)
6. πΏ(β(πΈ)) = β(πΏ(πΈ))
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
47/67
Closure Under Homomorphism
Proving πΏ(β(πΈ)) = β(πΏ(πΈ)).
Inductive step (cont.)
πΈ = πΉ πΊ (similar to the previous case)
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
48/67
Closure Under Homomorphism
Proving πΏ(β(πΈ)) = β(πΏ(πΈ)).
Inductive step (cont.)
πΈ = πΉ πΊ (similar to the previous case)
πΈ = πΉ β (similar to the previous case)
1. πΏ(πΈ) = (πΏ(πΉ ))β (def. of β )
2. β(πΈ) = β(πΉ β ) = (β(πΉ ))β (def. of β(πΈ))
3. πΏ(β(πΈ)) = πΏ((β(πΉ ))β ) = (πΏ(β(πΉ )))β (def. of β )
4. β(πΏ(πΈ)) = β((πΏ(πΉ ))β ) = (β(πΏ(πΉ )))β (β is applied to a language
by application to each of its strings)
5. πΏ(β(πΉ )) = β(πΏ(πΉ )) (IH)
6. πΏ(β(πΈ)) = β(πΏ(πΈ))
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
49/67
Closure Under Homomorphism
Example
Prove that
πΏ = {0π 1π 2π β£ π, π, π β β€+ and π β π β π}
is a language not regular.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
50/67
Closure Under Homomorphism
Example
Prove that
πΏ = {0π 1π 2π β£ π, π, π β β€+ and π β π β π}
is a language not regular.
Proof.
1. We define the homomorphism
β(0) = 0,
β(1) = 1,
β(2) = π.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
51/67
Closure Under Homomorphism
Example
Prove that
πΏ = {0π 1π 2π β£ π, π, π β β€+ and π β π β π}
is a language not regular.
Proof.
1. We define the homomorphism
β(0) = 0,
β(1) = 1,
β(2) = π.
2. The homomorphism β removes the 2π s, so
β(πΏ) = {0π 1π β£ π, π β β€+ and π β π}.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
52/67
Closure Under Homomorphism
Example
Prove that
πΏ = {0π 1π 2π β£ π, π, π β β€+ and π β π β π}
is a language not regular.
Proof.
1. We define the homomorphism
β(0) = 0,
β(1) = 1,
β(2) = π.
2. The homomorphism β removes the 2π s, so
β(πΏ) = {0π 1π β£ π, π β β€+ and π β π}.
3. We know that β(πΏ) is not regular, so πΏ is not regular.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
53/67
Closure Under Homomorphism
Example
Let πΏ be a regular language and β a homomorphism on πΏ. Define ββ (πΏ) by
ββ (πΏ) = πΏ βͺ β(πΏ) βͺ β(β(πΏ)) βͺ β(β(β(πΏ))) βͺ β¦
Is ββ (πΏ) necessarily regular?
β
From somewhere in Internet (I donβt remember).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
54/67
Closure Under Homomorphism
Example
Let πΏ be a regular language and β a homomorphism on πΏ. Define ββ (πΏ) by
ββ (πΏ) = πΏ βͺ β(πΏ) βͺ β(β(πΏ)) βͺ β(β(β(πΏ))) βͺ β¦
Is ββ (πΏ) necessarily regular?
No. Let πΏ = {01} and β defined as β(0) = 00 and β(1) = 11. Then
ββ (πΏ) = {01, 0011, 00001111, β¦ }
= {0π 1π β£ π = 2π for π β₯ 0},
which is a language not regular.β
β
From somewhere in Internet (I donβt remember).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
55/67
hβ1(L) = {w β Ξ£β : h(w) β L}
Closure Under Inverse Homomorphism
Definition
L
h and πΏh(L)
Let β βΆ Ξ£β β Ξβ be a homomorphism
β Ξβ a language, thenβ
ββ1 (πΏ) = {π€ β Ξ£β β£ β(π€) β πΏ}.
(a)
h-1 (L)
h
L
(b)
110
β
Hopcroft, Motwani and Ullman [2007, Fig. 4.5b].
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
56/67
Closure Under Inverse Homomorphism
Example
Let β βΆ {π, π} β {0, 1}β a homomorphism defined by
β(π) = 01,
β(π) = 10.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
57/67
Closure Under Inverse Homomorphism
Example
Let β βΆ {π, π} β {0, 1}β a homomorphism defined by
β(π) = 01,
β(π) = 10.
If πΏ = πΏ((00 + 1)β ), then ββ1 (πΏ) = πΏ((ba)β )
(It is necessary to prove β(π€) β πΏ β π€ = ππππ β― ππ).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
58/67
Closure Under Inverse Homomorphism
Theorem (Hopcroft, Motwani and Ullman [2007], Theorem 4.16)
Let β βΆ Ξ£β β Ξβ be a homomorphism and πΏ β Ξβ a regular language. Then
ββ1 (πΏ) is regular (proof using automata).
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
59/67
Closure Under Inverse Homomorphism
Example
Prove that πΏ = {0π 12π β£ π β₯ 0} is a language not regular.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
60/67
Closure Under Inverse Homomorphism
Example
Prove that πΏ = {0π 12π β£ π β₯ 0} is a language not regular.
Proof.
1. Given the homomorphism
β(0) = 0,
β(1) = 11,
then ββ1 (πΏ) = {0π 1π β£ π β₯ 0}.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
61/67
Closure Under Inverse Homomorphism
Example
Prove that πΏ = {0π 12π β£ π β₯ 0} is a language not regular.
Proof.
1. Given the homomorphism
β(0) = 0,
β(1) = 11,
then ββ1 (πΏ) = {0π 1π β£ π β₯ 0}.
2. Since ββ1 (πΏ) is not regular, then πΏ is not regular.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
62/67
Closure Properties
Exercise (Hopcroft, Motwani and Ullman [2007], Exercise 4.2.2)
If πΏ is a language, and π is a symbol, then πΏ/π, the quotient of πΏ and π, is
the set of strings π€ such that π€π is in πΏ. For example, if πΏ = {π, πππ, πππ},
then πΏ/π = {π, ππ}. Prove that if πΏ is regular, so is πΏ/π. Hint: Start with
a DFA for πΏ and consider the set of accepting states.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
63/67
Closure Properties
Exercise (Hopcroft, Motwani and Ullman [2007], Exercise 4.2.2)
If πΏ is a language, and π is a symbol, then πΏ/π, the quotient of πΏ and π, is
the set of strings π€ such that π€π is in πΏ. For example, if πΏ = {π, πππ, πππ},
then πΏ/π = {π, ππ}. Prove that if πΏ is regular, so is πΏ/π. Hint: Start with
a DFA for πΏ and consider the set of accepting states.
Proof (Hopcroft, Motwani and Ullman [2007] solution).
Start with a DFA π΄ for πΏ. Construct a new DFA π΅, that is exactly the same
as π΄, except that state π is an accepting state of π΅ if and only if πΏ(π, π)
is an accepting state of π΄. Then π΅ accepts input string π€ if and only if π΄
accepts π€π; that is, πΏ(π΅) = πΏ/π.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
64/67
Closure Properties
Exercise (Hopcroft, Motwani and Ullman [2007], Exercise 4.2.3)
If πΏ is a language, and π is a symbol, then π\πΏ is the set of strings π€ such
that ππ€ is in πΏ. For example, if πΏ = {π, πππ, πππ}, then π\πΏ = {π, ππ}.
Prove that if πΏ is regular, so is π\πΏ. Hint: Start with a DFA for πΏ and
consider its start state.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
65/67
Closure Properties
Exercise (Hopcroft, Motwani and Ullman [2007], Exercise 4.2.3)
If πΏ is a language, and π is a symbol, then π\πΏ is the set of strings π€ such
that ππ€ is in πΏ. For example, if πΏ = {π, πππ, πππ}, then π\πΏ = {π, ππ}.
Prove that if πΏ is regular, so is π\πΏ. Hint: Start with a DFA for πΏ and
consider its start state.
Proof (Hopcroft, Motwani and Ullman [2007] solution).
Start with a DFA π΄ for πΏ. Construct a new DFA π΅, that is exactly the
same as π΄, except that its start state is πΏ(π0 , π) where π0 is the start state
of π΄. Then π΅ accepts input string π€ if and only if π΄ accepts ππ€; that is,
πΏ(π΅) = πΏ\π.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
66/67
References
Cohn, P. M. (1981). Universal Algebra. Revised edition. D. Reidel Publishing
Company.
Hopcroft, J. E., Motwani, R. and Ullman, J. D. (2007). Introduction to Automata
theory, Languages, and Computation. 3rd ed. Pearson Education.
Automata and Formal Languages - CM0081. Closure Properties of Regular Languages
67/67
© Copyright 2026 Paperzz