autfilt: handle alternation with --equivalent-to and friends

* bin/autfilt.cc (ensure_deterministic): Remove alternation on demand.
(process_automaton): Prefer twa::intersects() over
product()/is_empty().
* spot/twa/twa.cc (remove_fin_maybe): Also remove alternation.
* tests/core/alternating.test: More tests.
This commit is contained in:
Alexandre Duret-Lutz 2016-12-28 10:18:05 +01:00
parent 77ce4170dc
commit 096c78a3f8
3 changed files with 85 additions and 12 deletions

View file

@ -25,6 +25,7 @@
#include <spot/twaalgos/couvreurnew.hh>
#include <spot/twaalgos/word.hh>
#include <spot/twaalgos/remfin.hh>
#include <spot/twaalgos/alternation.hh>
#include <spot/twa/twaproduct.hh>
#include <utility>
@ -48,14 +49,15 @@ namespace spot
namespace
{
// Remove Fin-acceptance and alternation.
const_twa_ptr remove_fin_maybe(const const_twa_ptr& a)
{
if (!a->acc().uses_fin_acceptance())
return a;
auto aa = std::dynamic_pointer_cast<const twa_graph>(a);
if ((!aa || !aa->is_alternating()) && !a->acc().uses_fin_acceptance())
return a;
if (!aa)
aa = make_twa_graph(a, twa::prop_set::all());
return remove_fin(aa);
return remove_fin(remove_alternation(aa));
}
}