Inf(i)|Inf(j) -> Inf(k) and Fin(i)&Fin(j) -> Fin(k)
Implement those rules in simplify_acceptance_here(). * NEWS: Mention the change. * spot/twa/acc.cc, spot/twa/acc.hh (acc_cond::acc_code::used_once_sets): New method. * spot/twaalgos/cleanacc.cc, spot/twaalgos/cleanacc.hh: Implement the above rule. * tests/core/remfin.test: Adjust expected results. * tests/python/simplacc.py: New file. * tests/Makefile.am: Add it.
This commit is contained in:
parent
5dc6da0b20
commit
50c0f880dc
8 changed files with 416 additions and 23 deletions
54
tests/python/simplacc.py
Normal file
54
tests/python/simplacc.py
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# -*- mode: python; coding: utf-8 -*-
|
||||
# Copyright (C) 2020 Laboratoire de Recherche et Développement de l'Epita
|
||||
# (LRDE).
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
import spot
|
||||
|
||||
|
||||
auts = list(spot.automata("""
|
||||
HOA: v1 States: 2 Start: 0 AP: 2 "a" "b" Acceptance: 2 Inf(0) | Inf(1) --BODY--
|
||||
State: 0 [1] 0 [0] 1 {0} State: 1 [0] 1 [1] 0 {1} --END--
|
||||
HOA: v1 States: 2 Start: 0 AP: 2 "a" "b" Acceptance: 2 (Inf(0) | Inf(1)) &
|
||||
Fin(0) --BODY-- State: 0 [1] 0 [0] 1 {0} State: 1 [0] 1 [1] 0 {1} --END--
|
||||
HOA: v1 States: 2 Start: 0 AP: 2 "a" "b" Acceptance: 3 (Inf(0) | Inf(1)) &
|
||||
(Fin(0) | Inf(2)) --BODY-- State: 0 [1] 0 [0] 1 {0} State: 1 [0] 1 {2} [1] 0
|
||||
{1} --END--
|
||||
HOA: v1 States: 2 Start: 0 AP: 2 "a" "b" Acceptance: 4 (Inf(0) |
|
||||
(Inf(1)&(Inf(3)|Fin(2)))) --BODY-- State: 0 [1] 0 {3} [0] 1 {0} State: 1 [0] 1
|
||||
{2} [1] 0 {1} --END--
|
||||
"""))
|
||||
|
||||
res = []
|
||||
for a in auts:
|
||||
b = spot.simplify_acceptance(a)
|
||||
assert b.equivalent_to(a)
|
||||
res.append(str(b.get_acceptance()))
|
||||
|
||||
a.set_acceptance(a.num_sets(), a.get_acceptance().complement())
|
||||
b = spot.simplify_acceptance(a)
|
||||
assert b.equivalent_to(a)
|
||||
res.append(str(b.get_acceptance()))
|
||||
|
||||
assert res == ['Inf(0)',
|
||||
'Fin(0)',
|
||||
'Inf(1) & Fin(0)',
|
||||
'Fin(1) | Inf(0)',
|
||||
'Inf(1) & (Fin(0) | Inf(2))',
|
||||
'Fin(1) | (Fin(2) & Inf(0))',
|
||||
'(Fin(1) | Inf(2)) & Inf(0)',
|
||||
'Fin(0) | (Fin(2) & Inf(1))']
|
||||
Loading…
Add table
Add a link
Reference in a new issue