The (accessible part of the) shuffle product of automata.
Preconditions:
See also:
In [1]:
import vcsn
The shuffle product of automata computes the shuffling of their languages: all the possible interleavings.
In [2]:
std = lambda exp: vcsn.B.expression(exp).standard()
a = std('abc')
a
Out[2]:
In [3]:
a.shuffle(std('xyz'))
Out[3]:
In the case of weighted automata, weights are "kept" with the letters.
In [4]:
c = vcsn.context('lal_char, seriesset<lal_char, z>')
std = lambda exp: c.expression(exp).standard()
In [5]:
std('<A>a<B>b').shuffle(std('<X>x<Y>y'))
Out[5]:
In [6]:
x = std('<x>a')
y = std('<y>a')
z = std('<z>a')
In [7]:
x.shuffle(y, z)
Out[7]:
In [8]:
x.shuffle(y).shuffle(z)
Out[8]: