postproc: add support for colored-parity

* spot/twaalgos/postproc.cc, spot/twaalgos/postproc.hh: Add support
for a colored option.
* bin/common_post.cc, bin/common_post.hh bin/autfilt.cc,
bin/ltl2tgba.cc, bin/dstar2tgba.cc: Add support for --colored-parity.
* bin/ltldo.cc: Adjust as well for consistency, even if --parity and
--colored-parity is not used here.
* tests/core/parity2.test: Add tests.
* doc/org/autfilt.org, doc/org/ltl2tgba.org: Add examples.
* NEWS: Mention --colored-parity.
This commit is contained in:
Alexandre Duret-Lutz 2018-01-08 11:33:00 +01:00
parent 6bad8aebdd
commit bd6dc7a806
12 changed files with 411 additions and 41 deletions

View file

@ -180,6 +180,7 @@ namespace spot
#define PREF_ (pref_ & (Small | Deterministic))
#define COMP_ (pref_ & Complete)
#define SBACC_ (pref_ & SBAcc)
#define COLORED_ (pref_ & Colored)
twa_graph_ptr
postprocessor::run(twa_graph_ptr a, formula f)
@ -194,6 +195,9 @@ namespace spot
state_based_ = true;
bool want_parity = (type_ & Parity) == Parity;
if (COLORED_ && !want_parity)
throw std::runtime_error("postprocessor: the Colored setting only works "
"for parity acceptance");
auto finalize = [&](twa_graph_ptr tmp)
{
@ -205,6 +209,8 @@ namespace spot
tmp = sbacc(tmp);
if (want_parity)
{
if (COLORED_)
colorize_parity_here(tmp);
parity_kind kind = parity_kind_any;
parity_style style = parity_style_any;
if ((type_ & ParityMin) == ParityMin)

View file

@ -136,6 +136,7 @@ namespace spot
Complete = 4,
SBAcc = 8, // State-based acceptance.
Unambiguous = 16,
Colored = 32, // Colored parity; requires parity acceptance
};
typedef int output_pref;
@ -163,7 +164,9 @@ namespace spot
///
/// The above options can be combined with \c Complete and \c
/// SBAcc, to request a complete automaton, and an automaton with
/// state-based acceptance.
/// state-based acceptance. Automata with parity acceptance may
/// also be required to be \c Colored, ensuring that each
/// transition (or state) belong to exactly one acceptance set.
///
/// Note 1: the \c Unambiguous option is not actually supported by
/// spot::postprocessor; it is only honored by spot::translator.