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
|
|
@ -1,6 +1,5 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
|
||||
## Copyright (C) 2009-2019 Laboratoire de Recherche et Développement
|
||||
## Copyright (C) 2009-2020 Laboratoire de Recherche et Développement
|
||||
## de l'Epita (LRDE).
|
||||
## Copyright (C) 2003-2006 Laboratoire d'Informatique de Paris 6
|
||||
## (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
|
||||
|
|
@ -410,6 +409,7 @@ TESTS_python = \
|
|||
python/semidet.py \
|
||||
python/setacc.py \
|
||||
python/setxor.py \
|
||||
python/simplacc.py \
|
||||
python/simstate.py \
|
||||
python/split.py \
|
||||
python/streett_totgba.py \
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2015-2018 Laboratoire de Recherche et Développement de
|
||||
# l'Epita (LRDE).
|
||||
# Copyright (C) 2015-2018, 2020 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
#
|
||||
|
|
@ -340,7 +339,7 @@ HOA: v1
|
|||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
Acceptance: 5 (Inf(0)&Inf(1)&Inf(4)) | Inf(0) | (Inf(2)&Inf(3))
|
||||
Acceptance: 4 (Inf(0)&Inf(1)) | Inf(0) | (Inf(2)&Inf(3))
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
|
|
@ -357,7 +356,7 @@ State: 2
|
|||
[!0&!1] 2 {0}
|
||||
[!0&!1] 3
|
||||
State: 3
|
||||
[!0&!1] 3 {0 1 4}
|
||||
[!0&!1] 3 {0 1}
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 1
|
||||
|
|
@ -402,7 +401,8 @@ HOA: v1
|
|||
States: 10
|
||||
Start: 2
|
||||
AP: 1 "p1"
|
||||
Acceptance: 2 Inf(1) | Inf(0)
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
|
|
@ -410,29 +410,29 @@ State: 0
|
|||
[!0] 6
|
||||
[0] 8
|
||||
[0] 9
|
||||
State: 1 {0 1}
|
||||
State: 1
|
||||
[t] 3
|
||||
State: 2 {0 1}
|
||||
State: 2
|
||||
[0] 1
|
||||
[!0] 5
|
||||
State: 3 {0 1}
|
||||
State: 3
|
||||
[0] 0
|
||||
[!0] 6
|
||||
State: 4 {0 1}
|
||||
State: 4 {0}
|
||||
[0] 4
|
||||
[!0] 6
|
||||
State: 5 {0 1}
|
||||
State: 5
|
||||
[0] 3
|
||||
[!0] 7
|
||||
State: 6
|
||||
[0] 0
|
||||
[!0] 6
|
||||
State: 7 {1}
|
||||
State: 7
|
||||
[0] 4
|
||||
[!0] 6
|
||||
State: 8
|
||||
[0] 8
|
||||
State: 9 {1}
|
||||
State: 9 {0}
|
||||
[0] 9
|
||||
--END--
|
||||
HOA: v1
|
||||
|
|
@ -765,7 +765,7 @@ acc-name: Buchi
|
|||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
State: 0
|
||||
[!0&1] 5
|
||||
[!0&1] 7
|
||||
State: 1
|
||||
|
|
|
|||
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