parity: don't change_parity to the same acceptance

Follow up to #552.

* spot/twaalgos/parity.cc (change_parity): Do not work if the output
is supposed to have the same acceptance as the input and 0 or 1
colors.
This commit is contained in:
Alexandre Duret-Lutz 2023-11-17 23:06:09 +01:00
parent 205df01390
commit 3be62a907c

View file

@ -150,8 +150,20 @@ namespace spot
{
auto new_acc = acc_cond::acc_code::parity(output_max,
output_odd, num_sets);
// Even if change_kind || change_style, it may be
// the case that the new acceptance is the same as the old.
// For instance "t" can be both "min even" or "max odd".
if (num_sets <= 1 && new_acc == aut->get_acceptance())
return aut;
aut->set_acceptance(num_sets, new_acc);
}
else
{
if (num_sets <= 1)
return aut; // Nothing to do
}
// even if the acceptance is not changed, this code will remove
// superfluous colors in case a transition has more than one.
change_acc(aut, old_num_sets, change_kind,
change_style, output_max, current_max);
return aut;