Merge emptiness-checks tests into ltl2tgba.

* src/tgbatest/Makefile (check_PRORGRAMS): Remove
emptinesscheck and ltlmagic.
(emptinesscheck_SOURCES, ltlmagic_SOURCES): Remove.
(TESTS): Replace emptinesscheck.test and ltlmagic.test by
emptchk.test.
* src/tgbatest/emptinesscheck.test, src/tgbatest/ltlmagic.test:
Delete.
* src/tgbatest/emptchk.test: New file.
* src/tgbatest/emptinesscheck.cc, src/tgbatest/ltlmagic.cc:
Delete.
* src/tgbatest/ltl2tgba.cc: Add support for -e, -E, -m, -M, and -n.
This commit is contained in:
Alexandre Duret-Lutz 2003-10-23 11:37:07 +00:00
parent a11a29a1f7
commit 65f84e2c61
8 changed files with 159 additions and 267 deletions

View file

@ -11,6 +11,8 @@
#include "tgbaalgos/dotty.hh"
#include "tgbaalgos/lbtt.hh"
#include "tgba/tgbatba.hh"
#include "tgbaalgos/magic.hh"
#include "tgbaalgos/emptinesscheck.hh"
void
syntax(char* prog)
@ -19,14 +21,25 @@ syntax(char* prog)
<< " "<< prog << " -F [OPTIONS...] file" << std::endl
<< std::endl
<< "Options:" << std::endl
<< " -a display the accepting_conditions BDD, not the reachability graph"
<< " -a display the accepting_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
<< " -E emptiness-check (Couvreur), expect no counter-example "
<< std::endl
<< " -f use Couvreur's FM algorithm for translation"
<< std::endl
<< " -F read the formula from the file" << std::endl
<< " -m magic-search (implies -D), expect a counter-example"
<< std::endl
<< " -M magic-search (implies -D), expect no counter-example"
<< std::endl
<< " -n same as -m, but display more counter-examples"
<< std::endl
<< " -r display the relation BDD, not the reachability graph"
<< std::endl
<< " -R same as -r, but as a set" << std::endl
@ -47,6 +60,9 @@ main(int argc, char** argv)
bool file_opt = false;
int output = 0;
int formula_index = 0;
enum { None, Couvreur, MagicSearch } echeck = None;
bool magic_many = false;
bool expect_counter_example = false;
for (;;)
{
@ -71,6 +87,18 @@ main(int argc, char** argv)
{
degeneralize_opt = true;
}
else if (!strcmp(argv[formula_index], "-e"))
{
echeck = Couvreur;
expect_counter_example = true;
output = -1;
}
else if (!strcmp(argv[formula_index], "-E"))
{
echeck = Couvreur;
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-f"))
{
fm_opt = true;
@ -79,6 +107,28 @@ main(int argc, char** argv)
{
file_opt = true;
}
else if (!strcmp(argv[formula_index], "-m"))
{
echeck = MagicSearch;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
}
else if (!strcmp(argv[formula_index], "-M"))
{
echeck = MagicSearch;
degeneralize_opt = true;
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-n"))
{
echeck = MagicSearch;
degeneralize_opt = true;
expect_counter_example = true;
output = -1;
magic_many = true;
}
else if (!strcmp(argv[formula_index], "-r"))
{
output = 1;
@ -143,12 +193,15 @@ main(int argc, char** argv)
spot::ltl::destroy(f);
spot::tgba* degeneralized = 0;
spot::tgba_tba_proxy* degeneralized = 0;
if (degeneralize_opt)
a = degeneralized = new spot::tgba_tba_proxy(a);
switch (output)
{
case -1:
/* No output. */
break;
case 0:
spot::dotty_reachable(std::cout, a);
break;
@ -184,6 +237,53 @@ main(int argc, char** argv)
assert(!"unknown output option");
}
switch (echeck)
{
case None:
break;
case Couvreur:
{
spot::emptiness_check ec = spot::emptiness_check();
bool res = ec.tgba_emptiness_check(a);
if (expect_counter_example)
{
if (res)
{
exit_code = 1;
break;
}
ec.counter_example(a);
ec.print_result(std::cout, a);
}
else
{
exit_code = !res;
}
}
break;
case MagicSearch:
{
spot::magic_search ms(degeneralized);
bool res = ms.check();
if (expect_counter_example)
{
if (!res)
{
exit_code = 1;
break;
}
do
ms.print_result(std::cout);
while (magic_many && ms.check());
}
else
{
exit_code = res;
}
}
break;
}
if (degeneralize_opt)
delete degeneralized;