Title: Closure Properties for Regular Languages
1Closure Properties for Regular Languages
2Preliminaries
- So far, we have stated languages in plain
English. For example all words starting and
ending with the character b - The description in plain English can be
cumbersome and ambiguous - Regular Expressions is a formal way to describe
languages accepted by finite automata
3Regular Expressions
Regular Expressions are built upon a subset of
the following operations on sets
- Union
- Complementation
- Intersection
- Difference
- Concatenation
- Kleene star
4Union
Let L and M two languages, then their union is
defined by
L ? M w w ? L or w ? M
Let AL and AM two finite automata accepting L and
M respectively
AL
AM
s
gt
s
gt
Is there a finite automata accepting L ? M ?
5Union (2)
Is there a finite automata accepting L ? M ?
Yes!
AL
s
e
q
gt
e
s
AM
6Complement
Let L be a language over an alphabet ?, then the
complement of L is defined as
LC w w ? ? and w ? L
Let AL be a finite automaton accepting L. Is
there a finite automaton accepting LC?
b
b
a
a
f
s
q
b
b
P
a
a
7Complement (2)
a
r
r
s
q
q
gt
b
b
b
8Complement (3)
Given a language accepted by a finite automaton
AL, to find a finite automaton accepting LC we
have to do the following steps 1.
Transform AL into an equivalent DFA AL
2. Construct a new automaton ALC by taking AL
and 2.1 Removing the
favorable marks of all favorable states
2.2 Marking as favorable those
states that initially had no favorable
mark The resulting ALC is a DFA accepting LC
9Intersection
Let L and be M two languages, then their
intersection is defined by
L ? M w w ? L and w ? M
Using DeMorgans Laws (L ? M) (LC ?
MC)C
Thus, there must be a finite automaton accepting
(L ? M)
10Difference
Let L and M be two languages, then their
difference is defined by
L ? M w w ? L and w ? M
Using DeMorgans Laws (L ? M) L ? MC
Thus, there must be a finite automaton for (L ?
M)
11Concatenation
Let L and M be two languages, then their
concatenation is defined by
LM wv w ? L and v ? M
b
b
A
B
a
a
s
f
a
s
f
b
a
b
b
P
a
How to extend these automata such that the
resulting one accepts the concatenation language?
12Concatenation (2)
AL
e
s
gt
s
e
AM
e
Steps to obtain a finite automation accepting
LM 1. Make an e-transition from all
favorable states in AL to the initial state in
AM 2. Unmark all favorable states in AL
3. Remove the mark of the initial state in AM
13Kleene Star
Let L be a language over an alphabet an alphabet
?, then we define L0 e L1 L
L2 LL L3 L2L LLL
Ln Ln-1L
Kleene star of L is defined as
L L0 ? L1 ? L2 ?
14Kleene Star (2)
An equivalent definition L
w1 w2 wk w1, w2, , wk ? L
b
A
a
s
f
a
gt
b
b
P
a
Obtain a finite automaton accepting L(A)
15Kleene Star (3)
e
e
AL
s
s
gt
e
e
e
This finite automaton accepts L
16Closure under Set Operations Theorem
Theorem. Let L and M two regular languages, then
the following languages are also regular
One says that the regular languages are closed
under these 6 operations