A DFA is a deterministic finite automaton, a simple model of computation. It is one way to model regular languages. Each DFA consists of a finite set of states and a transition function between those states describing how the state of the machine changes in response to new input. DFAs are closely related to regular expressions in the sense that they can be converted into each other. Thus, DFAs are often used to implement regular expression matchers.
Questions tagged [dfa]
569 questions
5
votes
1 answer
drawing minmal DFA for the given regular expression
What is the direct and easy approach to draw minimal DFA, that accepts the same language as of given Regular Expression(RE).
I know it can be done by:
Regex ---to----► NFA ---to-----► DFA ---to-----► minimized DFA
But is there any shortcut way?…

Niraj Rana
- 83
- 1
- 1
- 4
5
votes
3 answers
DFA minimization
I have a question about DFA minimization. So I've used very well known techniques to convert regular expression into NFA and then construct DFA from it, using goto / closure algorithm. Now the question is how do I minimize it? I've watched lections…

Ruslan
- 313
- 1
- 3
- 16
5
votes
4 answers
Data structure to represent automata
I'm currently trying to come up with a data structure that fits the needs of two automata learning algorithms I'd like to implement in Haskell: RPNI and EDSM.
Intuitively, something close to what zippers are to trees would be perfect: those…

m09
- 7,490
- 3
- 31
- 58
5
votes
1 answer
How to implement regular expression assertions/lookaround (i.e. \b style word boundary) using a DFA regular expression matcher
I would like to implement "word boundary" matches within a DFA based regular expression matcher. Can someone tell me how this is done?
To give some background, I'm currently using the "dk.brics.automaton" library, but it does not support assertions…

user1255384
- 303
- 2
- 8
4
votes
2 answers
How to figure out if a regex implementation uses DFA or NFA?
I'm facing the question, whether a certain regex implementation is based on a DFA or NFA.
What are the starting points for me to figure this out. One could also ask: What am I looking for? What are the basic patterns and / or characteristics? A good…

Jan
- 1,594
- 1
- 20
- 30
4
votes
2 answers
Can I Determine the Set of First Chars Matched by Regex Pattern?
I would like to be able to compute the set of all characters which may be matched as the first character in a string by a given instance of java.util.regex.Pattern. More formally, given the DFA equivalent to a certain regular expression, I want the…

Daniel Spiewak
- 54,515
- 14
- 108
- 120
4
votes
1 answer
How does the minizinc pentominoes regular constraint example work?
The minizinc benchmarks repository contains several pentomino examples.
Here is the data for the first example:
width = 5;
height = 4;
filled = 1;
ntiles = 5;
size = 864;
tiles = [|63,6,1,2,0,
|9,6,1,2,378,
|54,6,1,2,432,
|4,6,1,2,756,
…

makeyourownmaker
- 1,558
- 2
- 13
- 33
4
votes
1 answer
Uncountably many regular languages
Consider the following language S = {0, 00, 000, 0000, 00000,....}.
Consider the power-set of S and let each element of the power-set of S be a regular language. Since S is countably infinite its power set is uncountably infinite. Since each element…

Ahmed Shaaban
- 51
- 2
4
votes
3 answers
DFA Minimization Brzozowski algorithm
I am trying to implement Brzozowski's algorithm for minimizing my DFA
Following is the algorithm for the same.
DFA = d(r(d(r(NFA))))
where r() is reversal of NFA and D() converts NFA to DFA.
But I do not understand what is the meaning of r()…

Avinash
- 12,851
- 32
- 116
- 186
4
votes
2 answers
Design DFA accepting decimal strings divisible by 7
I'm a student studying DFAs looking for a DFA that could find if a decimal number is divisible by 7.
today I've solved divisibility problem for numbers 2,3,4,5,6,8,9 but I can't solve this problem for number 7. I've searched the web but I couldn't…

Peyman
- 3,097
- 5
- 33
- 56
4
votes
7 answers
What is the algorithm for generating a random Deterministic Finite Automata?
The DFA must have the following four properties:
The DFA has N nodes
Each node has 2 outgoing transitions.
Each node is reachable from every other node.
The DFA is chosen with perfectly uniform randomness from all possibilities
This is what I have…

Jeff B.
- 85
- 5
4
votes
2 answers
A turing machine that decides {0^2^n; n>0} that's not the commonly accepted one
We're being asked to create a Turing Machine that accepts {0^(2^n); n>0} that is not the commonly accepted one published by Michael Sipser.
Instead, we are being asked to create one for the algorithm as follows:
On the first pass of the head, the…

Alyssa Buchthal
- 57
- 1
- 3
4
votes
1 answer
boost string matching DFA
Given a string I have to test whether that ends with a known set of suffixes. Now as the the of suffixes are not very small and every word in the document has to be checked against that list of known suffixes. Every character in the word and suffix…

Neel Basu
- 12,638
- 12
- 82
- 146
4
votes
1 answer
Construct DFA for L = {(na(w)-nb(w)) mod 3>0}
As per the title:
L = {(na(w)-nb(w)) mod 3>0}
Alphabet = {a,b}
I found two answers to this problem:
In this solution, our language is accepted.
However,
w = b
is accepted as well.
In the next solution:
Our problem of
w = b
is solved here but
w…

Shubham
- 153
- 1
- 2
- 9
4
votes
2 answers
Has anyone used RE2 in a C# application?
I started my search a for a decent Regular Expression engine. It landed me to this page Benchmark of Regex Libraries. I decided to use RE2 because it seems to be the best FSA engine in this list.
My final application will be built using WPF in…

Pranav Shah
- 3,233
- 3
- 30
- 47