automaton.costandard

Turns an automaton into a costandard automaton. This is equivalent to calling _aut_.transpose().standard().transpose().

Preconditions:

  • None

Postconditions:

  • result.is_costandard()

See also:

Examples

There is a single final state.

In [1]:
import vcsn
ctx = vcsn.context('lal_char(abc), z')
std = lambda e: ctx.expression(e).standard()
a = std('a').add(std('b'), 'general')
a
Out[1]:
%3 I0 0 0 I0->0 I2 2 2 I2->2 F1 F3 1 1 0->1 a 1->F1 3 3 2->3 b 3->F3
In [2]:
a = a.costandard()
a
Out[2]:
%3 I0 0 0 I0->0 I2 2 2 I2->2 F4 4 4 0->4 a 2->4 b 4->F4

The final state has 1 as (final) weight.

In [3]:
a = a.costandard() * 2
a
Out[3]:
%3 I0 0 0 I0->0 I1 1 1 I1->1 F2 2 2 0->2 a 1->2 b 2->F2 ⟨2⟩
In [4]:
a.costandard()
Out[4]:
%3 I0 0 0 I0->0 I1 1 1 I1->1 F3 3 3 0->3 ⟨2⟩a 1->3 ⟨2⟩b 3->F3

There is no outgoing transition from the final state.

In [5]:
%%automaton -s a
context = "lal_char(abc), z"
$ -> 0 <2>
0 -> $ <2>
0 -> 1 a
1 -> 0 b
%3 I0 0 0 I0->0 ⟨2⟩ F0 0->F0 ⟨2⟩ 1 1 0->1 a 1->0 b
In [6]:
a.costandard()
Out[6]:
%3 I0 0 0 I0->0 ⟨2⟩ I2 2 2 I2->2 ⟨4⟩ F2 1 1 0->1 a 1->0 b 1->2 ⟨2⟩b 2->F2