Fix bugs in minimize(), caught by spotlbtt.test.

* src/tgbaalgos/minimize.cc (minimize): Don't add acceptance
conditions if the final set is empty.
* src/tgbaalgos/powerset.cc (tgba_powerset): Add the initial state
to acc_list if it is accepting.  Also do not compute an SCC build
map if we don't have to build acc_list.
This commit is contained in:
Alexandre Duret-Lutz 2010-04-13 14:29:58 +02:00
parent 54e10c2501
commit 72139fd760
4 changed files with 27 additions and 8 deletions

View file

@ -1,3 +1,13 @@
2010-04-13 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Fix bugs in minimize(), caught by spotlbtt.test.
* src/tgbaalgos/minimize.cc (minimize): Don't add acceptance
conditions if the final set is empty.
* src/tgbaalgos/powerset.cc (tgba_powerset): Add the initial state
to acc_list if it is accepting. Also do not compute an SCC build
map if we don't have to build acc_list.
2010-04-13 Alexandre Duret-Lutz <adl@lrde.epita.fr> 2010-04-13 Alexandre Duret-Lutz <adl@lrde.epita.fr>
"ltl2tgba -Rm" will apply WDBA-minimization only if correct. "ltl2tgba -Rm" will apply WDBA-minimization only if correct.

View file

@ -93,6 +93,7 @@ namespace spot
tgba_explicit_number* res = new tgba_explicit_number(a->get_dict()); tgba_explicit_number* res = new tgba_explicit_number(a->get_dict());
// For each transition in the initial automaton, add the corresponding // For each transition in the initial automaton, add the corresponding
// transition in res. // transition in res.
if (!final->empty())
res->declare_acceptance_condition(ltl::constant::true_instance()); res->declare_acceptance_condition(ltl::constant::true_instance());
for (sit = sets.begin(); sit != sets.end(); ++sit) for (sit = sets.begin(); sit != sets.end(); ++sit)
{ {

View file

@ -1,4 +1,4 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement // Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -56,7 +56,12 @@ namespace spot
ps.insert(s); ps.insert(s);
todo.push_back(ps); todo.push_back(ps);
seen[ps] = 1; seen[ps] = 1;
if (acc_list)
{
m.build_map(); m.build_map();
if (m.accepting(m.scc_of_state(s)))
acc_list->push_front(new state_explicit(res->add_state(1)));
}
} }
unsigned state_num = 1; unsigned state_num = 1;
@ -99,9 +104,12 @@ namespace spot
{ {
states.insert(s); states.insert(s);
} }
if (acc_list)
{
unsigned scc_num = m.scc_of_state(s); unsigned scc_num = m.scc_of_state(s);
if (m.accepting(scc_num)) if (m.accepting(scc_num))
accepting = true; accepting = true;
}
dest.insert(s); dest.insert(s);
} }
delete si; delete si;
@ -123,7 +131,7 @@ namespace spot
seen[dest] = dest_num; seen[dest] = dest_num;
todo.push_back(dest); todo.push_back(dest);
t = res->create_transition(seen[src], dest_num); t = res->create_transition(seen[src], dest_num);
if (acc_list && accepting) if (accepting)
{ {
const state* dst = new state_explicit(t->dest); const state* dst = new state_explicit(t->dest);
acc_list->push_front(dst); acc_list->push_front(dst);

View file

@ -1,4 +1,4 @@
// Copyright (C) 2010 Laboratoire de Recherche et Développement // Copyright (C) 2010 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.