degen: learn to work on generalized-Co-Büchi as well

* spot/twaalgos/degen.hh, spot/twaalgos/degen.cc: Adjust
degeneralize() and degeneralize_tba() to work on generalized-co-Büchi.
* NEWS: Mention this.
* spot/twaalgos/cobuchi.hh, spot/twaalgos/cobuchi.cc (to_nca): Use
degeneralization on generalized-co-Büchi.
* spot/twaalgos/postproc.cc: Use degeneralization for generalized
co-Büchi as well.
* bin/autfilt.cc: Improve chain products of co-Büchi automata by using
generalization if too many colors are needed.
* tests/core/prodchain.test, tests/python/pdegen.py: Add test cases.
This commit is contained in:
Alexandre Duret-Lutz 2022-09-07 14:36:23 +02:00
parent fe3ebd370b
commit bdac53511a
9 changed files with 169 additions and 81 deletions

View file

@ -713,10 +713,12 @@ ensure_deterministic(const spot::twa_graph_ptr& aut, bool nonalt = false)
return p.run(aut);
}
static spot::twa_graph_ptr ensure_tba(spot::twa_graph_ptr aut)
static spot::twa_graph_ptr
ensure_tba(spot::twa_graph_ptr aut,
spot::postprocessor::output_type type = spot::postprocessor::Buchi)
{
spot::postprocessor p;
p.set_type(spot::postprocessor::Buchi);
p.set_type(type);
p.set_pref(spot::postprocessor::Any);
p.set_level(spot::postprocessor::Low);
return p.run(aut);
@ -726,12 +728,14 @@ static spot::twa_graph_ptr ensure_tba(spot::twa_graph_ptr aut)
static spot::twa_graph_ptr
product(spot::twa_graph_ptr left, spot::twa_graph_ptr right)
{
if ((type == spot::postprocessor::Buchi)
&& (left->num_sets() + right->num_sets() >
spot::acc_cond::mark_t::max_accsets()))
// Are we likely to fail because of too many colors?
if ((left->num_sets() + right->num_sets() >
spot::acc_cond::mark_t::max_accsets())
&& (type == spot::postprocessor::Buchi
|| type == spot::postprocessor::CoBuchi))
{
left = ensure_tba(left);
right = ensure_tba(right);
left = ensure_tba(left, type);
right = ensure_tba(right, type);
}
return spot::product(left, right);
}
@ -739,12 +743,14 @@ product(spot::twa_graph_ptr left, spot::twa_graph_ptr right)
static spot::twa_graph_ptr
product_or(spot::twa_graph_ptr left, spot::twa_graph_ptr right)
{
if ((type == spot::postprocessor::Buchi)
&& (left->num_sets() + right->num_sets() >
spot::acc_cond::mark_t::max_accsets()))
// Are we likely to fail because of too many colors?
if ((left->num_sets() + right->num_sets() >
spot::acc_cond::mark_t::max_accsets())
&& (type == spot::postprocessor::Buchi
|| type == spot::postprocessor::CoBuchi))
{
left = ensure_tba(left);
right = ensure_tba(right);
left = ensure_tba(left, type);
right = ensure_tba(right, type);
}
return spot::product_or(left, right);
}
@ -988,7 +994,7 @@ parse_opt(int key, char* arg, struct argp_state*)
if (!opt->included_in)
opt->included_in = aut;
else
opt->included_in = spot::product_or(opt->included_in, aut);
opt->included_in = ::product_or(opt->included_in, aut);
}
break;
case OPT_INHERENTLY_WEAK_SCCS: