automaton.ldivide(aut)
Compute the left quotient of two automata, i.e. the automaton recognizing the language of words such that there exists a word recognized by lhs with recognized by rhs.
In other words, it is the automata equivalent of languages left quotient, denoted by the operator or by a exposant on the left-hand side, and defined by:
where is the (left) quotient of L by the word u, defined like this:
See also:
Algorithm
Boolean case
For two automata with respective state set , the algorithm works as follows:
Remove all initial transitions of
For every state pair , set as initial if the following conditions are respected:
is accessible in
is final
Let and denote an initial and a final state of . The first condition ensures that, for any path , there is a path in , and therefore a path in . The second condition ensures that is recognized by .
Since is set as initial, now recognizes . So for any path accepting in , the constructed automaton recognizes if and only if is recognized by .
Preconditions:
None
Postconditions:
None
Weighted case
In the weighted case, the algorithm is similar to the conjunction between and except for three things:
continues matching even when it reaches an accepting state
if has not reached an accepting state yet, transitions are labelled one
weights are multiplied
Preconditions:
the labelset is free
Postconditions:
None
Examples
Quotient of two words
The quotient can be seen as a prefix-remover operator, such that the identity is respected for any word and .
On this example, and . The suppression of the original initial transitions (on state 0 in this example) will often lead to non-accessible states, which we may want to remove with the automaton.trim method:
Quotient of a language by a word
The quotient of a language by a word is the union of word quotients for all words of the language:
Since "a" is not a prefix of "bc", it is not taken into account in the resulting automaton.
Quotient of two languages
The quotient of two languages is the union of the quotient of the right-hand side by words of the left-hand side:
Weighted automata
Left quotient also works on weighted automata:
Right quotient
The right quotient of a language by a word is defined similarly as the left quotient:
Which naturaly leads to the right quotient of two languages:
The right quotient can be expressed using the left quotient and the transpose operator: