0% found this document useful (0 votes)
62 views10 pages

Theory of Automata: Regular Expression

The document discusses the theory of regular expressions and regular languages. It provides examples to illustrate important concepts: 1) The language EVEN-EVEN containing strings with an even number of a's and b's can be expressed by the regular expression (aa+bb+(ab+ba)(aa+bb)*(ab+ba))*. 2) The regular expressions r1=a*+b* and r2=(a+b)* generate different languages, with r1 not allowing concatenation of a and b. 3) Two regular expressions are equivalent if they generate the same language, such as r1=(a+b)* (aa+bb) and r2=(a+b)*aa + (

Uploaded by

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

Theory of Automata: Regular Expression

The document discusses the theory of regular expressions and regular languages. It provides examples to illustrate important concepts: 1) The language EVEN-EVEN containing strings with an even number of a's and b's can be expressed by the regular expression (aa+bb+(ab+ba)(aa+bb)*(ab+ba))*. 2) The regular expressions r1=a*+b* and r2=(a+b)* generate different languages, with r1 not allowing concatenation of a and b. 3) Two regular expressions are equivalent if they generate the same language, such as r1=(a+b)* (aa+bb) and r2=(a+b)*aa + (

Uploaded by

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

Theory of Automata

Regular Expression
An important example

The Language EVEN-EVEN :


Language of strings, defined over Σ={a, b} having even
number of a’s and even number of b’s. i.e.
EVEN-EVEN = {Λ, aa, bb, aaaa,aabb,abab, abba, baab, baba,
bbaa, bbbb,…} ,
its regular expression can be written as
(aa+bb+(ab+ba)(aa+bb)*(ab+ba))*
Note

 It is important to be clear about the difference of the


following regular expressions
r1=a*+b*
r2=(a+b)*
Here r1 does not generate any string of concatenation of a
and b, while r2 generates such strings.
Equivalent Regular Expressions

 Definition:
Two regular expressions are said to be equivalent if they
generate the same language.
Example:
Consider the following regular expressions
r1= (a + b)* (aa + bb)
r2= (a + b)*aa + ( a + b)*bb then
both regular expressions define the language of strings ending
in aa or bb.
Note

 If r1 =(aa + bb) and r2=( a + b) then


1. r1+r2 =(aa + bb) + (a + b)
2. r1r2 =(aa + bb) (a + b) =(aaa + aab + bba +
bbb)
3. (r1)* =(aa + bb)*
Regular Languages

 Definition:
The language generated by any regular expression is called a
regular language.
It is to be noted that if r1, r2 are regular expressions,
corresponding to the languages L1 and L2 then the languages
generated by r1+ r2, r1r2( or r2r1) and r1*( or r2*) are also regular
languages.
Note

 It is to be noted that if L1 and L2 are expressed by r1and r2, respectively then


the language expressed by
1) r1+ r2, is the language L1 + L2 or L1 U L2
2) r1r2, , is the language L1L2, of strings obtained by prefixing every string of
L1 with every string of L2
3) r1*, is the language L1*, of strings obtained by concatenating the strings
of L, including the null string.
Example

 If r1=(aa+bb) and r2=(a+b) then the language of strings generated by r1+r2,


is also a regular language, expressed by (aa+bb)+(a+b)
 If r1=(aa+bb) and r2=(a+b) then the language of strings generated by r1r2,
is also a regular language, expressed by (aa+bb)(a+b)
 If r=(aa+bb) then the language of strings generated by r *, is also a regular
language, expressed by (aa+bb)*
All finite languages are regular.

Example:
Consider the language L, defined over Σ={a,b}, of strings of
length 2, starting with a, then
L={aa, ab}, may be expressed by the regular expression aa+ab.
Hence L, by definition, is a regular language.
Note

It may be noted that if a language contains even thousand


words, its RE may be expressed, placing ‘ + ’ between all the
words.
Here the special structure of RE is not important.
Consider the language L={aaa, aab, aba, abb, baa, bab, bba,
bbb}, that may be expressed by a RE
aaa+aab+aba+abb+baa+bab+bba+bbb, which is equivalent to
(a+b)(a+b)(a+b).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy