SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Example 2.16: consider the NFA of Figure 2.8




M                     ε-closure of M (S)       S′a   S′b
1                   1,2,6                      3,7
3,7                 3,4,7,8                          5
5                   5,8

                             a                   b




                                        1
Example 2.17: consider the NFA of Figure 2.9 (regular expression letter(letter|digit)*)




    M                    ε-closure of M (S)      S′letter           S′digit
    1                 1                          2
    2                 2,3,4,5,7,10               6                  8
    6                 4,5,6,7,9,10               6                  8
    8                 4,5,7,8,9,10               6                  8



                                                                                  le tte r




                                            2
2.4.3 Simulating an NFA using the subset construction

      As mentioned at section 2.3.
      NFAs can be implemented in similar ways to DFAs, except that since NFAs are
nondeterministic, there are potentially many different sequences of transitions that
must be tried.
      A program that simulates an NFA must store up transitions that have not yet been
tried and backtrack to them on failure.

    An other way of simulating an NFA is to use the subset construction, but instead
of constructing all the states of the associated DFA, we construct only the state at each
point that is indicated by the next input character.

    The advantage: we may not need to construct the entire DFA.

             In example 2.16, the input string consisting of the single character a.
                               a                           b




    The disadvantage: a state may be constructed many times, if the path contains loops.
           In example 2.17, given the input string r2d3




2.4.4 Minimizing the number of states in a DFA
    The process we have described of deriving a DFA algorithmically from a regular
expression has the unfortunate property that the resulting DFA may be more complex
than necessary.

    For example 2.15 we derived the DFA for the regular expression a*:




whereas the DFA will do as well.

                                                       a




                                                3
An important result from automata theory states that,
     given any DFA, there is an equivalent DFA containing a minimum number of
states,
     and, that this minimum-state DFA is unique (except for renaming of states).

 It is also possible to directly obtain this minimum-state DFA from any given DFA.

  Given the algorithm as follow:
   (1) It begins with the most optimistic assumption possible.
        It creates two sets, one consisting of all the accepting states and the other
   consisting of all the non-accepting states.

   (2) Given this partition of the states of the original DFA, consider the transitions on
      each character a of the alphabet.
        If all accepting states have transitions on a to accepting states, then this
           defines an a-transition from the new accepting state (the set of all the old
           accepting states) to itself.
        If all accepting states have transitions on a to non-accepting states, then this
           defines an a-transition from the new accepting state to the new non-
           accepting state (the set of all the old non-accepting stales).
        On the other hand, if there are two accepting states s and t that have
           transitions on a that land in different sets, then no a-transition can be
           defined for this grouping of the states. We say that a distinguishes the states
           s and t
        We must also consider error transitions to an error state that is non-
           accepting. If there are accepting states s and t such that s has an a-transition
           to another accepting state, while t has no a-transition at all (i.e., an error
           transition), then a distinguishes s and t.

   (3) If any further sets are split, we must return and repeat the process from the
       beginning. This process continues until either all sets contain only one element
       (in which case, we have shown the original DFA to be minimal) or until no
       further splitting of sets occurs.




                                           4
le tte r




Example 2.18: The regular expression letter(letter|digit)*




      The accepting sets                {2,3,4,5,7,10},{4,5,6,7,9,10},{4,5,7,8,9,10}
      The nonaccepting sets             {1}
 The following minimum-state DFA :
                                                              letter




                                                              digit



    Example 2.19: the regular expression (a| ε)b*




    The accepting sets                         {1,2,3}
    The non-accepting sets

     state 1 has an a-transition to an accepting state, while states 2 .and 3 have no
a-transition (or, rather, an error transition on a to the error nonaccepting state).
     Thus, a distinguishes state 1 from states 2 and 3,
     and we must repartition the states into the sets {1} and {2,3}.
     Now we begin over. The set {1} cannot be split further, so we no longer consider it.
Now the states 2 and 3 cannot be distinguished by either a or b.




                                           5

Weitere ähnliche Inhalte

Was ist angesagt?

HOMOGENEOUS LINEAR PDE
HOMOGENEOUS LINEAR PDEHOMOGENEOUS LINEAR PDE
HOMOGENEOUS LINEAR PDEKomathiJ
 
14 pro resolution
14 pro resolution14 pro resolution
14 pro resolutionTianlu Wang
 
1.9. minimization of dfa
1.9. minimization of dfa1.9. minimization of dfa
1.9. minimization of dfaSampath Kumar S
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...ijceronline
 
Design of a Pseudo-Random Binary Code Generator via a Developed Simulation Model
Design of a Pseudo-Random Binary Code Generator via a Developed Simulation ModelDesign of a Pseudo-Random Binary Code Generator via a Developed Simulation Model
Design of a Pseudo-Random Binary Code Generator via a Developed Simulation ModelIDES Editor
 
NFA DFA Equivalence theorem
NFA DFA Equivalence theorem NFA DFA Equivalence theorem
NFA DFA Equivalence theorem niveditJain
 
