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


:0: FutureWarning: IPython widgets are experimental and may change in the future.

In [2]:
a = vcsn.context('lal_char(abcd), b').expression('abc').standard()
a


Out[2]:
%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 [3]:
a.is_ambiguous()


Out[3]:
False

In [4]:
try:
    a.ambiguous_word()
except RuntimeError as err:
    print("error:", err)


error: automaton is unambiguous

In [5]:
a = a + a
a


Out[5]:
%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 [6]:
a.ambiguous_word()


Out[6]:
$\mathit{abc}$