SlideShare a Scribd company logo
1 of 18
1
Recap Lecture-2
Kleene Star Closure, Plus operation, recursive
definition of languages, INTEGER, EVEN,
factorial, PALINDROME, {an
bn
}, languages of
strings (i) ending in a, (ii) beginning and ending
in same letters, (iii) containing aa or bb
(iv)containing exactly aa,
2
Task
Q)
1) Let S={ab, bb} and T={ab, bb, bbbb} Show
that S*
= T*
[Hint S*
⊆ T*
and T*
⊆ S*
]
2) Let S={ab, bb} and T={ab, bb, bbb} Show that S*
≠
T*
But S*
⊂ T*
Solution: Since S⊂ T , so every string belonging
to S*
, also belongs to T*
but bbb is a string belongs
to T*
but does not belong to S*
.
3
3) Let S={a, bb, bab, abaab} be a set of strings. Are
abbabaabab and baabbbabbaabb in S*
? Does any word
in S*
have odd number of b’s?
Solution: since abbabaabab can be grouped as (a)(bb)
(abaab)ab , which shows that the last member of the
group does not belong to S, so abbabaabab is not in S*
,
while baabbbabbaabb can not be grouped as members
of S, hence baabbbabbaabb is not in S*
. Since each
string in S has even number of b’s so there is no
possiblity of any string with odd number of b’s to be in S*
.
4
Task
Q1)Is there any case when S+
contains Λ? If
yes then justify your answer.
Solution: consider S={Λ,a} then
S+
={Λ, a, aa, aaa, …}
Here Λ is in S+
as member of S. Thus Λ will
be in S+
, in this case.
5
Q2) Prove that for any set of strings S
i. (S+
)*
=(S*
)*
Solution: In general Λ is not in S+
, while Λ
does belong to S*
. Obviously Λ will now be
in (S+
)*
, while (S*
)*
and S*
generate the same
set of strings. Hence (S+
)*
=(S*
)*
.
6
Q2) continued…
ii) (S+
)+
=S+
Solution: since S+
generates all possible
strings that can be obtained by
concatenating the strings of S, so (S+
)+
generates all possible strings that can be
obtained by concatenating the strings of S+
,
will not generate any new string.
Hence (S+
)+
=S+
7
Q2) continued…
iii) Is (S*
)+
=(S+
)*
Solution: since Λ belongs to S*
,so Λ will
belong to (S*
)+
as member of S*
.Moreover Λ
may not belong to S+
, in general, while Λ will
automatically belong to (S+
)*
.
Hence (S*
)+
=(S+
)*
8
Regular Expression
As discussed earlier that a*
generates
Λ, a, aa, aaa, …
and a+
generates a, aa, aaa, aaaa, …, so the
language L1
= {Λ, a, aa, aaa, …} and L2
= {a, aa, aaa, aaaa, …} can simply be
expressed by a*
and a+
, respectively.
a*
and a+
are called the regular expressions
(RE) for L1
and L2
respectively.
Note: a+
, aa*
and a*
a generate L2
.
9
Recursive definition of Regular
Expression(RE)
Step 1: Every letter of Σ including Λ is a
regular expression.
Step 2: If r1
and r2 are regular expressions then
1.(r1
)
2.r1
r2
3.r1
+ r2
and
4. r1
*
are also regular expressions.
10
Defining Languages (continued)…
Method 3 (Regular Expressions)
Consider the language L={Λ, x, xx, xxx,…} of
strings, defined over Σ = {x}.
We can write this language as the Kleene star
closure of alphabet Σ or L=Σ*
={x}*
this language can also be expressed by the
regular expression x*
.
Similarly the language L={x, xx, xxx,…},
defined over Σ = {x}, can be expressed by the
regular expression x+
.
11
Now consider another language L, consisting
of all possible strings, defined over Σ
= {a, b}. This language can also be expressed
by the regular expression
(a + b)*
.
Now consider another language L, of strings
having exactly double a, defined over Σ
= {a, b}, then it’s regular expression may be
b*
aab*
12
Now consider another language L, of even
length, defined over Σ = {a, b}, then it’s
regular expression may be
((a+b)(a+b))*
Now consider another language L, of odd
length, defined over Σ = {a, b}, then it’s
regular expression may be
(a+b)((a+b)(a+b))*
or
((a+b)(a+b))*
(a+b)
13
Remark
It may be noted that a language may be
expressed by more than one regular
expressions, while given a regular expression
there exist a unique language generated by that
regular expression.
14
Example:
Consider the language, defined over
Σ={a , b} of words having at least one a,
may be expressed by a regular expression
(a+b)*
a(a+b)*
.
Consider the language, defined over
Σ = {a, b} of words having at least one a
and one b, may be expressed by a regular
expression
(a+b)*
a(a+b)*
b(a+b)*
+ (a+b)*
b(a+b)*
a(a+b)*
.
15
Consider the language, defined over
Σ={a, b}, of words starting with double a
and ending in double b then its regular
expression may be aa(a+b)*
bb
Consider the language, defined over
Σ={a, b} of words starting with a and
ending in b OR starting with b and ending
in a, then its regular expression may be
a(a+b)*
b+b(a+b)*
a
16
TASK
Consider the language, defined over
Σ={a, b} of words beginning with a, then
its regular expression may be a(a+b)*
Consider the language, defined over
Σ={a, b} of words beginning and ending
in same letter, then its regular expression
may be (a+b)+a(a+b)*
a+b(a+b)*
b
17
TASK
Consider the language, defined over
Σ={a, b} of words ending in b, then its
regular expression may be (a+b)*
b.
Consider the language, defined over
Σ={a, b} of words not ending in a, then its
regular expression may be (a+b)*
b + Λ. It is to be
noted that this language may also be expressed
by ((a+b)*
b)*
.
18
SummingUP Lecture 3
RE, Recursive definition of RE, defining
languages by RE, { x}*
, { x}+
, {a+b}*
, Language of
strings having exactly one aa, Language of
strings of even length, Language of strings of
odd length, RE defines unique language (as
Remark), Language of strings having at least
one a, Language of strings havgin at least
one a and one b, Language of strings
starting with aa and ending in bb,
Language of strings starting with and
ending in different letters.

