Finite-state machines are finite collections of states with transition rules that take you from one state to another. They can be represented as graphs with nodes as states and directed arcs indicating transitions. Deterministic finite automata (DFAs) are finite-state machines where transitions are defined by reading input characters left to right. Nondeterministic finite automata (NFAs) allow transitions from a state to multiple states on a given input. While NFAs are more expressive, any NFA can be converted to an equivalent DFA using the subset construction algorithm.
Short Notes on Automata Theory
Automata theory is the study of abstract machines and automata, as well as the computational problems that can be solved using them. It is a theory in theoretical computer science and discrete mathematics (a subject of study in both mathematics and computer science). The word automata (the plural of automaton) comes from the Greek word αὐτόματα, which means "self-making".
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Mohammad Ilyas Malik
The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled computing device which follows a predetermined sequence of operations automatically.
Short Notes on Automata Theory
Automata theory is the study of abstract machines and automata, as well as the computational problems that can be solved using them. It is a theory in theoretical computer science and discrete mathematics (a subject of study in both mathematics and computer science). The word automata (the plural of automaton) comes from the Greek word αὐτόματα, which means "self-making".
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Mohammad Ilyas Malik
The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled computing device which follows a predetermined sequence of operations automatically.
Quality defects in TMT Bars, Possible causes and Potential Solutions.PrashantGoswami42
Maintaining high-quality standards in the production of TMT bars is crucial for ensuring structural integrity in construction. Addressing common defects through careful monitoring, standardized processes, and advanced technology can significantly improve the quality of TMT bars. Continuous training and adherence to quality control measures will also play a pivotal role in minimizing these defects.
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Vaccine management system project report documentation..pdfKamal Acharya
The Division of Vaccine and Immunization is facing increasing difficulty monitoring vaccines and other commodities distribution once they have been distributed from the national stores. With the introduction of new vaccines, more challenges have been anticipated with this additions posing serious threat to the already over strained vaccine supply chain system in Kenya.
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSEDuvanRamosGarzon1
AIRCRAFT GENERAL
The Single Aisle is the most advanced family aircraft in service today, with fly-by-wire flight controls.
The A318, A319, A320 and A321 are twin-engine subsonic medium range aircraft.
The family offers a choice of engines
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfKamal Acharya
The College Bus Management system is completely developed by Visual Basic .NET Version. The application is connect with most secured database language MS SQL Server. The application is develop by using best combination of front-end and back-end languages. The application is totally design like flat user interface. This flat user interface is more attractive user interface in 2017. The application is gives more important to the system functionality. The application is to manage the student’s details, driver’s details, bus details, bus route details, bus fees details and more. The application has only one unit for admin. The admin can manage the entire application. The admin can login into the application by using username and password of the admin. The application is develop for big and small colleges. It is more user friendly for non-computer person. Even they can easily learn how to manage the application within hours. The application is more secure by the admin. The system will give an effective output for the VB.Net and SQL Server given as input to the system. The compiled java program given as input to the system, after scanning the program will generate different reports. The application generates the report for users. The admin can view and download the report of the data. The application deliver the excel format reports. Because, excel formatted reports is very easy to understand the income and expense of the college bus. This application is mainly develop for windows operating system users. In 2017, 73% of people enterprises are using windows operating system. So the application will easily install for all the windows operating system users. The application-developed size is very low. The application consumes very low space in disk. Therefore, the user can allocate very minimum local disk space for this application.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Final project report on grocery store management system..pdf
03-FiniteAutomata.pptx
1. Finite-State Machines
Michael T. Goodrich
University of California, Irvine
Some of the slides below are adapted from slides for CS154 at Stanford University
2. 2
Introduction
To understand how to match regular
expressions we first need to understand
finite-state machines, which are are finite
collections of states with transition rules that
take you from one state to another.
Today, several kinds of software can be
modeled by finite automata.
3. 3
Representing Finite-State Machines
The simplest representation is often a graph.
Nodes = states.
Directed arcs indicate state transitions.
Labels on arcs tell what causes the transition.
We define the size of a finite-state machine to be
the total number of nodes and edges in its graph
representation.
5. 5
Finite Automata
A finite automaton is a finite-state machine where
transitions are defined by reading characters in a
text string left-to-right.
Image from https://er.yuvayana.org/how-dfa-operates-theory-with-block-diagram-of-fa/
^
6. 6
Example: Recognizing Strings Ending
in “ing”
Saw i
i
Not i
Saw ing
g
i
Not i or g
i
Saw in
n
Not i or n
nothing
Start
i
Not i
A final state accepts the input string and
is indicated with a boundary double circle.
7. 7
Automata to Code (by hand)
• In C/C++/Java:
1. Initialize state q to start state.
2. Loop through the string one character at a
time.
3. Make a switch statement with a case for each
state for q, where each case sets q according
to the transitions for that state.
4. Accept if you end in a final state.
8. 8
Example in Java
Scanner scan = new Scanner(System.in);
String s = scan.next();
int q = 0;
for (char c : s.toCharArray()) {
switch (q) {
case 0: q = (c=='i')? 1 : 0; break;
case 1: q = (c=='n')? 2 : ((c=='i')? 1 : 0); break;
case 2: q = (c=='g')? 3 : ((c=='i')? 1 : 0); break;
case 3: q = (c=='i')? 1 : 0;
}
}
if (q==3)
System.out.println("accept.");
else
System.out.println("reject.");
0 1 2 3
Start state
Final state
Loop through string s
Transitions
9. 9
Automata to Code – General
It would be nice to have an automatic way to
generate such code or test for a match of a
regular expression to an input string…
Example: How grep works. This is where finite
automata come in…
Image from https://linuxconfig.org/how-to-correctly-grep-for-text-in-bash-scripts
10. 10
Another Finite Automaton Example:
Matching An Even Number of 1’s
even odd
1
0
Start
0
1
• How would it look to accept a number
of 1’s that is a multiple of 3?
11. Password/Keyword Example
11
This is sometimes
called a dead state.
BTW, there is a potential security risk on the password application if
this finite automaton reports failure too quickly.
any character
any character
16. General Comments
Some things are easy with finite automata:
Substrings (…abcabc…)
Subsequences (…a…b…c…b…a…)
Modular counting (odd number of 1’s)
Some things are impossible with finite automata:
An equal number of a’s and b’s
More 0’s than 1’s
But when they can be used, they are generally
fast.
16
17. 17
Deterministic Finite Automata (DFA)
A formalism for defining languages,
consisting of:
1. A finite set of states (Q, typically).
2. An input alphabet (Σ, typically).
3. A transition function (δ, typically).
4. A start state (q0, in Q, typically).
5. A set of final states (F ⊆ Q, typically).
“Final” and “accepting” are synonyms.
18. 18
The Transition Function
Takes two arguments: a state and an input
symbol.
δ(q, a) = the state that the DFA goes to when it is
in state q and input a is received.
0 1
A A B
B A C
C C C
Rows = states
Columns =
input symbols
Final states
starred *
*
*
Arrow for
start state
19. 19
Graph Representation of DFA’s
Nodes = states.
Arcs represent transition function.
Arc from state p to state q labeled by all those input
symbols that have transitions from p to q.
Arrow labeled “Start” to the start state.
Final states indicated by double circles.
Recall that the size of a DFA is the total number
of nodes and edges in its graph representation.
Note that this is also proportional to the size of
the transition table representation.
20. 20
Example: Graph of a DFA
Start
1
0
A C
B
1
0 0,1
Previous
string OK,
does not
end in 1.
Previous
String OK,
ends in a
single 1.
Consecutive
1’s have
been seen.
Accepts all strings without two consecutive 1’s.
21. 21
Language of a DFA
Automata of all kinds define languages.
If A is an automaton, L(A) is its language.
For a DFA, A, L(A) is the set of strings
labeling paths from the start state to a final
state.
22. 22
Example: String in a Language
Start
1
0
A C
B
1
0 0,1
String 101 is in the language of the DFA below.
Start at A.
23. 23
Example: String in a Language
Start
1
0
A C
B
1
0 0,1
Follow arc labeled 1.
String 101 is in the language of the DFA below.
24. 24
Example: String in a Language
Start
1
0
A C
B
1
0 0,1
Then arc labeled 0 from current state B.
String 101 is in the language of the DFA below.
25. 25
Example: String in a Language
Start
1
0
A C
B
1
0 0,1
Finally arc labeled 1 from current state A. Result
is an accepting state, so 101 is in the language.
String 101 is in the language of the DFA below.
26. 26
Example – Concluded
The language of our example DFA is:
{w | w is in {0,1}* and w does not have
two consecutive 1’s}
Read a set former as
“The set of strings w…
Such that… These conditions
about w are true.
27. DFA Matching is Fast
Given a DFA, A, of size, m, and an input string, T, of
length n, we can test if T is in L(A) in O(m + n) time:
1. Read in the graph representation for A.
Step 1 takes O(m) time.
2. Let s = the initial state for A.
3. For each character, c, in T (in order): Let s = d(s,c).
Step 3 takes O(n) time in total.
4. If s is a final state, accept T.
28. 28
Nondeterminism
A nondeterministic finite automaton has the
ability to be in several states at once.
Transitions from a state on an input symbol can
be to any set of states.
Start in one start state.
Accept if any sequence of choices leads to a
final state.
Intuitively: the NFA always “guesses right.”
29. 29
Example: Moves on a Chessboard
• States = squares.
• Inputs = r (move to an adjacent red square) and
b (move to an adjacent black square).
• Start state, final state are in opposite corners.
1 2
5
7 9
3
4
8
6
30. 30
Example: Chessboard
1 2
5
7 9
3
4
8
6
1
r b b
4
2 1
5
3
7
5
1
3
9
7
r b
1 2,4 5
2 4,6 1,3,5
3 2,6 5
4 2,8 1,5,7
5 2,4,6,8 1,3,7,9
6 2,8 3,5,9
7 4,8 5
8 4,6 5,7,9
9 6,8 5
*
Accept, since final state reached
31. 31
Formal Nondeterministic Finite
Automaton (NFA) Definition
A finite set of states, typically Q.
An input alphabet, typically Σ.
A transition function, typically δ.
δ(q, a) is a set of states.
Extend to strings as follows:
Basis: δ(q, ε) = {q}
Induction: δ(q, wa) = the union over all states p in
δ(q, w) of δ(p, a)
A start state in Q, typically q0.
A set of final states F ⊆ Q.
32. 32
NFA Properties
A string w is accepted by an NFA if δ(q0, w)
contains at least one final state.
That is, there exists a sequence of valid
transitions from q0 to a final state given the input w.
The language of the NFA is the set of strings it
accepts.
As with a DFA, we say that the size of an NFA is
the total number of nodes and edges in its graph
representation. Note that this is also proportional to
the size of the NFA’s transition table representation
(where we store each δ(q, w) entry as a list).
33. Example NFA
Set of all strings with two consecutive a’s or
two consecutive b’s:
Note that some states have an empty
transition on an a or b, and some have
multiple transitions on a or b. 33
34. NFA Simulation
Given an NFA, A, of size, m, and an input string, T, of
length n, we can test if T is in L(A) in O(mn) time:
1. Read in the the graph representation for A.
Step 1 takes O(m) time.
2. Let S = {q}, where q is the initial state for A.
3. For each character, c, in T (in order):
Let S be the union of d(q,c), for each q in S.
Note: we can compute S in O(m) time, since the total size
of all the d(q,c) sets is at most O(m) even counting
duplicates.
4. If S contains a final state, accept T.
35. 35
Every DFA can be Converted to an
Equivalent NFA
A DFA can easily be turned into an NFA that
accepts the same language.
If δD(q, a) = p, let the NFA have δN(q, a) = {p}.
Then the NFA is always in a state set
containing exactly one DFA state – the state
the DFA is in after reading the same input.
36. 36
Every NFA can be Converted to an
Equivalent DFA
Surprisingly, for any NFA there is a DFA that
accepts the same language.
The proof is called the subset construction.
It was defined by Michael Rabin and Dana Scott.
The drawback is that the number of states of the
DFA can be exponential in the number of states
of the NFA.
37. Michael Rabin Dana Scott
1959: They jointly published the subset construction
and introduced the nondeterminism concept.
1976: They jointly received the Turing Award
The “Nobel Prize” of Computer Science
Images from https://en.wikipedia.org/wiki/Michael_O._Rabin, https://en.wikipedia.org/wiki/Dana_Scott
38. 38
Subset Construction
Given an NFA with states Q, inputs Σ,
transition function δN, state state q0, and
final states F, construct equivalent DFA
with:
States 2Q (Set of subsets of Q).
Inputs Σ.
Start state {q0}.
Final states = all those with a member of F.
39. 39
Critical Point
• The DFA states have names that are sets of
NFA states.
• So as a DFA state, an expression like {p,q}
must be read as a single symbol, not as a set.
• Analogy: a class of objects whose values are
sets of objects of another class.
40. 40
Subset Construction – (2)
The transition function δD is defined by:
δD({q1,…,qk}, a) is the union over all i = 1,…,k of
δN(qi, a).
Example: We’ll construct the DFA equivalent of
our “chessboard” NFA.
41. 41
Example: Subset Construction
r b
1 2,4 5
2 4,6 1,3,5
3 2,6 5
4 2,8 1,5,7
5 2,4,6,8 1,3,7,9
6 2,8 3,5,9
7 4,8 5
8 4,6 5,7,9
9 6,8 5
*
r b
{1} {2,4} {5}
{2,4}
{5}
Alert: What we’re doing here is
the lazy form of DFA construction,
where we only construct a state
if we are forced to.
42. 42
Example: Subset Construction
r b
1 2,4 5
2 4,6 1,3,5
3 2,6 5
4 2,8 1,5,7
5 2,4,6,8 1,3,7,9
6 2,8 3,5,9
7 4,8 5
8 4,6 5,7,9
9 6,8 5
*
r b
{1}
{2,4,6,8}
{5}
{2,4} {2,4,6,8} {1,3,5,7}
{1,3,5,7}
{2,4} {5}
43. 43
Example: Subset Construction
r b
1 2,4 5
2 4,6 1,3,5
3 2,6 5
4 2,8 1,5,7
5 2,4,6,8 1,3,7,9
6 2,8 3,5,9
7 4,8 5
8 4,6 5,7,9
9 6,8 5
*
r b
{1}
* {1,3,7,9}
{2,4,6,8}
{2,4,6,8} {1,3,7,9}
{5}
{2,4} {2,4,6,8} {1,3,5,7}
{1,3,5,7}
{2,4} {5}
48. 48
NFA’s With ε-Transitions
We can allow state-to-state transitions on ε (null)
input.
These transitions are done spontaneously,
without looking at the input string.
A convenience at times, but still only regular
languages are accepted.
49. 49
Example: ε-NFA
C
E F
A
B D
1
1 1
0
0
0
ε
ε ε
0 1 ε
A {E} {B} ∅
B ∅ {C} {D}
C ∅ {D} ∅
D ∅ ∅ ∅
E {F} ∅ {B, C}
F {D} ∅ ∅
*
50. 50
Closure of States
CL(q) = set of states you can reach from state
q following only arcs labeled ε.
Example: CL(A) = {A};
CL(E) = {B, C, D, E}.
Closure of a set of states = union of the
closure of each state.
Can be computed by doing a depth-first
search that just follows ε-transitions.
C
E F
A
B D
1
1 1
0
0
0
ε
ε ε
51. 51
Equivalence of NFA and ε-NFA
Every NFA is an ε-NFA.
It just has no transitions on ε.
The converse requires us to take an ε-NFA with
m states and construct an NFA that accepts the
same language (also with m states).
We do so by combining ε–transitions with the
next transition on a real input.
53. 53
Equivalence – (2)
Start with an ε-NFA with states Q, inputs Σ, start
state q0, final states F, and transition function δE.
Construct an “ordinary” NFA with states Q, inputs
Σ, start state q0, final states F’, and transition
function δN.
If the ε-NFA has size m, then the resulting
equivalent NFA will have size O(m2) in the worst
case.
54. 54
Compute δN as follows:
1. For each q in Q, let Sq = CL(q).
Step 1 takes O(m2) time (by doing a depth-first search
from each q that just follows ε-transitions).
2. Let δN(q, a) be the union over all p in Sq of δE(p, a)
for which δE(p, a) is defined.
Step 2 takes O(m) time for each state q, since the
total size of all the δE(p, a) sets is O(m).
So, the total running time for ε-NFA-to-NFA
conversion is O(m2). The resulting NFA could
have size O(m2), since it will have the same
number of nodes, but could have more edges.
F’ = set of states q such that CL(q) contains a
state of F.
55. 55
Example: ε-NFA-to-NFA
0 1 ε
A {E} {B} ∅
B ∅ {C} {D}
C ∅ {D} ∅
D ∅ ∅ ∅
E {F} ∅ {B, C}
F {D} ∅ ∅
*
ε-NFA
0 1
A {E} {B}
B ∅ {C}
C ∅ {D}
D ∅ ∅
E {F} {C, D}
F {D} ∅
*
*
*
Since closure of
E includes B and
C; which have
transitions on 1
to C and D.
Since closures of
B and E include
final state D.
Interesting
closures:
CL(B) = {B,D};
CL(E) = {B,C,D,E}
NFA
δN
δE
56. ε-NFA Matching via DFA Conversion
can be Slow for Big Finite Automata
Given an ε-NFA, A, of size m, and an input string, T,
of length n, we can test if T is in L(A) in O(2m + n)
time:
1. Convert A into an equivalent DFA, B, using the above
ε-NFA to NFA to DFA constructions.
Step 1 takes O(2m) time in the worst case and creates a
DFA of size O(2m) in the worst case.
2. Test if T is in L(B) using the DFA simulation algorithm.
Step 2 takes O(2m + n) time.
57. There is an Alternative Approach
Instead of converting the ε-NFA to a DFA, and
then matching using the DFA, simulate the ε-NFA
directly.
Image from http://algs4.cs.princeton.edu
58. ε-NFA Simulation
Given an ε-NFA, A, of size, m, and an input string, T,
of length n, we can test if T is in L(A) in O(mn) time:
1. Read in the graph representation for A.
Step 1 takes O(m) time.
2. Let S = {q}, where q is the initial state for A.
3. For each character, c, in T (in order):
Let S = CL(S). This can be done in O(m) time by a DFS
that only follows ε-transitions.
Let S be the union of d(q,c), for each q in S. This takes
O(m) time, since the size of all the d(q,c) sets is O(m).
4. If S contains a final state, accept T.
59. 59
Summary
DFA’s, NFA’s, and ε–NFA’s all accept exactly the
same set of languages: the regular languages.
The NFA types are easier to design and may
have exponentially fewer states than a DFA.
But only a DFA can be implemented in linear
time, that is, O(m + n) time.
Implementing an ε-NFA by the conversion to DFA
method takes O(2m + n) time.
Implementing an ε-NFA by the ε-NFA simulation
method takes O(mn) time.