0

Here we have a DFA like this:

enter image description here

Is this already a minimized DFA or should we minimize it using Hopcroft algorithm by grouping all accepted states in one class and output:

enter image description here

BobHU
  • 402
  • 5
  • 18
  • The automata are not equivalent. The first will not accept the string `bbb` while it is accepted by the second. – Johan Oct 26 '18 at 14:40
  • 1
    Indeed, the first one may not even be a DFA depending on your definitions. There is an implied third state where strings of the form (bb)(a+b)* end up. – Patrick87 Oct 26 '18 at 14:52
  • This is actually an NFA, since there are two transitions from state 1 on input a. You can either stay in state 1 or go to state 0. – Todd O'Bryan Jun 11 '23 at 04:45

1 Answers1

0

The Hopcroft minimisation algorithm assumes a complete DFA, in which every state has a transition on every symbol in the alphabet.

It's common to use incomplete DFAs, in which missing transitions are allowed. Technically, this an NFA (although it's fully deterministic). Unlike a DFA, an NFA allows an alphabet symbol to produce a set of possible transitions from a given state, and that set could be empty, in which case the NFA halts. (A DFA only halts when the end of input is reached.)

For the purpose of minimisation, it's usual to add a non-accepting "sink" state which has a transition to itself on every input symbol. All "missing" transitions can then be replaced by a transition to the sink state, making the automaton complete. (In practice, of course, one would prefer to use the automaton which halts immediately on invalid input rather than spinning uselessly in the sink state until the end of input. After minimization, the sink state can be removed.)

With that convention, your DFA does not only have accepting states; there is one (implicit) non-accepting state. If the DFA really only had accepting states, then it would recognize Σ* and could indeed be minimized to a single accepting state.

Hopcroft's algorithm runs in time O(sN log N) where s is the size of the alphabet and N is the number of states. Since the DFA is assumed to be complete, sn is also the number of edges in the automaton's graph (every state must have s transitions), so we could write that as O(E log N). But if we relax the requirement that the DFA be complete, its graph will probably have considerably fewer edges, albeit only by a constant factor (if we take the alphabet size to be constant). There have been several proposals of algorithms which attempt to take advantage of this fact. See, for example, Marie-Pierre Béal, Maxime Crochemore. Minimizing incomplete automata. Finite-State Methods and Natural Language Processing (FSMNLP’08), 2008, United States. pp.9-16, 2008, Joint Research Centre.

rici
  • 234,347
  • 28
  • 237
  • 341
  • Is the Hopcroft algorithm the same one as the table filling one, where you start by marking pairs of a final and a non final state in a table of `n x n` for `n` states and then iterate marking pairs of states that have any edges into an already marked pair on a common input symbol? I cannot tell from the paragraph in the Wikipedia article on Hopcroft's algorithm – lo tolmencre Aug 14 '20 at 23:08
  • @lotolmencre: that description of an algorithm isn't precise enough for me to tell, but if you have an `n x n` table, it seems likely that your algorithm is at least O(n²), whereas Hopcroft's algorithm is O(n log n). Hopcroft's algorithm is a divide-and-conquer algorithm, and it's important how you implement the data structures; n log n is possible because certain operations can be implemented in O(1) as swaps. – rici Aug 14 '20 at 23:17