* src/tgbaalgos/tarjan_on_fly.hh,

src/tgbaalgos/tarjan_on_fly.cc,
src/tgbaalgos/nesteddfs.hh,
src/tgbaalgos/nesteddfs.cc,
src/tgbaalgos/minimalce.hh,
src/tgbaalgos/minimalce.cc,
src/tgbaalgos/colordfs.hh,
src/tgbaalgos/colordfs.cc: four new algorithms for emptyness check.

src/tgbaalgos/gtec/ce.hh,
src/tgbaalgos/gtec/ce.cc: Adapt the counter exemple for the ce
object in minimalce.hh.

src/tgbatest/ltl2tgba.cc,
src/tgbatest/emptchk.test,
src/tgbaalgos/Makefile.am: Add files for emptyness-check.


* src/tgbaalgos/reductgba_sim_del.cc: Restrict to degeneralize automata.
* src/tgba/tgbareduc.hh: src/tgba/tgbareduc.cc: Merge transition
for scc reduce.
This commit is contained in:
martinez 2004-08-23 12:48:33 +00:00
parent 3d2135c883
commit 2d1151e018
17 changed files with 2526 additions and 157 deletions

View file

@ -35,6 +35,10 @@
#include "tgbaalgos/lbtt.hh"
#include "tgba/tgbatba.hh"
#include "tgbaalgos/magic.hh"
#include "tgbaalgos/nesteddfs.hh"
#include "tgbaalgos/colordfs.hh"
#include "tgbaalgos/tarjan_on_fly.hh"
//#include "tgbaalgos/minimalce.hh"
#include "tgbaalgos/gtec/gtec.hh"
#include "tgbaalgos/gtec/ce.hh"
#include "tgbaparse/public.hh"
@ -51,67 +55,95 @@ syntax(char* prog)
<< " "<< prog << " -X [OPTIONS...] file" << std::endl
<< std::endl
<< "Options:" << std::endl
<< " -a display the acceptance_conditions BDD, not the "
<< " -a display the acceptance_conditions BDD, not the "
<< "reachability graph"
<< std::endl
<< " -A same as -a, but as a set" << std::endl
<< " -d turn on traces during parsing" << std::endl
<< " -D degeneralize the automaton" << std::endl
<< " -e emptiness-check (Couvreur), expect and compute "
<< "a counter-example" << std::endl
<< " -e2 emptiness-check (Couvreur variant), expect and compute "
<< "a counter-example" << std::endl
<< " -E emptiness-check (Couvreur), expect no counter-example "
<< " -A same as -a, but as a set" << std::endl
<< " -c color-search (implies -D), expect a counter-example"
<< std::endl
<< " -E2 emptiness-check (Couvreur variant), expect no "
<< " -C color-search (implies -D), expect no counter-example"
<< std::endl
<< " -d turn on traces during parsing" << std::endl
<< " -D degeneralize the automaton" << std::endl
<< " -e emptiness-check (Couvreur), expect and compute "
<< "a counter-example" << std::endl
<< " -e2 emptiness-check (Couvreur variant), expect and compute "
<< "a counter-example" << std::endl
<< " -E emptiness-check (Couvreur), expect no counter-example "
<< std::endl
<< " -E2 emptiness-check (Couvreur variant), expect no "
<< "counter-example " << std::endl
<< " -f use Couvreur's FM algorithm for translation"
<< " -f use Couvreur's FM algorithm for translation"
<< std::endl
<< " -F read the formula from the file" << std::endl
<< " -L fair-loop approximation (implies -f)" << std::endl
<< " -m magic-search (implies -D), expect a counter-example"
<< " -F read the formula from the file" << std::endl
<< " -L fair-loop approximation (implies -f)" << std::endl
<< " -m magic-search (implies -D), expect a counter-example"
<< std::endl
<< " -M magic-search (implies -D), expect no counter-example"
<< " -ms minmimal-search (implies -D), expect a counter-example"
<< std::endl
<< " -n same as -m, but display more counter-examples"
<< " -mold magic-search (implies -D), expect a counter-example"
<< std::endl
<< " -N display the never clain for Spin "
<< " -M magic-search (implies -D), expect no counter-example"
<< std::endl
<< " -Mold magic-search (implies -D), expect no counter-example"
<< std::endl
<< " -ndfs nesteddfs-search (implies -D), expect a "
<< "counter-example"
<< std::endl
<< " -Ndfs nesteddfs-search (implies -D), expect no "
<< "counter-example"
<< std::endl
<< " -ndfs2 modify-nesteddfs-search (implies -D), "
<< "expect a counter-example"
<< std::endl
<< " -Ndfs2 modify-nesteddfs-search (implies -D), "
<< "expect no counter-example"
<< std::endl
<< " -n same as -m, but display more counter-examples"
<< std::endl
<< " -N display the never clain for Spin "
<< "(implies -D)" << std::endl
<< " -p branching postponement (implies -f)" << std::endl
<< " -r display the relation BDD, not the reachability graph"
<< " -p branching postponement (implies -f)" << std::endl
<< " -r display the relation BDD, not the reachability graph"
<< std::endl
<< " -r1 reduce formula using basic rewriting" << std::endl
<< " -r2 reduce formula using class of eventuality and "
<< " -r1 reduce formula using basic rewriting" << std::endl
<< " -r2 reduce formula using class of eventuality and "
<< "and universality" << std::endl
<< " -r3 reduce formula using implication between "
<< " -r3 reduce formula using implication between "
<< "sub-formulae" << std::endl
<< " -r4 reduce formula using all rules" << std::endl
<< " -rd display the reduce formula" << std::endl
<< " -R same as -r, but as a set" << std::endl
<< " -R1 use direct simulation to reduce the automata "
<< " -r4 reduce formula using all rules" << std::endl
<< " -rd display the reduce formula" << std::endl
<< " -R same as -r, but as a set" << std::endl
<< " -R1 use direct simulation to reduce the automata "
<< "(use -L for more reduction)"
<< std::endl
<< " -R2 use delayed simulation to reduce the automata "
<< " -R2 use delayed simulation to reduce the automata "
<< "(use -L for more reduction)"
<< std::endl
<< " -R3 use SCC to reduce the automata"
<< " -R3 use SCC to reduce the automata"
<< std::endl
<< " -Rd display the simulation relation"
<< " -Rd display the simulation relation"
<< std::endl
<< " -RD display the parity game (dot format)"
<< " -RD display the parity game (dot format)"
<< std::endl
<< " -s convert to explicit automata, and number states "
<< " -s convert to explicit automata, and number states "
<< "in DFS order" << std::endl
<< " -S convert to explicit automata, and number states "
<< " -S convert to explicit automata, and number states "
<< "in BFS order" << std::endl
<< " -t display reachable states in LBTT's format" << std::endl
<< " -v display the BDD variables used by the automaton"
<< " -t display reachable states in LBTT's format" << std::endl
<< " -T display reachable states in LBTT's format w/o "
<< "acceptance conditions" << std::endl
<< " -tj tarjan-on-fly (implies -D), expect a counter-example"
<< std::endl
<< " -x try to produce a more deterministic automaton "
<< " -TJ tarjan-on-fly (implies -D), expect no counter-example"
<< std::endl
<< " -v display the BDD variables used by the automaton"
<< std::endl
<< " -x try to produce a more deterministic automata "
<< "(implies -f)" << std::endl
<< " -X do not compute an automaton, read it from a file"
<< " -X do not compute an automaton, read it from a file"
<< std::endl
<< " -y do not merge states with same symbolic representation "
<< " -y do not merge states with same symbolic representation "
<< "(implies -f)" << std::endl;
exit(2);
}
@ -129,7 +161,12 @@ main(int argc, char** argv)
bool file_opt = false;
int output = 0;
int formula_index = 0;
enum { None, Couvreur, Couvreur2, MagicSearch } echeck = None;
enum { None, Couvreur, Couvreur2, MagicSearch, MagicSearchOld,
NestedDFSSearch, NestedDFSSearchModify, ColorDFSSearch,
TarjanOnFly, MinimalSearch} echeck = None;
spot::emptyness_search* es = 0;
//int opt_search = 0; //FIXME
spot::search_opt opt_nested_search = spot::magic;
enum { NoneDup, BFS, DFS } dupexp = NoneDup;
bool magic_many = false;
bool expect_counter_example = false;
@ -157,6 +194,22 @@ main(int argc, char** argv)
{
output = 4;
}
else if (!strcmp(argv[formula_index], "-c"))
{
echeck = ColorDFSSearch;
//opt_search = 0;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
magic_many = false;
}
else if (!strcmp(argv[formula_index], "-C"))
{
echeck = ColorDFSSearch;
degeneralize_opt = true;
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-d"))
{
debug_opt = true;
@ -202,23 +255,92 @@ main(int argc, char** argv)
fair_loop_approx = true;
fm_opt = true;
}
else if (!strcmp(argv[formula_index], "-m"))
else if (!strcmp(argv[formula_index], "-mold"))
{
echeck = MagicSearch;
echeck = MagicSearchOld;
//opt_search = 0;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
}
else if (!strcmp(argv[formula_index], "-m"))
{
opt_nested_search = spot::magic;
echeck = MagicSearch;
//opt_search = 0;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
//magic_many = true;
}
else if (!strcmp(argv[formula_index], "-ms"))
{
echeck = MinimalSearch;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
}
else if (!strcmp(argv[formula_index], "-Mold"))
{
echeck = MagicSearchOld; // FIXME
degeneralize_opt = true;
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-M"))
{
opt_nested_search = spot::magic;
echeck = MagicSearch;
degeneralize_opt = true;
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-Ms"))
{
echeck = MinimalSearch;
degeneralize_opt = true;
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-ndfs"))
{
opt_nested_search = spot::nested;
echeck = NestedDFSSearch;
//opt_search = 1;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
}
else if (!strcmp(argv[formula_index], "-Ndfs"))
{
opt_nested_search = spot::nested;
echeck = NestedDFSSearch;
//opt_search = 1;
degeneralize_opt = true;
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-ndfs2"))
{
opt_nested_search = spot::my_nested;
echeck = NestedDFSSearchModify;
//opt_search = 2;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
}
else if (!strcmp(argv[formula_index], "-Ndfs2"))
{
opt_nested_search = spot::my_nested;
echeck = NestedDFSSearchModify;
//opt_search = 2;
degeneralize_opt = true;
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-n"))
{
echeck = MagicSearch;
echeck = MagicSearchOld;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
@ -260,10 +382,12 @@ main(int argc, char** argv)
}
else if (!strcmp(argv[formula_index], "-R1"))
{
//degeneralize_opt = true; // FIXME
reduc_aut |= spot::Reduce_Dir_Sim;
}
else if (!strcmp(argv[formula_index], "-R2"))
{
//degeneralize_opt = true; // FIXME
reduc_aut |= spot::Reduce_Del_Sim;
}
else if (!strcmp(argv[formula_index], "-R3"))
@ -294,6 +418,20 @@ main(int argc, char** argv)
{
output = 6;
}
else if (!strcmp(argv[formula_index], "-tj"))
{
echeck = TarjanOnFly;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
}
else if (!strcmp(argv[formula_index], "-TJ"))
{
echeck = TarjanOnFly;
degeneralize_opt = true;
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-v"))
{
output = 5;
@ -497,6 +635,7 @@ main(int argc, char** argv)
{
case None:
break;
case Couvreur:
case Couvreur2:
{
@ -505,9 +644,7 @@ main(int argc, char** argv)
ec = new spot::emptiness_check(a);
else
ec = new spot::emptiness_check_shy(a);
bool res = ec->check();
if (expect_counter_example)
{
if (res)
@ -517,7 +654,12 @@ main(int argc, char** argv)
break;
}
spot::counter_example ce(ec->result());
ce.print_result(std::cout);
//ce.print_result(std::cout);
spot::ce::counter_example* res2 = ce.get_counter_example();
spot::tgba* aut = res2->ce2tgba();
spot::dotty_reachable(std::cout, aut);
delete res2;
delete aut;
}
else
{
@ -526,7 +668,8 @@ main(int argc, char** argv)
delete ec;
}
break;
case MagicSearch:
case MagicSearchOld:
{
spot::magic_search ms(degeneralized);
bool res = ms.check();
@ -547,8 +690,68 @@ main(int argc, char** argv)
}
}
break;
case ColorDFSSearch:
es = new spot::colordfs_search(degeneralized);
break;
case TarjanOnFly:
es = new spot::tarjan_on_fly(degeneralized);
break;
case MinimalSearch:
es = new spot::minimalce_search(degeneralized);
break;
case MagicSearch:
case NestedDFSSearch:
case NestedDFSSearchModify:
es = new spot::nesteddfs_search(degeneralized, opt_nested_search);
break;
}
if (es)
{
spot::ce::counter_example* res = es->check();
if (expect_counter_example)
{
do
{
if (!res)
{
exit_code = 1;
break;
}
std::cout << "CE : " << std::endl
<< " size : " << res->size()
<< std::endl;
spot::tgba* aut = res->ce2tgba();
//spot::dotty_reachable(std::cout, aut);
res->print(std::cout);
es->print_stat(std::cout);
delete aut;
delete res;
res = 0;
}
while (magic_many && (res = es->check()));
}
else if (res)
{
exit_code = res->size();
std::cout << "res->size ?? : " << exit_code << std::endl;
}
else
{
exit_code = (res != 0);
std::cout << "res != 0 ?? : " << exit_code << std::endl;
}
if (res)
delete res;
}
if (es)
delete es;
if (f)
spot::ltl::destroy(f);
if (expl)