SlideShare a Scribd company logo
1 of 46
Regular Expressions
Automaton
• An automaton is a finite representation of a formal language
that may be an infinite set.
Graphs Representing State Machines
• Ex
• Λ – x represents the set of all letters except x
• A word “abstemious” can reach to the accepting state
Graphs Representing State Machines
• we can design a program by first designing the graph, and
then mechanically translating the graph into a program
• At previous Ex …
• Boolean testWord(char *p){
• If (findChar(&p, ‘a’))
• If (findChar(&p, ‘e’))
• If (findChar(&p, ‘i’))
• If (findChar(&p, ‘o’))
• If (findChar(&p, ‘u’)) return TRUE;
• return FALSE }
Graphs Representing State Machines
• we can design a program by first designing the graph, and
then mechanically translating the graph into a program
• At previous Ex …
• Boolean testWord(char *p){
• If (findChar(&p, ‘a’))
• If (findChar(&p, ‘e’))
• If (findChar(&p, ‘i’))
• If (findChar(&p, ‘o’))
• If (findChar(&p, ‘u’)) return TRUE;
• return FALSE }
This function finds desired
character, and points the next
character, and returns TRUE.
Otherwise, returns FALSE.
Graphs Representing State Machines
• we can design a program by first designing the graph, and
then mechanically translating the graph into a program
• At previous Ex …
• Boolean testWord(char *p){
• If (findChar(&p, ‘a’))
• If (findChar(&p, ‘e’))
• If (findChar(&p, ‘i’))
• If (findChar(&p, ‘o’))
• If (findChar(&p, ‘u’)) return TRUE;
• return FALSE }
Ex) think a input “abstemious”
It leads to TRUE!
Deterministic and Nondeterministic
Automata
• Programs cannot go to two places(states) at once
Deterministic and Nondeterministic
Automata
• Deterministic Automataon vs Nondeterminsitc Automaton
vs
Deterministic and Nondeterministic
Automata
• Deterministic Automataon vs Nondeterminsitc Automaton
vs
Given an input ‘m’,
It can go to state 0 and
1 at the same time
Non programmableprogrammable
From Nondeterminism to Determinism
• We say N and D are equivalent if they accept the same set of
input string
• By constructing an equivalent deterministic automaton, we
can convert nondeterministic automaton into deterministic
automaton.
• How? Induction, or Algorithmic way
From Nondeterminism to Determinism
From Nondeterminism to Determinism
From Nondeterminism to Determinism
The Subset Construction
S is the Subset Construction,
where D is determinism
N is nondeterminism
The Subset Construction
Yet there is no guarantee that the
deterministic automaton will be small
because 𝑘-sate nondeterministic
automaton could wind up being
converted to a deterministic
automaton with at most 2 𝑘
states.
Minimization of Automata
• One of the issues concerning automata, especially when they
are used to design circuits, is how few states are needed to
perform a given task.
• If states s and t are equivalent, we can merge s and t into a
single state
Regular Expressions
• Regular Expressions are algebraic way to define patterns
• Operands
• A character 𝒙 be denoted by that character in boldface
• The symbol ε denotes the 𝑒𝑚𝑝𝑡𝑦 𝑠𝑡𝑟𝑖𝑛𝑔
• The symbol ∅ denotes the 𝑒𝑚𝑝𝑡𝑦 𝑠𝑒𝑡 𝑜𝑓 𝑠𝑡𝑟𝑖𝑛𝑔
• A variable whose value can be any pattern defined by a regular
expression
Regular Expressions
• For regular expressions, the value of each expression is a
pattern consisting of a set of strings often called a language
• The language denoted by a regular expression 𝐸 will be referred to
as 𝐿(𝐸)
• The languages of the atomic operands
• If 𝒙 is any character, the regular expression 𝒙 stands for the
language 𝐿 𝒙 = {𝑥}
• 𝐿 ε = ε
• 𝐿 ∅ = ∅
• A variable whose value can be any pattern defined by a regular
expression
Operators of Regular Expressions
• Suppose that 𝑅, 𝑆 are two regular expressions
• Union
• 𝑅 | 𝑆 denotes the union of the languages that 𝑅 and 𝑆 denote
• That is, 𝐿 𝑅 𝑆) = 𝐿 𝑅 ∪ L S
• Concatenation
• 𝐿 𝑅𝑆 , the language denoted by 𝑅𝑆, is formed from the languages
𝐿(𝑅) and L(𝑆)
• Closure
• 𝑅 ∗ is the closure of regular expression 𝑅.
• 𝑅 ∗ = ε | R | RR | RRR | ...
From Regular Expressions to Automata
• Designing deterministic automata is often a good way to
design a program
• However, we also saw that deterministic automata could be
hard to design
• It is good news that there is a way to convert any regular
expression into a nondeterministic automaton, and from there
we can use the subset construction to convert to a
deterministic automaton
From Regular Expressions to Automata
• Convert any regular expression to an automaton with ε-
transitions that defines the same language.
• Convert the automaton with ε-transitions to an automaton
without ε-transitions that accepts the same language.
From Regular Expressions to Automata
• Ex) Given a regular expression 𝑎|𝑏𝑐 ∗
• Construct An expression tree for this regular expression
Internal nodes = operators
Precedence is like this arrow
leaves
From Regular Expressions to Automata
• There are three leaves, and for each, we construct an instance
of the automaton, given the input 𝑎|𝑏𝑐 ∗
From Regular Expressions to Automata
• Apply operators and construct larger automata as we go,
given the input 𝑎|𝑏𝑐 ∗
From Regular Expressions to Automata
• Apply operators and construct larger automata as we go,
given the input 𝑎|𝑏𝑐 ∗
From Regular Expressions to Automata
• Apply operators and construct larger automata as we go,
given the input 𝑎|𝑏𝑐 ∗
From Regular Expressions to Automata
• Using depth-first search, we can construct Table of
reachability
From Regular Expressions to Automata
• Find automaton without ε-transitions that accepts the same
language. Important
states
From Regular Expressions to Automata
• Find automaton without ε-transitions that accepts the same
language.
From Regular Expressions to Automata
• Find automaton without ε-transitions that accepts the same
language. Important
statesBecome the accepting state, if the col has 1
Cannot reach any important state
From Regular Expressions to Automata
• Find automaton without ε-transitions that accepts the same
language.
Become the accepting state, if the col has 1
Cannot reach any important state
From Regular Expressions to Automata
• Find automaton without ε-transitions that accepts the same
language. Important
statesBecome the accepting state, if the col has 1
From Regular Expressions to Automata
• Find automaton without ε-transitions that accepts the same
language.
Become the accepting state, if the col has 1
From Regular Expressions to Automata
• Find automaton without ε-transitions that accepts the same
language. Important
statesBecome the accepting state, if the col has 1
From Regular Expressions to Automata
• Find automaton without ε-transitions that accepts the same
language.
Become the accepting state, if the col has 1
Accepting states
From Regular Expressions to Automata
• Find automaton without ε-transitions that accepts the same
language.
Become the accepting state, if the col has 1
Accepting states
From Regular Expressions to Automata
• there is a simpler deterministic automaton that accepts the
same language By recognizing that
states 5 and 8 are
equivalent, they can be
merged.
From Automata to Regular Expressions
• The key step in conversion from an automaton to a regular
expression is the elimination of states until two states remains
A regular expression for the set of
strings that get us from state s to
state t is
𝑆 ∗ 𝑈 𝑇 𝑉𝑆 ∗ 𝑈 ∗
From Automata to Regular Expressions
• The key step in conversion from an automaton to a regular
expression is the elimination of states
• Ex) bounce filter
• 0101101
• 0000111
From Automata to Regular Expressions
• The key step in conversion from an automaton to a regular
expression is the elimination of states
• Ex) bounce filter
• Case1
From Automata to Regular Expressions
• The key step in conversion from an automaton to a regular
expression is the elimination of states
• Ex) bounce filter
• Case2
From Automata to Regular Expressions
• The key step in conversion from an automaton to a regular
expression is the elimination of states
• Ex) bounce filter
• All cases have elimination of b
From Automata to Regular Expressions
• The key step in conversion from an automaton to a regular
expression is the elimination of states
• Ex) bounce filter
• All cases have elimination of b
• For the a–a pair
• 𝑎 → 𝑎 𝑖𝑠 𝑟𝑒𝑝𝑙𝑎𝑐𝑒𝑑 𝑏𝑦 0|1∅0
• ∄ the a-c pair
From Automata to Regular Expressions
• The key step in conversion from an automaton to a regular
expression is the elimination of states
• Ex) bounce filter
• After the elimination of b,
• Two cases exist
• Case 1: delete d
• Case 2: delete c
• Union(Case1, Case2)
From Automata to Regular Expressions
• The key step in conversion from an automaton to a regular
expression is the elimination of states
Union
0 10 ∗ 11 1 01 00 0 10 ∗ 11 ∗
0 10 ∗ 111 ∗ 0 11 ∗ 0 0 0|10 ∗ 111 ∗ 0 ∗
From Automata to Regular Expressions
• Simplify this expression
•
•
0 10 ∗ 11 1 01 00 0 10 ∗ 11 ∗ | 0 10 ∗ 111 ∗ 0 11 ∗ 0 0 0|10 ∗ 111 ∗ 0 ∗
0 10 ∗ 11| ( 1 01 00 0 10 ∗ 11 ∗ | 1 ∗ 0 11 ∗ 0 0 0|10 ∗ 111 ∗ 0 ∗ )

