SlideShare a Scribd company logo
1 of 21
1
Recap 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.
2
Task
Determine the RE of the language, defined over
Σ={a, b} of words beginning with a.
Solution:
The required RE may be a(a+b)*
Determine the RE of the language, defined over
Σ={a, b} of words beginning with and ending in
same letter.
Solution:
The required RE may be (a+b)+a(a+b)*
a+b(a+b)*
b
3
Task Continued …
Determine the RE of the language, defined over
Σ={a, b} of words ending in b.
Solution:
The required RE may be
(a+b)*
b.
Determine the RE of the language, defined over
Σ={a, b} of words not ending in a.
Solution: The required RE may be
(a+b)*
b + Λ Or ((a+b)*
b)*
4
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))*
5
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.
6
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.
7
Note
If r1
=(aa + bb) and r2
=( a + b) then
1. r1
+r2
=(aa + bb) + (a + b)
2. r1
r2
=(aa + bb) (a + b)
=(aaa + aab + bba + bbb)
3. (r1
)*
=(aa + bb)*
8
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
,
r1
r2
( or r2
r1
) and r1
*
( or r2
*
) are also regular
languages.
9
Note
It is to be noted that if L1
and L2
are expressed by r1
and r2
,
respectively then the language expressed by
1) r1
+ r2
, is the language L1
+ L2
or L1
U L2
2) r1
r2,
, is the language L1
L2
, 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.
10
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 r1
r2
, 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)*
11
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.
12
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).
13
Introduction to Finite
Automaton
Consider the following game board that contains
64 boxes
14
Finite Automaton Continued …
There are some pieces of paper. Some are of
white colour while others are of black color. The
number of pieces of paper are 64 or less. The
possible arrangements under which these
pieces of paper can be placed in the boxes, are
finite. To start the game, one of the
arrangements is supposed to be initial
arrangement. There is a pair of dice that can
generate the numbers 2,3,4,…12 . For each
number generated, a unique arrangement is
associated among the possible arrangements.
15
Finite Automaton Continued …
It shows that the total number of transition rules
of arrangement are finite. One and more
arrangements can be supposed to be the
winning arrangement. It can be observed that
the winning of the game depends on the
sequence in which the numbers are generated.
This structure of game can be considered to be
a finite automaton.
16
Defining Languages (continued)…
Method 4 (Finite Automaton)
Definition:
A Finite automaton (FA), is a collection of the
followings
1) Finite number of states, having one initial and some
(maybe none) final states.
2) Finite set of input letters (Σ) from which input strings
are formed.
3) Finite set of transitions i.e. for each state and for
each input letter there is a transition showing how to
move from one state to another.
17
Example
Σ = {a,b}
States: x, y, z where x is an initial state and z is final
state.
Transitions:
1. At state x reading a go to state z,
2. At state x reading b go to state y,
3. At state y reading a, b go to state y
4. At state z reading a, b go to state z
18
Example Continued …
These transitions can be expressed by the
following table called transition table
Old States New States
Reading a Reading b
x - z y
y y y
z + z z
19
Note
It may be noted that the information of an FA,
given in the previous table, can also be depicted
by the following diagram, called the transition
diagram, of the given FA
y
a
x –
b
Z+
a,b
a,b
20
Remark
The previous transition diagram is an FA
accepting the language of strings, defined over
Σ={a, b}, starting with a. It may be noted that
this language may be expressed by the regular
expression
a (a + b)*
21
Summing Up
Regular expression of EVEN-EVEN language,
Difference between a* + b* and (a+b)*,
Equivalent regular expressions; sum, product
and closure of regular expressions; regular
languages, finite languages are regular,
introduction to finite automaton, definition of FA,
transition table, transition diagram

More Related Content

What's hot (20)

Lesson 10
Lesson 10Lesson 10
Lesson 10
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lesson 12
Lesson 12Lesson 12
Lesson 12
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Lesson 08
Lesson 08Lesson 08
Lesson 08
 
Language
LanguageLanguage
Language
 
Context Free Grammar
Context Free GrammarContext Free Grammar
Context Free Grammar
 
FInite Automata
FInite AutomataFInite Automata
FInite Automata
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Lesson 11
Lesson 11Lesson 11
Lesson 11
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Lesson 09
Lesson 09Lesson 09
Lesson 09
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
Chapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata TheoryChapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata Theory
 
Regular Expression Examples.pptx
Regular Expression Examples.pptxRegular Expression Examples.pptx
Regular Expression Examples.pptx
 
Automata theory
Automata theoryAutomata theory
Automata theory
 

Similar to Lesson 04

Lesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptLesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptashja1
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal languageRabia Khalid
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxRaviAr5
 
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
 
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...parmeet834
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal languageRabia Khalid
 
Hw2 2017-spring
Hw2 2017-springHw2 2017-spring
Hw2 2017-spring奕安 陳
 
Lesson 01.ppt
Lesson 01.pptLesson 01.ppt
Lesson 01.pptImXaib
 
Handout Regular expression with examples and lecture
Handout Regular expression with examples  and lecture Handout Regular expression with examples  and lecture
Handout Regular expression with examples and lecture mariajan8
 
theory of computation notes. introduction and mcq points
theory of computation notes. introduction and mcq pointstheory of computation notes. introduction and mcq points
theory of computation notes. introduction and mcq pointsbushraphd2022
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 

Similar to Lesson 04 (20)

To lec 03
To lec 03To lec 03
To lec 03
 
Lesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptLesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.ppt
 
L_2_apl.pptx
L_2_apl.pptxL_2_apl.pptx
L_2_apl.pptx
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
 
theory of computation lecture 02
theory of computation lecture 02theory of computation lecture 02
theory of computation lecture 02
 
Lex analysis
Lex analysisLex analysis
Lex analysis
 
5.ppt
5.ppt5.ppt
5.ppt
 
Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........
 
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
 
Hwsoln03 toc
Hwsoln03 tocHwsoln03 toc
Hwsoln03 toc
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Hw2 2017-spring
Hw2 2017-springHw2 2017-spring
Hw2 2017-spring
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
UNIT_-_II.docx
UNIT_-_II.docxUNIT_-_II.docx
UNIT_-_II.docx
 
Lesson 01.ppt
Lesson 01.pptLesson 01.ppt
Lesson 01.ppt
 
Handout Regular expression with examples and lecture
Handout Regular expression with examples  and lecture Handout Regular expression with examples  and lecture
Handout Regular expression with examples and lecture
 
Lesson 09.ppt
Lesson 09.pptLesson 09.ppt
Lesson 09.ppt
 
theory of computation notes. introduction and mcq points
theory of computation notes. introduction and mcq pointstheory of computation notes. introduction and mcq points
theory of computation notes. introduction and mcq points
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 

Recently uploaded

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 

Recently uploaded (20)

Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 

Lesson 04

  • 1. 1 Recap 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.
  • 2. 2 Task Determine the RE of the language, defined over Σ={a, b} of words beginning with a. Solution: The required RE may be a(a+b)* Determine the RE of the language, defined over Σ={a, b} of words beginning with and ending in same letter. Solution: The required RE may be (a+b)+a(a+b)* a+b(a+b)* b
  • 3. 3 Task Continued … Determine the RE of the language, defined over Σ={a, b} of words ending in b. Solution: The required RE may be (a+b)* b. Determine the RE of the language, defined over Σ={a, b} of words not ending in a. Solution: The required RE may be (a+b)* b + Λ Or ((a+b)* b)*
  • 4. 4 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))*
  • 5. 5 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.
  • 6. 6 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.
  • 7. 7 Note If r1 =(aa + bb) and r2 =( a + b) then 1. r1 +r2 =(aa + bb) + (a + b) 2. r1 r2 =(aa + bb) (a + b) =(aaa + aab + bba + bbb) 3. (r1 )* =(aa + bb)*
  • 8. 8 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 , r1 r2 ( or r2 r1 ) and r1 * ( or r2 * ) are also regular languages.
  • 9. 9 Note It is to be noted that if L1 and L2 are expressed by r1 and r2 , respectively then the language expressed by 1) r1 + r2 , is the language L1 + L2 or L1 U L2 2) r1 r2, , is the language L1 L2 , 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.
  • 10. 10 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 r1 r2 , 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)*
  • 11. 11 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.
  • 12. 12 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).
  • 13. 13 Introduction to Finite Automaton Consider the following game board that contains 64 boxes
  • 14. 14 Finite Automaton Continued … There are some pieces of paper. Some are of white colour while others are of black color. The number of pieces of paper are 64 or less. The possible arrangements under which these pieces of paper can be placed in the boxes, are finite. To start the game, one of the arrangements is supposed to be initial arrangement. There is a pair of dice that can generate the numbers 2,3,4,…12 . For each number generated, a unique arrangement is associated among the possible arrangements.
  • 15. 15 Finite Automaton Continued … It shows that the total number of transition rules of arrangement are finite. One and more arrangements can be supposed to be the winning arrangement. It can be observed that the winning of the game depends on the sequence in which the numbers are generated. This structure of game can be considered to be a finite automaton.
  • 16. 16 Defining Languages (continued)… Method 4 (Finite Automaton) Definition: A Finite automaton (FA), is a collection of the followings 1) Finite number of states, having one initial and some (maybe none) final states. 2) Finite set of input letters (Σ) from which input strings are formed. 3) Finite set of transitions i.e. for each state and for each input letter there is a transition showing how to move from one state to another.
  • 17. 17 Example Σ = {a,b} States: x, y, z where x is an initial state and z is final state. Transitions: 1. At state x reading a go to state z, 2. At state x reading b go to state y, 3. At state y reading a, b go to state y 4. At state z reading a, b go to state z
  • 18. 18 Example Continued … These transitions can be expressed by the following table called transition table Old States New States Reading a Reading b x - z y y y y z + z z
  • 19. 19 Note It may be noted that the information of an FA, given in the previous table, can also be depicted by the following diagram, called the transition diagram, of the given FA y a x – b Z+ a,b a,b
  • 20. 20 Remark The previous transition diagram is an FA accepting the language of strings, defined over Σ={a, b}, starting with a. It may be noted that this language may be expressed by the regular expression a (a + b)*
  • 21. 21 Summing Up Regular expression of EVEN-EVEN language, Difference between a* + b* and (a+b)*, Equivalent regular expressions; sum, product and closure of regular expressions; regular languages, finite languages are regular, introduction to finite automaton, definition of FA, transition table, transition diagram