[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++Muhammad Hammad Waseem
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingSaranyaK68
 

Was ist angesagt? (12)

HOMOGENEOUS LINEAR PDE
HOMOGENEOUS LINEAR PDEHOMOGENEOUS LINEAR PDE
HOMOGENEOUS LINEAR PDE
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
14 pro resolution
14 pro resolution14 pro resolution
14 pro resolution
 
1.9. minimization of dfa
1.9. minimization of dfa1.9. minimization of dfa
1.9. minimization of dfa
 
05 dataflow
05 dataflow05 dataflow
05 dataflow
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 
Design of a Pseudo-Random Binary Code Generator via a Developed Simulation Model
Design of a Pseudo-Random Binary Code Generator via a Developed Simulation ModelDesign of a Pseudo-Random Binary Code Generator via a Developed Simulation Model
Design of a Pseudo-Random Binary Code Generator via a Developed Simulation Model
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
 
NFA DFA Equivalence theorem
NFA DFA Equivalence theorem NFA DFA Equivalence theorem
NFA DFA Equivalence theorem
 
[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++
 
Lec39
Lec39Lec39
Lec39
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 

Andere mochten auch

Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)bolovv
 
Chapter Eight(1)
Chapter Eight(1)Chapter Eight(1)
Chapter Eight(1)bolovv
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1Shashwat Shriparv
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler DesignShine Raj
 

Andere mochten auch (8)

Ch8a
Ch8aCh8a
Ch8a
 
Ch8b
Ch8bCh8b
Ch8b
 
Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)
 
Chapter Eight(1)
Chapter Eight(1)Chapter Eight(1)
Chapter Eight(1)
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1
 
Interm codegen
Interm codegenInterm codegen
Interm codegen
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler Design
 
Code generation
Code generationCode generation
Code generation
 

Ähnlich wie Chapter 2 2 1 2

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
 
Chapter 2 2 1 1
Chapter 2 2 1 1Chapter 2 2 1 1
Chapter 2 2 1 1bolovv
 
Lecture 17- F19.pdf
Lecture 17- F19.pdfLecture 17- F19.pdf
Lecture 17- F19.pdfAbrar11535
 
Compiler Design File
Compiler Design FileCompiler Design File
Compiler Design FileArchita Misra
 
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...venkatapranaykumarGa
 
A class of boundary value methods for the complex delay differential equation
A class of boundary value methods for the complex delay differential equationA class of boundary value methods for the complex delay differential equation
A class of boundary value methods for the complex delay differential equationijscmcj
 
Lecture 03 lexical analysis
Lecture 03 lexical analysisLecture 03 lexical analysis
Lecture 03 lexical analysisIffat Anjum
 
Let us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solutionLet us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solutionHazrat Bilal
 
aho corasick paper study note
 aho corasick paper study note aho corasick paper study note
aho corasick paper study noteYi-Jun Zheng
 
finite_automata.ppt
finite_automata.pptfinite_automata.ppt
finite_automata.pptAkhlasHashim
 
02. chapter 3 lexical analysis
02. chapter 3   lexical analysis02. chapter 3   lexical analysis
02. chapter 3 lexical analysisraosir123
 
Comparative Report Ed098
Comparative Report Ed098Comparative Report Ed098
Comparative Report Ed098mikebrowl
 

Ähnlich wie Chapter 2 2 1 2 (17)

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
 
Chapter 2 2 1 1
Chapter 2 2 1 1Chapter 2 2 1 1
Chapter 2 2 1 1
 
Nfa vs dfa
Nfa vs dfaNfa vs dfa
Nfa vs dfa
 
Lecture 17- F19.pdf
Lecture 17- F19.pdfLecture 17- F19.pdf
Lecture 17- F19.pdf
 
Compiler Design File
Compiler Design FileCompiler Design File
Compiler Design File
 
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
 
optimization of DFA
optimization of DFAoptimization of DFA
optimization of DFA
 
A class of boundary value methods for the complex delay differential equation
A class of boundary value methods for the complex delay differential equationA class of boundary value methods for the complex delay differential equation
A class of boundary value methods for the complex delay differential equation
 
Lecture 03 lexical analysis
Lecture 03 lexical analysisLecture 03 lexical analysis
Lecture 03 lexical analysis
 
Let us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solutionLet us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solution
 
aho corasick paper study note
 aho corasick paper study note aho corasick paper study note
aho corasick paper study note
 
Laplace
LaplaceLaplace
Laplace
 
finite_automata.ppt
finite_automata.pptfinite_automata.ppt
finite_automata.ppt
 
1406
14061406
1406
 
02. chapter 3 lexical analysis
02. chapter 3   lexical analysis02. chapter 3   lexical analysis
02. chapter 3 lexical analysis
 
Comparative Report Ed098
Comparative Report Ed098Comparative Report Ed098
Comparative Report Ed098
 

Mehr von bolovv

Chapter Three(2)
Chapter Three(2)Chapter Three(2)
Chapter Three(2)bolovv
 
Chapter Three(1)
Chapter Three(1)Chapter Three(1)
Chapter Three(1)bolovv
 
