postproc: fix issue #402

* spot/twaalgos/postproc.cc, spot/twaalgos/postproc.hh,
spot/twaalgos/translate.cc: Introduce a gen-reduce-parity option and
use it on sub-automata built by ltl-split.
* bin/spot-x.cc: Document it.
* tests/core/ltl2tgba2.test: Add test case reported by Juraj Major.
This commit is contained in:
Alexandre Duret-Lutz 2020-04-25 19:59:11 +02:00
parent fe340ae8db
commit 6706042019
5 changed files with 52 additions and 18 deletions

View file

@ -84,6 +84,7 @@ namespace spot
sat_states_ = opt->get("sat-states", 0);
state_based_ = opt->get("state-based", 0);
wdba_minimize_ = opt->get("wdba-minimize", 1);
gen_reduce_parity_ = opt->get("gen-reduce-parity", 1);
if (sat_acc_ && sat_minimize_ == 0)
sat_minimize_ = 1; // Dicho.
@ -254,15 +255,25 @@ namespace spot
bool isparity = in->acc().is_parity();
if (isparity && in->is_existential()
&& (type_ == Generic || want_parity))
return reduce_parity(in);
if (!(want_parity && isparity))
{
if (level_ == High)
return simplify_acceptance(in);
else
return cleanup_acceptance(in);
auto res = reduce_parity(in);
if (want_parity || gen_reduce_parity_)
return res;
// In case type_ == Generic and gen_reduce_parity_ == 0,
// we only return the result of reduce_parity() if it can
// lower the number of colors. Otherwise,
// simplify_acceptance() will not do better and we return
// the input unchanged. The reason for not always using
// the output of reduce_parity() is that is may hide
// symmetries between automata, as in issue #402.
return (res->num_sets() < in->num_sets()) ? res : in;
}
return cleanup_parity(in);
if (want_parity && isparity)
return cleanup_parity(in);
if (level_ == High)
return simplify_acceptance(in);
else
return cleanup_acceptance(in);
};
a = simplify_acc(a);

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012-2019 Laboratoire de Recherche et Développement
// Copyright (C) 2012-2020 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -251,6 +251,7 @@ namespace spot
bool sat_langmap_ = false;
int sat_acc_ = 0;
int sat_states_ = 0;
int gen_reduce_parity_ = 1;
bool state_based_ = false;
bool wdba_minimize_ = true;
};

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013-2018 Laboratoire de Recherche et Développement
// Copyright (C) 2013-2018, 2020 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -226,22 +226,32 @@ namespace spot
if (susp.empty() && (type_ == TGBA || type_ == BA))
goto nosplit;
option_map om;
option_map om_wos;
option_map om_ws;
if (opt_)
om = *opt_;
om.set("ltl-split", 0);
translator translate_without_split(simpl_, &om);
om_ws = *opt_;
// Don't blindingly apply reduce_parity() in the
// generic case, for issue #402.
om_ws.set("gen-reduce-parity", 0);
om_wos = om_ws;
om_wos.set("ltl-split", 0);
translator translate_without_split(simpl_, &om_wos);
// Never force colored automata at intermediate steps.
// This is best added at the very end.
translate_without_split.set_pref(pref_ & ~Colored);
translate_without_split.set_level(level_);
translate_without_split.set_type(type_);
translator translate_with_split(simpl_, &om_ws);
translate_with_split.set_pref(pref_ & ~Colored);
translate_with_split.set_level(level_);
translate_with_split.set_type(type_);
auto transrun = [&](formula f)
{
if (f == r2)
return translate_without_split.run(f);
else
return run(f);
return translate_with_split.run(f);
};
// std::cerr << "splitting\n";