ignore false edges in emptiness checks and scc_info
Based on reports by Florian Renkin and Jens Kreber. * spot/twaalgos/bfssteps.cc, spot/twaalgos/couvreurnew.cc, spot/twaalgos/gtec/gtec.cc, spot/twaalgos/gv04.cc, spot/twaalgos/magic.cc, spot/twaalgos/sccinfo.cc spot/twaalgos/se05.cc, spot/twaalgos/tau03.cc: Ignore bddfalse edges. * spot/twaalgos/gtec/gtec.hh: Remove debugging function. * tests/core/neverclaimread.test: Adjust. * tests/python/ecfalse.py: New test file. * tests/Makefile.am: Add it. * NEWS: Mention the bug.
This commit is contained in:
parent
67fa19cb08
commit
0b25820211
13 changed files with 206 additions and 61 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014, 2015, 2018 Laboratoire de Recherche et
|
||||
// Copyright (C) 2014, 2015, 2018, 2020 Laboratoire de Recherche et
|
||||
// Développement de l'Epita (LRDE)
|
||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -78,6 +78,10 @@ namespace spot
|
|||
todo.pop_front();
|
||||
for (auto i: a_->succ(src))
|
||||
{
|
||||
// skip false transitions
|
||||
if (SPOT_UNLIKELY(i->cond() == bddfalse))
|
||||
continue;
|
||||
|
||||
const state* dest = filter(i->dst());
|
||||
|
||||
if (!dest)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2016-2019 Laboratoire de Recherche et Développement
|
||||
// Copyright (C) 2016-2020 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -41,7 +41,8 @@ namespace spot
|
|||
public:
|
||||
explicitproxy(explicit_iterator it)
|
||||
: it_(it)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
const explicitproxy*
|
||||
operator->() const
|
||||
|
|
@ -73,6 +74,12 @@ namespace spot
|
|||
return it_->acc;
|
||||
}
|
||||
|
||||
bdd
|
||||
cond() const
|
||||
{
|
||||
return it_->cond;
|
||||
}
|
||||
|
||||
void
|
||||
next()
|
||||
{
|
||||
|
|
@ -704,7 +711,7 @@ namespace spot
|
|||
assert(ecs_->root.size() == arc.size());
|
||||
|
||||
// We are looking at the next successor in SUCC.
|
||||
auto succ = todo.top().second;
|
||||
auto& succ = todo.top().second;
|
||||
|
||||
// If there are no more successors, backtrack.
|
||||
if (succ->done())
|
||||
|
|
@ -744,6 +751,14 @@ namespace spot
|
|||
|
||||
// We have a successor to look at.
|
||||
inc_transitions();
|
||||
|
||||
// Ignore false edges
|
||||
if (SPOT_UNLIKELY(succ->cond() == bddfalse))
|
||||
{
|
||||
succ->next();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Fetch the values we are interested in...
|
||||
auto acc = succ->acc();
|
||||
if (!need_accepting_run)
|
||||
|
|
@ -763,7 +778,7 @@ namespace spot
|
|||
state_t dest = succ->dst();
|
||||
// ... and point the iterator to the next successor, for
|
||||
// the next iteration.
|
||||
todo.top().second->next();
|
||||
succ->next();
|
||||
|
||||
// We do not need succ from now on.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2008, 2011, 2014-2016, 2018-2019 Laboratoire de
|
||||
// Copyright (C) 2008, 2011, 2014-2016, 2018-2020 Laboratoire de
|
||||
// Recherche et Développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
|
||||
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
|
|
@ -109,6 +109,8 @@ namespace spot
|
|||
do
|
||||
{
|
||||
inc_transitions();
|
||||
if (SPOT_UNLIKELY(i->cond() == bddfalse))
|
||||
continue;
|
||||
|
||||
const state* s = i->dst();
|
||||
auto j = ecs_->h.find(s);
|
||||
|
|
@ -219,9 +221,15 @@ namespace spot
|
|||
// of the arc) we are interested in...
|
||||
const state* dest = succ->dst();
|
||||
acc_cond::mark_t acc = succ->acc();
|
||||
trace << "-> " << dest << ' ' << acc << ' ' << succ->cond();
|
||||
// ... and point the iterator to the next successor, for
|
||||
// the next iteration.
|
||||
succ->next();
|
||||
{
|
||||
bdd cond = succ->cond();
|
||||
succ->next();
|
||||
if (SPOT_UNLIKELY(cond == bddfalse))
|
||||
continue;
|
||||
}
|
||||
// We do not need SUCC from now on.
|
||||
|
||||
// Are we going to a new state?
|
||||
|
|
@ -321,10 +329,12 @@ namespace spot
|
|||
{
|
||||
for (auto iter: shy->ecs_->aut->succ(s))
|
||||
{
|
||||
shy->inc_transitions();
|
||||
if (SPOT_UNLIKELY(iter->cond() == bddfalse))
|
||||
continue;
|
||||
q.emplace_back(iter->acc(),
|
||||
iter->dst());
|
||||
shy->inc_depth();
|
||||
shy->inc_transitions();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -372,24 +382,28 @@ namespace spot
|
|||
}
|
||||
|
||||
#ifdef TRACE
|
||||
couvreur99_check_shy::dump_queue(std::ostream& os)
|
||||
namespace
|
||||
{
|
||||
os << "--- TODO ---\n";
|
||||
unsigned lvl = 0;
|
||||
for (auto& ti: todo)
|
||||
{
|
||||
++lvl;
|
||||
os << '#' << lvl << " s:" << ti.s << " n:" << ti.n
|
||||
<< " q:{";
|
||||
for (auto qi = ti.q.begin(); qi != ti.q.end();)
|
||||
{
|
||||
os << qi->s;
|
||||
++qi;
|
||||
if (qi != ti.q.end())
|
||||
os << ", ";
|
||||
}
|
||||
os << "}\n";
|
||||
}
|
||||
template<class T>
|
||||
void dump_queue(const T& todo)
|
||||
{
|
||||
trace << "--- TODO ---\n";
|
||||
unsigned lvl = 0;
|
||||
for (auto& ti: todo)
|
||||
{
|
||||
++lvl;
|
||||
trace << '#' << lvl << " s:" << ti.s << " n:" << ti.n
|
||||
<< " q:{";
|
||||
for (auto qi = ti.q.begin(); qi != ti.q.end();)
|
||||
{
|
||||
trace << qi->s;
|
||||
++qi;
|
||||
if (qi != ti.q.end())
|
||||
trace << ", ";
|
||||
}
|
||||
trace << "}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -410,7 +424,7 @@ namespace spot
|
|||
for (;;)
|
||||
{
|
||||
#ifdef TRACE
|
||||
dump_queue();
|
||||
dump_queue(todo);
|
||||
#endif
|
||||
|
||||
assert(ecs_->root.size() == 1 + arc.size());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2008, 2013-2016, 2018-2019 Laboratoire de Recherche
|
||||
// Copyright (C) 2008, 2013-2016, 2018-2020 Laboratoire de Recherche
|
||||
// et Développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
|
||||
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
|
|
@ -218,11 +218,6 @@ namespace spot
|
|||
|
||||
void clear_todo();
|
||||
|
||||
#ifdef SPOT_TRACE
|
||||
/// Dump the queue for debugging.
|
||||
void dump_queue(std::ostream& os = std::cerr);
|
||||
#endif
|
||||
|
||||
/// Whether successors should be grouped for states in the same SCC.
|
||||
bool group_;
|
||||
// If the "group2" option is set (it implies "group"), we
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2008, 2010, 2011, 2013-2019 Laboratoire de
|
||||
// Copyright (C) 2008, 2010, 2011, 2013-2020 Laboratoire de
|
||||
// recherche et développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6
|
||||
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
|
||||
|
|
@ -120,6 +120,10 @@ namespace spot
|
|||
trace << " No more successors" << std::endl;
|
||||
pop();
|
||||
}
|
||||
else if (SPOT_UNLIKELY(iter->cond() == bddfalse))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
const state* s_prime = iter->dst();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2013-2019 Laboratoire de recherche et
|
||||
// Copyright (C) 2011, 2013-2020 Laboratoire de recherche et
|
||||
// développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -199,6 +199,8 @@ namespace spot
|
|||
// Go down the edge (f.s, <label, acc>, s_prime)
|
||||
f.it->next();
|
||||
inc_transitions();
|
||||
if (SPOT_UNLIKELY(label == bddfalse))
|
||||
continue;
|
||||
typename heap::color_ref c = h.get_color_ref(s_prime);
|
||||
if (c.is_white())
|
||||
{
|
||||
|
|
@ -286,6 +288,8 @@ namespace spot
|
|||
// Go down the edge (f.s, <label, acc>, s_prime)
|
||||
f.it->next();
|
||||
inc_transitions();
|
||||
if (SPOT_UNLIKELY(label == bddfalse))
|
||||
continue;
|
||||
typename heap::color_ref c = h.get_color_ref(s_prime);
|
||||
if (c.is_white())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -158,24 +158,25 @@ namespace spot
|
|||
// Gather all successor SCCs
|
||||
if (track_succs)
|
||||
for (auto& t: aut->out(*s))
|
||||
for (unsigned d: aut->univ_dests(t))
|
||||
{
|
||||
unsigned n = sccof_[d];
|
||||
if (n == num || n == -1U)
|
||||
continue;
|
||||
// If edges are cut, we are not able to
|
||||
// maintain proper successor information.
|
||||
if (filter_)
|
||||
switch (filter_(t, d, filter_data_))
|
||||
{
|
||||
case edge_filter_choice::keep:
|
||||
break;
|
||||
case edge_filter_choice::ignore:
|
||||
case edge_filter_choice::cut:
|
||||
continue;
|
||||
}
|
||||
succ.emplace_back(n);
|
||||
}
|
||||
if (SPOT_LIKELY(t.cond != bddfalse))
|
||||
for (unsigned d: aut->univ_dests(t))
|
||||
{
|
||||
unsigned n = sccof_[d];
|
||||
if (n == num || n == -1U)
|
||||
continue;
|
||||
// If edges are cut, we are not able to
|
||||
// maintain proper successor information.
|
||||
if (filter_)
|
||||
switch (filter_(t, d, filter_data_))
|
||||
{
|
||||
case edge_filter_choice::keep:
|
||||
break;
|
||||
case edge_filter_choice::ignore:
|
||||
case edge_filter_choice::cut:
|
||||
continue;
|
||||
}
|
||||
succ.emplace_back(n);
|
||||
}
|
||||
}
|
||||
while (*s++ != curr);
|
||||
|
||||
|
|
@ -251,6 +252,13 @@ namespace spot
|
|||
// Fetch the values we are interested in...
|
||||
auto& e = gr.edge_storage(tr_succ);
|
||||
|
||||
// Skip false edges.
|
||||
if (SPOT_UNLIKELY(e.cond == bddfalse))
|
||||
{
|
||||
todo_.top().out_edge = e.next_succ;
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned dest = e.dst;
|
||||
if ((int) dest < 0)
|
||||
{
|
||||
|
|
@ -412,7 +420,7 @@ namespace spot
|
|||
auto& s = result[src_scc];
|
||||
for (auto& t: aut_->out(src))
|
||||
{
|
||||
if (scc_of(t.dst) != src_scc)
|
||||
if (scc_of(t.dst) != src_scc || SPOT_UNLIKELY(t.cond == bddfalse))
|
||||
continue;
|
||||
s.insert(t.acc);
|
||||
}
|
||||
|
|
@ -502,7 +510,7 @@ namespace spot
|
|||
bfs_queue.pop_front();
|
||||
for (auto& t: aut->out(src))
|
||||
{
|
||||
if (filter(t))
|
||||
if (SPOT_UNLIKELY(t.cond == bddfalse) || filter(t))
|
||||
continue;
|
||||
|
||||
if (match(t))
|
||||
|
|
@ -573,7 +581,8 @@ namespace spot
|
|||
if (scc_of(s) != scc)
|
||||
continue;
|
||||
for (auto& e: aut_->out(s))
|
||||
if (e.src == e.dst && !filter(e) && acccond.accepting(e.acc))
|
||||
if (e.src == e.dst && SPOT_LIKELY(e.cond != bddfalse)
|
||||
&& !filter(e) && acccond.accepting(e.acc))
|
||||
{
|
||||
// We have found an accepting self-loop. That's the cycle
|
||||
// part of our accepting run.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2013-2019 Laboratoire de Recherche et
|
||||
// Copyright (C) 2011, 2013-2020 Laboratoire de Recherche et
|
||||
// Développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -195,6 +195,8 @@ namespace spot
|
|||
// Go down the edge (f.s, <label, acc>, s_prime)
|
||||
f.it->next();
|
||||
inc_transitions();
|
||||
if (SPOT_UNLIKELY(label == bddfalse))
|
||||
continue;
|
||||
typename heap::color_ref c = h.get_color_ref(s_prime);
|
||||
if (c.is_white())
|
||||
{
|
||||
|
|
@ -286,6 +288,8 @@ namespace spot
|
|||
// Go down the edge (f.s, <label, acc>, s_prime)
|
||||
f.it->next();
|
||||
inc_transitions();
|
||||
if (SPOT_UNLIKELY(label == bddfalse))
|
||||
continue;
|
||||
typename heap::color_ref c = h.get_color_ref(s_prime);
|
||||
if (c.is_white())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2013-2019 Laboratoire de Recherche et
|
||||
// Copyright (C) 2011, 2013-2020 Laboratoire de Recherche et
|
||||
// Developpement de l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -167,6 +167,8 @@ namespace spot
|
|||
// Go down the edge (f.s, <label, acc>, s_prime)
|
||||
f.it->next();
|
||||
inc_transitions();
|
||||
if (SPOT_UNLIKELY(label == bddfalse))
|
||||
continue;
|
||||
typename heap::color_ref c_prime = h.get_color_ref(s_prime);
|
||||
if (c_prime.is_white())
|
||||
{
|
||||
|
|
@ -194,11 +196,13 @@ namespace spot
|
|||
{
|
||||
inc_transitions();
|
||||
const state *s_prime = i->dst();
|
||||
bdd label = i->cond();
|
||||
auto acc = i->acc();
|
||||
if (SPOT_UNLIKELY(label == bddfalse))
|
||||
continue;
|
||||
trace << "DFS_BLUE rescanning the arc from "
|
||||
<< a_->format_state(f.s) << " to "
|
||||
<< a_->format_state(s_prime) << std::endl;
|
||||
bdd label = i->cond();
|
||||
auto acc = i->acc();
|
||||
typename heap::color_ref c_prime = h.get_color_ref(s_prime);
|
||||
assert(!c_prime.is_white());
|
||||
auto acu = acc | c.get_acc();
|
||||
|
|
@ -247,6 +251,8 @@ namespace spot
|
|||
// Go down the edge (f.s, <label, acc>, s_prime)
|
||||
f.it->next();
|
||||
inc_transitions();
|
||||
if (SPOT_UNLIKELY(label == bddfalse))
|
||||
continue;
|
||||
typename heap::color_ref c_prime = h.get_color_ref(s_prime);
|
||||
if (c_prime.is_white())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue