acc: add a to_dnf() method

* src/tgba/acc.cc, src/tgba/acc.hh: Implement a to_dnf()
method.
* src/bin/autfilt.cc: Add option --dnf-acceptance.
* src/tgbatest/acc2.test: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2015-02-22 23:10:31 +01:00
parent de586dd2f0
commit 1441c4fe34
4 changed files with 370 additions and 5 deletions

View file

@ -79,6 +79,7 @@ Exit status:\n\
#define OPT_SBACC 18
#define OPT_STRIPACC 19
#define OPT_KEEP_STATES 20
#define OPT_DNF_ACC 21
static const argp_option options[] =
{
@ -118,6 +119,8 @@ static const argp_option options[] =
{ "keep-states", OPT_KEEP_STATES, "NUM[,NUM...]", 0,
"only keep specified states. The first state will be the new "\
"initial state", 0 },
{ "dnf-acceptance", OPT_DNF_ACC, 0, 0,
"put the acceptance condition in Disjunctive Normal Form", 0 },
/**************************************************/
{ 0, 0, 0, 0, "Filtering options:", 6 },
{ "are-isomorphic", OPT_ARE_ISOMORPHIC, "FILENAME", 0,
@ -197,6 +200,7 @@ static char opt_instut = 0;
static bool opt_is_empty = false;
static bool opt_sbacc = false;
static bool opt_stripacc = false;
static bool opt_dnf_acc = false;
static spot::acc_cond::mark_t opt_mask_acc = 0U;
static std::vector<bool> opt_keep_states = {};
static unsigned int opt_keep_states_initial = 0;
@ -259,6 +263,9 @@ parse_opt(int key, char* arg, struct argp_state*)
case OPT_DESTUT:
opt_destut = true;
break;
case OPT_DNF_ACC:
opt_dnf_acc = true;
break;
case OPT_IS_COMPLETE:
opt_is_complete = true;
break;
@ -403,6 +410,9 @@ namespace
spot::strip_acceptance_here(aut);
if (opt_merge)
aut->merge_transitions();
if (opt_dnf_acc)
aut->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().to_dnf());
// Filters.