More Related Content

What's hot

AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESsuthi
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automatonSampath Kumar S
 
Jarrar: Final Check & Schema Engineering Issues
Jarrar: Final Check & Schema Engineering IssuesJarrar: Final Check & Schema Engineering Issues
Jarrar: Final Check & Schema Engineering IssuesMustafa Jarrar
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysisDattatray Gandhmal
 
Toc 1 | gate | Theory of computation
Toc 1 | gate | Theory of computationToc 1 | gate | Theory of computation
Toc 1 | gate | Theory of computationnarayan dudhe
 
Type conversion, precedence, associativity in c programming
Type conversion, precedence, associativity in c programmingType conversion, precedence, associativity in c programming
Type conversion, precedence, associativity in c programmingDhrumil Panchal
 
Jarrar: Subtype Relations and Constraints
Jarrar: Subtype Relations and ConstraintsJarrar: Subtype Relations and Constraints
Jarrar: Subtype Relations and ConstraintsMustafa Jarrar
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automatadeepinderbedi
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite AutomataAdel Al-Ofairi
 
Finite Automata in compiler design
Finite Automata in compiler designFinite Automata in compiler design
Finite Automata in compiler designRiazul Islam
 
Chapter 3 : Programming with Java Operators and Strings
Chapter 3 : Programming with Java Operators and  StringsChapter 3 : Programming with Java Operators and  Strings
Chapter 3 : Programming with Java Operators and StringsIt Academy
 
