expansion.ldivide(xpn)

xpn//expansion

An expansion which denotes the left quotient of both expansions. Beware that the notation lhs // rhs is somewhat misleading, and corresponds to lhs \ rhs, i.e. lhs is the divisor, and rhs the dividend.

Precondition:

  • the labelset features a one (empty word)

See also:

Examples

In [1]:
import vcsn
ctx = vcsn.context('lan, q')
def exp(e):
    return ctx.expression(e)
def xpn(e):
    return exp(e).expansion()
xpn('ab') // xpn('abc')
Out[1]:
$\varepsilon \odot \left[b \backslash b \, c\right]$

The support for the left-quotient operator in expansion relies on the left quotient of the expansions. Contrast the following result with the previous one.

In [2]:
xpn('ab {\} abc')
Out[2]:
$\varepsilon \odot \left[b \backslash b \, c\right]$

And with a more complex expression:

In [3]:
xpn('[ab]* {\} (ab)*')
Out[3]:
$\left\langle 1\right\rangle \oplus \varepsilon \odot \left[a \, b \, \left(a \, b\right)^{*} \oplus a \, \left(a + b\right)^{*} \backslash \varepsilon \oplus b \, \left(a + b\right)^{*} \backslash \varepsilon \oplus \left(a + b\right)^{*} \backslash b \, \left(a \, b\right)^{*}\right]$
In [4]:
xpn('[ab]*') // xpn('(ab)*')
Out[4]:
$\left\langle 1\right\rangle \oplus \varepsilon \odot \left[a \, b \, \left(a \, b\right)^{*} \oplus a \, \left(a + b\right)^{*} \backslash \varepsilon \oplus b \, \left(a + b\right)^{*} \backslash \varepsilon \oplus \left(a + b\right)^{*} \backslash b \, \left(a \, b\right)^{*}\right]$

And the corresponding derived-term automaton:

In [5]:
exp('[ab]* {\} (ab)*').derived_term()
Out[5]:
%3 I0 0 (a+b)*{\}(ab)* I0->0 F0 F6 0->F0 1 ab(ab)* 0->1 ε 2 a(a+b)*{\}ε 0->2 ε 3 b(a+b)*{\}ε 0->3 ε 4 (a+b)*{\}b(ab)* 0->4 ε 5 b(ab)* 1->5 a 2->2 ε 3->3 ε 4->0 ε 4->5 ε 6 (ab)* 5->6 b 6->F6 6->5 a