parity: introduce reduce_parity()

* spot/twaalgos/parity.cc, spot/twaalgos/parity.hh: Here.
* tests/core/parity.cc: Add test case.
* tests/python/parity.ipynb, NEWS: More documentation.
This commit is contained in:
Alexandre Duret-Lutz 2019-06-11 22:18:18 +02:00
parent f6575d2ec5
commit ebfa3a377a
5 changed files with 1280 additions and 5 deletions

View file

@ -384,6 +384,23 @@ int main()
is_max, is_odd, acc_num_sets))
throw std::runtime_error("cleanup_parity: wrong acceptance.");
}
// Check reduce_parity
for (auto colored: { true, false })
{
auto output = spot::reduce_parity(aut, colored);
if (!colored && !is_almost_colored(output))
throw std::runtime_error(
"reduce_parity: too many acc on a transition.");
if (colored && !is_colored_printerr(output))
throw std::runtime_error("reduce_parity: not colored.");
if (!are_equiv(aut, output))
throw std::runtime_error("reduce_parity: not equivalent.");
if (!is_right_parity(output, to_parity_kind(is_max),
spot::parity_style_any,
is_max, is_odd, acc_num_sets))
throw std::runtime_error("reduce_parity: wrong acceptance.");
}
}
}