partial_degeneralize: a support for disjunction of Fin
* spot/twaalgos/degen.cc, spot/twaalgos/degen.hh: Implement this. Also throw a runtime error in case were todegen does not match any subformula. * tests/python/pdegen.py: Add tests.
This commit is contained in:
parent
f1008c156b
commit
f9e75de647
4 changed files with 120 additions and 26 deletions
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
import spot
|
||||
|
||||
a, b, d = spot.automata("""
|
||||
a, b, d, f = spot.automata("""
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
|
|
@ -59,6 +59,18 @@ Acceptance: 1 Fin(0)
|
|||
State: 0
|
||||
[0] 0 {0}
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 1 "p0"
|
||||
Acceptance: 2 Fin(0)|Fin(1)
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 0 {0}
|
||||
[0] 1 {1}
|
||||
State: 1
|
||||
[!0] 0
|
||||
--END--
|
||||
""")
|
||||
|
||||
da = spot.partial_degeneralize(a, [0, 1])
|
||||
|
|
@ -97,6 +109,42 @@ assert dd.equivalent_to(d)
|
|||
assert dd.num_states() == 1
|
||||
assert str(dd.get_acceptance()) == 'Inf(1) & Fin(0)'
|
||||
|
||||
e = spot.dualize(b)
|
||||
de = spot.partial_degeneralize(e, [0, 1])
|
||||
assert de.equivalent_to(e)
|
||||
assert de.num_states() == 4
|
||||
|
||||
de.copy_state_names_from(e)
|
||||
dehoa = de.to_str('hoa')
|
||||
assert dehoa == """HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 1 "p0"
|
||||
acc-name: parity max even 2
|
||||
Acceptance: 2 Fin(1) & Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete
|
||||
properties: deterministic
|
||||
--BODY--
|
||||
State: 0 "0#0"
|
||||
[0] 1
|
||||
[!0] 2
|
||||
State: 1 "1#0"
|
||||
[!0] 2
|
||||
[0] 3 {0 1}
|
||||
State: 2 "3#0"
|
||||
[t] 2 {0}
|
||||
State: 3 "2#0"
|
||||
[0] 1 {0 1}
|
||||
[!0] 2
|
||||
--END--"""
|
||||
|
||||
try:
|
||||
df = spot.partial_degeneralize(f, [0, 1])
|
||||
except RuntimeError as e:
|
||||
assert 'partial_degeneralize(): {0,1} does not' in str(e)
|
||||
else:
|
||||
raise RuntimeError("missing exception")
|
||||
|
||||
aut5 = spot.automaton(""" HOA: v1 States: 8 Start: 0 AP: 3 "p0" "p1" "p2"
|
||||
acc-name: generalized-Buchi 10 Acceptance: 10
|
||||
Inf(0)&Inf(1)&Inf(2)&Inf(3)&Inf(4)&Inf(5)&Inf(6)&Inf(7)&Inf(8)&Inf(9)
|
||||
|
|
@ -158,3 +206,9 @@ pdaut8 = spot.partial_degeneralize(aut8, sets)
|
|||
assert pdaut8.equivalent_to(aut8)
|
||||
assert daut8.num_states() == 22
|
||||
assert pdaut8.num_states() == 9
|
||||
|
||||
aut9 = spot.dualize(aut8)
|
||||
pdaut9 = spot.partial_degeneralize(aut9, sets)
|
||||
assert pdaut9.equivalent_to(aut9)
|
||||
# one more state than aut9, because dualize completed the automaton.
|
||||
assert pdaut9.num_states() == 10
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue