relabel: do not create automata with false labels

* spot/twaalgos/relabel.cc: Remove false transitions if
some of the propositions are equivalent to true or false.
* NEWS: Mention the bug.
* tests/core/ltl2tgba2.test: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2020-02-10 12:05:36 +01:00
parent 09bb61db33
commit 443f638b9c
3 changed files with 22 additions and 3 deletions

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2015-2018 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2015-2018, 2020 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -32,6 +32,7 @@ namespace spot
std::set<int> newvars;
vars.reserve(relmap->size());
bool bool_subst = false;
bool need_cleanup = false;
for (auto& p: *relmap)
{
@ -61,6 +62,8 @@ namespace spot
bdd newb = formula_to_bdd(p.second, d, aut);
bdd_setbddpair(pairs, oldv, newb);
bool_subst = true;
if (newb == bddtrue || newb == bddfalse)
need_cleanup = true;
}
}
if (!bool_subst)
@ -76,5 +79,13 @@ namespace spot
for (auto v: vars)
if (newvars.find(v) == newvars.end())
aut->unregister_ap(v);
// If some of the proposition are equivalent to true or false,
// it's possible that we have introduced edges with false labels.
if (need_cleanup)
{
aut->merge_edges(); // remove any edge labeled by 0
aut->purge_dead_states(); // remove useless states
}
}
}