Chapter Seven(2)
Chapter Seven(2)Chapter Seven(2)
Chapter Seven(2)bolovv
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)bolovv
 
Chapter Five(2)
Chapter Five(2)Chapter Five(2)
Chapter Five(2)bolovv
 
Chapter One
Chapter OneChapter One
Chapter Onebolovv
 
Chapter Seven(1)
Chapter Seven(1)Chapter Seven(1)
Chapter Seven(1)bolovv
 
Chapter Two(1)
Chapter Two(1)Chapter Two(1)
Chapter Two(1)bolovv
 
Chapter 1 1
Chapter 1 1Chapter 1 1
Chapter 1 1bolovv
 

Mehr von bolovv (9)

Chapter Three(2)
Chapter Three(2)Chapter Three(2)
Chapter Three(2)
 
Chapter Three(1)
Chapter Three(1)Chapter Three(1)
Chapter Three(1)
 
Chapter Seven(2)
Chapter Seven(2)Chapter Seven(2)
Chapter Seven(2)
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
 
Chapter Five(2)
Chapter Five(2)Chapter Five(2)
Chapter Five(2)
 
Chapter One
Chapter OneChapter One
Chapter One
 
Chapter Seven(1)
Chapter Seven(1)Chapter Seven(1)
Chapter Seven(1)
 
Chapter Two(1)
Chapter Two(1)Chapter Two(1)
Chapter Two(1)
 
Chapter 1 1
Chapter 1 1Chapter 1 1
Chapter 1 1
 

Kürzlich hochgeladen

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Kürzlich hochgeladen (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Chapter 2 2 1 2

  • 1. Example 2.16: consider the NFA of Figure 2.8 M ε-closure of M (S) S′a S′b 1 1,2,6 3,7 3,7 3,4,7,8 5 5 5,8 a b 1
  • 2. Example 2.17: consider the NFA of Figure 2.9 (regular expression letter(letter|digit)*) M ε-closure of M (S) S′letter S′digit 1 1 2 2 2,3,4,5,7,10 6 8 6 4,5,6,7,9,10 6 8 8 4,5,7,8,9,10 6 8 le tte r 2
  • 3. 2.4.3 Simulating an NFA using the subset construction As mentioned at section 2.3. NFAs can be implemented in similar ways to DFAs, except that since NFAs are nondeterministic, there are potentially many different sequences of transitions that must be tried. A program that simulates an NFA must store up transitions that have not yet been tried and backtrack to them on failure. An other way of simulating an NFA is to use the subset construction, but instead of constructing all the states of the associated DFA, we construct only the state at each point that is indicated by the next input character. The advantage: we may not need to construct the entire DFA. In example 2.16, the input string consisting of the single character a. a b The disadvantage: a state may be constructed many times, if the path contains loops. In example 2.17, given the input string r2d3 2.4.4 Minimizing the number of states in a DFA The process we have described of deriving a DFA algorithmically from a regular expression has the unfortunate property that the resulting DFA may be more complex than necessary. For example 2.15 we derived the DFA for the regular expression a*: whereas the DFA will do as well. a 3
  • 4. An important result from automata theory states that, given any DFA, there is an equivalent DFA containing a minimum number of states, and, that this minimum-state DFA is unique (except for renaming of states). It is also possible to directly obtain this minimum-state DFA from any given DFA. Given the algorithm as follow: (1) It begins with the most optimistic assumption possible. It creates two sets, one consisting of all the accepting states and the other consisting of all the non-accepting states. (2) Given this partition of the states of the original DFA, consider the transitions on each character a of the alphabet.  If all accepting states have transitions on a to accepting states, then this defines an a-transition from the new accepting state (the set of all the old accepting states) to itself.  If all accepting states have transitions on a to non-accepting states, then this defines an a-transition from the new accepting state to the new non- accepting state (the set of all the old non-accepting stales).  On the other hand, if there are two accepting states s and t that have transitions on a that land in different sets, then no a-transition can be defined for this grouping of the states. We say that a distinguishes the states s and t  We must also consider error transitions to an error state that is non- accepting. If there are accepting states s and t such that s has an a-transition to another accepting state, while t has no a-transition at all (i.e., an error transition), then a distinguishes s and t. (3) If any further sets are split, we must return and repeat the process from the beginning. This process continues until either all sets contain only one element (in which case, we have shown the original DFA to be minimal) or until no further splitting of sets occurs. 4
  • 5. le tte r Example 2.18: The regular expression letter(letter|digit)* The accepting sets {2,3,4,5,7,10},{4,5,6,7,9,10},{4,5,7,8,9,10} The nonaccepting sets {1} The following minimum-state DFA : letter digit Example 2.19: the regular expression (a| ε)b* The accepting sets {1,2,3} The non-accepting sets state 1 has an a-transition to an accepting state, while states 2 .and 3 have no a-transition (or, rather, an error transition on a to the error nonaccepting state). Thus, a distinguishes state 1 from states 2 and 3, and we must repartition the states into the sets {1} and {2,3}. Now we begin over. The set {1} cannot be split further, so we no longer consider it. Now the states 2 and 3 cannot be distinguished by either a or b. 5