is_unambiguous: fix false negatives again

Reported by Simon Jantsch and David Müller.

* spot/twaalgos/isunamb.cc (is_unambiguous): Rewrite wihtout assuming
that the product of two accepting SCCs is accepting,  Also use
the result of is_accepting_scc()/is_rejectng_scc() when available.
* spot/twaalgos/sccinfo.cc, spot/twaalgos/sccinfo.hh: Make it
possible to check the acceptance of a unique SCC.
* tests/core/unambig.test: Add more test cases.
This commit is contained in:
Alexandre Duret-Lutz 2018-04-15 13:51:39 +02:00
parent befdb03c9a
commit 2fe67769d7
4 changed files with 107 additions and 32 deletions

View file

@ -423,6 +423,20 @@ namespace spot
return support;
}
bool scc_info::check_scc_emptiness(unsigned n, std::vector<bool>* k)
{
if (SPOT_UNLIKELY(!aut_->is_existential()))
throw std::runtime_error("scc_info::check_scc_emptiness() "
"does not support alternating automata");
if (SPOT_UNLIKELY(!(options_ & scc_info_options::TRACK_STATES)))
report_need_track_states();
k->assign(aut_->num_states(), false);
auto& node = node_[n];
for (auto i: node.states_)
(*k)[i] = true;
return mask_keep_accessible_states(aut_, *k, node.one_state_)->is_empty();
}
void scc_info::determine_unknown_acceptance()
{
std::vector<bool> k;
@ -438,15 +452,8 @@ namespace spot
throw std::runtime_error(
"scc_info::determine_unknown_acceptance() "
"does not support alternating automata");
if (SPOT_UNLIKELY(!(options_ & scc_info_options::TRACK_STATES)))
report_need_track_states();
auto& node = node_[s];
if (k.empty())
k.resize(aut_->num_states());
for (auto i: node.states_)
k[i] = true;
if (mask_keep_accessible_states(aut_, k, node.one_state_)
->is_empty())
if (check_scc_emptiness(s, &k))
node.rejecting_ = true;
else
node.accepting_ = true;