partial_degeneralize: force purge_unreachable in some corner case

* spot/twaalgos/degen.cc: If an all-accepting transition has been
redirected, we need to force purge_unreachable_state() to be called,
otherwise we may have unreachable states.
* tests/python/pdegen.py: Add test case.
This commit is contained in:
Alexandre Duret-Lutz 2020-02-10 14:08:05 +01:00
parent 443f638b9c
commit dd8c00fff0
2 changed files with 38 additions and 5 deletions

View file

@ -366,3 +366,24 @@ assert dot == """digraph "" {
aut12g = spot.partial_degeneralize(aut12f)
assert aut12f == aut12g
aut13 = spot.automaton("""HOA: v1
States: 2
Start: 0
AP: 4 "p9" "p14" "p10" "p7"
acc-name: generalized-Buchi 3
Acceptance: 3 Inf(0)&Inf(1)&Inf(2)
properties: trans-labels explicit-labels trans-acc deterministic
--BODY--
State: 0
[!0&!1&2] 0 {0 1 2}
[!0&!1&!2] 1 {0 1}
State: 1
[!0&!1&2&!3] 0 {0 1 2}
[!0&!1&!2&!3] 1 {0 1}
[!0&!1&!2&3] 1 {0}
[!0&!1&2&3] 1 {0 2}
--END--""")
aut13g = spot.partial_degeneralize(aut13)
assert aut13g.equivalent_to(aut13)
assert aut13g.num_states() == 3