From 3be62a907c53f41519f5867ea6a9ecff890cacbf Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 17 Nov 2023 23:06:09 +0100 Subject: [PATCH] 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. --- spot/twaalgos/parity.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spot/twaalgos/parity.cc b/spot/twaalgos/parity.cc index 4da129bfb..46eed1ff9 100644 --- a/spot/twaalgos/parity.cc +++ b/spot/twaalgos/parity.cc @@ -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;