Switch from "promises" to "accepting set". Fix the definitions
of these accepting set so that they are really usable. Provide a all_accepting_conditions() method for use in the emptyness check, and a neg_accepting_conditions() for products. Predeclare TGBA accepting conditions is the i/o. * src/tgba/bddprint.cc (want_prom): Rename as ... (want_prom): ... this. (print_handler): Adjust to display Acc[]. (print_acc_handler, bdd_print_acc): New functions. * src/tgba/bddprint.hh (print_acc_handler, bdd_print_acc): New functions. * src/tgba/succiter.hh (current_promise): Rename as ... (current_accepting_conditions): ... this. * src/tgba/succiterconcrete.cc (current_state): Rename next to now. (current_promise): Rename as ... (current_accepting_conditions): ... this, and compute the accepting conditions. * src/tgba/dictunion.cc, src/tgba/ltl2tgba.cc, src/tgba/succiterconcrete.hh, src/tgba/tgbabddconcretefactory.cc, src/tgba/tgbabddcoredata.cc, src/tgba/tgbabddcoredata.hh, src/tgba/tgbabdddict.hh, src/tgba/tgbabdddict.cc, src/tgba/tgbabddtranslatefactory.cc, src/tgbaalgos/dotty.cc: Adjust to new names. * src/tgba/tgba.hh (all_accepting_conditions, neg_accepting_conditions): New functions. * src/tgba/tgbabddconcretefactory.cc: Adjust to new names, and record accepting conditions instead of promises. * src/tgba/tgbabddcoredata.hh (accepting_conditions, all_accepting_conditions, negacc_set): New variables. (notnow_set, notprom_set, declare_promise): Rename as ... (notnext_set, notacc_set, declare_accepting_condition): ... these. * src/tgba/tgbaexplicit.hh (tgba_explicit_succ_iterator::current_promise): Rename as ... (tgba_explicit_succ_iterator::current_accepting_conditions): ... this. (tgba_explicit::add_promise): Rename as ... (tgba_explicit::add_accepting_condition): ... this. (tgba_explicit::declare_accepting_condition, tgba_explicit::has_accepting_condition): New variables. (tgba_explicit::get_promise): Rename as ... (tgba_explicit::get_accepting_condition): ... this. (tgba_explicit::all_accepting_conditions, tgba_explicit::neg_accepting_conditions): Implement them. (all_accepting_conditions, neg_accepting_conditions, all_accepting_conditions): New variables. (tgba_explicit_succ_iterator): Embed all_accepting_conditions_. * src/tgba/tgbaexplicit.cc: Likewise. * src/tgba/tgbaproduct.hh (tgba_product_succ_uterator): Embed left_neg_ and right_neg_. (tgba_product::all_accepting_conditions, tgba_product::neg_accepting_conditions): Implement them. * src/tgba/tgbatranslateproxy.hh: (tgba_translate_proxy::all_accepting_conditions, tgba_translate_proxy::neg_accepting_conditions): Implement them. * src/tgba/tgbatranslateproxy.cc: Likewise. * src/tgbaalgos/save.cc (save_rec): Call bdd_print (tgba_save_reachable): Output the `acc =' line. * src/tgbaparse/tgbaparse.yy: Support the for accepting conditions definitions using an "acc =" line at the start. Later, use has_accepting_condition while parsing accepting conditions to ensure they were declared. Disallow !cond in accepting conditions. * src/tgbaparse/tgbascan.ll (ACC_DEF): New token. * src/tgbatest/explicit.cc (main): Declare accepting conditions. * src/tgbatest/ltl2tgba.cc (main): Add support for the -a, -A, and -R new options. * src/tgbatest/tgbaread.cc (main): Really exit on parse error. * src/tgbatest/explicit.test, src/tgbatest/explprod.test, src/tgbatest/mixprod.test, src/tgbatest/readsave.test, src/tgbatest/tgbaread.test, src/tgbatest/tripprod.test: Reflect recent changes.
This commit is contained in:
parent
fbbfda43f2
commit
25e6cca4b4
37 changed files with 662 additions and 220 deletions
|
|
@ -18,9 +18,12 @@ main()
|
|||
a.add_condition(t2, e.require("a"));
|
||||
a.add_condition(t3, e.require("b"));
|
||||
a.add_condition(t3, e.require("c"));
|
||||
a.add_promise(t1, e.require("p"));
|
||||
a.add_promise(t1, e.require("q"));
|
||||
a.add_promise(t2, e.require("r"));
|
||||
a.declare_accepting_condition(e.require("p"));
|
||||
a.declare_accepting_condition(e.require("q"));
|
||||
a.declare_accepting_condition(e.require("r"));
|
||||
a.add_accepting_condition(t1, e.require("p"));
|
||||
a.add_accepting_condition(t1, e.require("q"));
|
||||
a.add_accepting_condition(t2, e.require("r"));
|
||||
|
||||
spot::dotty_reachable(std::cout, a);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ digraph G {
|
|||
1 [label="state 0"]
|
||||
0 -> 1
|
||||
2 [label="state 1"]
|
||||
1 -> 2 [label="T\n<Prom[p]:1, Prom[q]:1>"]
|
||||
1 -> 2 [label="T\n<Acc[p]:0, Acc[q]:1, Acc[r]:0><Acc[p]:1, Acc[q]:0, Acc[r]:0>"]
|
||||
3 [label="state 2"]
|
||||
2 -> 3 [label="<a:1>\n<Prom[r]:1>"]
|
||||
3 -> 1 [label="<b:1, c:1>\nT"]
|
||||
2 -> 3 [label="<a:1>\n<Acc[p]:0, Acc[q]:0, Acc[r]:1>"]
|
||||
3 -> 1 [label="<b:1, c:1>\nF"]
|
||||
}
|
||||
EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -5,28 +5,31 @@
|
|||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
s1, s3, a,;
|
||||
acc = p1;
|
||||
s1, s3, a, true;
|
||||
s1, s2, b, p1;
|
||||
s2, s1, !a,;
|
||||
s2, s3, c,;
|
||||
s2, s1, !a, true;
|
||||
s2, s3, c, true;
|
||||
EOF
|
||||
|
||||
cat >input2 <<EOF
|
||||
acc=p2 p3;
|
||||
s1, s2, b, p2;
|
||||
s2, s1, a, p3;
|
||||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
"s1 * s1", "s3 * s2", a b, "p2";
|
||||
acc = "p1" "p2" "p3";
|
||||
"s1 * s1", "s3 * s2", a b, "p1" "p2";
|
||||
"s1 * s1", "s2 * s2", b, "p1" "p2";
|
||||
"s2 * s2", "s3 * s1", a c, "p3";
|
||||
"s2 * s2", "s3 * s1", a c, "p1" "p3";
|
||||
EOF
|
||||
|
||||
./explprod input1 input2 > stdout
|
||||
|
||||
# Sort out some possible inversions in the output.
|
||||
# (The order is not guaranteed by SPOT.)
|
||||
sed 's/c a/a c/g;s/b a/a b/g;s/"p2" "p1"/"p1" "p2"/g' stdout > tmp_ &&
|
||||
sed 's/c a/a c/g;s/b a/a b/g;s/"p3" "p1"/"p1" "p3"/g;s/"p3" "p2"/"p1" "p3"/g;s/"p2" "p1"/"p1" "p2"/g' stdout > tmp_ &&
|
||||
mv tmp_ stdout
|
||||
|
||||
cat stdout
|
||||
|
|
|
|||
|
|
@ -13,10 +13,14 @@ syntax(char* prog)
|
|||
{
|
||||
std::cerr << "Usage: "<< prog << " [-d][-o][-r] formula" << std::endl
|
||||
<< std::endl
|
||||
<< " -a display the accepting_conditions BDD, not the reachability graph"
|
||||
<< " -A same as -a, but as a set" << std::endl
|
||||
<< " -d turn on traces during parsing" << std::endl
|
||||
<< " -o re-order BDD variables in the automata" << std::endl
|
||||
<< std::endl
|
||||
<< " -r display the relation BDD, not the reachability graph"
|
||||
<< std::endl;
|
||||
<< std::endl
|
||||
<< " -R same as -r, but as a set" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +31,7 @@ main(int argc, char** argv)
|
|||
|
||||
bool debug_opt = false;
|
||||
bool defrag_opt = false;
|
||||
bool rel_opt = false;
|
||||
int output = 0;
|
||||
int formula_index = 0;
|
||||
|
||||
for (;;)
|
||||
|
|
@ -37,7 +41,15 @@ main(int argc, char** argv)
|
|||
|
||||
++formula_index;
|
||||
|
||||
if (!strcmp(argv[formula_index], "-d"))
|
||||
if (!strcmp(argv[formula_index], "-a"))
|
||||
{
|
||||
output = 2;
|
||||
}
|
||||
else if (!strcmp(argv[formula_index], "-A"))
|
||||
{
|
||||
output = 4;
|
||||
}
|
||||
else if (!strcmp(argv[formula_index], "-d"))
|
||||
{
|
||||
debug_opt = true;
|
||||
}
|
||||
|
|
@ -47,7 +59,11 @@ main(int argc, char** argv)
|
|||
}
|
||||
else if (!strcmp(argv[formula_index], "-r"))
|
||||
{
|
||||
rel_opt = true;
|
||||
output = 1;
|
||||
}
|
||||
else if (!strcmp(argv[formula_index], "-R"))
|
||||
{
|
||||
output = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -70,11 +86,30 @@ main(int argc, char** argv)
|
|||
spot::ltl::destroy(f);
|
||||
if (defrag_opt)
|
||||
a = spot::defrag(a);
|
||||
if (rel_opt)
|
||||
spot::bdd_print_dot(std::cout, a.get_dict(),
|
||||
a.get_core_data().relation);
|
||||
else
|
||||
spot::dotty_reachable(std::cout, a);
|
||||
switch (output)
|
||||
{
|
||||
case 0:
|
||||
spot::dotty_reachable(std::cout, a);
|
||||
break;
|
||||
case 1:
|
||||
spot::bdd_print_dot(std::cout, a.get_dict(),
|
||||
a.get_core_data().relation);
|
||||
break;
|
||||
case 2:
|
||||
spot::bdd_print_dot(std::cout, a.get_dict(),
|
||||
a.get_core_data().accepting_conditions);
|
||||
break;
|
||||
case 3:
|
||||
spot::bdd_print_set(std::cout, a.get_dict(),
|
||||
a.get_core_data().relation);
|
||||
break;
|
||||
case 4:
|
||||
spot::bdd_print_set(std::cout, a.get_dict(),
|
||||
a.get_core_data().accepting_conditions);
|
||||
break;
|
||||
default:
|
||||
assert(!"unknown output option");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ set -e
|
|||
# trigger assertions or I/O errors.
|
||||
|
||||
cat >input1 <<EOF
|
||||
acc = p1;
|
||||
s1, s3, a,;
|
||||
s1, s2, b, p1;
|
||||
s2, s1, !a,;
|
||||
|
|
|
|||
|
|
@ -5,23 +5,34 @@
|
|||
set -e
|
||||
|
||||
cat >input <<EOF
|
||||
acc = c d;
|
||||
s1, "s2", a!b, c d;
|
||||
"s2", "state 3", a, !c;
|
||||
"s2", "state 3", a, c;
|
||||
"state 3", s1,,;
|
||||
EOF
|
||||
|
||||
./readsave input > stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
acc = "c" "d";
|
||||
"s1", "s2", a !b, "c" "d";
|
||||
"s2", "state 3", a, !"c";
|
||||
"state 3", "s1", , ;
|
||||
"s2", "state 3", a, "c";
|
||||
"state 3", "s1", ,;
|
||||
EOF
|
||||
|
||||
# Sort out some possible inversions in the output.
|
||||
# (The order is not guaranteed by SPOT.)
|
||||
sed 's/"d" "c"/"c" "d"/g' stdout > tmp_ && mv tmp_ stdout
|
||||
|
||||
diff stdout expected
|
||||
|
||||
mv stdout input
|
||||
./readsave input > stdout
|
||||
|
||||
# Sort out some possible inversions in the output.
|
||||
# (The order is not guaranteed by SPOT.)
|
||||
sed 's/"d" "c"/"c" "d"/g' stdout > tmp_ && mv tmp_ stdout
|
||||
|
||||
diff input stdout
|
||||
|
||||
rm input stdout expected
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ main(int argc, char** argv)
|
|||
spot::tgba_parse_error_list pel;
|
||||
spot::tgba_explicit* a = spot::tgba_parse(argv[filename_index],
|
||||
pel, env, debug);
|
||||
|
||||
exit_code =
|
||||
spot::format_tgba_parse_errors(std::cerr, pel);
|
||||
|
||||
if (spot::format_tgba_parse_errors(std::cerr, pel))
|
||||
return 2;
|
||||
|
||||
if (a)
|
||||
{
|
||||
|
|
@ -44,7 +44,7 @@ main(int argc, char** argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
exit_code = 1;
|
||||
return 1;
|
||||
}
|
||||
return exit_code;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@
|
|||
set -e
|
||||
|
||||
cat >input <<EOF
|
||||
acc = c d;
|
||||
s1, "s2", a!b, c d;
|
||||
"s2", "state 3", a, !c;
|
||||
"s2", "state 3", a, c;
|
||||
"state 3", s1,,;
|
||||
EOF
|
||||
|
||||
|
|
@ -19,10 +20,10 @@ digraph G {
|
|||
1 [label="s1"]
|
||||
0 -> 1
|
||||
2 [label="s2"]
|
||||
1 -> 2 [label="<a:1, b:0>\n<Prom[c]:1, Prom[d]:1>"]
|
||||
1 -> 2 [label="<a:1, b:0>\n<Acc[c]:0, Acc[d]:1><Acc[c]:1, Acc[d]:0>"]
|
||||
3 [label="state 3"]
|
||||
2 -> 3 [label="<a:1>\n<Prom[c]:0>"]
|
||||
3 -> 1 [label="T\nT"]
|
||||
2 -> 3 [label="<a:1>\n<Acc[c]:1, Acc[d]:0>"]
|
||||
3 -> 1 [label="T\nF"]
|
||||
}
|
||||
EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -5,18 +5,21 @@
|
|||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
s1, s3, a,;
|
||||
acc = p1;
|
||||
s1, s3, a, true;
|
||||
s1, s2, b, p1;
|
||||
s2, s1, !a,;
|
||||
s2, s1, !a, true;
|
||||
s2, s3, c,;
|
||||
EOF
|
||||
|
||||
cat >input2 <<EOF
|
||||
acc = p2 p3;
|
||||
s1, s2, b, p2;
|
||||
s2, s1, a, p3;
|
||||
EOF
|
||||
|
||||
cat >input3 <<EOF
|
||||
acc = p4;
|
||||
s1, s2, a,;
|
||||
s1, s3, b,;
|
||||
s3, s2,, p4;
|
||||
|
|
@ -24,10 +27,11 @@ s2, s3,, p4;
|
|||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
"s1 * s1 * s1", "s3 * s2 * s2", a b, "p2";
|
||||
acc = "p2" "p3" "p4" "p1";
|
||||
"s1 * s1 * s1", "s3 * s2 * s2", a b, "p1" "p2";
|
||||
"s1 * s1 * s1", "s2 * s2 * s2", a b, "p1" "p2";
|
||||
"s2 * s2 * s2", "s3 * s1 * s3", a c, "p3" "p4";
|
||||
"s1 * s1 * s1", "s3 * s2 * s3", a b, "p2";
|
||||
"s1 * s1 * s1", "s3 * s2 * s3", a b, "p1" "p2";
|
||||
"s1 * s1 * s1", "s2 * s2 * s3", b, "p1" "p2";
|
||||
"s2 * s2 * s3", "s3 * s1 * s2", a c, "p3" "p4";
|
||||
EOF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue