twa: fix duplicate propositions in ap()

Calling register_ap() with same atomic proposition several time, for
instance via copy_ap() in a product, would create duplicate atomic
propositions.  This fix will be exercised by the next patch.

* spot/twa/twa.hh: Here.
* spot/twaalgos/compsusp.cc, spot/twaalgos/ltl2taa.cc: Fix
to correctly register atomic propositions.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2015-12-24 11:02:27 +01:00
parent fbf5ac0ea7
commit ad37cacbc0
4 changed files with 24 additions and 7 deletions

View file

@ -597,9 +597,13 @@ namespace spot
/// \return The BDD variable number.
int register_ap(formula ap)
{
aps_.push_back(ap);
int res = dict_->register_proposition(ap, this);
bddaps_ &= bdd_ithvar(res);
int res = dict_->has_registered_proposition(ap, this);
if (res < 0)
{
aps_.push_back(ap);
res = dict_->register_proposition(ap, this);
bddaps_ &= bdd_ithvar(res);
}
return res;
}
@ -720,7 +724,6 @@ namespace spot
void copy_ap_of(const const_twa_ptr& a)
{
get_dict()->register_all_propositions_of(a, this);
for (auto f: a->ap())
this->register_ap(f);
}