strength: fix is_terminal()

Fix #198.  Reported by Maximilien Colange.

* spot/twaalgos/strength.cc (is_terminal): Test that no accepting
transition lead to a rejecting SCC.
* tests/core/strength.test: Add test case.
* spot/twaalgos/strength.hh, spot/twa/twa.hh, doc/org/concepts.org:
Adjust documentation.
* NEWS: Mention the fix.
This commit is contained in:
Alexandre Duret-Lutz 2016-11-28 16:19:05 +01:00
parent 2fbc75f439
commit 9bc978a90f
6 changed files with 133 additions and 15 deletions

View file

@ -1179,10 +1179,12 @@ namespace spot
/// \brief Whether the automaton is terminal.
///
/// An automaton is terminal if it is weak, no non-accepting cycle
/// can be reached from an accepting cycle, and the accepting
/// strongly components are complete (i.e., any suffix is accepted
/// as soon as we enter an accepting component).
/// An automaton is terminal if it is weak, its accepting strongly
/// components are complete, and no accepting edge lead to a
/// non-accepting SCC.
///
/// This property ensures that a word can be accepted as soon as
/// on of its prefixes move through an accepting edge.
///
/// \see prop_weak()
/// \see prop_inherently_weak()

View file

@ -79,6 +79,17 @@ namespace spot
break;
}
}
// A terminal automaton should accept any word that as a prefix
// leading to an accepting edge. In other words, we cannot have
// an accepting edge that goes into a rejecting SCC.
if (terminal && is_term)
for (auto& e: aut->edges())
if (si->is_rejecting_scc(si->scc_of(e.dst))
&& aut->acc().accepting(e.acc))
{
is_term = false;
break;
}
exit:
if (need_si)
delete si;

View file

@ -25,8 +25,12 @@ namespace spot
{
/// \brief Whether an automaton is terminal.
///
/// An automaton is terminal if it is weak, and all accepting SCCs
/// are complete.
/// An automaton is terminal if it is weak, all its accepting SCCs
/// are complete, and no accepting transitions lead to a
/// non-accepting SCC.
///
/// This property guarantees that a word is accepted if it has some
/// prefix that reaches an accepting transition.
///
/// \param aut the automaton to check
///