simplify_acceptance: fix erroneous simplification

Reported by Florian Renkin.

* spot/twaalgos/cleanacc.cc: Do not rewrite
...Fin(0)&(Fin(1)|(Fin(3)&Inf(4)))... as Fin(0)&f when it appears that
{1,3} cannot receive {0}, because {1} is used elsewhere in the
acceptance.
* tests/python/simplacc.py: Add test case.
This commit is contained in:
Alexandre Duret-Lutz 2020-02-24 12:17:07 +01:00
parent b44daef42a
commit 8a4a4b9fff
2 changed files with 25 additions and 12 deletions

View file

@ -524,8 +524,8 @@ namespace spot
case acc_cond::acc_op::Or:
// On
// Fin(a)&(Fin(b)&Inf(c)|Fin(d))
// where we'd like to return [{a},
// {b,d}] and decide later that
// where we'd like to return [({a},...),
// ({b,d},...)] and decide later that
// {b,d} can receive {a} if they
// (b and d) are both used once.
if (auto m = find_interm_rec(pos))
@ -553,7 +553,8 @@ namespace spot
if (!can_receive)
return;
for (auto p: singletons)
if (p.first != can_receive)
if (p.first != can_receive &&
p.first.lowest() == p.first)
{
to_fuse.emplace_back(p.first, can_receive);
if (p.second->sub.op == acc_cond::acc_op::Fin)
@ -592,6 +593,7 @@ namespace spot
for (auto pair: to_fuse)
if (pair.first & once) // can we remove pair.first?
{
assert(pair.first.count() == 1);
for (auto& e: aut->edges())
if (e.acc & pair.first)
e.acc = (e.acc - pair.first) | pair.second;