postproc: add support for co-Büchi output

* spot/twaalgos/cobuchi.cc, spot/twaalgos/cobuchi.hh (to_nca): New
function.
(weak_to_cobuchi): New internal function, used in to_nca and to_dca
when appropriate.
* spot/twaalgos/postproc.cc, spot/twaalgos/postproc.hh: Implement
the CoBuchi option.
* python/spot/__init__.py: Support it in Python.
* bin/common_post.cc: Add support for --buchi.
* bin/autfilt.cc: Remove the --dca option.
* tests/core/dca.test, tests/python/automata.ipynb: Adjust and add
more tests.  In particular, add more complex persistence and
recurrence formulas to the list of dca.test.
* tests/python/dca.test: Adjust and rename to...
* tests/core/dca2.test: ... this.  Add more tests, to the point
that this is now failing, as described in issue #317.
* tests/python/dca.py: Remove.
* tests/Makefile.am: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2018-01-12 20:53:53 +01:00
parent 9464043d39
commit 61b0a542f1
14 changed files with 618 additions and 531 deletions

View file

@ -359,12 +359,6 @@ static const argp_option options[] =
"solver can be set thanks to the SPOT_SATSOLVER environment variable"
"(see spot-x)."
, 0 },
{ "dca", OPT_DCA, nullptr, 0,
"convert to deterministic co-Büchi. The resulting automaton will always "
"recognize at least the same language. Actually, it can recognize "
"more if the original language can not be expressed using a co-Büchi "
"acceptance condition."
, 0 },
{ nullptr, 0, nullptr, 0, "Decorations (for -d and -H1.1 output):", 9 },
{ "highlight-nondet-states", OPT_HIGHLIGHT_NONDET_STATES, "NUM",
OPTION_ARG_OPTIONAL, "highlight nondeterministic states with color NUM",
@ -1440,8 +1434,6 @@ namespace
aut = spot::to_generalized_rabin(aut, opt_gra == GRA_SHARE_INF);
if (opt_gsa)
aut = spot::to_generalized_streett(aut, opt_gsa == GSA_SHARE_FIN);
if (opt_dca)
aut = spot::to_dca(aut, false);
if (opt_streett_like)
aut = spot::dnf_to_streett(aut);

View file

@ -34,7 +34,8 @@ bool level_set = false;
bool pref_set = false;
enum {
OPT_HIGH = 1,
OPT_COBUCHI = 256,
OPT_HIGH,
OPT_LOW,
OPT_MEDIUM,
OPT_SMALL,
@ -65,6 +66,11 @@ static constexpr const argp_option options[] =
"any|min|max|odd|even|min odd|min even|max odd|max even",
OPTION_ARG_OPTIONAL,
"colored automaton with parity acceptance", 0, },
{ "cobuchi", OPT_COBUCHI, nullptr, 0,
"automaton with co-Büchi acceptance (will recognize"
"a superset of the input language if not co-Büchi "
"realizable)", 0 },
{ "coBuchi", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
/**************************************************/
{ nullptr, 0, nullptr, 0, "Simplification goal:", 20 },
{ "small", OPT_SMALL, nullptr, 0, "prefer small automata (default)", 0 },
@ -123,6 +129,11 @@ static const argp_option options_disabled[] =
"any|min|max|odd|even|min odd|min even|max odd|max even",
OPTION_ARG_OPTIONAL,
"colored automaton with parity acceptance", 0, },
{ "cobuchi", OPT_COBUCHI, nullptr, 0,
"automaton with co-Büchi acceptance (will recognize"
"a superset of the input language if not co-Büchi "
"realizable)", 0 },
{ "coBuchi", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
/**************************************************/
{ nullptr, 0, nullptr, 0, "Simplification goal:", 20 },
{ "small", OPT_SMALL, nullptr, 0, "prefer small automata", 0 },
@ -210,6 +221,9 @@ parse_opt_post(int key, char* arg, struct argp_state*)
case 'S':
sbacc = spot::postprocessor::SBAcc;
break;
case OPT_COBUCHI:
type = spot::postprocessor::CoBuchi;
break;
case OPT_HIGH:
level = spot::postprocessor::High;
simplification_level = 3;