The computation of the counter example fails the valgrind tests

and is wrong into two ways: the search stack is generally not a
path, and does not run until the end of the STL container.
Remove it.
* src/tgbaalgos/tarjan_on_fly.cc, src/tgbaalgos/tarjan_on_fly.hh
(tarjan_on_fly): Do not inherit from the emptiness_search class,
because the check method will no longer return a counter example.
(tarjan_on_fly::check): Return only a boolean.
(tarjan_on_fly::build_counter): Delete.
* src/tgbatest/ltl2tgba.cc: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2004-10-13 17:39:27 +00:00
parent ca27267c69
commit e8e2bec243
4 changed files with 30 additions and 88 deletions

View file

@ -1,5 +1,16 @@
2004-10-13 Alexandre Duret-Lutz <adl@src.lip6.fr> 2004-10-13 Alexandre Duret-Lutz <adl@src.lip6.fr>
The computation of the counter example fails the valgrind tests
and is wrong into two ways: the search stack is generally not a
path, and does not run until the end of the STL container.
Remove it.
* src/tgbaalgos/tarjan_on_fly.cc, src/tgbaalgos/tarjan_on_fly.hh
(tarjan_on_fly): Do not inherit from the emptiness_search class,
because the check method will no longer return a counter example.
(tarjan_on_fly::check): Return only a boolean.
(tarjan_on_fly::build_counter): Delete.
* src/tgbatest/ltl2tgba.cc: Adjust.
* src/tgba/tgbaexplicit.cc (tgba_explicit_succ_iterator::current_state, * src/tgba/tgbaexplicit.cc (tgba_explicit_succ_iterator::current_state,
tgba_explicit_succ_iterator::current_condition, tgba_explicit_succ_iterator::current_condition,
tgba_explicit_succ_iterator::current_accepting_conditions): Assert tgba_explicit_succ_iterator::current_accepting_conditions): Assert
@ -109,7 +120,7 @@
src/tgbaalgos/minimalce.hh, src/tgbaalgos/minimalce.hh,
src/tgbaalgos/minimalce.cc, src/tgbaalgos/minimalce.cc,
src/tgbaalgos/colordfs.hh, src/tgbaalgos/colordfs.hh,
src/tgbaalgos/colordfs.cc: four new algorithms for emptyness check. src/tgbaalgos/colordfs.cc: four new algorithms for emptiness check.
* src/tgbaalgos/gtec/ce.hh, * src/tgbaalgos/gtec/ce.hh,
src/tgbaalgos/gtec/ce.cc: Adapt the counter exemple for the ce src/tgbaalgos/gtec/ce.cc: Adapt the counter exemple for the ce
@ -117,7 +128,7 @@
* src/tgbatest/ltl2tgba.cc, * src/tgbatest/ltl2tgba.cc,
src/tgbatest/emptchk.test, src/tgbatest/emptchk.test,
src/tgbaalgos/Makefile.am: Add files for emptyness-check. src/tgbaalgos/Makefile.am: Add files for emptiness-check.
2004-08-23 Thomas Martinez <martinez@src.lip6.fr> 2004-08-23 Thomas Martinez <martinez@src.lip6.fr>
@ -3174,7 +3185,7 @@
Switch from "promises" to "accepting sets". Fix the definitions Switch from "promises" to "accepting sets". Fix the definitions
of these accepting sets so that they are really useful. Provide of these accepting sets so that they are really useful. Provide
an all_accepting_conditions() method for use in the emptyness an all_accepting_conditions() method for use in the emptiness
check, and a neg_accepting_conditions() for products. Predeclare check, and a neg_accepting_conditions() for products. Predeclare
TGBA accepting conditions in the i/o. TGBA accepting conditions in the i/o.

View file

@ -51,7 +51,7 @@ namespace spot
} }
} }
ce::counter_example* bool
tarjan_on_fly::check() tarjan_on_fly::check()
{ {
tgba_succ_iterator* iter = 0; tgba_succ_iterator* iter = 0;
@ -96,12 +96,7 @@ namespace spot
pop(); pop();
} }
if (violation) return violation;
return build_counter();
//std::cout << "NO COUNTER EXAMPLE FOUND" << std::endl;
return 0;
} }
void void
@ -148,12 +143,6 @@ namespace spot
void void
tarjan_on_fly::pop() tarjan_on_fly::pop()
{ {
/*
const state *s = stack[dftop].s;
hash_type::iterator hi = h.find(s);
hi->second = -1;
*/
int p = stack[dftop].pre; int p = stack[dftop].pre;
if (p >= 0) if (p >= 0)
@ -183,14 +172,6 @@ namespace spot
{ {
int n = 0; int n = 0;
/*
hash_type::const_iterator hi = h.find(s);
if (hi != h.end())
n = hi->second;
else
n = -1;
*/
stack_type::const_iterator i; stack_type::const_iterator i;
for (i = stack.begin(); i != stack.end(); ++i, ++n) for (i = stack.begin(); i != stack.end(); ++i, ++n)
if (s->compare(i->s) == 0) if (s->compare(i->s) == 0)
@ -202,38 +183,10 @@ namespace spot
return n; return n;
} }
ce::counter_example*
tarjan_on_fly::build_counter()
{
ce = new ce::counter_example(a);
stack_type::iterator i;
for (i = stack.begin(); i != stack.end(); ++i)
{
if (x && x->compare(i->s) == 0)
break;
ce->prefix.push_back(ce::state_ce(i->s->clone(),
i->lasttr->current_condition()));
}
for (; i != stack.end(); ++i)
{
ce->cycle.push_back(ce::state_ce(i->s->clone(),
i->lasttr->current_condition()));
}
return ce;
}
std::ostream& std::ostream&
tarjan_on_fly::print_stat(std::ostream& os) const tarjan_on_fly::print_stat(std::ostream& os) const
{ {
int ce_size = 0; os << "States explored : " << h.size() << std::endl;
if (ce)
ce_size = ce->size();
os << "Size of Counter Example : " << ce_size << std::endl
<< "States explored : " << h.size() << std::endl;
return os; return os;
} }

View file

@ -27,13 +27,11 @@
#include <utility> #include <utility>
#include <ostream> #include <ostream>
#include "tgba/tgbatba.hh" #include "tgba/tgbatba.hh"
//#include "tgba/bddprint.hh"
#include "tgbaalgos/minimalce.hh"
namespace spot namespace spot
{ {
class tarjan_on_fly: public emptiness_search class tarjan_on_fly
{ {
public: public:
@ -41,8 +39,8 @@ namespace spot
tarjan_on_fly(const tgba_tba_proxy *a); tarjan_on_fly(const tgba_tba_proxy *a);
virtual ~tarjan_on_fly(); virtual ~tarjan_on_fly();
/// \brief Find a counter example. /// \brief Return true if there exits an accepting path.
virtual ce::counter_example* check(); bool check();
/// \brief Print Stat. /// \brief Print Stat.
std::ostream& print_stat(std::ostream& os) const; std::ostream& print_stat(std::ostream& os) const;
@ -56,8 +54,6 @@ namespace spot
int lowlink; int lowlink;
int pre; int pre;
int acc; int acc;
//int pos;
}; };
//typedef std::pair<int, tgba_succ_iterator*> state_iter_pair; //typedef std::pair<int, tgba_succ_iterator*> state_iter_pair;
@ -65,8 +61,6 @@ namespace spot
state_ptr_hash, state_ptr_equal> hash_type; state_ptr_hash, state_ptr_equal> hash_type;
hash_type h; ///< Map of visited states. hash_type h; ///< Map of visited states.
//typedef std::pair<const state*, struct_state> pair_type;
typedef std::vector<struct_state> stack_type; typedef std::vector<struct_state> stack_type;
stack_type stack; ///< Stack of visited states on the path. stack_type stack; ///< Stack of visited states on the path.
@ -77,16 +71,11 @@ namespace spot
bool violation; bool violation;
const state* x; const state* x;
ce::counter_example* ce;
void push(const state* s); void push(const state* s);
void pop(); void pop();
void lowlinkupdate(int f, int t); void lowlinkupdate(int f, int t);
int in_stack(const state* s) const; int in_stack(const state* s) const;
ce::counter_example* build_counter();
//clock_t tps_;
}; };
} }

View file

@ -721,14 +721,6 @@ main(int argc, char** argv)
spot::counter_example ce(ec->result()); spot::counter_example ce(ec->result());
ce.print_result(std::cout); ce.print_result(std::cout);
ce.print_stats(std::cout); ce.print_stats(std::cout);
//spot::ce::counter_example* res2 = ce.get_counter_example();
//spot::tgba* aut = res2->ce2tgba();
//spot::dotty_reachable(std::cout, aut);
//res2->print(std::cout);
//delete res2;
//delete aut;
} }
else else
{ {
@ -744,15 +736,7 @@ main(int argc, char** argv)
spot::nesteddfsgen_search* ec = new spot::nesteddfsgen_search(a); spot::nesteddfsgen_search* ec = new spot::nesteddfsgen_search(a);
bool res = ec->check(); bool res = ec->check();
ec->print_stats(std::cout); ec->print_stats(std::cout);
if (expect_counter_example) exit_code = expect_counter_example ? !res : res;
{
if (!res)
exit_code = 1;
}
else
{
exit_code = res;
}
delete ec; delete ec;
} }
break; break;
@ -786,9 +770,14 @@ main(int argc, char** argv)
break; break;
case TarjanOnFly: case TarjanOnFly:
std::cout << "Tarjan On Fly" << std::endl; {
es = new spot::tarjan_on_fly(degeneralized); std::cout << "Tarjan On Fly" << std::endl;
break; spot::tarjan_on_fly* tof = new spot::tarjan_on_fly(degeneralized);
bool res = tof->check();
exit_code = expect_counter_example ? !res : res;
delete tof;
break;
}
case MinimalSearch: case MinimalSearch:
{ {
@ -804,7 +793,7 @@ main(int argc, char** argv)
break; break;
case MinimalSearchIterative: case MinimalSearchIterative:
std::cout << "Iterative Minimal Search" << std::endl; std::cout << "Iterative Minimal Search" << std::endl;
es = new spot::minimalce_search(degeneralized, true); es = new spot::minimalce_search(degeneralized, true);
break; break;