SlideShare a Scribd company logo
Theory of Automata



            By
     Amjad Khan Khalil
     amjad@aup.edu.pk
Regular Expression Practice
Continue
   Write down the regular expression defined over Σ={a,b} where
    each string ends with double a’s or double b’s.
   Write down the regular expression defined over Σ={a,b} Where
    each string start with double b’s and end with double a’s.
   Write down the regular expression for the language defined
    over Σ={a,b} where each string have exactly one double b’s.
   Write down the regular expression for the language defined
    over Σ={a,b} where each string have exactly one triple a’s.
   Write down the regular expression defined over Σ={0,1} which
    consist of even number of 0’s and even number of 1’s.
   Write down a regular expression for the language defined over
    Σ={a,b} where each string consist of odd number of a’s and odd
    number of b’s.
Practice continue
   Find the shortest string that is in the language represented by the
    regular expression a*(ab)*b*.
   Find the shortest string that is not in the language represented by the
    regular expression a*(ab)*b*.
   Consider the language S*, where S={aa, b}
    How many words this language have of length 2? of length 3?
   Construct a regular expression defining each of the following languages
    over the alphabet Σ = {a, b}
       All strings that end in double letter
       All strings that do not end in double letter
       All words that contain exactly two b’s or exactly three b’s, not more
   Show that the following pairs of regular expressions define the same language
    over the alphabet Σ = {a, b} or not???
       (ab)*a and a(ba)*
       (a*+b*) and (a+b)*
       (a*+b*)* and (a+b)*
Practice Continue
   Write RE of strings of a and b, which
    must end on triple b’s
   Write RE of strings of a and c followed
    by 3 b’s
   Write RE of strings of a and c, followed
    by any numbers of b’s
Practice Continue
A language is defined over Σ={0,1} , you need to Write a regular
   expression for each of the following sets of binary strings.
   contains at least three consecutive 1's
   Does not contains two consecutive 0’s
   Contains at most two 0’s
   contains the substring 101
   contains the substring 1101100

   Write down the regular expression for the language defined over
    Σ={a,b} that does not contain aab
Equivalent Regular Expression
  Two or more regular expressions are said to be
   equivalent if they generate the same language.
 Exp: Write down the regular expression for the

   language defined over Σ={a,b} where each string
   ends with aa or bb.
 then
      R1= (a|b)*(aa|bb)
      R2=(a|b)*aa|(a|b)*bb
As both the above mentioned regular expression
   defined the same language so both are equivalent.
Con’t
   Now consider the following two regular expression
    R1= (a*|b*)
    R2= (a|b)*
    Then both of the regular expressions are
    equal??????????????
    The answer is NO!
    Because the R1 does not generate the string which is
    the concatenation of a and b while the R2 generate
    such string which is the concatenation of a and b.
Con’t
   If R1=(aa|bb) and R2=(a|b) then show that the
    following are equal or not?
   R1|R2
   R1.R2
   R1*
   We need to check that all the above Regular
    Expression generate the same language or
    not.
Some important identities
   ϵ.R=R. ϵ=R
   ϵ*=ϵ
   Φ*= ϵ
   R+R=R|R=R
   R*.R*=R*
   (R*)*=R*
   R+ Φ =R
   (ϵ+R)*=(ϵ|R)*=R*
   (R+R)S*=(R|R)S*=RS*
What is Regular language?
   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
    R2R1 and
    R1*( or R2*) are also regular languages.
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
   Consider the following regular expression
    R.E=(aa|ab)
    Thus the language generated by this regular
    expression is
    L={aa,ab}
    Which is a language of length 2 where each
    string start from a.
    Thus L is a regular language.
What is finite automaton.(FA)
   It is the fourth way of defining the language and can
    be defined as the collection of the following.
       Finite number of states, having one initial and having none,
        one or many final states.
        Finite set of input letters (Σ) from which input strings are
        formed.
       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.
    It should be noted that for one language there may two or more
    FA’s which all be correct but for a single FA there will be exactly
    one language.
Points to be noted
   We should take care of the following points
    while constructing an FA.
       A state may be denoted by any name.
       A transition is denoted by an arrow initiates from one stated
        and terminates on another.
       The label(letter or digit) above the arrow shows the inputs.
       If an arrow initiate from a state and terminate on the same
        state is called loop.
       The loop represent any combination of the label including
        NULL.
       An FA is also called finite state machine or transition
        diagram.
Points to be noted
   It may be noted that to indicate the initial state an
    arrow head can also be placed before that state and
    the final state can be indicated by double circle. It is
    also to be noted while expressing the FA by its
    transition diagram the labels of states are not
    necessary.
Example
   A language is defined over Σ={a,b} then
    construct a finite state machine that
    accept any combination of b’s but must
    end with a.
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
Con’t
   These transition can be expressed by
    the table called transition table as
    under:
Con’t
   The finite state machine or transition diagram
    will be as under:

The above 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)*

More Related Content

What's hot

Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2
shah zeb
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
Rabia Khalid
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
shah zeb
 
Chapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata TheoryChapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata Theory
Tsegazeab Asgedom
 
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01
hamzamughal39
 
Automata definitions
Automata definitionsAutomata definitions
Automata definitions
Sajid Marwat
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
Rabia Khalid
 
Lesson 03
Lesson 03Lesson 03
Lesson 03
maamir farooq
 
Generalized transition graphs
Generalized transition graphsGeneralized transition graphs
Generalized transition graphs
Arham Khan G
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
shah zeb
 
Lesson 04
Lesson 04Lesson 04
Lesson 12
Lesson 12Lesson 12
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
Ashu
 
Theory of computation Lec2
Theory of computation Lec2Theory of computation Lec2
Theory of computation Lec2
Arab Open University and Cairo University
 
Lesson 10
Lesson 10Lesson 10
1.1. the central concepts of automata theory
1.1. the central concepts of automata theory1.1. the central concepts of automata theory
1.1. the central concepts of automata theory
Sampath Kumar S
 
Lesson 08
Lesson 08Lesson 08
Theory of computing
Theory of computingTheory of computing
Theory of computing
Ranjan Kumar
 
Flat unit 3
Flat unit 3Flat unit 3
Flat unit 3
VenkataRaoS1
 
Lesson 09
Lesson 09Lesson 09

What's hot (20)

Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2
 
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
 
Chapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata TheoryChapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata Theory
 
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01
 
Automata definitions
Automata definitionsAutomata definitions
Automata definitions
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Lesson 03
Lesson 03Lesson 03
Lesson 03
 
Generalized transition graphs
Generalized transition graphsGeneralized transition graphs
Generalized transition graphs
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Lesson 04
Lesson 04Lesson 04
Lesson 04
 
Lesson 12
Lesson 12Lesson 12
Lesson 12
 
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
 
Theory of computation Lec2
Theory of computation Lec2Theory of computation Lec2
Theory of computation Lec2
 
Lesson 10
Lesson 10Lesson 10
Lesson 10
 
1.1. the central concepts of automata theory
1.1. the central concepts of automata theory1.1. the central concepts of automata theory
1.1. the central concepts of automata theory
 
Lesson 08
Lesson 08Lesson 08
Lesson 08
 
Theory of computing
Theory of computingTheory of computing
Theory of computing
 
Flat unit 3
Flat unit 3Flat unit 3
Flat unit 3
 
Lesson 09
Lesson 09Lesson 09
Lesson 09
 

Viewers also liked

Regular Expression
Regular ExpressionRegular Expression
Regular Expression
Bharat17485
 
Compilers midterm spring 2013 model answer
Compilers midterm spring 2013   model answerCompilers midterm spring 2013   model answer
Compilers midterm spring 2013 model answer
Arab Open University and Cairo University
 
Finite State Automata
Finite State AutomataFinite State Automata
Finite State Automata
孟賢 施
 
Advanced Regular Expressions in .NET
Advanced Regular Expressions in .NETAdvanced Regular Expressions in .NET
Advanced Regular Expressions in .NET
Patrick Delancy
 
Regular expression
Regular expressionRegular expression
Regular expression
Larry Nung
 
Compilers Final spring 2013 model answer
 Compilers Final spring 2013 model answer Compilers Final spring 2013 model answer
Compilers Final spring 2013 model answer
Arab Open University and Cairo University
 
Model answer of compilers june spring 2013
Model answer of compilers june spring 2013Model answer of compilers june spring 2013
Model answer of compilers june spring 2013
Arab Open University and Cairo University
 
Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...
Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...
Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...
Farwa Ansari
 
Question, mark scheme, examiners report and model answer jan 13
Question, mark scheme, examiners report and model answer jan 13Question, mark scheme, examiners report and model answer jan 13
Question, mark scheme, examiners report and model answer jan 13
mattbentley34
 
Lecture4 lexical analysis2
Lecture4 lexical analysis2Lecture4 lexical analysis2
Lecture4 lexical analysis2
Mahesh Kumar Chelimilla
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
Mukesh Tekwani
 
Unit 2: Excellent revision aid..a must for all students
Unit 2: Excellent revision aid..a must for all studentsUnit 2: Excellent revision aid..a must for all students
Unit 2: Excellent revision aid..a must for all students
mattbentley34
 
Regular language and Regular expression
Regular language and Regular expressionRegular language and Regular expression
Regular language and Regular expression
Animesh Chaturvedi
 
Finite automata
Finite automataFinite automata
Finite automata
ankitamakin
 

Viewers also liked (14)

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
 
Finite State Automata
Finite State AutomataFinite State Automata
Finite State Automata
 
Advanced Regular Expressions in .NET
Advanced Regular Expressions in .NETAdvanced Regular Expressions in .NET
Advanced Regular Expressions in .NET
 
Regular expression
Regular expressionRegular expression
Regular expression
 
Compilers Final spring 2013 model answer
 Compilers Final spring 2013 model answer Compilers Final spring 2013 model answer
Compilers Final spring 2013 model answer
 
Model answer of compilers june spring 2013
Model answer of compilers june spring 2013Model answer of compilers june spring 2013
Model answer of compilers june spring 2013
 
Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...
Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...
Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...
 
Question, mark scheme, examiners report and model answer jan 13
Question, mark scheme, examiners report and model answer jan 13Question, mark scheme, examiners report and model answer jan 13
Question, mark scheme, examiners report and model answer jan 13
 
Lecture4 lexical analysis2
Lecture4 lexical analysis2Lecture4 lexical analysis2
Lecture4 lexical analysis2
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Unit 2: Excellent revision aid..a must for all students
Unit 2: Excellent revision aid..a must for all studentsUnit 2: Excellent revision aid..a must for all students
Unit 2: Excellent revision aid..a must for all students
 
Regular language and Regular expression
Regular language and Regular expressionRegular language and Regular expression
Regular language and Regular expression
 
Finite automata
Finite automataFinite automata
Finite automata
 

Similar to To lec 03

Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
shah zeb
 
Regular Expression in Compiler design
Regular Expression in Compiler designRegular Expression in Compiler design
Regular Expression in Compiler design
Riazul Islam
 
5.ppt
5.ppt5.ppt
Hw2 2017-spring
Hw2 2017-springHw2 2017-spring
Hw2 2017-spring
奕安 陳
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
RaviAr5
 
Problem set1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Problem set1 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurProblem set1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Problem set1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Vivekananda Samiti
 
Ch2 automata.pptx
Ch2 automata.pptxCh2 automata.pptx
Ch2 automata.pptx
TemesgenAzezew
 
Hwsoln03 toc
Hwsoln03 tocHwsoln03 toc
Hwsoln03 toc
parmeet834
 
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
 
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
 
Problemes chap1 toc
Problemes chap1 tocProblemes chap1 toc
Problemes chap1 toc
parmeet834
 
L_2_apl.pptx
L_2_apl.pptxL_2_apl.pptx
L_2_apl.pptx
ReehaamMalikArain
 
Lesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptLesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.ppt
ashja1
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
A. S. M. Shafi
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
Lesson 02Lesson 02
Lesson 02
maamir farooq
 
1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression
Sampath Kumar S
 
PART A.doc
PART A.docPART A.doc
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
bushraphd2022
 
Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........
NaumanAli215439
 

Similar to To lec 03 (20)

Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
Regular Expression in Compiler design
Regular Expression in Compiler designRegular Expression in Compiler design
Regular Expression in Compiler design
 
5.ppt
5.ppt5.ppt
5.ppt
 
Hw2 2017-spring
Hw2 2017-springHw2 2017-spring
Hw2 2017-spring
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
 
Problem set1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Problem set1 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurProblem set1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Problem set1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
Ch2 automata.pptx
Ch2 automata.pptxCh2 automata.pptx
Ch2 automata.pptx
 
Hwsoln03 toc
Hwsoln03 tocHwsoln03 toc
Hwsoln03 toc
 
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...
 
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
 
Problemes chap1 toc
Problemes chap1 tocProblemes chap1 toc
Problemes chap1 toc
 
L_2_apl.pptx
L_2_apl.pptxL_2_apl.pptx
L_2_apl.pptx
 
Lesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptLesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.ppt
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression
 
PART A.doc
PART A.docPART A.doc
PART A.doc
 
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
 
Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........
 

More from Hasam Panezai

Introduction to android basics
Introduction to android basicsIntroduction to android basics
Introduction to android basics
Hasam Panezai
 
Cognitive architecture
Cognitive architectureCognitive architecture
Cognitive architecture
Hasam Panezai
 
cog arch
cog archcog arch
cog arch
Hasam Panezai
 
Lecture application layer
Lecture application layerLecture application layer
Lecture application layer
Hasam Panezai
 
Lecture 1 4
Lecture 1 4Lecture 1 4
Lecture 1 4
Hasam Panezai
 
White box
White boxWhite box
White box
Hasam Panezai
 
Software testing & its technology
Software testing & its technologySoftware testing & its technology
Software testing & its technology
Hasam Panezai
 
Lecture (coa)
Lecture (coa)Lecture (coa)
Lecture (coa)
Hasam Panezai
 

More from Hasam Panezai (8)

Introduction to android basics
Introduction to android basicsIntroduction to android basics
Introduction to android basics
 
Cognitive architecture
Cognitive architectureCognitive architecture
Cognitive architecture
 
cog arch
cog archcog arch
cog arch
 
Lecture application layer
Lecture application layerLecture application layer
Lecture application layer
 
Lecture 1 4
Lecture 1 4Lecture 1 4
Lecture 1 4
 
White box
White boxWhite box
White box
 
Software testing & its technology
Software testing & its technologySoftware testing & its technology
Software testing & its technology
 
Lecture (coa)
Lecture (coa)Lecture (coa)
Lecture (coa)
 

Recently uploaded

Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 

Recently uploaded (20)

Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 

To lec 03

  • 1. Theory of Automata By Amjad Khan Khalil amjad@aup.edu.pk
  • 2. Regular Expression Practice Continue  Write down the regular expression defined over Σ={a,b} where each string ends with double a’s or double b’s.  Write down the regular expression defined over Σ={a,b} Where each string start with double b’s and end with double a’s.  Write down the regular expression for the language defined over Σ={a,b} where each string have exactly one double b’s.  Write down the regular expression for the language defined over Σ={a,b} where each string have exactly one triple a’s.  Write down the regular expression defined over Σ={0,1} which consist of even number of 0’s and even number of 1’s.  Write down a regular expression for the language defined over Σ={a,b} where each string consist of odd number of a’s and odd number of b’s.
  • 3. Practice continue  Find the shortest string that is in the language represented by the regular expression a*(ab)*b*.  Find the shortest string that is not in the language represented by the regular expression a*(ab)*b*.  Consider the language S*, where S={aa, b} How many words this language have of length 2? of length 3?  Construct a regular expression defining each of the following languages over the alphabet Σ = {a, b}  All strings that end in double letter  All strings that do not end in double letter  All words that contain exactly two b’s or exactly three b’s, not more  Show that the following pairs of regular expressions define the same language over the alphabet Σ = {a, b} or not???  (ab)*a and a(ba)*  (a*+b*) and (a+b)*  (a*+b*)* and (a+b)*
  • 4. Practice Continue  Write RE of strings of a and b, which must end on triple b’s  Write RE of strings of a and c followed by 3 b’s  Write RE of strings of a and c, followed by any numbers of b’s
  • 5. Practice Continue A language is defined over Σ={0,1} , you need to Write a regular expression for each of the following sets of binary strings.  contains at least three consecutive 1's  Does not contains two consecutive 0’s  Contains at most two 0’s  contains the substring 101  contains the substring 1101100  Write down the regular expression for the language defined over Σ={a,b} that does not contain aab
  • 6. Equivalent Regular Expression  Two or more regular expressions are said to be equivalent if they generate the same language.  Exp: Write down the regular expression for the language defined over Σ={a,b} where each string ends with aa or bb. then R1= (a|b)*(aa|bb) R2=(a|b)*aa|(a|b)*bb As both the above mentioned regular expression defined the same language so both are equivalent.
  • 7. Con’t  Now consider the following two regular expression R1= (a*|b*) R2= (a|b)* Then both of the regular expressions are equal?????????????? The answer is NO! Because the R1 does not generate the string which is the concatenation of a and b while the R2 generate such string which is the concatenation of a and b.
  • 8. Con’t  If R1=(aa|bb) and R2=(a|b) then show that the following are equal or not?  R1|R2  R1.R2  R1*  We need to check that all the above Regular Expression generate the same language or not.
  • 9. Some important identities  ϵ.R=R. ϵ=R  ϵ*=ϵ  Φ*= ϵ  R+R=R|R=R  R*.R*=R*  (R*)*=R*  R+ Φ =R  (ϵ+R)*=(ϵ|R)*=R*  (R+R)S*=(R|R)S*=RS*
  • 10. What is Regular language?  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 R2R1 and R1*( or R2*) are also regular languages.
  • 11. 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)*
  • 12. All finite languages are regular  Consider the following regular expression R.E=(aa|ab) Thus the language generated by this regular expression is L={aa,ab} Which is a language of length 2 where each string start from a. Thus L is a regular language.
  • 13. What is finite automaton.(FA)  It is the fourth way of defining the language and can be defined as the collection of the following.  Finite number of states, having one initial and having none, one or many final states.  Finite set of input letters (Σ) from which input strings are formed.  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. It should be noted that for one language there may two or more FA’s which all be correct but for a single FA there will be exactly one language.
  • 14. Points to be noted  We should take care of the following points while constructing an FA.  A state may be denoted by any name.  A transition is denoted by an arrow initiates from one stated and terminates on another.  The label(letter or digit) above the arrow shows the inputs.  If an arrow initiate from a state and terminate on the same state is called loop.  The loop represent any combination of the label including NULL.  An FA is also called finite state machine or transition diagram.
  • 15. Points to be noted  It may be noted that to indicate the initial state an arrow head can also be placed before that state and the final state can be indicated by double circle. It is also to be noted while expressing the FA by its transition diagram the labels of states are not necessary.
  • 16. Example  A language is defined over Σ={a,b} then construct a finite state machine that accept any combination of b’s but must end with a.
  • 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. Con’t  These transition can be expressed by the table called transition table as under:
  • 19. Con’t  The finite state machine or transition diagram will be as under: The above 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)*