isweakscc: cleanup interfaces and code

* src/tgbaalgos/isweakscc.cc, src/tgbaalgos/isweakscc.hh: Do not pass
automata since they are known from the scc.  Avoid several dynamic
casts.  Try to match the established vocabulary wrt "weak" and
"inherently weak".  The old is_weak_scc() that used to enumerate cycles
is therefore renamed to is_inherently_weak_scc(), while the new
is_weak_scc() will should ensure all transitions are fully accepting.
* NEWS: Mention the new interface.
This commit is contained in:
Alexandre Duret-Lutz 2013-04-27 20:02:11 +02:00
parent 450ec22bc3
commit cb7cd868a5
3 changed files with 116 additions and 99 deletions

View file

@ -1,4 +1,4 @@
// Copyright (C) 2012 Laboratoire de Recherche et Developpement de
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -26,62 +26,68 @@ namespace spot
/// \addtogroup tgba_misc
/// @{
/// \brief Whether the SCC number \a scc in \a map is inherently
/// weak.
///
/// An SCC is inherently weak if either its cycles are all
/// accepting, or they are all non-accepting.
///
/// Note the terminal SCCs are also inherently weak with that
/// definition.
///
/// The scc_map \a map should have been built already. The absence
/// of accepting cycle is easy to check (the scc_map can tell
/// whether the SCC is non-accepting already). Similarly, an SCC in
/// which all transitions belong to all acceptance sets is
/// necessarily weak.
/// For other accepting SCCs, this function enumerates all cycles in
/// the given SCC (it stops if it find a non-accepting cycle).
bool is_inherently_weak_scc(scc_map& map, unsigned scc);
/// \brief Whether the SCC number \a scc in \a map is weak.
///
/// An SCC is weak if either its cycles are all accepting, or they
/// are all non-accepting.
/// An SCC is weak if its non-accepting, or if all its transition
/// are fully accepting (i.e., the belong to all acceptance sets).
///
/// The scc_map \a map should have been built already. The absence
/// of accepting cycle is easy to check (the scc_map can tell
/// whether the SCC is non-accepting already). Similarly, an SCC in
/// which all transitions belong to all acceptance sets is
/// necessarily weak.
/// For other accepting SCCs, this function enumerates all cycles in
/// the given SCC (it stops if it find a non-accepting cycle).
bool is_weak_scc(scc_map& map, unsigned scc, bool easydetect = true);
/// Note that terminal SCCs are also weak with that definition.
///
/// The scc_map \a map should have been built already.
bool is_weak_scc(scc_map& map, unsigned scc);
/// \brief Whether the SCC number \a scc in \a map is complete
/// \brief Whether the SCC number \a scc in \a map is complete.
///
/// A SCC is complete iff for all states for all label there exist
/// a transition that stay into this SCC.
bool
is_complete_scc(const tgba *a, scc_map& map, unsigned scc);
/// An SCC is complete iff for all states and all label there exists
/// a transition that stays into this SCC.
///
/// The scc_map \a map should have been built already.
bool is_complete_scc(scc_map& map, unsigned scc);
/// \brief Whether the SCC number \a scc in \a map is syntactically weak.
/// \brief Whether the SCC number \a scc in \a map is syntactically
/// weak.
///
/// An SCC is syntactically weak iff the lowest label of states inside
/// this SCC corresponds to an obligation label
/// This works only on tgba whose labels are formulas. An SCC is
/// syntactically weak if one of its states is labeled by a
/// syntactic-persistence formula.
///
/// Work only on tgba where labels are formula
///
/// The scc_map \a map should have been built already. The absence
/// of accepting cycle is easy to check (the scc_map can tell
/// whether the SCC is non-accepting already). Similarly, an SCC in
/// which all transitions belong to all acceptance sets is
/// necessarily weak.
/// For other accepting SCCs, this function enumerates all cycles in
/// the given SCC (it stops if it find a non-accepting cycle).
bool is_syntactic_weak_scc(const tgba *a, scc_map& map, unsigned scc);
/// The scc_map \a map should have been built already.
bool is_syntactic_weak_scc(scc_map& map, unsigned scc);
/// \brief wether a SCC is syntactically characterized by a gurarantee
/// formula
/// \brief Whether the SCC number \a scc in \a map is syntactically
/// terminal.
///
/// Work only on tgba where labels are formula
bool is_syntactic_terminal_scc(const tgba *a, scc_map& map, unsigned scc);
/// \brief wether a SCC is terminal using an heuristic
/// This works only on tgba whose labels are formulas. An SCC is
/// syntactically terminal if one of its states is labeled by a
/// syntactic-guarantee formula.
///
/// The heuristic try to characterize the SCC by loking if the SCC
/// is complete and all cycle are fully accepting ( all transitions
/// have all acceptance conditions)
bool
is_terminal_heuristic (const tgba *a, scc_map& map, unsigned scc);
/// The scc_map \a map should have been built already.
bool is_syntactic_terminal_scc(scc_map& map, unsigned scc);
/// \brief wether a SCC is weak using an heuristic
///
/// The heuristic looks if all path are fully accepting
bool
is_weak_heuristic(scc_map& map, unsigned scc);
/// \brief Whether the SCC number \a scc in \a map is terminal.
///
/// An SCC is terminal if it is weak, complete, and accepting.
///
/// The scc_map \a map should have been built already.
bool is_terminal_scc(scc_map& map, unsigned scc);
/// @}
}