alternation: add a states_and algorithm
This should will come handy to implement the convertion from LTL to alternating automata, and to handle automata with multiple initial states. * spot/twaalgos/alternation.hh, spot/twaalgos/alternation.cc: New files. * spot/twaalgos/Makefile.am: Add them. * python/spot/impl.i: Add bindings. * tests/python/alternating.py: Test states_and.
This commit is contained in:
parent
48c812a595
commit
27ab631cdc
5 changed files with 233 additions and 0 deletions
|
|
@ -94,3 +94,41 @@ State: 1
|
|||
State: 2
|
||||
[0 | 1] 2
|
||||
--END--"""
|
||||
|
||||
st = spot.states_and(aut, [0, 2])
|
||||
st2 = spot.states_and(aut, [1, st])
|
||||
st3 = spot.states_and(aut, [0, 1, 2])
|
||||
assert (st, st2, st3) == (3, 4, 5)
|
||||
|
||||
received = False
|
||||
try:
|
||||
st4 = spot.states_and(aut, [])
|
||||
except RuntimeError:
|
||||
received = True
|
||||
assert received
|
||||
|
||||
h = aut.to_str('hoa')
|
||||
print(h)
|
||||
assert h == """HOA: v1
|
||||
States: 6
|
||||
Start: 0
|
||||
AP: 2 "p1" "p2"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: univ-branch trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1&2 {0}
|
||||
[1] 0&1
|
||||
State: 1
|
||||
[0&1] 0&2&1
|
||||
State: 2
|
||||
[0 | 1] 2
|
||||
State: 3
|
||||
[0] 1&2
|
||||
[1] 0&1&2
|
||||
State: 4
|
||||
[0&1] 0&1&2
|
||||
State: 5
|
||||
[0&1] 0&1&2
|
||||
--END--"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue