relabel: do not unregister old AP that are also new

Reported by Ayrat Khalimov against the trans.html page when using
ltl3ba.

* spot/twaalgos/relabel.cc: Here.
* tests/core/ltl3dra.test: Test it.
* NEWS: Mention it.
* THANKS: Add Ayrat.
This commit is contained in:
Alexandre Duret-Lutz 2016-07-07 15:57:14 +02:00
parent 91e8493c7f
commit 421a9a1b12
4 changed files with 19 additions and 2 deletions

View file

@ -27,6 +27,7 @@ namespace spot
bddPair* pairs = bdd_newpair();
auto d = aut->get_dict();
std::vector<int> vars;
std::set<int> newvars;
vars.reserve(relmap->size());
for (auto& p: *relmap)
{
@ -34,10 +35,15 @@ namespace spot
int newv = aut->register_ap(p.second);
bdd_setpair(pairs, oldv, newv);
vars.push_back(oldv);
newvars.insert(newv);
}
for (auto& t: aut->edges())
t.cond = bdd_replace(t.cond, pairs);
// Erase all the old variable that are not reused in the new set.
// (E.g., if we relabel a&p0 into p0&p1 we should not unregister
// p0)
for (auto v: vars)
aut->unregister_ap(v);
if (newvars.find(v) == newvars.end())
aut->unregister_ap(v);
}
}