is_unambiguous: fix detection of empty languages

* src/tests/unambig.test: New test case.  Reported by Ming-Hsien Tsai.
* src/twaalgos/sccfilter.cc: Always create an initial state.
* src/twaalgos/isunamb.cc: Speed up on empty languages.
* NEWS, THANKS: Update.
This commit is contained in:
Alexandre Duret-Lutz 2015-10-20 08:06:31 +02:00
parent 61bf5daab4
commit cd8e53de09
5 changed files with 29 additions and 5 deletions

View file

@ -324,11 +324,12 @@ namespace spot
}
if (!given_si)
delete si;
// If the initial state has been filtered out, we don't attempt
// to fix it.
// If the initial state has been filtered out, we have to create
// a new one (not doing so may cause empty automata, which in turn
// cause all sort of issue with algorithms assuming an automaton
// has one initial state).
auto init = inout[aut->get_init_state_number()];
if (init < out_n)
filtered->set_init_state(init);
filtered->set_init_state(init < out_n ? init : filtered->new_state());
return filtered;
}