SlideShare a Scribd company logo
DMI-ST. JOHN THE BAPTIST UNIVERSITY
LILONGWE, MALAWI
Module Code: 055CS62
Subject Name: Theory of computation
Unit II Detail Notes
School of Computer Science
Module Teacher: Fanny Chatola
Syllabus
Operators of RE, Building RE, Precedence of operators, Algebraic laws for RE, Conversions: NFA to DFA, RE to DFA
Conversions: RE to DFA, DFA to RE Conversions: State/loop elimination, Arden‘s theorem Properties of Regular
Languages: Pumping Lemma for Regular languages, Closure and Decision properties. Case Study: RE in text search
and replace
Regular Expressions: Formal Definition
We construct REs from primitive constituents (basic elements) by repeatedly applying
certain recursive rules as given below. (In the definition)
Definition : Let S be an alphabet. The regular expressions are defined recursively as
follows.
iii) , a is RE.
These are called primitive regular expression i.e. Primitive Constituents
Recursive Step :
I
are REs over, then so are
i)
ii)
iii)
iv)
and
Closure : r is RE over only if it can be obtained from the basis elements (Primitive
REs) by a finite no of applications of the recursive step (given in 2).
Language described by REs : Each describes a language (or a language is associated
with every RE). We will see later that REs are used to attribute regular languages.
Notation : If r is a RE over some alphabet then L(r) is the language associate with r . We
can define the language L(r) associated with (or described by) a REs as follows.
1. is the RE describing the empty language i.e. L(
2. is a RE describing the language { } i.e. L( ) = { } .
3. , a is a RE denoting the language {a} i.e . L(a) = {a} .
4. If and are REs denoting language L( ) and L( ) respectively, then
i) is a regular expression denoting the language L( ) ∪ L( )
ii) is a regular expression denoting the language L( )
iii) is a regular expression denoting the language iv) ( ) is a
regular expression denoting the language L(()) = L( )
Example : Consider the RE (0*(0+1)). Thus the language denoted by the RE is
L(0*(0+1)) = L(0*) L(0+1) .......................by 4(ii)
= L(0)*L(0) ∪ L(1)
= { , 0,00,000,. } {0} {1}
= { , 0,00,000,........} {0,1}
= {0, 00, 000, 0000,..........,1, 01, 001, 0001,...............}
Precedence Rule
Consider the RE ab + c. The language described by the RE can be thought of either
L(a)L(b+c) or L(ab) L(c) as provided by the rules (of languages described by REs)
given already. But these two represents two different languages lending to
ambiguity. To remove this ambiguity we can either
1) Use fully parenthesized expression- (cumbersome) or
) = .
) = L(
)=L( ) L(
2) Use a set of precedence rules to evaluate the options of REs in some order.
Like other algebras mod in mathematics.
For REs, the order of precedence for the operators is as follows:
i) The star operator precedes concatenation and concatenation precedes
union (+) operator.
ii) It is also important to note that concatenation & union (+) operators are
associative and union operation is commutative.
Using these precedence rule, we find that the RE ab+c represents the language
L(ab) L(c) i.e. it should be grouped as ((ab)+c).
We can, of course change the order of precedence by using L(0*(0+1)) = L(0*) L(0+1) .......................by
4(ii)
= L(0)*L(0) L(1)
= { , 0,00,000,........} {0} {1}
= { , 0,00,000,........} {0,1}
= {0, 00, 000, 0000,..........,1, 01, 001, 0001,...............}
Precedence Rule
Consider the RE ab + c. The language described by the RE can be thought of either L(a)L(b+c) or
L(ab) L(c) as provided by the rules (of languages described by REs) given already. But these two
represents two different languages lending to ambiguity. To remove this ambiguity we can either
1) Use fully parenthesized expression- (cumbersome) or
2) Use a set of precedence rules to evaluate the options of REs in some order. Like other algebras mod in
mathematics.
For REs, the order of precedence for the operators is as follows:
i) The star operator precedes concatenation and concatenation precedes union (+) operator.
ii) It is also important to note that concatenation & union (+) operators are associative and union operation is
commutative.
Using these precedence rule, we find that the RE ab+c represents the language L(ab) L(c) i.e. it should be
grouped as ((ab)+c).
We can, of course change the order of precedence by using parentheses. For example, the language
represented by the RE a(b+c) is L(a)L(b+c).
theory of computation notes for school of engineering
1. is
theory of computation notes for school of engineering
theory of computation notes for school of engineering
PUMPING LEMMA FOR REGULAR LANGUAGES
 This is a basic and important theorem used for checking whether given string is accepted by regular
expression or not.
CLOSURE AND DECISION PROPERTIES
theory of computation notes for school of engineering
theory of computation notes for school of engineering
theory of computation notes for school of engineering
theory of computation notes for school of engineering
CASE STUDY: RE in text search and replace
When u want to search a specific pattern of text, use regular expressions. They can help you in pattern
matching, parsing, filtering of results, and so on. Once you learn the regex syntax, you can use it for almost
any language.

More Related Content

PDF
Formal Languages and Automata Theory unit 2
PPTX
fullunit2-220307090026 (1) theory of computation.pptx
PPTX
Regular expressions
PPTX
L_2_apl.pptx
PPTX
Chapter Two - Regular Expression and Regular languages.pptx
PDF
Lecture: Regular Expressions and Regular Languages
PPTX
Automata theory -RE to NFA-ε
PDF
Chapter 3 REGULAR EXPRESSION.pdf
Formal Languages and Automata Theory unit 2
fullunit2-220307090026 (1) theory of computation.pptx
Regular expressions
L_2_apl.pptx
Chapter Two - Regular Expression and Regular languages.pptx
Lecture: Regular Expressions and Regular Languages
Automata theory -RE to NFA-ε
Chapter 3 REGULAR EXPRESSION.pdf

Similar to theory of computation notes for school of engineering (20)

PDF
Unit ii
DOCX
UNIT_-_II.docx
DOCX
Regular Expression .docx
PPTX
Mod 2_RegularExpressions.pptx
PPT
4_Regular_Expressionssssssssssassssss.ppt
PPTX
13000120020_A.pptx
PPTX
Regular Expression in Compiler design
DOC
PPTX
AUTOMATA AUTOMATA Automata4Chapter3.pptx
PPTX
BCS503 TOC Module 2 PPT.pptx VTU academic Year 2024-25 ODD SEM
PPT
Regular expressions-Theory of computation
PPTX
Chapter 4_Regular Expressions in Automata.pptx
PPTX
Unit-2. Regular Expressions and Languages.pptx
DOCX
unit 2 part b.docx
PPTX
Regular Expressions here we have .pptx
PPTX
Unit2 Toc.pptx
PPT
Regular_Expresssions_pptsforreference.ppt
PPT
1LECTURE 8 Regular_Expressions.ppt
PPT
3-regular_expressions_and_languages (1).ppt
PPT
3-regular_expressions_and_languages.ppt 1
Unit ii
UNIT_-_II.docx
Regular Expression .docx
Mod 2_RegularExpressions.pptx
4_Regular_Expressionssssssssssassssss.ppt
13000120020_A.pptx
Regular Expression in Compiler design
AUTOMATA AUTOMATA Automata4Chapter3.pptx
BCS503 TOC Module 2 PPT.pptx VTU academic Year 2024-25 ODD SEM
Regular expressions-Theory of computation
Chapter 4_Regular Expressions in Automata.pptx
Unit-2. Regular Expressions and Languages.pptx
unit 2 part b.docx
Regular Expressions here we have .pptx
Unit2 Toc.pptx
Regular_Expresssions_pptsforreference.ppt
1LECTURE 8 Regular_Expressions.ppt
3-regular_expressions_and_languages (1).ppt
3-regular_expressions_and_languages.ppt 1
Ad

More from FIONACHATOLA (18)

PPTX
ARTIFICIAL INTELLIGENCE CONSTRAINT SATISFACTION PROBLEMS (CSPS) AND MINI-MAX....
PPT
ARTIFICAIL INTELLIGENCE AO ALGORITHMS NOTES
PPTX
business intelligence and analytics notes
PPTX
VOICE OVER INTERNET PROTOCOL(VOIP) notes
PPTX
PC HARWARE AND TROUBLE SHOOTING INTRODUCTION
PDF
Unit I Data structure and algorithms notes
PDF
UG_B.Sc._Information Technology_129 14_Office Automation Lab.pdf
PPT
computer Hardware and trouble shooting Basics
PPTX
Introduction to Email, internet protocols
PPTX
Introduction to Internet Protocol ADDRESS.pptx
PPTX
introduction to OSI MODEL-WPS Office.pptx
PDF
computer system organization and architecture
PDF
computer fundamentals -e- notes for IT & CS
DOCX
theory of computation notes for school of engineering
DOCX
theory of computation notes for school of engineering
DOCX
theory of computation notes for school of engineering
DOCX
theory of computation notes for school of engineering
DOCX
in computer data structures and algorithms
ARTIFICIAL INTELLIGENCE CONSTRAINT SATISFACTION PROBLEMS (CSPS) AND MINI-MAX....
ARTIFICAIL INTELLIGENCE AO ALGORITHMS NOTES
business intelligence and analytics notes
VOICE OVER INTERNET PROTOCOL(VOIP) notes
PC HARWARE AND TROUBLE SHOOTING INTRODUCTION
Unit I Data structure and algorithms notes
UG_B.Sc._Information Technology_129 14_Office Automation Lab.pdf
computer Hardware and trouble shooting Basics
Introduction to Email, internet protocols
Introduction to Internet Protocol ADDRESS.pptx
introduction to OSI MODEL-WPS Office.pptx
computer system organization and architecture
computer fundamentals -e- notes for IT & CS
theory of computation notes for school of engineering
theory of computation notes for school of engineering
theory of computation notes for school of engineering
theory of computation notes for school of engineering
in computer data structures and algorithms
Ad

Recently uploaded (20)

PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Welding lecture in detail for understanding
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Construction Project Organization Group 2.pptx
PPT
Project quality management in manufacturing
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Internet of Things (IOT) - A guide to understanding
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
CH1 Production IntroductoryConcepts.pptx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
Operating System & Kernel Study Guide-1 - converted.pdf
Lecture Notes Electrical Wiring System Components
Welding lecture in detail for understanding
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Construction Project Organization Group 2.pptx
Project quality management in manufacturing
CYBER-CRIMES AND SECURITY A guide to understanding
Internet of Things (IOT) - A guide to understanding

theory of computation notes for school of engineering

  • 1. DMI-ST. JOHN THE BAPTIST UNIVERSITY LILONGWE, MALAWI Module Code: 055CS62 Subject Name: Theory of computation Unit II Detail Notes School of Computer Science Module Teacher: Fanny Chatola
  • 2. Syllabus Operators of RE, Building RE, Precedence of operators, Algebraic laws for RE, Conversions: NFA to DFA, RE to DFA Conversions: RE to DFA, DFA to RE Conversions: State/loop elimination, Arden‘s theorem Properties of Regular Languages: Pumping Lemma for Regular languages, Closure and Decision properties. Case Study: RE in text search and replace
  • 3. Regular Expressions: Formal Definition We construct REs from primitive constituents (basic elements) by repeatedly applying certain recursive rules as given below. (In the definition) Definition : Let S be an alphabet. The regular expressions are defined recursively as follows. iii) , a is RE. These are called primitive regular expression i.e. Primitive Constituents Recursive Step : I are REs over, then so are i) ii) iii) iv) and
  • 4. Closure : r is RE over only if it can be obtained from the basis elements (Primitive REs) by a finite no of applications of the recursive step (given in 2). Language described by REs : Each describes a language (or a language is associated with every RE). We will see later that REs are used to attribute regular languages. Notation : If r is a RE over some alphabet then L(r) is the language associate with r . We can define the language L(r) associated with (or described by) a REs as follows. 1. is the RE describing the empty language i.e. L( 2. is a RE describing the language { } i.e. L( ) = { } . 3. , a is a RE denoting the language {a} i.e . L(a) = {a} . 4. If and are REs denoting language L( ) and L( ) respectively, then i) is a regular expression denoting the language L( ) ∪ L( ) ii) is a regular expression denoting the language L( ) iii) is a regular expression denoting the language iv) ( ) is a regular expression denoting the language L(()) = L( ) Example : Consider the RE (0*(0+1)). Thus the language denoted by the RE is L(0*(0+1)) = L(0*) L(0+1) .......................by 4(ii) = L(0)*L(0) ∪ L(1) = { , 0,00,000,. } {0} {1} = { , 0,00,000,........} {0,1} = {0, 00, 000, 0000,..........,1, 01, 001, 0001,...............} Precedence Rule Consider the RE ab + c. The language described by the RE can be thought of either L(a)L(b+c) or L(ab) L(c) as provided by the rules (of languages described by REs) given already. But these two represents two different languages lending to ambiguity. To remove this ambiguity we can either 1) Use fully parenthesized expression- (cumbersome) or ) = . ) = L( )=L( ) L(
  • 5. 2) Use a set of precedence rules to evaluate the options of REs in some order. Like other algebras mod in mathematics. For REs, the order of precedence for the operators is as follows: i) The star operator precedes concatenation and concatenation precedes union (+) operator. ii) It is also important to note that concatenation & union (+) operators are associative and union operation is commutative. Using these precedence rule, we find that the RE ab+c represents the language L(ab) L(c) i.e. it should be grouped as ((ab)+c). We can, of course change the order of precedence by using L(0*(0+1)) = L(0*) L(0+1) .......................by 4(ii) = L(0)*L(0) L(1) = { , 0,00,000,........} {0} {1} = { , 0,00,000,........} {0,1} = {0, 00, 000, 0000,..........,1, 01, 001, 0001,...............} Precedence Rule Consider the RE ab + c. The language described by the RE can be thought of either L(a)L(b+c) or L(ab) L(c) as provided by the rules (of languages described by REs) given already. But these two represents two different languages lending to ambiguity. To remove this ambiguity we can either 1) Use fully parenthesized expression- (cumbersome) or 2) Use a set of precedence rules to evaluate the options of REs in some order. Like other algebras mod in mathematics. For REs, the order of precedence for the operators is as follows: i) The star operator precedes concatenation and concatenation precedes union (+) operator. ii) It is also important to note that concatenation & union (+) operators are associative and union operation is commutative. Using these precedence rule, we find that the RE ab+c represents the language L(ab) L(c) i.e. it should be grouped as ((ab)+c). We can, of course change the order of precedence by using parentheses. For example, the language represented by the RE a(b+c) is L(a)L(b+c).
  • 10. PUMPING LEMMA FOR REGULAR LANGUAGES  This is a basic and important theorem used for checking whether given string is accepted by regular expression or not.
  • 11. CLOSURE AND DECISION PROPERTIES
  • 16. CASE STUDY: RE in text search and replace When u want to search a specific pattern of text, use regular expressions. They can help you in pattern matching, parsing, filtering of results, and so on. Once you learn the regex syntax, you can use it for almost any language.