0% found this document useful (0 votes)
91 views28 pages

Handout-10 - A - Properties of RL

The document discusses properties of regular languages. It states that regular languages are closed under operations like union, intersection, complement, concatenation and Kleene closure. This means that if two languages are regular, the result of applying these operations will also be a regular language. The document provides proofs of closure properties using regular expressions and finite automata. It also provides examples to illustrate the closure properties.

Uploaded by

TALHA SALEEM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views28 pages

Handout-10 - A - Properties of RL

The document discusses properties of regular languages. It states that regular languages are closed under operations like union, intersection, complement, concatenation and Kleene closure. This means that if two languages are regular, the result of applying these operations will also be a regular language. The document provides proofs of closure properties using regular expressions and finite automata. It also provides examples to illustrate the closure properties.

Uploaded by

TALHA SALEEM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 28

Regular Languages

Properties
Regular Languages
• A language that can be defined by a
regular expression is called a regular
language.
• Closure Properties
• Decision Properties
• The language that cannot be defined by
a regular expression are nonregular
languages e.g. PALINDROME, PRIME
Closure Properties of Regular
Languages
• If certain languages are regular, and a language L
is formed from the application of some special
operations, then L is also regular.
• Principal Closure Properties
– Union of two regular languages is regular
– Complement of a regular language is regular
– Intersection of two regular languages is regular
– Closure of a regular language is regular
– Product / Concatenation of regular languages is
regular
Closure Properties
of Regular Languages (Union)
• If L and M are regular languages over alphabet 

then L U M is the language that contains all strings

that are in either or both of L and M.

• “Union of Two regular languages is regular” i.e.

Set of regular languages is closed under union.


Closure Properties of Regular
Languages (Union)
• Proof (By Regular Expression)

• If L1 and L2 are regular languages, there are


regular expressions r1 and r2 that define
these languages. Then (r1+r2) is a regular
expression that defines the language L1+L2.
Hence L1+L2 (L1 U L2) is a regular language.
Closure Properties of Regular
Languages (Union)
• Proof by Machines

-
Λ Λ

- -

TG1 TG2

+ +
Another Method
• Example
• We will consider two FA’s
• Then Construct the FA for the
Union of These FA’s
Closure Properties of Regular
Languages (Complement)

• If L is a language over the alphabet ,


then its complement denoted by L’ is a
language consisting of all strings from
* that are not words in L.
• If L is a regular Language, then L’ is
also a regular language. i.e. the set of
regular languages is closed under
complementation
Closure Properties of Regular
Languages (Complement)
• Proof
– If L is a regular language then Kleen’s theorem states
that there is some FA that accepts the language L.
– This FA contains some final states. Reverse the final
status of each state.
– This new FA will now accept all the strings that were
previously being rejected and reject all the previously
accepted strings i.e it accepts the words of L’.
– Thus this new FA defines L’ which by Kleen’s theorem
indicates that L’ can also be defined by a Regular
Expression and hence is a Regular language
Closure Properties of Regular
Languages (Complement)
• Example

a b a,b a b a,b
-
- + + +
+

a a
b b
a,b a,b
+

a,b a,b
Closure Properties of Regular
Languages (Intersection)

• Let L and M be languages over alphabet . Then


L ∩ M is the language that contains all strings
that are in both L and M
• Intersection of Regular Languages
– If L1 and L2 are regular languages then L1 ∩ L2 is
also a regular language. i.e. Set of regular languages
is closed under intersection
Closure Properties of Regular
Languages (Intersection)
• Proof
• By Demorgan’s Law
• L1 ∩ L2 = (L1’ U L2’)’
= (L1’ + L2’)’
• This implies that L1 ∩ L2 consists of all
words that are not is either L1’ or L2’.
As L1 and L2 are regular languages so
are L1’ and L2’. There union L1’ + L2’ is
also a regular language.
Closure Properties of Regular
Languages (Intersection)
• L1 = all strings with a double a
• L2 = all strings with an even number of a’s
• Both are regular languages and they have
following RE respectively
• R1 = (a+b)*aa(a+b)*
• R2 = b*(ab*ab*)*
• Both languages are regular, Kleen’s Theorem
says that they can also be defined by FAs

a a,b b a b
b a
-
- +
+

b FA1 FA2 a
Closure Properties of Regular
Languages (Intersection)
• Complements of FAs

a a,b b a b
b a
x1-
+ x3 y1- y2+
+

b FA1’ FA2’ a

Join the machines to get FA3 = FA1’ + FA2’ which defines the
language (L1’ + L2’)
Reverse the final status of each state of FA3 to get (FA1’+FA2’)’
that defines L1 ∩ L2
Apply the TG to RE conversion over FA3 to get r3 that defines the
intersection of both languages
Closure Properties of Regular
Languages (Intersection)
• Second Method of Intersection
a a,b b a b
b a
y1-
x1- x2 x3+ y2
+

b FA1 FA2 a

Join both the machines to get FA3 = FA1+FA2 that defines


L1+L2
FA3 consists of states of both FA1 and FA2. Remove all the +
and put a + only at a state where the corresponding x and y
components both are final
Closure Properties of Regular
Languages (Closure)
• If L is a regular expression then L*
consists of all strings formed by the
concatenation of arbitrarily many factors
of L
• Closure Property
– If L is a regular language so is L*
Closure Properties of Regular
Languages (Closure)

• Proof (By regular expression)


• If a regular lanugage L is defined by a
regular expression r then the language L*
can be defined by r*. Thus L* is a regular
language
Closure Properties of Regular
Languages (Closure)
• Proof (By Machines)

Λ TG1 Λ

+
Closure Properties of Regular
Languages (Concatenation)

• If L1 and L2 are two regular languages


then L1L2 contains all words formed by
concatenation of a word from L1 with a
word from L2
• Concatenation of Regular Languages
– If L1 and L2 are two regular languages then
so is L1L2.
Closure Properties of Regular
Languages (Concatenation/Product)
• Proof (By Regular Expression)
• If L1 and L2 are regular languages then there
are two regular expressions r1 and r2 which
define these respectively. The language L1L2
can be defined by r1r2 which is also a regular
expression. Hence L1L2 is also a regular
language.
Closure Properties of Regular
Languages (Concatenation/Product)

• Proof (By Machines)

Λ
- TG1 1 2 TG2 +

You might also like