Nondeterministic Finite Automat
Nondeterministic Finite AutomatNondeterministic Finite Automat
Nondeterministic Finite AutomatAdel Al-Ofairi
 
Partial redundancy elimination
Partial redundancy eliminationPartial redundancy elimination
Partial redundancy eliminationIshucs
 

What's hot (18)

AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTES
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton
 
Jarrar: Final Check & Schema Engineering Issues
Jarrar: Final Check & Schema Engineering IssuesJarrar: Final Check & Schema Engineering Issues
Jarrar: Final Check & Schema Engineering Issues
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
 
Toc 1 | gate | Theory of computation
Toc 1 | gate | Theory of computationToc 1 | gate | Theory of computation
Toc 1 | gate | Theory of computation
 
Type conversion, precedence, associativity in c programming
Type conversion, precedence, associativity in c programmingType conversion, precedence, associativity in c programming
Type conversion, precedence, associativity in c programming
 
Jarrar: Subtype Relations and Constraints
Jarrar: Subtype Relations and ConstraintsJarrar: Subtype Relations and Constraints
Jarrar: Subtype Relations and Constraints
 
Lexical 2
Lexical 2Lexical 2
Lexical 2
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automata
 
Operators & Casts
Operators & CastsOperators & Casts
Operators & Casts
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite Automata
 
Lexicalanalyzer
LexicalanalyzerLexicalanalyzer
Lexicalanalyzer
 
Finite Automata in compiler design
Finite Automata in compiler designFinite Automata in compiler design
Finite Automata in compiler design
 
Java basic operators
Java basic operatorsJava basic operators
Java basic operators
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
Chapter 3 : Programming with Java Operators and Strings
Chapter 3 : Programming with Java Operators and  StringsChapter 3 : Programming with Java Operators and  Strings
Chapter 3 : Programming with Java Operators and Strings
 
Nondeterministic Finite Automat
Nondeterministic Finite AutomatNondeterministic Finite Automat
Nondeterministic Finite Automat
 
Partial redundancy elimination
Partial redundancy eliminationPartial redundancy elimination
Partial redundancy elimination
 

Similar to Regular expression automata

Implementation of lexical analyser
Implementation of lexical analyserImplementation of lexical analyser
Implementation of lexical analyserArchana Gopinath
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptxSKUP1
 
a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...NALESVPMEngg
 
Pattern Matching using Computational and Automata Theory
Pattern Matching using Computational and Automata TheoryPattern Matching using Computational and Automata Theory
Pattern Matching using Computational and Automata TheoryIRJET Journal
 
Regular Expression to Finite Automata
Regular Expression to Finite AutomataRegular Expression to Finite Automata
Regular Expression to Finite AutomataArchana Gopinath
 
Regular expression
Regular expressionRegular expression
Regular expressionRajon
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and SelectionAhmed Nobi
 
Syntactic analysis in NLP
Syntactic analysis in NLPSyntactic analysis in NLP
Syntactic analysis in NLPkartikaVashisht
 

Similar to Regular expression automata (20)

TOC Introduction
TOC Introduction TOC Introduction
TOC Introduction
 
phases of compiler
phases of compilerphases of compiler
phases of compiler
 
NLP_KASHK:Finite-State Automata
NLP_KASHK:Finite-State AutomataNLP_KASHK:Finite-State Automata
NLP_KASHK:Finite-State Automata
 
FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
 
Parsing
ParsingParsing
Parsing
 
Implementation of lexical analyser
Implementation of lexical analyserImplementation of lexical analyser
Implementation of lexical analyser
 
Finite automata
Finite automataFinite automata
Finite automata
 
Finite automata
Finite automataFinite automata
Finite automata
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptx
 
a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...
 
Pattern Matching using Computational and Automata Theory
Pattern Matching using Computational and Automata TheoryPattern Matching using Computational and Automata Theory
Pattern Matching using Computational and Automata Theory
 
Regular Expression to Finite Automata
Regular Expression to Finite AutomataRegular Expression to Finite Automata
Regular Expression to Finite Automata
 
Word2vec and Friends
Word2vec and FriendsWord2vec and Friends
Word2vec and Friends
 
C++ Tokens
C++ TokensC++ Tokens
C++ Tokens
 
3. Syntax Analyzer.pptx
3. Syntax Analyzer.pptx3. Syntax Analyzer.pptx
3. Syntax Analyzer.pptx
 
C Language Part 1
C Language Part 1C Language Part 1
C Language Part 1
 
Regular expression
Regular expressionRegular expression
Regular expression
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and Selection
 
Syntactic analysis in NLP
Syntactic analysis in NLPSyntactic analysis in NLP
Syntactic analysis in NLP
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 

Recently uploaded

Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

Regular expression automata

  • 2. Automaton • An automaton is a finite representation of a formal language that may be an infinite set.
  • 3. Graphs Representing State Machines • Ex • Λ – x represents the set of all letters except x • A word “abstemious” can reach to the accepting state
  • 4. Graphs Representing State Machines • we can design a program by first designing the graph, and then mechanically translating the graph into a program • At previous Ex … • Boolean testWord(char *p){ • If (findChar(&p, ‘a’)) • If (findChar(&p, ‘e’)) • If (findChar(&p, ‘i’)) • If (findChar(&p, ‘o’)) • If (findChar(&p, ‘u’)) return TRUE; • return FALSE }
  • 5. Graphs Representing State Machines • we can design a program by first designing the graph, and then mechanically translating the graph into a program • At previous Ex … • Boolean testWord(char *p){ • If (findChar(&p, ‘a’)) • If (findChar(&p, ‘e’)) • If (findChar(&p, ‘i’)) • If (findChar(&p, ‘o’)) • If (findChar(&p, ‘u’)) return TRUE; • return FALSE } This function finds desired character, and points the next character, and returns TRUE. Otherwise, returns FALSE.
  • 6. Graphs Representing State Machines • we can design a program by first designing the graph, and then mechanically translating the graph into a program • At previous Ex … • Boolean testWord(char *p){ • If (findChar(&p, ‘a’)) • If (findChar(&p, ‘e’)) • If (findChar(&p, ‘i’)) • If (findChar(&p, ‘o’)) • If (findChar(&p, ‘u’)) return TRUE; • return FALSE } Ex) think a input “abstemious” It leads to TRUE!
  • 7. Deterministic and Nondeterministic Automata • Programs cannot go to two places(states) at once
  • 8. Deterministic and Nondeterministic Automata • Deterministic Automataon vs Nondeterminsitc Automaton vs
  • 9. Deterministic and Nondeterministic Automata • Deterministic Automataon vs Nondeterminsitc Automaton vs Given an input ‘m’, It can go to state 0 and 1 at the same time Non programmableprogrammable
  • 10. From Nondeterminism to Determinism • We say N and D are equivalent if they accept the same set of input string • By constructing an equivalent deterministic automaton, we can convert nondeterministic automaton into deterministic automaton. • How? Induction, or Algorithmic way
  • 11. From Nondeterminism to Determinism
  • 12. From Nondeterminism to Determinism
  • 13. From Nondeterminism to Determinism
  • 14. The Subset Construction S is the Subset Construction, where D is determinism N is nondeterminism
  • 15. The Subset Construction Yet there is no guarantee that the deterministic automaton will be small because 𝑘-sate nondeterministic automaton could wind up being converted to a deterministic automaton with at most 2 𝑘 states.
  • 16. Minimization of Automata • One of the issues concerning automata, especially when they are used to design circuits, is how few states are needed to perform a given task. • If states s and t are equivalent, we can merge s and t into a single state
  • 17. Regular Expressions • Regular Expressions are algebraic way to define patterns • Operands • A character 𝒙 be denoted by that character in boldface • The symbol ε denotes the 𝑒𝑚𝑝𝑡𝑦 𝑠𝑡𝑟𝑖𝑛𝑔 • The symbol ∅ denotes the 𝑒𝑚𝑝𝑡𝑦 𝑠𝑒𝑡 𝑜𝑓 𝑠𝑡𝑟𝑖𝑛𝑔 • A variable whose value can be any pattern defined by a regular expression
  • 18. Regular Expressions • For regular expressions, the value of each expression is a pattern consisting of a set of strings often called a language • The language denoted by a regular expression 𝐸 will be referred to as 𝐿(𝐸) • The languages of the atomic operands • If 𝒙 is any character, the regular expression 𝒙 stands for the language 𝐿 𝒙 = {𝑥} • 𝐿 ε = ε • 𝐿 ∅ = ∅ • A variable whose value can be any pattern defined by a regular expression
  • 19. Operators of Regular Expressions • Suppose that 𝑅, 𝑆 are two regular expressions • Union • 𝑅 | 𝑆 denotes the union of the languages that 𝑅 and 𝑆 denote • That is, 𝐿 𝑅 𝑆) = 𝐿 𝑅 ∪ L S • Concatenation • 𝐿 𝑅𝑆 , the language denoted by 𝑅𝑆, is formed from the languages 𝐿(𝑅) and L(𝑆) • Closure • 𝑅 ∗ is the closure of regular expression 𝑅. • 𝑅 ∗ = ε | R | RR | RRR | ...
  • 20. From Regular Expressions to Automata • Designing deterministic automata is often a good way to design a program • However, we also saw that deterministic automata could be hard to design • It is good news that there is a way to convert any regular expression into a nondeterministic automaton, and from there we can use the subset construction to convert to a deterministic automaton
  • 21. From Regular Expressions to Automata • Convert any regular expression to an automaton with ε- transitions that defines the same language. • Convert the automaton with ε-transitions to an automaton without ε-transitions that accepts the same language.
  • 22. From Regular Expressions to Automata • Ex) Given a regular expression 𝑎|𝑏𝑐 ∗ • Construct An expression tree for this regular expression Internal nodes = operators Precedence is like this arrow leaves
  • 23. From Regular Expressions to Automata • There are three leaves, and for each, we construct an instance of the automaton, given the input 𝑎|𝑏𝑐 ∗
  • 24. From Regular Expressions to Automata • Apply operators and construct larger automata as we go, given the input 𝑎|𝑏𝑐 ∗
  • 25. From Regular Expressions to Automata • Apply operators and construct larger automata as we go, given the input 𝑎|𝑏𝑐 ∗
  • 26. From Regular Expressions to Automata • Apply operators and construct larger automata as we go, given the input 𝑎|𝑏𝑐 ∗
  • 27. From Regular Expressions to Automata • Using depth-first search, we can construct Table of reachability
  • 28. From Regular Expressions to Automata • Find automaton without ε-transitions that accepts the same language. Important states
  • 29. From Regular Expressions to Automata • Find automaton without ε-transitions that accepts the same language.
  • 30. From Regular Expressions to Automata • Find automaton without ε-transitions that accepts the same language. Important statesBecome the accepting state, if the col has 1 Cannot reach any important state
  • 31. From Regular Expressions to Automata • Find automaton without ε-transitions that accepts the same language. Become the accepting state, if the col has 1 Cannot reach any important state
  • 32. From Regular Expressions to Automata • Find automaton without ε-transitions that accepts the same language. Important statesBecome the accepting state, if the col has 1
  • 33. From Regular Expressions to Automata • Find automaton without ε-transitions that accepts the same language. Become the accepting state, if the col has 1
  • 34. From Regular Expressions to Automata • Find automaton without ε-transitions that accepts the same language. Important statesBecome the accepting state, if the col has 1
  • 35. From Regular Expressions to Automata • Find automaton without ε-transitions that accepts the same language. Become the accepting state, if the col has 1 Accepting states
  • 36. From Regular Expressions to Automata • Find automaton without ε-transitions that accepts the same language. Become the accepting state, if the col has 1 Accepting states
  • 37. From Regular Expressions to Automata • there is a simpler deterministic automaton that accepts the same language By recognizing that states 5 and 8 are equivalent, they can be merged.
  • 38. From Automata to Regular Expressions • The key step in conversion from an automaton to a regular expression is the elimination of states until two states remains A regular expression for the set of strings that get us from state s to state t is 𝑆 ∗ 𝑈 𝑇 𝑉𝑆 ∗ 𝑈 ∗
  • 39. From Automata to Regular Expressions • The key step in conversion from an automaton to a regular expression is the elimination of states • Ex) bounce filter • 0101101 • 0000111
  • 40. From Automata to Regular Expressions • The key step in conversion from an automaton to a regular expression is the elimination of states • Ex) bounce filter • Case1
  • 41. From Automata to Regular Expressions • The key step in conversion from an automaton to a regular expression is the elimination of states • Ex) bounce filter • Case2
  • 42. From Automata to Regular Expressions • The key step in conversion from an automaton to a regular expression is the elimination of states • Ex) bounce filter • All cases have elimination of b
  • 43. From Automata to Regular Expressions • The key step in conversion from an automaton to a regular expression is the elimination of states • Ex) bounce filter • All cases have elimination of b • For the a–a pair • 𝑎 → 𝑎 𝑖𝑠 𝑟𝑒𝑝𝑙𝑎𝑐𝑒𝑑 𝑏𝑦 0|1∅0 • ∄ the a-c pair
  • 44. From Automata to Regular Expressions • The key step in conversion from an automaton to a regular expression is the elimination of states • Ex) bounce filter • After the elimination of b, • Two cases exist • Case 1: delete d • Case 2: delete c • Union(Case1, Case2)
  • 45. From Automata to Regular Expressions • The key step in conversion from an automaton to a regular expression is the elimination of states Union 0 10 ∗ 11 1 01 00 0 10 ∗ 11 ∗ 0 10 ∗ 111 ∗ 0 11 ∗ 0 0 0|10 ∗ 111 ∗ 0 ∗
  • 46. From Automata to Regular Expressions • Simplify this expression • • 0 10 ∗ 11 1 01 00 0 10 ∗ 11 ∗ | 0 10 ∗ 111 ∗ 0 11 ∗ 0 0 0|10 ∗ 111 ∗ 0 ∗ 0 10 ∗ 11| ( 1 01 00 0 10 ∗ 11 ∗ | 1 ∗ 0 11 ∗ 0 0 0|10 ∗ 111 ∗ 0 ∗ )