expression
.expansion()
Compute the expansion of a weighted expression. An expansion is a structure that combines three different features of a (weighted) rational expression :
its constant-term, i.e., the weight associated to the empty word, denoted
its firsts, i.e., the set of labels that prefix the defined language, denoted
its derived-terms, i.e., for each label , its associated polynomials of "subsequent" expressions, denoted .
If one denotes the expansion of , it holds that:
The main use of expansions (and derivations) is to compute the derived-term automaton of an expression. The advantage of expansions over derivations is their independence with respect to the alphabet. As a matter of fact, they do not require a finite-alphabet (see examples below). Besides, the reunite constant-term, first, and derivation into a single concept.
See also:
References:
demaille.2016.ictac introduces expansions
Examples
The following function will prove handy to demonstrate the relation between the expansion on the one hand, and, on the other hand, the constant-term and the derivations. It takes an expression and a list of letters, and returns a aligned
environment to display:
the expansion
the constant-term
the derivation with respect to .
Classical Expressions
In the classical case (labels are letters, and weights are Boolean), this is the construct as described by Antimirov.
Or, using the diffs
function we defined above:
Weighted Expressions
Of course, expressions can be weighted.
And this is tightly connected with the construction of the derived-term automaton.
Breaking expansion
There is (currently) no means to break an expansion (which would mean breaking its polynomials). The construction of the derived-term automaton does it on the fly.
Non-free labelsets
Contrary to derivation, which requires a finite alphabet, expansions support labels which are words, or even tuples.
Below, we define a two-tape-of-words context, and a simple expression that uses three different multitape labels: , etc. Then derived_term
is used to build the automaton.
This enables the construction of the associated derived-term automaton.