1. Definition

The quotient can be defined for automata or transducers of any type, that is, over any kind of alphabet and with any kind of weight semiring.

The quotient of an automaton A with respect to an equivalence on its states is an automaton B obtained from A by merging equivalent states.
The quotient is consistant if the equivalence is congruent with the transitions, i.e. if, for every pair (p,q) of equivalent states, the two following properties hold:

  1. they have the same final weight (or status);
  2. for every class C of equivalent states, for every label a, the sum of weights of transitions with source p, label a and target in C, is equal to the sum of weights of transitions with source q, label a and target in C.

Then, the quotient of A with respect to the equivalence is the automaton B where

If is congruent with transitions, the quotient of A is equivalent to A. The minimal quotient of A is the quotient with respect to the coarsest equivalence congruent with the transitions of A.

The co-quotient of an automaton A with respect to an equivalence is the transposition of the quotient of the transposition of A with respect to . To be consistent, must be congruent with the reverse transitions of A.

The minimal co-quotient of A is the co-quotient with respect to the coarsest equivalence congruent with the reverse transitions of A.

Note that the quotient does not involve product of weights. In particular, even if the semiring of weights is non commutative -- the consistency of transposition can then be problematic -- the co-quotient of A is well defined and equivalent to A.

2. Implementation

Two algorithms which computes the coarsest equivalence congruent with the transitions of a given automaton A are implemented in Awali. Both algorithms are refinement algorithms. They usually start with an equivalence where all states with the same final weight are equivalent, and split equivalence classes until the equivalence is congruent with the transitions.

In Awali, final weights are represented as special transitions whose target is the post-final state; the equivalence is therefore initialised as the class of all (normal) states, the singleton containing the pre-initial state, and the singleton containing the post-initial state.

2.1 Moore algorithm

At each round, for every class C and every state p in this class, the signature of p is computed: the signature of p is a list of triples (D,a,k) where k (different from zero) is the sum of the weights of the transitions with source p and label a to a state of class D. The signatures are weakly sorted such that there is no duplicate and two lists with the same set of entries are equal. The class C is then split into subclasses characterised by signatures.

If there is no splitting during a round, the algorithm ends.

2.2 Hopcrof algorithm

Classes are processed through a queue (Hopcroft algorithm does not specify any policy, but we use a FIFO). For every class C get from the queue, for every state p predecessor of some state in C, the signature of p is computed: the signature of p is a list of pair (a,k) where k (different from zero) is the sum of the weights of the transitions with source p and label a to a state of C. The signatures are weakly sort such that there is no duplicate and two lists with the same set of entries are equal. Each class that contains a predecessor of a state in C is then split into subclasses characterised by signatures. If the split of a class D occur when D is not in the queue, all the subclasses of D except the larger one are put in the queue, otherwise, all the subclasses are put in the queue. The algorithm ends when the queue is empty.

2.3 Caveat

For implementation purpose (hash maps), the minimal quotient can only be computed on automata for which there exists a hash function for labels.