Commit 9365f8de authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

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.
parent cf2cfcd2
......@@ -11,6 +11,9 @@ New in spot 2.8.5.dev (not yet released)
consequence, some correct output could be larger than necessary
(but still correct).
- Some formulas with Boolean sub-formulas equivalent to true or
false could be translated into automata with false labels.
New in spot 2.8.5 (2020-01-04)
Bugs fixed:
......
// -*- 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
}
}
}
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2019 Laboratoire de Recherche et Développement de
# Copyright (C) 2009-2020 Laboratoire de Recherche et Développement de
# l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
......@@ -431,3 +431,8 @@ cat >expected <<EOF
8,(Fin(1) | Inf(0)) & (Fin(2) | Inf(1))
8,(Fin(1) | Inf(0)) & (Fin(2) | Inf(1)) & (Fin(0) | Inf(2))
EOF
# This formula used to produce translation with false label.
ltl2tgba -D -G 'F(G(a | !a) & ((b <-> c) W d))' | grep '\[f\]' && exit 1
:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment