twaalgos: implement restrict_dead_end_edges_here()
Discussed in issue #587. * spot/twaalgos/deadends.cc, spot/twaalgos/deadends.hh: New files. * spot/twaalgos/Makefile.am, python/spot/impl.i: Add them. * tests/core/deadends.test, tests/python/deadends.py: New files. * tests/Makefile.am: Add them. * spot/twa/acc.cc, spot/twa/acc.hh (keep_one_inf_per_branch): New method. * bin/autfilt.cc: Learn option --restrict-dead-end-edges. * NEWS: Mention it.
This commit is contained in:
parent
f03e32619a
commit
31511e042a
11 changed files with 588 additions and 1 deletions
158
tests/python/deadends.py
Normal file
158
tests/python/deadends.py
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
# -*- mode: python; coding: utf-8 -*-
|
||||
# Copyright (C) by the Spot authors, see the AUTHORS file for details.
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
#
|
||||
# Spot is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
# License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Test that the spot.gen package works, in particular, we want
|
||||
# to make sure that the objects created from spot.gen methods
|
||||
# are usable with methods from the spot package.
|
||||
|
||||
|
||||
import spot
|
||||
from unittest import TestCase
|
||||
tc = TestCase()
|
||||
|
||||
b = spot.translate('FGb')
|
||||
a = spot.translate('GFa & GFc')
|
||||
p = spot.product_susp(b, a)
|
||||
q = spot.scc_filter(spot.simulation(p), True)
|
||||
s = p.to_str()
|
||||
spot.restrict_dead_end_edges_here(p)
|
||||
s += p.to_str()
|
||||
# Applying it twice should not change anything
|
||||
spot.restrict_dead_end_edges_here(p)
|
||||
s += p.to_str()
|
||||
|
||||
tc.assertEqual(s, """HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
[!0&1&!2] 1
|
||||
[0&1&!2] 1 {0}
|
||||
[!0&1&2] 1 {1}
|
||||
[0&1&2] 1 {0 1}
|
||||
State: 1
|
||||
[!0&1&!2] 1
|
||||
[0&1&!2] 1 {0}
|
||||
[!0&1&2] 1 {1}
|
||||
[0&1&2] 1 {0 1}
|
||||
--END--HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
[0&1&!2] 1 {0}
|
||||
[0&1&2] 1 {0 1}
|
||||
State: 1
|
||||
[!0&1&!2] 1
|
||||
[0&1&!2] 1 {0}
|
||||
[!0&1&2] 1 {1}
|
||||
[0&1&2] 1 {0 1}
|
||||
--END--HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
[0&1&!2] 1 {0}
|
||||
[0&1&2] 1 {0 1}
|
||||
State: 1
|
||||
[!0&1&!2] 1
|
||||
[0&1&!2] 1 {0}
|
||||
[!0&1&2] 1 {1}
|
||||
[0&1&2] 1 {0 1}
|
||||
--END--""")
|
||||
|
||||
spot.restrict_dead_end_edges_here(q)
|
||||
s = q.to_str()
|
||||
tc.assertEqual(s, """HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
[0&1] 1
|
||||
State: 1
|
||||
[!0&1&!2] 1
|
||||
[0&1&!2] 1 {0}
|
||||
[!0&1&2] 1 {1}
|
||||
[0&1&2] 1 {0 1}
|
||||
--END--""")
|
||||
|
||||
a = spot.translate('GFa & (FGb | FGc) & GFc')
|
||||
s = a.to_str()
|
||||
spot.restrict_dead_end_edges_here(a)
|
||||
s += a.to_str()
|
||||
tc.assertEqual(s, """HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
[0&1 | 1&2] 1
|
||||
[2] 2
|
||||
State: 1
|
||||
[!0&1&!2] 1
|
||||
[0&1&!2] 1 {0}
|
||||
[!0&1&2] 1 {1}
|
||||
[0&1&2] 1 {0 1}
|
||||
State: 2
|
||||
[!0&2] 2 {1}
|
||||
[0&2] 2 {0 1}
|
||||
--END--HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
[0&1] 1
|
||||
[0&2] 2
|
||||
State: 1
|
||||
[!0&1&!2] 1
|
||||
[0&1&!2] 1 {0}
|
||||
[!0&1&2] 1 {1}
|
||||
[0&1&2] 1 {0 1}
|
||||
State: 2
|
||||
[!0&2] 2 {1}
|
||||
[0&2] 2 {0 1}
|
||||
--END--""")
|
||||
Loading…
Add table
Add a link
Reference in a new issue