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 vcsn
a = vcsn.context('lal_char(abcd), 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)
error: automaton is unambiguous
In [4]:
a = a + a
a
Out[4]:
%3 I0 0 0 I0->0 F3 F6 1 1 0->1 a 4 4 0->4 a 2 2 1->2 b 3 3 2->3 c 3->F3 5 5 4->5 b 6 6 5->6 c 6->F6
In [5]:
a.ambiguous_word()
Out[5]:
$\mathit{abc}$