automaton.ambiguous_word

Return an ambiguous word, or raise if the automaton is unambiguous.

Preconditions:

  • the labelset is free

Postconditions:

  • the Result is accepted

See also:

Examples

In [1]:
import sys
import vcsn
a = vcsn.B.expression('abc').standard()
a
Out[1]:
%3 I0 0 0 I0->0 F4 1 1 0->1 a 3 3 1->3 b 4 4 3->4 c 4->F4
In [2]:
a.is_ambiguous()
Out[2]:
False
In [3]:
try:
    a.ambiguous_word()
except RuntimeError as err:
    print("error:", err, file=sys.stderr)
error: ambiguous_word: automaton is unambiguous
In [4]:
a = vcsn.B.expression('in (xxyy + xx + yy)* out').automaton()
a
Out[4]:
%3 I0 0 0 I0->0 F9 1 1 0->1 i 2 2 1->2 n 3 3 2->3 o 4 4 2->4 x 5 5 2->5 x 6 6 2->6 y 8 8 3->8 u 4->2 x 7 7 5->7 x 6->2 y 7->6 y 9 9 8->9 t 9->F9
In [5]:
a.ambiguous_word()
Out[5]:
$\mathit{inxxyyout}$