cleanacc: keep acceptance order when removing complementary colors

* spot/twaalgos/cleanacc.cc (remove_compl_rec): Rewrite to preserve
the original order of the acceptance condition while rewriting it.
* tests/core/sccdot.test, tests/python/merge.py,
tests/python/simplacc.py, tests/python/toparity.py: Adjust test cases.
This commit is contained in:
Alexandre Duret-Lutz 2020-04-18 22:05:43 +02:00
parent 262b24e6d7
commit c0e1b3e52a
5 changed files with 109 additions and 108 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2015, 2017, 2018 Laboratoire de Recherche et
# Copyright (C) 2015, 2017, 2018, 2020 Laboratoire de Recherche et
# Développement de l'Epita
#
# This file is part of Spot, a model checking library.
@ -156,7 +156,7 @@ HOA: v1
States: 8
Start: 0
AP: 2 "a" "b"
Acceptance: 3 Fin(2) & (Inf(0)&Inf(1))
Acceptance: 3 (Inf(0)&Inf(1)) & Fin(2)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0

View file

@ -43,7 +43,8 @@ assert hoa == """HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
Acceptance: 2 Fin(1) | Inf(0)
acc-name: parity min even 2
Acceptance: 2 Inf(0) | Fin(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
@ -78,7 +79,8 @@ assert hoa == """HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
Acceptance: 2 Fin(1) | Inf(0)
acc-name: parity min even 2
Acceptance: 2 Inf(0) | Fin(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
@ -149,7 +151,8 @@ assert hoa == """HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
Acceptance: 2 Fin(1) | Inf(0)
acc-name: parity min even 2
Acceptance: 2 Inf(0) | Fin(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
@ -289,7 +292,7 @@ assert hoa == """HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
Acceptance: 2 (Fin(1) & Inf(0)) | (Fin(1) & Inf(0))
Acceptance: 2 (Inf(0) & Fin(1)) | (Inf(0) & Fin(1))
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0 {0}

View file

@ -67,18 +67,17 @@ for a in auts:
c = spot.simplify_acceptance(b)
assert b.get_acceptance() == c.get_acceptance()
assert res == [
'Inf(0)',
'Fin(0)',
'Fin(0) & Inf(1)',
'Fin(1) | Inf(0)',
'(Fin(0) | Inf(2)) & Inf(1)',
'Fin(1) | (Fin(2) & Inf(0))',
'(Fin(1) | Inf(2)) & Inf(0)',
'Fin(0) | (Fin(2) & Inf(1))',
'((Fin(1) | Inf(2)) & Inf(5)) | (Fin(0) & (Fin(1) | (Fin(3) & Inf(4))))',
'(Fin(5) | (Fin(2) & Inf(1))) & (Inf(0) | ((Fin(4) | Inf(3)) & Inf(1)))',
'Inf(0)',
'Fin(0)',
]
'Inf(0)',
'Fin(0)',
'Inf(1) & Fin(0)',
'Fin(1) | Inf(0)',
'Inf(1) & (Fin(0) | Inf(2))',
'Fin(1) | (Inf(0) & Fin(2))',
'Inf(0) & (Inf(2) | Fin(1))',
'Fin(0) | (Fin(2) & Inf(1))',
'((Fin(1) | Inf(2)) & Inf(5)) | (Fin(0) & (Fin(1) | (Fin(3) & Inf(4))))',
'((Inf(1) & Fin(2)) | Fin(5)) & (Inf(0) | (Inf(1) & (Inf(3) | Fin(4))))',
'Inf(0)',
'Fin(0)',
]

View file

@ -112,7 +112,8 @@ def test(aut, expected_num_states=[], full=True):
spot.reduce_parity_here(p1)
assert spot.are_equivalent(aut, p1)
if expected_num is not None:
assert p1.num_states() == expected_num
# print(p1.num_states(), expected_num)
assert p1.num_states() == expected_num
if full:
# Make sure passing opt is the same as setting
# each argument individually
@ -292,7 +293,7 @@ State: 4
[0&!1] 4
[0&1] 4 {1 2 4}
--END--
"""), [9, 6, 6, 6, 7, 6, 6])
"""), [9, 6, 7, 7, 6, 6, 6])
test(spot.automaton("""
HOA: v1