streett_to_generalize_buchi: fix handling of SCCs without Fin

The generalization to Streett-like of 7b5b8f34 was incomplete for this
case.  Thanks to František Blahoudek for reporting the bug.
Fixes #279.

* spot/twaalgos/totgba.cc (streett_to_generalized_buchi): Here.
* tests/core/remfin.test: Add more tests.
This commit is contained in:
Alexandre Duret-Lutz 2017-09-01 20:22:21 +02:00
parent 7b9cedc697
commit f7ba490898
2 changed files with 82 additions and 26 deletions

View file

@ -264,6 +264,12 @@ trans-acc --BODY-- State: 0 [!0&1] 5 [!0&1] 7 State: 1 [0&!1] 2 {2}
[!0&1] 4 State: 7 [0&!1] 8 {3} [!0&!1] 7 {2} [0&!1] 3 {2} [!0&1] 5 {1}
State: 8 [!0&1] 8 {2} [!0&!1] 3 {1} [!0&1] 4 State: 9 [0&!1] 6 {0 3}
[!0&1] 2 --END--
/* Exposed the bug from #279 */
HOA: v1 States: 3 Start: 0 AP: 2 "b" "c" Acceptance: 3 Fin(0) &
(Inf(1)&Inf(2)) properties: trans-labels explicit-labels trans-acc
complete --BODY-- State: 0 [!0] 0 {1 2} [0] 0 {0 1 2} [0&!1] 1 [0&1] 2
State: 1 [!0 | !1] 1 {1 2} [0&1] 2 {1} State: 2 [!1] 1 {1 2} [1] 2 {1}
--END--
EOF
acctwelve='Inf(0)&Inf(1)&Inf(2)&Inf(3)&Inf(4)&Inf(5)'
@ -814,6 +820,30 @@ State: 20 {0}
[0&1] 16
[!0&1] 20
--END--
HOA: v1
States: 4
Start: 0
AP: 2 "b" "c"
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
[0] 0
[0] 1
[0&!1] 2
[0&1] 3
State: 1
[!0] 1 {0 1}
State: 2
[!0 | !1] 2 {0 1}
[0&1] 3 {0}
State: 3
[!1] 2 {0 1}
[1] 3 {0}
--END--
EOF
cat >expected-tgba <<EOF
@ -1358,6 +1388,28 @@ State: 20
[0&1] 16 {0}
[!0&1] 20 {0}
--END--
HOA: v1
States: 4
Start: 0
AP: 2 "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[t] 0
[t] 1
[0&!1] 2
[0&1] 3
State: 1
[!0] 1 {0}
State: 2
[!0 | !1] 2 {0}
[0&1] 3
State: 3
[!1] 2 {0}
[1] 3
--END--
EOF
run 0 $autfilt -H --remove-fin test1 > output
@ -1368,9 +1420,18 @@ run 0 $autfilt -H --tgba test1 > output
cat output
diff -u output expected-tgba
# make sure the above expected automata are correct
autcross --language-preserved 'autfilt --remove-fin' 'autfilt --tgba' -Ftest1
# try 10 small random automata just in case
randaut -A'random 6' -Q10 -n10 3 |
autcross --verbose --language-preserved 'autfilt --remove-fin' 'autfilt --tgba'
# Add 10 small random automata for the next case
randaut -A'random 6' -Q10 -n10 3 -Hl >> test1
# make sure the above expected automata are correct
autcross --verbose --language-preserved -Ftest1 \
'autfilt --remove-fin' 'autfilt --tgba'
# do it again, but make sure autfilt uses streett_to_generalized_buchi
# whenever buchi, and that autcross does not. This helps findings bug
# in streett_to_generalized_buchi().
SPOT_STREETT_CONV_MIN=0 \
autcross --language-preserved -Ftest1 \
'SPOT_STREETT_CONV_MIN=1 autfilt --remove-fin %H>%O' \
'SPOT_STREETT_CONV_MIN=1 autfilt --tgba %H>%O'