A careful analysis of automata with spontaneous transitions shows that in some case, spontaneous-cycles may result in automata with an undefined behavior. They are called invalid.
Preconditions:
See also:
References:
In [1]:
import vcsn
The following examples are taken from lombardy.2013.ijac.
The following automaton is invalid.
In [2]:
%%automaton q3
context = "lan_char, q"
$ -> 0
0 -> 0 <-1/2>\e
0 -> 1 <1/2>\e
1 -> 1 <-1/2>\e
1 -> 0 <1/2>\e
0 -> $
In [3]:
q3.is_valid()
Out[3]:
The following one, however, is valid. Spontaneous transitions can be eliminated.
In [4]:
%%automaton q4
context = "lan_char, q"
$ -> 0
0 -> 1 <1/2>\e, a
1 -> 0 <-1>\e, b
1 -> $ <2>
In [5]:
q4.proper()
Out[5]:
Sadly enough, the (weighted) Thompson construction may build invalid automata from valid expressions.
In [6]:
e = vcsn.context('lal_char, q').expression('(a*+<-1>b*)*')
e.is_valid()
Out[6]:
In [7]:
t = e.thompson()
t
Out[7]:
In [8]:
t.is_valid()
Out[8]: