automaton.partial_identity

Create a transducer which realizes a partial identity for the series recognized by the input automaton. It means that the transducer will accept the same series as the input automaton, and for each input word $w$ the output will be $w$.

Preconditions:

  • None

See also:

Examples

In [1]:
import vcsn

The following is the input automaton:

In [2]:
a = vcsn.Q.expression("<3>abc*(<2>d)* + ce<5>").automaton()
a
Out[2]:
%3 I0 0 0 I0->0 F3 F4 F5 1 1 0->1 ⟨3⟩a 2 2 0->2 ⟨5⟩c 4 4 1->4 b 3 3 2->3 e 3->F3 4->F4 4->4 c 5 5 4->5 ⟨2⟩d 5->F5 5->5 ⟨2⟩d
In [3]:
b = a.partial_identity()
b
Out[3]:
%3 I0 0 0 I0->0 F3 F4 F5 1 1 0->1 ⟨3⟩a|a 2 2 0->2 ⟨5⟩c|c 4 4 1->4 b|b 3 3 2->3 e|e 3->F3 4->F4 4->4 c|c 5 5 4->5 ⟨2⟩d|d 5->F5 5->5 ⟨2⟩d|d
In [4]:
b.context()
Out[4]:
$\{a, b, c, d, e, \ldots\} \times \{a, b, c, d, e, \ldots\}\to\mathbb{Q}$
In [5]:
a.evaluate("abcd")
Out[5]:
$6$
In [6]:
b.lift(1).evaluate("abcd")
Out[6]:
$ \left\langle 6 \right\rangle \,\left(\left(a\right) \, \left(b\right) \, \left(c\right) \, \left(d\right)\right)$