diff --git a/src/tgbatest/complementation.cc b/src/tgbatest/complementation.cc index 6f3174d6c..b00a2e9dc 100644 --- a/src/tgbatest/complementation.cc +++ b/src/tgbatest/complementation.cc @@ -20,8 +20,8 @@ #include #include #include "tgbaalgos/dotty.hh" -#include "tgbaalgos/save.hh" -#include "tgbaparse/public.hh" +#include "tgbaalgos/hoa.hh" +#include "hoaparse/public.hh" #include "tgba/tgbaproduct.hh" #include "tgbaalgos/gtec/gtec.hh" #include "tgbaalgos/ltl2tgba_fm.hh" @@ -39,7 +39,7 @@ void usage(const char* prog) { std::cout << "usage: " << prog << " [options]" << std::endl; std::cout << "with options" << std::endl - << "-b Output in spot's format\n" + << "-H Output in HOA\n" << "-s buchi_automaton display the safra automaton\n" << "-a buchi_automaton display the complemented automaton\n" << "-astat buchi_automaton statistics for !a\n" @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) bool stats = false; bool formula = false; bool print_formula = false; - bool save_spot = false; + bool save_hoa = false; if (argc < 3) { @@ -70,9 +70,9 @@ int main(int argc, char* argv[]) { if (argv[i][0] == '-') { - if (strcmp(argv[i] + 1, "b") == 0) + if (strcmp(argv[i] + 1, "H") == 0) { - save_spot = true; + save_hoa = true; continue; } @@ -121,10 +121,11 @@ int main(int argc, char* argv[]) if (print_automaton || print_safra) { spot::ltl::environment& env(spot::ltl::default_environment::instance()); - spot::tgba_parse_error_list pel; - spot::tgba_digraph_ptr a = spot::tgba_parse(file, pel, dict, env); - if (spot::format_tgba_parse_errors(std::cerr, file, pel)) + spot::hoa_parse_error_list pel; + auto h = spot::hoa_parse(file, pel, dict, env); + if (spot::format_hoa_parse_errors(std::cerr, file, pel)) return 2; + spot::tgba_digraph_ptr a = h->aut; spot::tgba_ptr complement = 0; @@ -132,8 +133,8 @@ int main(int argc, char* argv[]) if (print_automaton) { - if (save_spot) - spot::tgba_save_reachable(std::cout, complement); + if (save_hoa) + spot::hoa_reachable(std::cout, complement, nullptr); else spot::dotty_reachable(std::cout, complement); } @@ -177,11 +178,12 @@ int main(int argc, char* argv[]) } else { - spot::tgba_parse_error_list pel; + spot::hoa_parse_error_list pel; spot::ltl::environment& env(spot::ltl::default_environment::instance()); - a = spot::tgba_parse(file, pel, dict, env); - if (spot::format_tgba_parse_errors(std::cerr, file, pel)) + auto h = spot::hoa_parse(file, pel, dict, env); + if (spot::format_hoa_parse_errors(std::cerr, file, pel)) return 2; + a = h->aut; } auto safra_complement = spot::make_safra_complement(a); diff --git a/src/tgbatest/complementation.test b/src/tgbatest/complementation.test index 898785f90..57438716d 100755 --- a/src/tgbatest/complementation.test +++ b/src/tgbatest/complementation.test @@ -39,20 +39,31 @@ EOF # The following test-case was supplied by Martin Dieguez Lodeiro to # demonstrate a bug in our Safra implementation. -cat >x.tgba <x.hoa < nx.tgba -run 0 ../ltl2tgba -X -e nx.tgba +run 0 ../complement -H -a x.hoa > nx.hoa +run 0 ../ltl2tgba -XH -e nx.hoa # however the intersection of both should not # accept any run. -run 0 ../ltl2tgba -X -E -Pnx.tgba x.tgba +run 1 ../../bin/autfilt -q nx.hoa --intersect x.hoa diff --git a/src/tgbatest/cycles.test b/src/tgbatest/cycles.test index 583073c42..99f8caa43 100755 --- a/src/tgbatest/cycles.test +++ b/src/tgbatest/cycles.test @@ -21,63 +21,52 @@ . ./defs set -e -# GNU systems have seq, -# BSD systems have jot. -# Neither of those are POSIX... -if test "*`(seq 1 1 2>/dev/null)`" = "1"; then - have_seq=true -else - have_seq=false - if test "`(jot 1 1 2>/dev/null)`" = "1"; then - have_jot=true - else - have_jot=false - fi -fi - -# enum start end -enum() { - if $have_seq; then - seq $1 $2 - elif $have_jot; then - jot `expr $2 - $1 + 1` $1 - else - i=$1 - while test $i -le $2; do - echo $i - i=`expr $i + 1` - done - fi -} - # Fig.1 from Johnson's SIAM J. Comput. 1975 paper. +cat >johnson-fig1.hoa < johnson-fig1.tgba - - -run 0 ../ltl2tgba -KC -X johnson-fig1.tgba > out +run 0 ../ltl2tgba -KC -XH johnson-fig1.hoa > out test `wc -l < out` -eq 10 run 0 ../ltl2tgba -KW '(Ga -> Gb) W c' > out diff --git a/src/tgbatest/dbacomp.test b/src/tgbatest/dbacomp.test index 7bce350bd..e4e0b0f72 100755 --- a/src/tgbatest/dbacomp.test +++ b/src/tgbatest/dbacomp.test @@ -1,6 +1,6 @@ #!/bin/sh # -*- coding: utf-8 -*- -# Copyright (C) 2013 Laboratoire de Recherche et +# Copyright (C) 2013, 2015 Laboratoire de Recherche et # Développement de l'Epita (LRDE). # # This file is part of Spot, a model checking library. @@ -23,25 +23,37 @@ set -e # This automaton used to trigger a bug in the complementation: its # intersection with the complement was not empty! -cat >input.tgba <input.hoa < output.hoa +run 1 ../../bin/autfilt -q input.hoa --intersect output.hoa diff --git a/src/tgbatest/degenid.test b/src/tgbatest/degenid.test index 8f549ac4c..1d7e2b505 100755 --- a/src/tgbatest/degenid.test +++ b/src/tgbatest/degenid.test @@ -1,6 +1,6 @@ #!/bin/sh # -*- coding: utf-8 -*- -# Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et +# Copyright (C) 2011, 2013, 2014, 2015 Laboratoire de Recherche et # Développement de l'Epita (LRDE). # # This file is part of Spot, a model checking library. @@ -26,12 +26,12 @@ set -e for f in 'FGa|GFb' 'GFa & GFb & GFc' 'GF(a->FGb)&GF(c->FGd)'; do for opt in -DS -DT; do - ../ltl2tgba $opt -b "$f" > autX.spot - ../ltl2tgba -X -kt autX.spot > base.size + ../ltl2tgba $opt -H "$f" > autX.spot + ../ltl2tgba -XH -kt autX.spot > base.size cat base.size for x in X XX XXX; do - ../ltl2tgba -X $opt -b aut$x.spot > autX$x.spot - ../ltl2tgba -X -kt autX$x.spot > new.size + ../ltl2tgba -XH $opt -H aut$x.spot > autX$x.spot + ../ltl2tgba -XH -kt autX$x.spot > new.size cat new.size cmp base.size new.size done @@ -42,61 +42,91 @@ done # This is another 6-state degeneralized automaton that # we used the "redegeneralize" to a 8-state BA... cat > bug < out +run 0 ../ltl2tgba -ks -XH -DS bug > out grep 'states: 6' out # This 8-state degeneralized automaton used # to be "degeneralized" to a 9-state BA... cat > bug2 <out +run 0 ../ltl2tgba -ks -XH -DS bug2 >out grep 'states: 8' out diff --git a/src/tgbatest/dfs.test b/src/tgbatest/dfs.test index c36141791..bd9c520a3 100755 --- a/src/tgbatest/dfs.test +++ b/src/tgbatest/dfs.test @@ -35,51 +35,68 @@ set -e # |_______| cat >blue_counter <<'EOF' -acc = a; -s1, s2,, a; -s2, s3,,; -s3, s1,,; -s3, s4,,; -s4, s4,,; -s4, s5,,; -s4, s6,,; -s4, s7,,; -s4, s8,,; -s4, s9,,; -s5, s4,,; -s5, s5,,; -s5, s6,,; -s5, s7,,; -s5, s8,,; -s5, s9,,; -s6, s4,,; -s6, s5,,; -s6, s6,,; -s6, s7,,; -s6, s8,,; -s6, s9,,; -s7, s4,,; -s7, s5,,; -s7, s6,,; -s7, s7,,; -s7, s8,,; -s7, s9,,; -s8, s4,,; -s8, s5,,; -s8, s6,,; -s8, s7,,; -s8, s8,,; -s8, s9,,; -s9, s4,,; -s9, s5,,; -s9, s6,,; -s9, s7,,; -s9, s8,,; -s9, s9,,; +HOA: v1 +States: 9 +Start: 0 +AP: 0 +acc-name: Buchi +Acceptance: 1 Inf(0) +properties: trans-labels explicit-labels state-acc complete +--BODY-- +State: 0 {0} +[t] 1 +State: 1 +[t] 2 +State: 2 +[t] 0 +[t] 3 +State: 3 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 4 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 5 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 6 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 7 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 8 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +--END-- EOF -run 0 ../ltl2tgba -CR -eSE05 -X blue_counter -run 0 ../ltl2tgba -CR -eTau03_opt -X blue_counter +run 0 ../ltl2tgba -CR -eSE05 -XH blue_counter +run 0 ../ltl2tgba -CR -eTau03_opt -XH blue_counter # s1->s2->s3->(large composant from s4 to s9) # ^ || @@ -87,51 +104,68 @@ run 0 ../ltl2tgba -CR -eTau03_opt -X blue_counter # ||______|| cat >blue_last <<'EOF' -acc = a; -s1, s2,,; -s2, s3,,; -s3, s1,, a; -s3, s4,,; -s4, s4,,; -s4, s5,,; -s4, s6,,; -s4, s7,,; -s4, s8,,; -s4, s9,,; -s5, s4,,; -s5, s5,,; -s5, s6,,; -s5, s7,,; -s5, s8,,; -s5, s9,,; -s6, s4,,; -s6, s5,,; -s6, s6,,; -s6, s7,,; -s6, s8,,; -s6, s9,,; -s7, s4,,; -s7, s5,,; -s7, s6,,; -s7, s7,,; -s7, s8,,; -s7, s9,,; -s8, s4,,; -s8, s5,,; -s8, s6,,; -s8, s7,,; -s8, s8,,; -s8, s9,,; -s9, s4,,; -s9, s5,,; -s9, s6,,; -s9, s7,,; -s9, s8,,; -s9, s9,,; +HOA: v1 +States: 9 +Start: 0 +AP: 0 +acc-name: Buchi +Acceptance: 1 Inf(0) +properties: trans-labels explicit-labels trans-acc complete +--BODY-- +State: 0 +[t] 1 +State: 1 +[t] 2 +State: 2 +[t] 0 {0} +[t] 3 +State: 3 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 4 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 5 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 6 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 7 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 8 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +--END-- EOF -run 0 ../ltl2tgba -CR -eSE05 -X blue_last -run 0 ../ltl2tgba -CR -eTau03_opt -X blue_last +run 0 ../ltl2tgba -CR -eSE05 -XH blue_last +run 0 ../ltl2tgba -CR -eTau03_opt -XH blue_last # _______ # | | @@ -142,51 +176,68 @@ run 0 ../ltl2tgba -CR -eTau03_opt -X blue_last # ||______|| cat >red <<'EOF' -acc = a; -s1, s2,,; -s1, s3,, a; -s2, s3,,; -s3, s1,,; -s3, s4,,; -s4, s4,,; -s4, s5,,; -s4, s6,,; -s4, s7,,; -s4, s8,,; -s4, s9,,; -s5, s4,,; -s5, s5,,; -s5, s6,,; -s5, s7,,; -s5, s8,,; -s5, s9,,; -s6, s4,,; -s6, s5,,; -s6, s6,,; -s6, s7,,; -s6, s8,,; -s6, s9,,; -s7, s4,,; -s7, s5,,; -s7, s6,,; -s7, s7,,; -s7, s8,,; -s7, s9,,; -s8, s4,,; -s8, s5,,; -s8, s6,,; -s8, s7,,; -s8, s8,,; -s8, s9,,; -s9, s4,,; -s9, s5,,; -s9, s6,,; -s9, s7,,; -s9, s8,,; -s9, s9,,; +HOA: v1 +States: 9 +Start: 0 +AP: 0 +acc-name: Buchi +Acceptance: 1 Inf(0) +properties: trans-labels explicit-labels trans-acc complete +--BODY-- +State: 0 +[t] 1 +[t] 2 {0} +State: 1 +[t] 2 +State: 2 +[t] 0 +[t] 3 +State: 3 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 4 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 5 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 6 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 7 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +State: 8 +[t] 3 +[t] 4 +[t] 5 +[t] 6 +[t] 7 +[t] 8 +--END-- EOF -run 0 ../ltl2tgba -CR -eSE05 -X red -run 0 ../ltl2tgba -CR -eTau03_opt -X red +run 0 ../ltl2tgba -CR -eSE05 -XH red +run 0 ../ltl2tgba -CR -eTau03_opt -XH red rm -f red blue_counter blue_last diff --git a/src/tgbatest/emptchke.test b/src/tgbatest/emptchke.test index 277afe7e9..347e15792 100755 --- a/src/tgbatest/emptchke.test +++ b/src/tgbatest/emptchke.test @@ -1,6 +1,6 @@ #!/bin/sh # -*- coding: utf-8 -*- -# Copyright (C) 2009, 2010, 2014 Laboratoire de Recherche et +# Copyright (C) 2009, 2010, 2014, 2015 Laboratoire de Recherche et # Développement de l'Epita (LRDE). # Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de # Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), @@ -28,21 +28,32 @@ set -e expect_ce() { - run 0 ../ltl2tgba -CR -e -X "$1" - run 0 ../ltl2tgba -CR -e -DT -X "$1" - run 0 ../ltl2tgba -CR -e'Cou99(shy)' -X "$1" - run 0 ../ltl2tgba -CR -e'Cou99(shy)' -DT -X "$1" - run 0 ../ltl2tgba -CR -eCVWY90 -X "$1" - run 0 ../ltl2tgba -CR -eGV04 -X "$1" - run 0 ../ltl2tgba -CR -eSE05 -X "$1" - run 0 ../ltl2tgba -CR -eTau03 -X "$1" + run 0 ../ltl2tgba -CR -e -XH "$1" + run 0 ../ltl2tgba -CR -e -DT -XH "$1" + run 0 ../ltl2tgba -CR -e'Cou99(shy)' -XH "$1" + run 0 ../ltl2tgba -CR -e'Cou99(shy)' -DT -XH "$1" + run 0 ../ltl2tgba -CR -eCVWY90 -XH "$1" + run 0 ../ltl2tgba -CR -eGV04 -XH "$1" + run 0 ../ltl2tgba -CR -eSE05 -XH "$1" + run 0 ../ltl2tgba -CR -eTau03 -XH "$1" } cat >input <<'EOF' -acc = c d; -s1, "s2", "a & !b", c d; -"s2", "state 3", "a", c; -"state 3", s1,,; +HOA: v1 +States: 3 +Start: 0 +AP: 2 "a" "b" +acc-name: generalized-Buchi 2 +Acceptance: 2 Inf(0)&Inf(1) +properties: trans-labels explicit-labels state-acc deterministic +--BODY-- +State: 0 {0 1} +[0&!1] 1 +State: 1 {0} +[0] 2 +State: 2 +[t] 0 +--END-- EOF expect_ce input @@ -55,19 +66,36 @@ expect_ce input # b->c e->f h->i # cat >input <<'EOF' -acc = A; -a, b, "1",; -b, c, "1",; -c, a, "1",; -a, d, "1",; -d, e, "1",; -e, f, "1",; -f, d, "1",; -d, g, "1",; -g, h, "1",; -h, i, "1",; -i, g, "1", A; -a, g, "1",; +HOA: v1 +States: 9 +Start: 0 +AP: 0 +acc-name: Buchi +Acceptance: 1 Inf(0) +properties: trans-labels explicit-labels state-acc complete +--BODY-- +State: 0 +[t] 1 +[t] 3 +[t] 6 +State: 1 +[t] 2 +State: 2 +[t] 0 +State: 3 +[t] 4 +[t] 6 +State: 4 +[t] 5 +State: 5 +[t] 3 +State: 6 +[t] 7 +State: 7 +[t] 8 +State: 8 {0} +[t] 6 +--END-- EOF expect_ce input @@ -100,15 +128,29 @@ expect_ce input # and finally closes the cycle with c->d->a # cat >input <<'EOF' -acc = A B; -a, b, "1",; -b, c, "1",; -c, d, "1",; -d, a, "1",; -b, e, "1", A; -e, f, "1",; -f, b, "1", B; -e, c, "1", B; +HOA: v1 +States: 6 +Start: 0 +AP: 0 +acc-name: generalized-Buchi 2 +Acceptance: 2 Inf(0)&Inf(1) +properties: trans-labels explicit-labels trans-acc complete +--BODY-- +State: 0 +[t] 1 +State: 1 +[t] 2 +[t] 4 {0} +State: 2 +[t] 3 +State: 3 +[t] 0 +State: 4 +[t] 2 {1} +[t] 5 +State: 5 +[t] 1 {1} +--END-- EOF expect_ce input @@ -118,33 +160,61 @@ expect_ce input # It triggered a bug in our implementation of GV04 (that didn't see any # accepting path). cat >input <merge_transitions(); + daut->aut->merge_transitions(); + system_aut = daut->aut; tm.stop("reading -P's argument"); - system_aut = s; } else if (!strcmp(argv[formula_index], "-r1")) { @@ -869,11 +857,6 @@ checked_main(int argc, char** argv) translation = TransFM; fm_exprop_opt = true; } - else if (!strcmp(argv[formula_index], "-X")) - { - from_file = true; - readformat = ReadSpot; - } else if (!strcmp(argv[formula_index], "-XD")) { from_file = true; @@ -984,18 +967,6 @@ checked_main(int argc, char** argv) { switch (readformat) { - case ReadSpot: - { - spot::tgba_digraph_ptr e; - spot::tgba_parse_error_list pel; - tm.start("parsing automaton"); - a = e = spot::tgba_parse(input, pel, dict, env, debug_opt); - tm.stop("parsing automaton"); - if (spot::format_tgba_parse_errors(std::cerr, input, pel)) - return 2; - e->merge_transitions(); - } - break; case ReadLbtt: { std::string error; @@ -1530,9 +1501,6 @@ checked_main(int argc, char** argv) case 6: spot::lbtt_reachable(std::cout, a); break; - case 7: - spot::tgba_save_reachable(std::cout, a); - break; case 8: { assert(degeneralize_opt == DegenSBA); diff --git a/src/tgbatest/ltl2tgba.test b/src/tgbatest/ltl2tgba.test index fdcbf7435..6e43f7a99 100755 --- a/src/tgbatest/ltl2tgba.test +++ b/src/tgbatest/ltl2tgba.test @@ -175,14 +175,14 @@ grep 'transitions: 5$' stdout grep 'states: 3$' stdout # Make sure FGa|GFb has the same number of states/transitions when -# output as a never claim or are a degeneralized BA in Spot's textual -# format. The option -R1q -R1t used to cause two degeneralizations to +# output as a never claim or are a degeneralized BA in HOAF. +# The option -R1q -R1t used to cause two degeneralizations to # occur. run 0 ../ltl2tgba -R1q -R1t -N 'FGa|FGb' > out.never run 0 ../ltl2tgba -XN -kt out.never > count.never -run 0 ../ltl2tgba -R1q -R1t -DS -b 'FGa|FGb' > out.spot -run 0 ../ltl2tgba -X -kt out.spot > count.spot -cmp count.never count.spot +run 0 ../ltl2tgba -R1q -R1t -DS -H 'FGa|FGb' > out.hoa +run 0 ../ltl2tgba -XH -kt out.hoa > count.hoa +cmp count.never count.hoa # The following automaton should have only 4 states. run 0 ../ltl2tgba -R3 -ks -f '(p&XF!p)|(!p&XFp)|X(Fp&F!p)' >stdout diff --git a/src/tgbatest/renault.test b/src/tgbatest/renault.test index edb3d9120..03df482c5 100755 --- a/src/tgbatest/renault.test +++ b/src/tgbatest/renault.test @@ -1,6 +1,6 @@ #!/bin/sh # -*- coding: utf-8 -*- -# Copyright (C) 2012 Laboratoire de Recherche et Développement +# Copyright (C) 2012, 2015 Laboratoire de Recherche et Développement # de l'Epita (LRDE). # # This file is part of Spot, a model checking library. @@ -22,28 +22,46 @@ set -e cat >file <outexp < out +run 0 ../ltl2tgba -XH -ks -RDS file > out cmp out outexp diff --git a/src/tgbatest/satmin2.test b/src/tgbatest/satmin2.test index 4bbe3db58..5e37d3475 100755 --- a/src/tgbatest/satmin2.test +++ b/src/tgbatest/satmin2.test @@ -1,7 +1,6 @@ - #!/bin/sh # -*- coding: utf-8 -*- -# Copyright (C) 2013 Laboratoire de Recherche et Développement +# Copyright (C) 2013, 2015 Laboratoire de Recherche et Développement # de l'Epita (LRDE). # # This file is part of Spot, a model checking library. @@ -28,14 +27,25 @@ set -e # This is a counterexample for one of the optimization idea we had for # the SAT-based minimization. -cat >input.tgba <input.hoa <expected < output +../ltl2tgba -RS1 -kt -XH input.hoa > output diff output expected - diff --git a/src/tgbatest/sccsimpl.test b/src/tgbatest/sccsimpl.test index 4313dc1ef..f9421f79f 100755 --- a/src/tgbatest/sccsimpl.test +++ b/src/tgbatest/sccsimpl.test @@ -32,138 +32,207 @@ set -e # G((!p0 | !p2 | (!p1 W (!p1 & p3 & X(!p1 U p4)))) U p1) # The formula does not really matter (except to show how # such automata can occur). The important point is that the -# acceptance condition "p4", used a lot, is always present -# when "p1" is used. So the "p4" acceptance can be removed. +# acceptance set "0" contains the acceptance set "1", so +# "0" can be removed. cat < aut.txt -acc = "p4" "p1"; -S1, S1, "p1", "p4" "p1"; -S1, S1, "!p0 | !p2", "p4"; -S1, S2, "p3", "p4"; -S1, S3, "1", "p4"; -S2, S1, "p1 & p4", "p4" "p1"; -S2, S1, "(p4 & !p0) | (p4 & !p2)", "p4"; -S2, S2, "p3 & p4", "p4"; -S2, S2, "(!p1 & !p0) | (!p1 & !p2) | (!p1 & p3)",; -S2, S3, "p4", "p4"; -S2, S4, "!p1",; -S3, S2, "!p1 & p3", "p4"; -S3, S3, "!p1", "p4"; -S4, S2, "!p1 & p3 & p4", "p4"; -S4, S2, "!p1 & p3",; -S4, S3, "!p1 & p4", "p4"; -S4, S4, "!p1",; +HOA: v1 +States: 4 +Start: 0 +AP: 5 "p1" "p0" "p2" "p3" "p4" +acc-name: generalized-Buchi 2 +Acceptance: 2 Inf(0)&Inf(1) +properties: trans-labels explicit-labels trans-acc +--BODY-- +State: 0 +[0] 0 {0 1} +[!1 | !2] 0 {0} +[3] 1 {0} +[t] 2 {0} +State: 1 +[0&4] 0 {0 1} +[!1&4 | !2&4] 0 {0} +[3&4] 1 {0} +[!0&!1 | !0&!2 | !0&3] 1 +[4] 2 {0} +[!0] 3 +State: 2 +[!0&3] 1 {0} +[!0] 2 {0} +State: 3 +[!0&3] 1 +[!0&3&4] 1 {0} +[!0&4] 2 {0} +[!0] 3 +--END-- EOF -run 0 ../ltl2tgba -X -R3 -b aut.txt > out.txt -grep '^acc = "[^"]*";$' out.txt +run 0 ../ltl2tgba -XH -R3 -H aut.txt > out.txt +grep '^Acceptance: 1 Inf(0)' out.txt -# Here, acceptances A and C can both be removed. +# Here, acceptance sets 0 and 2 can both be removed. cat < aut2.txt -acc = A B C D; -S1, S1, "a", A; -S1, S1, "b", A B; -S1, S1, "c", A B C; -S1, S1, "d", C D; +HOA: v1 +States: 1 +Start: 0 +AP: 4 "a" "b" "c" "d" +acc-name: generalized-Buchi 4 +Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3) +properties: trans-labels explicit-labels trans-acc +--BODY-- +State: 0 +[0] 0 {0} +[1] 0 {0 1} +[2] 0 {0 1 2} +[3] 0 {2 3} +--END-- EOF -run 0 ../ltl2tgba -X -R3 -b aut2.txt > out2.txt -grep '^acc = "." ".";$' out2.txt || exit 1 -# only 4 lines output, because the "b" and "c" lines have been merged. -test `wc -l < out2.txt` = 4 +run 0 ../ltl2tgba -XH -R3 -H aut2.txt > out2.txt +grep '^Acceptance: 2 ' out2.txt +# only 3 transitions output, because [1] and [2] have been merged +test `grep -c '\[.*\]' out2.txt` = 3 -# Here, acceptances A and B can both be removed. +# Here, acceptance sets 0 and 1 can both be removed. cat < aut3.txt -acc = A B C D; -S1, S1, "a", A; -S1, S1, "b", A B; -S1, S1, "c", A B C; -S1, S1, "d", B D; +HOA: v1 +States: 1 +Start: 0 +AP: 4 "a" "b" "c" "d" +acc-name: generalized-Buchi 4 +Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3) +properties: trans-labels explicit-labels trans-acc +--BODY-- +State: 0 +[0] 0 {0} +[1] 0 {0 1} +[2] 0 {0 1 2} +[3] 0 {1 3} +--END-- EOF -run 0 ../ltl2tgba -X -R3 -b aut3.txt > out3.txt -grep '^acc = "." ".";$' out3.txt || exit 1 -# only 4 lines output, because the "a" and "b" lines have been merged. -test `wc -l < out3.txt` = 4 +run 0 ../ltl2tgba -XH -R3 -H aut3.txt > out3.txt +grep '^Acceptance: 2 ' out3.txt +# only 3 transitions output, because [0] and [1] have been merged +test `grep -c '\[.*\]' out3.txt` = 3 # No simplification possible here cat < aut4.txt -acc = A B C D; -S1, S1, "a", A; -S1, S1, "b", A B; -S1, S1, "c", A B C; -S1, S1, "d", B D; -S1, S1, "e", C D; +HOA: v1 +States: 1 +Start: 0 +AP: 5 "a" "b" "c" "d" "e" +acc-name: generalized-Buchi 4 +Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3) +properties: trans-labels explicit-labels trans-acc +--BODY-- +State: 0 +[0] 0 {0} +[1] 0 {0 1} +[2] 0 {0 1 2} +[3] 0 {1 3} +[4] 0 {2 3} +--END-- EOF -run 0 ../ltl2tgba -X -R3 -b aut4.txt > out4.txt -test `grep '^acc' out4.txt | wc -w` = 6 -test `wc -l < out4.txt` = 6 - +run 0 ../ltl2tgba -XH -R3 -H aut4.txt > out4.txt +grep '^Acceptance: 4 ' out4.txt +test `grep -c '\[.*\]' out4.txt` = 5 # Make sure nothing wrong (like an assert()) # happens when no acceptance conditions are used. cat < aut5.txt -acc = ; -S1, S1, "a", ; -S1, S1, "b", ; -S1, S1, "c", ; +HOA: v1 +States: 1 +Start: 0 +AP: 3 "a" "b" "c" +acc-name: all +Acceptance: 0 t +properties: trans-labels explicit-labels state-acc +--BODY-- +State: 0 +[0] 0 +[1 | 2] 0 +--END-- EOF -run 0 ../ltl2tgba -X -R3 -b aut5.txt > out5.txt -test `wc -l < out5.txt` = 2 +run 0 ../ltl2tgba -XH -R3 -H aut5.txt > out5.txt +grep '^Acceptance: 0 t' out5.txt +test `grep -c '\[.*\]' out5.txt` = 1 -# Here, one of A,B and one of C,D can be removed. +# Here, one of 0,1 and one of 2,3 can be removed. cat < aut6.txt -acc = A B C D; -S1, S1, "a", A B; -S1, S1, "b", A B; -S1, S1, "c", C D; -S1, S1, "d", C D; +HOA: v1 +States: 1 +Start: 0 +AP: 4 "a" "b" "c" "d" +acc-name: generalized-Buchi 4 +Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3) +properties: trans-labels explicit-labels trans-acc +--BODY-- +State: 0 +[0] 0 {0 1} +[1] 0 {0 1} +[2] 0 {2 3} +[3] 0 {2 3} +--END-- EOF -run 0 ../ltl2tgba -X -R3 -b aut6.txt > out6.txt -test `grep '^acc' out6.txt | wc -w` = 4 -test `wc -l < out6.txt` = 3 - +run 0 ../ltl2tgba -XH -R3 -H aut6.txt > out6.txt +grep '^Acceptance: 2 ' out6.txt +test `grep -c '\[.*\]' out6.txt` = 2 # This automaton comes from the formula # 1 U (p0 & (!p1 R ((1 U !p2) & (1 U !p3)))) -# and and early implementation of our simplification +# and an early implementation of our simplification # missed the simplification. cat < aut7.txt -acc = ZZ "!p3" "!p2"; -S1, S2, "p0 & !p2 & !p3 & !p1", ZZ "!p3" "!p2"; -S1, S1, "!p0 | p1 | p2 | p3", "!p3" "!p2"; -S1, S3, "p0 & p2 & !p3 & !p1", ZZ "!p3"; -S1, S4, "p0 & p3 & !p2 & !p1", ZZ "!p2"; -S1, S5, "(p0 & p2 & !p1) | (p0 & p3 & !p1)", ZZ; -S1, S6, "p0 & p1 & !p2 & !p3", ZZ "!p3" "!p2"; -S1, S6, "(p0 & p1 & !p3) | (p0 & p2 & !p3)", ZZ "!p3"; -S1, S6, "(p0 & p1 & !p2) | (p0 & p3 & !p2)", ZZ "!p2"; -S1, S6, "(p0 & p1) | (p0 & p2) | (p0 & p3)", ZZ; -S2, S2, "1", ZZ "!p3" "!p2"; -S3, S2, "!p2", ZZ "!p3" "!p2"; -S3, S3, "p2", ZZ "!p3"; -S4, S2, "!p3", ZZ "!p3" "!p2"; -S4, S4, "p3", ZZ "!p2"; -S5, S2, "!p2 & !p3", ZZ "!p3" "!p2"; -S5, S3, "p2 & !p3", ZZ "!p3"; -S5, S4, "p3 & !p2", ZZ "!p2"; -S5, S5, "p2 | p3", ZZ; -S6, S2, "!p2 & !p3 & !p1", ZZ "!p3" "!p2"; -S6, S3, "p2 & !p3 & !p1", ZZ "!p3"; -S6, S4, "p3 & !p2 & !p1", ZZ "!p2"; -S6, S5, "(p2 & !p1) | (p3 & !p1)", ZZ; -S6, S6, "p1 & !p2 & !p3", ZZ "!p3" "!p2"; -S6, S6, "(p1 & !p3) | (p2 & !p3)", ZZ "!p3"; -S6, S6, "(p1 & !p2) | (p3 & !p2)", ZZ "!p2"; -S6, S6, "p1 | p2 | p3", ZZ; +HOA: v1 +States: 6 +Start: 0 +AP: 4 "p0" "p1" "p2" "p3" +acc-name: generalized-Buchi 3 +Acceptance: 3 Inf(0)&Inf(1)&Inf(2) +properties: trans-labels explicit-labels trans-acc complete +--BODY-- +State: 0 +[!0 | 1 | 2 | 3] 0 {1 2} +[0&!1&!2&!3] 1 {0 1 2} +[0&!1&2&!3] 2 {0 1} +[0&!1&!2&3] 3 {0 2} +[0&!1&2 | 0&!1&3] 4 {0} +[0&1&!2&!3] 5 {0 1 2} +[0&1&!3 | 0&2&!3] 5 {0 1} +[0&1&!2 | 0&!2&3] 5 {0 2} +[0&1 | 0&2 | 0&3] 5 {0} +State: 1 +[t] 1 {0 1 2} +State: 2 +[!2] 1 {0 1 2} +[2] 2 {0 1} +State: 3 +[!3] 1 {0 1 2} +[3] 3 {0 2} +State: 4 +[!2&!3] 1 {0 1 2} +[2&!3] 2 {0 1} +[!2&3] 3 {0 2} +[2 | 3] 4 {0} +State: 5 +[!1&!2&!3] 1 {0 1 2} +[!1&2&!3] 2 {0 1} +[!1&!2&3] 3 {0 2} +[!1&2 | !1&3] 4 {0} +[1 | 2 | 3] 5 {0} +[1&!2&!3] 5 {0 1 2} +[1&!3 | 2&!3] 5 {0 1} +[1&!2 | !2&3] 5 {0 2} +--END-- EOF -run 0 ../ltl2tgba -X -R3 -b aut7.txt > out7.txt -test `grep '^acc' out7.txt | wc -w` = 4 +run 0 ../ltl2tgba -XH -R3 -H aut7.txt > out7.txt +grep '^Acceptance: 2 ' out7.txt -run 0 ../ltl2tgba -R3 -b '(GFa&GFb) | (GFc&GFd)' > out8.txt -test `grep '^acc' out8.txt | wc -w` = 4 +run 0 ../ltl2tgba -R3 -H '(GFa&GFb) | (GFc&GFd)' > out8.txt +grep 'Acceptance: 2 ' out8.txt # This formula gives a 12-state automaton in which one acceptance # condition can be removed, and after what direct simulation should diff --git a/src/tgbatest/sim2.test b/src/tgbatest/sim2.test index d7f4a7db6..eacf6e112 100755 --- a/src/tgbatest/sim2.test +++ b/src/tgbatest/sim2.test @@ -1,6 +1,6 @@ #! /bin/sh # -*- coding: utf-8 -*- -# Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement +# Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et Développement # de l'Epita (LRDE). # # This file is part of Spot, a model checking library. @@ -21,8 +21,7 @@ . ./defs set -e -../ltl2tgba -b -x -R3f -RDS '{(a&b)[*3]}<>=>G(a&!b)' > ref - +../ltl2tgba -H -x -R3f -RDS '{(a&b)[*3]}<>=>G(a&!b)' > ref for i in -R3 -R3f '-R3 -RDS' '-R3f -RDS'; do ../ltl2tgba -Pref -E -x $i '(X!b R F!a) U (!a | G!b)'