automaton
.is_valid
¶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:
import vcsn
The following examples are taken from lombardy.2013.ijac.
The following automaton is invalid.
%%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 -> $
q3.is_valid()
The following one, however, is valid. Spontaneous transitions can be eliminated.
%%automaton q4
context = "lan_char, q"
$ -> 0
0 -> 1 <1/2>\e, a
1 -> 0 <-1>\e, b
1 -> $ <2>
q4.proper()
Sadly enough, the (weighted) Thompson construction may build invalid automata from valid expressions.
e = vcsn.context('lal_char, q').expression('(a*+<-1>b*)*')
e.is_valid()
t = e.thompson()
t
t.is_valid()