dstarparse: get rid of the deticated data structures and conversions

* src/dstarparse/dstarparse.yy: Use the twa_graph_ptr to store the
acceptance condition.
* src/dstarparse/dra2ba.cc, src/dstarparse/dstar2tgba.cc,
src/dstarparse/nra2nba.cc, src/dstarparse/nsa2tgba.cc: Delete
all these conversion routines.
* src/dstarparse/public.hh, src/dstarparse/Makefile.am: Adjust.
* src/bin/dstar2tgba.cc: Adjust to call to_generalized_buchi()
instead.
* src/bin/ltlcross.cc: Adjust to call remove_fin() instead.
* src/bin/ltldo.cc: Use the parsed automaton as-is.
* src/tests/degenid.test, src/tests/dstar.test, src/tests/ikwiad.cc:
Adjust test cases.
This commit is contained in:
Alexandre Duret-Lutz 2015-08-20 19:50:03 +02:00
parent 5f0b6dc36c
commit 9b5340b90a
13 changed files with 75 additions and 874 deletions

View file

@ -139,7 +139,7 @@ test 3 = "`../../bin/ltl2tgba -B 'G(a|G(b|Fc))' --stats=%s`"
# This 7-state DRA (built with
# ltlfilt -f 'F(a & GFb) | (Fc & Fa & F(c & GF!b))' -l |
# ltl2dstar --ltl2nba=spin:ltl2tgba@-sD - -
# should be converted in into a 6-state DBA.
# should be converted in into a 5-state DBA.
cat >in.dra <<EOF
DRA v2 explicit
Comment: "Union{Safra[NBA=3],Safra[NBA=5]}"
@ -221,7 +221,7 @@ Acc-Sig:
EOF
run 0 ../../bin/dstar2tgba in.dra -BD --stats=%s > out.stat
test 6 = "`cat out.stat`"
test 5 = "`cat out.stat`"
# Only one state should be accepting. In spot 1.2.x an initial state
# in a trivial SCC was marked as accepting: this is superfluous.

View file

@ -68,9 +68,9 @@ digraph G {
0 -> 0 [label="a & !b"]
0 -> 1 [label="!a & !b"]
0 -> 2 [label="b"]
1 [label="1"]
1 [label="1\n{0}"]
1 -> 1 [label="1"]
2 [label="2"]
2 [label="2\n{1}"]
2 -> 2 [label="1"]
}
EOF
@ -78,7 +78,7 @@ EOF
diff expected stdout
run 0 ../ikwiad -XDD dra.dstar | tee stdout
run 0 ../ikwiad -XDB -R3 dra.dstar | tee stdout
cat >expected <<EOF
digraph G {
@ -130,39 +130,26 @@ digraph G {
rankdir=LR
node [shape="circle"]
I [label="", style=invis, width=0]
I -> 0
I -> 1
0 [label="0"]
0 -> 1 [label="1"]
0 -> 2 [label="1"]
0 -> 0 [label="!a"]
0 -> 2 [label="a"]
1 [label="1"]
1 -> 1 [label="!a"]
1 -> 2 [label="!a"]
1 -> 3 [label="a"]
1 -> 4 [label="a"]
1 -> 0 [label="1"]
2 [label="2"]
2 -> 5 [label="!a"]
2 -> 4 [label="a\n{0}"]
3 [label="3"]
3 -> 1 [label="!a"]
3 -> 2 [label="!a"]
2 -> 0 [label="!a"]
2 -> 2 [label="a"]
2 -> 3 [label="a"]
3 [label="3", peripheries=2]
3 -> 3 [label="a"]
3 -> 4 [label="a"]
4 [label="4"]
4 -> 5 [label="!a"]
4 -> 4 [label="a\n{0}"]
5 [label="5"]
5 -> 5 [label="!a"]
5 -> 6 [label="a"]
6 [label="6"]
6 -> 5 [label="!a"]
6 -> 6 [label="a"]
}
EOF
diff expected stdout
test "`../../bin/dstar2tgba -D dsa.dstar --stats '%s %t %p %d'`" = "2 5 0 0"
test "`../../bin/dstar2tgba -DC dsa.dstar --stats '%s %t %p %d'`" = "3 8 1 0"
# These one could be reduced to 2 5 0 0 and 3 8 1 0
test "`../../bin/dstar2tgba -D dsa.dstar --stats '%s %t %p %d'`" = "4 8 0 0"
test "`../../bin/dstar2tgba -DC dsa.dstar --stats '%s %t %p %d'`" = "5 11 1 0"
@ -213,7 +200,7 @@ Acc-Sig: +0 +1
4
EOF
run 0 ../ikwiad -XDD dra.dstar | tee stdout
run 0 ../ikwiad -XDB dra.dstar | tee stdout
cat >expected <<EOF
digraph G {
@ -272,7 +259,7 @@ digraph G {
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 0 [label="1"]
0 -> 0 [label="1\n{0}"]
}
EOF

View file

@ -67,6 +67,7 @@
#include "twaalgos/dtbasat.hh"
#include "twaalgos/dtgbasat.hh"
#include "twaalgos/stutter.hh"
#include "twaalgos/totgba.hh"
#include "taalgos/tgba2ta.hh"
#include "taalgos/dot.hh"
@ -120,8 +121,6 @@ syntax(char* prog)
<< " ltl2dstar file" << std::endl
<< " -XDB read the from an ltl2dstar file and convert it to "
<< "TGBA" << std::endl
<< " -XDD read the from an ltl2dstar file and convert it to "
<< "TGBA,\n keeping it deterministic when possible\n"
<< " -XH do not compute an automaton, read it from a"
<< " HOA file\n"
<< " -XL do not compute an automaton, read it from an"
@ -347,7 +346,6 @@ checked_main(int argc, char** argv)
bool from_file = false;
enum { ReadDstar, ReadHoa } readformat = ReadHoa;
bool nra2nba = false;
bool dra2dba = false;
bool scc_filter = false;
bool simpltl = false;
spot::ltl::ltl_simplifier_options redopt(false, false, false, false,
@ -876,13 +874,6 @@ checked_main(int argc, char** argv)
readformat = ReadDstar;
nra2nba = true;
}
else if (!strcmp(argv[formula_index], "-XDD"))
{
from_file = true;
readformat = ReadDstar;
nra2nba = true;
dra2dba = true;
}
else if (!strcmp(argv[formula_index], "-XH"))
{
from_file = true;
@ -986,20 +977,8 @@ checked_main(int argc, char** argv)
tm.start("dstar2tgba");
if (nra2nba)
{
if (daut->type == spot::Rabin)
{
if (dra2dba)
a = spot::dstar_to_tgba(daut);
else
a = spot::nra_to_nba(daut);
assert(a->is_sba());
assume_sba = true;
}
else
{
a = spot::nsa_to_tgba(daut);
assume_sba = false;
}
a = spot::to_generalized_buchi(daut->aut);
assume_sba = a->is_sba();
}
else
{
@ -1112,7 +1091,10 @@ checked_main(int argc, char** argv)
if (scc_filter)
{
tm.start("SCC-filter");
a = spot::scc_filter(ensure_digraph(a), scc_filter_all);
if (a->has_state_based_acc() & !scc_filter_all)
a = spot::scc_filter_states(ensure_digraph(a));
else
a = spot::scc_filter(ensure_digraph(a), scc_filter_all);
tm.stop("SCC-filter");
assume_sba = false;
}