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

@ -164,9 +164,19 @@ namespace spot
false));
twa_graph_ptr res = make_twa_graph(dict);
dict->register_all_variables_of(left, res);
dict->register_all_variables_of(right, res);
dict->unregister_variable(bdd_var(v), res);
{
// Copy all atomic propositions, except the one corresponding
// to the variable v used for synchronization.
int vn = bdd_var(v);
assert(dict->bdd_map[vn].type = bdd_dict::var);
formula vf = dict->bdd_map[vn].f;
for (auto a: left->ap())
if (a != vf)
res->register_ap(a);
for (auto a: right->ap())
if (a != vf)
res->register_ap(a);
}
unsigned lsets = left->num_sets();
res->set_generalized_buchi(lsets + right->num_sets());

View file

@ -72,6 +72,7 @@ namespace spot
SPOT_UNIMPLEMENTED();
case op::ap:
{
res_->register_ap(f);
if (negated_)
f = formula::Not(f);
init_ = f;