package fix
Module Minimize.MinimizeSource
The functor application Minimize(Label)(A) applies a partition refinement algorithm to minimize the deterministic finite automaton A. The time complexity of this operation is O(n + m.log m), where n is the number of states of the automaton A and m is the number of its transitions. This bound is independent of the size of the alphabet of the transition labels.
Parameters
module Label : sig ... endmodule A : sig ... endSignature
A description of the minimized automaton A'.
A state of the original automaton A is retained only if it is accessible and co-accessible, that is, only if this state lies on a path from some initial state to some final state.
The states that are retained are then grouped into equivalence classes; these equivalence classes form the states of the minimal automaton A'.
The equivalence classes are made as coarse as possible (that is, as large as possible), while obeying the following constraints:
- The equivalence classes must respect the group of the final states,
A.finals. That is, if two states are deemed equivalent, then they must be both final or both non-final.
- Every group supplied by the user via
A.groupsmust similarly be respected.
- For every label
l, the equivalence classes must be compatible with the transitions that carry the labell. That is, if two statess1ands2are deemed equivalent, and if the states1has a transition labeledltowards some states'1, then the states2must have a transition labeledltowards some states'2such thats'1ands'2are also deemed equivalent.
include DFA with type label = Label.t
The type states is a type-level representation of the number of states of the automaton. Thus, a state number has type states index. See Indexing for more information about type-level indices.
states is the number of states of the automaton.
A state number is an integer in the range [0, cardinal states).
The type transitions is a type-level representation of the number of transitions of the automaton. Thus, a transition number has type transitions index. See Indexing for more information about type-level indices.
transitions is the number of transitions of the automaton.
A transition number is an integer in the range [0, cardinal transitions).
label t returns the label of the transition t.
source t returns the source state of the transition t.
target t returns the target state of the transition t.
The function transport_state maps a state of the original automaton A to the corresponding state of the minimal automaton A'. It is a partial function: transport_state s is Some _ if and only if the state s lies on a path from some initial state to some final state.
The function transport_transition maps a transition of the original automaton A to the corresponding transition of the minimal automaton A'. It is a partial function: transport_transition t is Some _ if and only if the transition t lies on a path from some initial state to some final state.
The function backport_state_one maps a state s' of the minimal automaton A' to a state s of the original automaton A such that transport_state s = Some s' holds. There may exist several states s such that this equation holds. A representative state in each equivalence class is chosen, and backport_state_one always returns a representative state.
The function backport_state_all maps a state s' of the minimal automaton A' to an enumeration of all states s of the original automaton A such that transport_state s = Some s' holds. There exists at least one such state: this enumeration is never empty.
The function backport_transition maps a transition t' of the minimal automaton A' to a transition t of the original automaton A such that transport_transition t = Some t' holds. There may exist several transitions t such that this equation holds; backport_transition returns the transition whose source state is a representative state.