degen: learn to work on generalized-Co-Büchi as well
* spot/twaalgos/degen.hh, spot/twaalgos/degen.cc: Adjust degeneralize() and degeneralize_tba() to work on generalized-co-Büchi. * NEWS: Mention this. * spot/twaalgos/cobuchi.hh, spot/twaalgos/cobuchi.cc (to_nca): Use degeneralization on generalized-co-Büchi. * spot/twaalgos/postproc.cc: Use degeneralization for generalized co-Büchi as well. * bin/autfilt.cc: Improve chain products of co-Büchi automata by using generalization if too many colors are needed. * tests/core/prodchain.test, tests/python/pdegen.py: Add test cases.
This commit is contained in:
parent
fe3ebd370b
commit
bdac53511a
9 changed files with 169 additions and 81 deletions
|
|
@ -26,9 +26,7 @@ shift
|
|||
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 \
|
||||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42; do
|
||||
ltl2tgba "{a[*$i]}[]->GFb" > $i.hoa
|
||||
done
|
||||
for i in *.hoa; do
|
||||
set x "$@" --product $i
|
||||
set x "$@" --product $i.hoa
|
||||
shift
|
||||
done
|
||||
shift
|
||||
|
|
@ -41,8 +39,9 @@ test "4,7,16,1" = `autfilt --stats=%s,%e,%t,%a result`
|
|||
|
||||
set x
|
||||
shift
|
||||
for i in *.hoa; do
|
||||
set x "$@" --product-or $i
|
||||
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 \
|
||||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42; do
|
||||
set x "$@" --product-or $i.hoa
|
||||
shift
|
||||
done
|
||||
shift
|
||||
|
|
@ -55,28 +54,30 @@ shift
|
|||
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 \
|
||||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42; do
|
||||
ltl2tgba -D --cobuchi -S "{a[*$i]}<>->FGb" > $i.hoa
|
||||
done
|
||||
for i in *.hoa; do
|
||||
set x "$@" --product $i
|
||||
set x "$@" --product $i.hoa
|
||||
shift
|
||||
done
|
||||
shift
|
||||
autfilt -D --cobuchi --low -S "$@" > result
|
||||
test "85,170,174,1" = `autfilt --stats=%s,%e,%t,%a result`
|
||||
autfilt --cobuchi --high -D -S "$@" > result
|
||||
test "44,47,92,1" = `autfilt --stats=%s,%e,%t,%a result`
|
||||
|
||||
: > stats
|
||||
set x
|
||||
shift
|
||||
for i in *.hoa; do
|
||||
set x "$@" --product-or $i
|
||||
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 \
|
||||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42; do
|
||||
ltl2tgba -D --cobuchi "{a[*$i]}<>->FGb" > $i.hoa
|
||||
set x "$@" --product-or $i.hoa
|
||||
shift
|
||||
test $i -eq 1 && shift # remove the first --product
|
||||
test 2,3,6,1 = `autfilt --high --small --cobuchi "$@" --stats=%s,%e,%t,%a`
|
||||
test 3,5,10,1 = \
|
||||
`autfilt --high --small --cobuchi "$@" | autfilt -S --stats=%s,%e,%t,%a`
|
||||
done
|
||||
shift
|
||||
|
||||
if [ $MAX_ACCSETS -eq 32 ]; then
|
||||
autfilt --cobuchi -S "$@" 2> error && exit 1
|
||||
autfilt "$@" 2> error && exit 1
|
||||
grep 'Too many acceptance sets used' error
|
||||
fi
|
||||
# FIXME: implement degeneralization for generalized-co-Büchi
|
||||
# autfilt --cobuchi --low -S "$@" > result
|
||||
# test "45,89,180,1" = `autfilt --stats=%s,%e,%t,%a result`
|
||||
|
||||
true
|
||||
|
|
|
|||
|
|
@ -149,6 +149,9 @@ tc.assertEqual(spot.is_partially_degeneralizable(de), [])
|
|||
df = spot.partial_degeneralize(f, [0, 1])
|
||||
df.equivalent_to(f)
|
||||
tc.assertEqual(str(df.acc()), '(1, Fin(0))')
|
||||
df2 = spot.degeneralize(f)
|
||||
df.equivalent_to(f)
|
||||
tc.assertEqual(str(df2.acc()), '(1, Fin(0))')
|
||||
|
||||
try:
|
||||
df = spot.partial_degeneralize(f, [0, 1, 2])
|
||||
|
|
@ -206,6 +209,16 @@ pdaut7 = spot.partial_degeneralize(aut7, sets)
|
|||
tc.assertTrue(pdaut7.equivalent_to(aut7))
|
||||
tc.assertEqual(daut7.num_states(), 10)
|
||||
tc.assertEqual(pdaut7.num_states(), 10)
|
||||
ddaut7 = spot.dualize(aut7)
|
||||
ddaut7a = spot.scc_filter(spot.dualize(spot.degeneralize_tba(ddaut7)))
|
||||
tc.assertTrue(ddaut7a.equivalent_to(aut7))
|
||||
tc.assertEqual(ddaut7a.num_states(), daut7.num_states())
|
||||
ddaut7b = spot.scc_filter(spot.dualize(spot.to_nca(ddaut7)))
|
||||
tc.assertTrue(ddaut7b.equivalent_to(aut7))
|
||||
tc.assertEqual(ddaut7b.num_states(), daut7.num_states())
|
||||
ddaut7c = spot.scc_filter(spot.dualize(spot.to_dca(ddaut7)))
|
||||
tc.assertTrue(ddaut7c.equivalent_to(aut7))
|
||||
tc.assertEqual(ddaut7c.num_states(), daut7.num_states())
|
||||
|
||||
aut8 = spot.automaton("""HOA: v1 States: 8 Start: 0 AP: 3 "p0" "p1" "p2"
|
||||
acc-name: generalized-Buchi 5 Acceptance: 5 Inf(0)&Inf(1)&Inf(2)&Inf(3)&Inf(4)
|
||||
|
|
@ -482,4 +495,4 @@ State: 1
|
|||
[0] 0 {0}
|
||||
State: 2
|
||||
[!0] 0
|
||||
--END--""")
|
||||
--END--""")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue