expression.transpose

Reverse all the concatenations, and transpose the labels.

Preconditions:

  • None

Properties:

  • involution

See also:

Examples

In [1]:
import vcsn
c = vcsn.context('law_char(abc), seriesset<law_char(xyz), b>')
c
Out[1]:
$\{a, b, c\}^*\to\mathsf{Series}[\{x, y, z\}^*\to\mathbb{B}]$
In [2]:
r = c.expression('(<x>a+<xyz>(abc))*')
r
Out[2]:
$\left( \left\langle \mathit{x} \right\rangle \,\mathit{a} + \left\langle \mathit{xyz} \right\rangle \,\left(\mathit{abc}\right)\right)^{*}$
In [3]:
r.transpose()
Out[3]:
$\left( \left\langle \mathit{x} \right\rangle \,\mathit{a} + \left\langle \mathit{zyx} \right\rangle \,\left(\mathit{cba}\right)\right)^{*}$
In [4]:
assert(r.transpose().transpose() == r)

transpose and transposition should not be confused. The former completely rewrites the expression, while the latter only wraps it in a syntactic transposition operator:

In [5]:
r = c.expression('<xyz>(abc)')
r
Out[5]:
$ \left\langle \mathit{xyz} \right\rangle \,\left(\mathit{abc}\right)$
In [6]:
r.transpose()
Out[6]:
$ \left\langle \mathit{zyx} \right\rangle \,\left(\mathit{cba}\right)$
In [7]:
r.transposition()
Out[7]:
$\left( \left\langle \mathit{xyz} \right\rangle \,\left(\mathit{abc}\right)\right)^{T}$