add a newer version of the generic emptiness check

As discussed with Jan Strejček.

* spot/twa/acc.cc, spot/twa/acc.hh (fin_unit_one_split): New function.
(fin_one_extract): Return the simplified acceptance condition as an
optimization.
* python/spot/impl.i: Bind this new function.
* tests/python/acc.py: New file, to test it.
* tests/Makefile.am: Add acc.py.
* spot/twaalgos/genem.cc, spot/twaalgos/genem.hh: Implement the
spot211 variant of the emptiness check.
* tests/python/genem.py: Test it.
* tests/python/acc_cond.ipynb: Adjust test for fin_one_extract.
This commit is contained in:
Alexandre Duret-Lutz 2022-05-25 17:02:38 +02:00
parent aca6bd9042
commit 721d5695ec
9 changed files with 308 additions and 30 deletions

View file

@ -551,6 +551,17 @@ namespace std {
}
%apply std::vector<unsigned> &OUTPUT {std::vector<unsigned>& pairs}
%apply std::vector<spot::acc_cond::rs_pair> &OUTPUT {std::vector<spot::acc_cond::rs_pair>& pairs}
// Must occur before the twa declaration
%typemap(out) SWIGTYPE spot::acc_cond::fin_unit_one_split %{
{
auto& v = static_cast<const std::tuple<int, spot::acc_cond, spot::acc_cond>>($1);
$result = PyTuple_Pack(3,
swig::from(std::get<0>(v)),
swig::from(std::get<1>(v)),
swig::from(std::get<2>(v)));
}
%}
%include <spot/twa/acc.hh>
%template(pair_bool_mark) std::pair<bool, spot::acc_cond::mark_t>;