More Related Content

What's hot (20)

Lesson 04
Lesson 04Lesson 04
Lesson 04
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
Lesson 05
Lesson 05Lesson 05
Lesson 05
 
Lesson 08
Lesson 08Lesson 08
Lesson 08
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Lesson 12
Lesson 12Lesson 12
Lesson 12
 
Lesson 03
Lesson 03Lesson 03
Lesson 03
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Lesson 10
Lesson 10Lesson 10
Lesson 10
 
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
Language
LanguageLanguage
Language
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Introduction to Computer theory Daniel Cohen Chapter 4 & 5 Solutions
Introduction to Computer theory Daniel Cohen Chapter 4 & 5 SolutionsIntroduction to Computer theory Daniel Cohen Chapter 4 & 5 Solutions
Introduction to Computer theory Daniel Cohen Chapter 4 & 5 Solutions
 
Chomsky Normal Form
Chomsky Normal FormChomsky Normal Form
Chomsky Normal Form
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammar
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
 

Similar to Lesson 03

Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxRaviAr5
 
Introduction to Computer theory Daniel Cohen Chapter 2 Solutions
Introduction to Computer theory Daniel Cohen Chapter 2 SolutionsIntroduction to Computer theory Daniel Cohen Chapter 2 Solutions
Introduction to Computer theory Daniel Cohen Chapter 2 SolutionsAshu
 
Lesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptLesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptashja1
 
theory of computation lecture 02
theory of computation lecture 02theory of computation lecture 02
theory of computation lecture 028threspecter
 
Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........NaumanAli215439
 
Regular Expression Examples.pptx
Regular Expression Examples.pptxRegular Expression Examples.pptx
Regular Expression Examples.pptxGhulamRabani9
 
context free grammars automata therory and compiler design
context free grammars automata therory and compiler designcontext free grammars automata therory and compiler design
context free grammars automata therory and compiler designsunitachalageri1
 
Automata definitions
Automata definitionsAutomata definitions
Automata definitionsSajid Marwat
 

Similar to Lesson 03 (20)

L_2_apl.pptx
L_2_apl.pptxL_2_apl.pptx
L_2_apl.pptx
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Cs419 lec4 lexical analysis using re
Cs419 lec4   lexical analysis using reCs419 lec4   lexical analysis using re
Cs419 lec4 lexical analysis using re
 
Lesson 09
Lesson 09Lesson 09
Lesson 09
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
 
Introduction to Computer theory Daniel Cohen Chapter 2 Solutions
Introduction to Computer theory Daniel Cohen Chapter 2 SolutionsIntroduction to Computer theory Daniel Cohen Chapter 2 Solutions
Introduction to Computer theory Daniel Cohen Chapter 2 Solutions
 
Lesson 09.ppt
Lesson 09.pptLesson 09.ppt
Lesson 09.ppt
 
Lesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptLesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.ppt
 
theory of computation lecture 02
theory of computation lecture 02theory of computation lecture 02
theory of computation lecture 02
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Compilers midterm spring 2013 model answer
Compilers midterm spring 2013   model answerCompilers midterm spring 2013   model answer
Compilers midterm spring 2013 model answer
 
Cfg part ii
Cfg   part iiCfg   part ii
Cfg part ii
 
Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........
 
Ch02
Ch02Ch02
Ch02
 
Ch03
Ch03Ch03
Ch03
 
Regular Expression Examples.pptx
Regular Expression Examples.pptxRegular Expression Examples.pptx
Regular Expression Examples.pptx
 
context free grammars automata therory and compiler design
context free grammars automata therory and compiler designcontext free grammars automata therory and compiler design
context free grammars automata therory and compiler design
 
To lec 03
To lec 03To lec 03
To lec 03
 
Automata theory -RE to NFA-ε
Automata theory -RE to  NFA-εAutomata theory -RE to  NFA-ε
Automata theory -RE to NFA-ε
 
Automata definitions
Automata definitionsAutomata definitions
Automata definitions
 

More from maamir farooq (20)

Ooad lab1
Ooad lab1Ooad lab1
Ooad lab1
 
Php client libray
Php client librayPhp client libray
Php client libray
 
Swiftmailer
SwiftmailerSwiftmailer
Swiftmailer
 
Lect15
Lect15Lect15
Lect15
 
Lec 7
Lec 7Lec 7
Lec 7
 
Lec 6
Lec 6Lec 6
Lec 6
 
Lec 5
Lec 5Lec 5
Lec 5
 
J query 1.7 cheat sheet
J query 1.7 cheat sheetJ query 1.7 cheat sheet
J query 1.7 cheat sheet
 
Assignment
AssignmentAssignment
Assignment
 
Java script summary
Java script summaryJava script summary
Java script summary
 
Lec 3
Lec 3Lec 3
Lec 3
 
Lec 2
Lec 2Lec 2
Lec 2
 
Lec 1
Lec 1Lec 1
Lec 1
 
Css summary
Css summaryCss summary
Css summary
 
Manual of image processing lab
Manual of image processing labManual of image processing lab
Manual of image processing lab
 
Session management
Session managementSession management
Session management
 
Data management
Data managementData management
Data management
 
Content provider
Content providerContent provider
Content provider
 
Android sq lite database tutorial
Android sq lite database tutorialAndroid sq lite database tutorial
Android sq lite database tutorial
 
5. content providers
5. content providers5. content providers
5. content providers
 

Recently uploaded

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 

Recently uploaded (20)

9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 

Lesson 03

  • 1. 1 Recap Lecture-2 Kleene Star Closure, Plus operation, recursive definition of languages, INTEGER, EVEN, factorial, PALINDROME, {an bn }, languages of strings (i) ending in a, (ii) beginning and ending in same letters, (iii) containing aa or bb (iv)containing exactly aa,
  • 2. 2 Task Q) 1) Let S={ab, bb} and T={ab, bb, bbbb} Show that S* = T* [Hint S* ⊆ T* and T* ⊆ S* ] 2) Let S={ab, bb} and T={ab, bb, bbb} Show that S* ≠ T* But S* ⊂ T* Solution: Since S⊂ T , so every string belonging to S* , also belongs to T* but bbb is a string belongs to T* but does not belong to S* .
  • 3. 3 3) Let S={a, bb, bab, abaab} be a set of strings. Are abbabaabab and baabbbabbaabb in S* ? Does any word in S* have odd number of b’s? Solution: since abbabaabab can be grouped as (a)(bb) (abaab)ab , which shows that the last member of the group does not belong to S, so abbabaabab is not in S* , while baabbbabbaabb can not be grouped as members of S, hence baabbbabbaabb is not in S* . Since each string in S has even number of b’s so there is no possiblity of any string with odd number of b’s to be in S* .
  • 4. 4 Task Q1)Is there any case when S+ contains Λ? If yes then justify your answer. Solution: consider S={Λ,a} then S+ ={Λ, a, aa, aaa, …} Here Λ is in S+ as member of S. Thus Λ will be in S+ , in this case.
  • 5. 5 Q2) Prove that for any set of strings S i. (S+ )* =(S* )* Solution: In general Λ is not in S+ , while Λ does belong to S* . Obviously Λ will now be in (S+ )* , while (S* )* and S* generate the same set of strings. Hence (S+ )* =(S* )* .
  • 6. 6 Q2) continued… ii) (S+ )+ =S+ Solution: since S+ generates all possible strings that can be obtained by concatenating the strings of S, so (S+ )+ generates all possible strings that can be obtained by concatenating the strings of S+ , will not generate any new string. Hence (S+ )+ =S+
  • 7. 7 Q2) continued… iii) Is (S* )+ =(S+ )* Solution: since Λ belongs to S* ,so Λ will belong to (S* )+ as member of S* .Moreover Λ may not belong to S+ , in general, while Λ will automatically belong to (S+ )* . Hence (S* )+ =(S+ )*
  • 8. 8 Regular Expression As discussed earlier that a* generates Λ, a, aa, aaa, … and a+ generates a, aa, aaa, aaaa, …, so the language L1 = {Λ, a, aa, aaa, …} and L2 = {a, aa, aaa, aaaa, …} can simply be expressed by a* and a+ , respectively. a* and a+ are called the regular expressions (RE) for L1 and L2 respectively. Note: a+ , aa* and a* a generate L2 .
  • 9. 9 Recursive definition of Regular Expression(RE) Step 1: Every letter of Σ including Λ is a regular expression. Step 2: If r1 and r2 are regular expressions then 1.(r1 ) 2.r1 r2 3.r1 + r2 and 4. r1 * are also regular expressions.
  • 10. 10 Defining Languages (continued)… Method 3 (Regular Expressions) Consider the language L={Λ, x, xx, xxx,…} of strings, defined over Σ = {x}. We can write this language as the Kleene star closure of alphabet Σ or L=Σ* ={x}* this language can also be expressed by the regular expression x* . Similarly the language L={x, xx, xxx,…}, defined over Σ = {x}, can be expressed by the regular expression x+ .
  • 11. 11 Now consider another language L, consisting of all possible strings, defined over Σ = {a, b}. This language can also be expressed by the regular expression (a + b)* . Now consider another language L, of strings having exactly double a, defined over Σ = {a, b}, then it’s regular expression may be b* aab*
  • 12. 12 Now consider another language L, of even length, defined over Σ = {a, b}, then it’s regular expression may be ((a+b)(a+b))* Now consider another language L, of odd length, defined over Σ = {a, b}, then it’s regular expression may be (a+b)((a+b)(a+b))* or ((a+b)(a+b))* (a+b)
  • 13. 13 Remark It may be noted that a language may be expressed by more than one regular expressions, while given a regular expression there exist a unique language generated by that regular expression.
  • 14. 14 Example: Consider the language, defined over Σ={a , b} of words having at least one a, may be expressed by a regular expression (a+b)* a(a+b)* . Consider the language, defined over Σ = {a, b} of words having at least one a and one b, may be expressed by a regular expression (a+b)* a(a+b)* b(a+b)* + (a+b)* b(a+b)* a(a+b)* .
  • 15. 15 Consider the language, defined over Σ={a, b}, of words starting with double a and ending in double b then its regular expression may be aa(a+b)* bb Consider the language, defined over Σ={a, b} of words starting with a and ending in b OR starting with b and ending in a, then its regular expression may be a(a+b)* b+b(a+b)* a
  • 16. 16 TASK Consider the language, defined over Σ={a, b} of words beginning with a, then its regular expression may be a(a+b)* Consider the language, defined over Σ={a, b} of words beginning and ending in same letter, then its regular expression may be (a+b)+a(a+b)* a+b(a+b)* b
  • 17. 17 TASK Consider the language, defined over Σ={a, b} of words ending in b, then its regular expression may be (a+b)* b. Consider the language, defined over Σ={a, b} of words not ending in a, then its regular expression may be (a+b)* b + Λ. It is to be noted that this language may also be expressed by ((a+b)* b)* .
  • 18. 18 SummingUP Lecture 3 RE, Recursive definition of RE, defining languages by RE, { x}* , { x}+ , {a+b}* , Language of strings having exactly one aa, Language of strings of even length, Language of strings of odd length, RE defines unique language (as Remark), Language of strings having at least one a, Language of strings havgin at least one a and one b, Language of strings starting with aa and ending in bb, Language of strings starting with and ending in different letters.