simplify_acc: loop over the simplifications
* spot/twaalgos/cleanacc.cc (simplify_acceptance_here): Run the simplifications in a loop until the condition does not change anymore. * tests/python/simplacc.py, tests/core/accsimpl.test, tests/core/remfin.test, tests/python/merge.py, tests/python/simplacc.py, tests/python/toparity.py: Update expected results. * tests/python/automata.ipynb: Update the failing example to a more interesting one, matching the one in doc/org/autfilt.org.
This commit is contained in:
parent
b62e1bb13c
commit
102ef04364
7 changed files with 1516 additions and 1209 deletions
|
|
@ -617,20 +617,20 @@ namespace spot
|
||||||
|
|
||||||
twa_graph_ptr simplify_acceptance_here(twa_graph_ptr aut)
|
twa_graph_ptr simplify_acceptance_here(twa_graph_ptr aut)
|
||||||
{
|
{
|
||||||
cleanup_acceptance_here(aut, false);
|
for (;;)
|
||||||
merge_identical_marks_here(aut);
|
|
||||||
if (!aut->acc().is_generalized_buchi())
|
|
||||||
{
|
{
|
||||||
|
cleanup_acceptance_here(aut, false);
|
||||||
|
merge_identical_marks_here(aut);
|
||||||
|
if (aut->acc().is_generalized_buchi())
|
||||||
|
break;
|
||||||
|
acc_cond::acc_code old = aut->get_acceptance();
|
||||||
simplify_complementary_marks_here(aut);
|
simplify_complementary_marks_here(aut);
|
||||||
fuse_marks_here(aut);
|
fuse_marks_here(aut);
|
||||||
|
aut->set_acceptance(aut->acc().unit_propagation());
|
||||||
|
if (old == aut->get_acceptance())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
cleanup_acceptance_here(aut, true);
|
cleanup_acceptance_here(aut, true);
|
||||||
auto prop_cond = aut->acc().unit_propagation();
|
|
||||||
if (prop_cond != aut->acc())
|
|
||||||
{
|
|
||||||
aut->set_acceptance(prop_cond);
|
|
||||||
cleanup_acceptance_here(aut, true);
|
|
||||||
}
|
|
||||||
return aut;
|
return aut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,4 +72,4 @@ State: 0
|
||||||
--END--
|
--END--
|
||||||
EOF
|
EOF
|
||||||
autcross --language-preserved 'autfilt --simplify-acc' -F frenkin
|
autcross --language-preserved 'autfilt --simplify-acc' -F frenkin
|
||||||
test 1,4,2 = "`autfilt --simplify-acc frenkin --stats=%s,%e,%a`"
|
test 1,4,1 = "`autfilt --simplify-acc frenkin --stats=%s,%e,%a`"
|
||||||
|
|
|
||||||
|
|
@ -313,27 +313,25 @@ State: 2 {0}
|
||||||
[!1] 2
|
[!1] 2
|
||||||
--END--
|
--END--
|
||||||
HOA: v1
|
HOA: v1
|
||||||
States: 4
|
States: 3
|
||||||
Start: 0
|
Start: 0
|
||||||
AP: 2 "a" "b"
|
AP: 2 "a" "b"
|
||||||
Acceptance: 4 Inf(0) | Inf(3) | (Inf(1)&Inf(2))
|
acc-name: Buchi
|
||||||
|
Acceptance: 1 Inf(0)
|
||||||
properties: trans-labels explicit-labels trans-acc
|
properties: trans-labels explicit-labels trans-acc
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0
|
||||||
[t] 0 {2 3}
|
[t] 0 {0}
|
||||||
[0] 1 {2 3}
|
[0] 1 {0}
|
||||||
[!0] 2 {2 3}
|
[!0] 2 {0}
|
||||||
State: 1
|
State: 1
|
||||||
[1] 0 {2}
|
[1] 0 {0}
|
||||||
[0&1] 1 {2}
|
[0&1] 1 {0}
|
||||||
[!0&1] 2 {1 2}
|
[!0&1] 2 {0}
|
||||||
State: 2
|
State: 2
|
||||||
[!1] 0
|
[!1] 0
|
||||||
[0&!1] 1
|
[0&!1] 1 {0}
|
||||||
[!0&!1] 2
|
[!0&!1] 2 {0}
|
||||||
[!0&!1] 3
|
|
||||||
State: 3
|
|
||||||
[!0&!1] 3 {0}
|
|
||||||
--END--
|
--END--
|
||||||
HOA: v1
|
HOA: v1
|
||||||
States: 3
|
States: 3
|
||||||
|
|
@ -915,7 +913,7 @@ State: 2 {0}
|
||||||
[!1] 2
|
[!1] 2
|
||||||
--END--
|
--END--
|
||||||
HOA: v1
|
HOA: v1
|
||||||
States: 4
|
States: 3
|
||||||
Start: 0
|
Start: 0
|
||||||
AP: 2 "a" "b"
|
AP: 2 "a" "b"
|
||||||
acc-name: Buchi
|
acc-name: Buchi
|
||||||
|
|
@ -927,16 +925,13 @@ State: 0
|
||||||
[0] 1 {0}
|
[0] 1 {0}
|
||||||
[!0] 2 {0}
|
[!0] 2 {0}
|
||||||
State: 1
|
State: 1
|
||||||
[1] 0
|
[1] 0 {0}
|
||||||
[0&1] 1
|
[0&1] 1 {0}
|
||||||
[!0&1] 2 {0}
|
[!0&1] 2 {0}
|
||||||
State: 2
|
State: 2
|
||||||
[!1] 0
|
[!1] 0
|
||||||
[0&!1] 1
|
[0&!1] 1 {0}
|
||||||
[!0&!1] 2
|
[!0&!1] 2 {0}
|
||||||
[!0&!1] 3
|
|
||||||
State: 3
|
|
||||||
[!0&!1] 3 {0}
|
|
||||||
--END--
|
--END--
|
||||||
HOA: v1
|
HOA: v1
|
||||||
States: 3
|
States: 3
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- mode: python; coding: utf-8 -*-
|
# -*- mode: python; coding: utf-8 -*-
|
||||||
# Copyright (C) 2017 Laboratoire de Recherche et Développement de
|
# Copyright (C) 2017, 2020 Laboratoire de Recherche et Développement de
|
||||||
# l'EPITA.
|
# l'EPITA.
|
||||||
#
|
#
|
||||||
# This file is part of Spot, a model checking library.
|
# This file is part of Spot, a model checking library.
|
||||||
|
|
@ -78,8 +78,7 @@ assert hoa == """HOA: v1
|
||||||
States: 3
|
States: 3
|
||||||
Start: 0
|
Start: 0
|
||||||
AP: 2 "a" "b"
|
AP: 2 "a" "b"
|
||||||
acc-name: parity min even 2
|
Acceptance: 2 Fin(1) | Inf(0)
|
||||||
Acceptance: 2 Inf(0) | Fin(1)
|
|
||||||
properties: trans-labels explicit-labels trans-acc
|
properties: trans-labels explicit-labels trans-acc
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0
|
||||||
|
|
|
||||||
|
|
@ -57,23 +57,28 @@ for a in auts:
|
||||||
b = spot.simplify_acceptance(a)
|
b = spot.simplify_acceptance(a)
|
||||||
assert b.equivalent_to(a)
|
assert b.equivalent_to(a)
|
||||||
res.append(str(b.get_acceptance()))
|
res.append(str(b.get_acceptance()))
|
||||||
|
c = spot.simplify_acceptance(b)
|
||||||
|
assert b.get_acceptance() == c.get_acceptance()
|
||||||
|
|
||||||
a.set_acceptance(a.num_sets(), a.get_acceptance().complement())
|
a.set_acceptance(a.num_sets(), a.get_acceptance().complement())
|
||||||
b = spot.simplify_acceptance(a)
|
b = spot.simplify_acceptance(a)
|
||||||
assert b.equivalent_to(a)
|
assert b.equivalent_to(a)
|
||||||
res.append(str(b.get_acceptance()))
|
res.append(str(b.get_acceptance()))
|
||||||
|
c = spot.simplify_acceptance(b)
|
||||||
|
assert b.get_acceptance() == c.get_acceptance()
|
||||||
|
|
||||||
|
|
||||||
assert res == [
|
assert res == [
|
||||||
'Inf(0)',
|
'Inf(0)',
|
||||||
'Fin(0)',
|
'Fin(0)',
|
||||||
'Inf(1) & Fin(0)',
|
'Fin(0) & Inf(1)',
|
||||||
'Fin(1) | Inf(0)',
|
'Fin(1) | Inf(0)',
|
||||||
'Inf(1) & (Fin(0) | Inf(2))',
|
'(Fin(0) | Inf(2)) & Inf(1)',
|
||||||
'Fin(1) | (Fin(2) & Inf(0))',
|
'Fin(1) | (Fin(2) & Inf(0))',
|
||||||
'(Fin(1) | Inf(2)) & Inf(0)',
|
'(Fin(1) | Inf(2)) & Inf(0)',
|
||||||
'Fin(0) | (Fin(2) & Inf(1))',
|
'Fin(0) | (Fin(2) & Inf(1))',
|
||||||
'((Fin(1) | Inf(2)) & Inf(5)) | (Fin(0) & (Fin(1) | (Fin(3) & Inf(4))))',
|
'((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)))',
|
'(Fin(5) | (Fin(2) & Inf(1))) & (Inf(0) | ((Fin(4) | Inf(3)) & Inf(1)))',
|
||||||
'Inf(1) | Inf(0)',
|
'Inf(0)',
|
||||||
'Fin(1) & Fin(0)',
|
'Fin(0)',
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,7 @@ State: 4
|
||||||
[0&!1] 4
|
[0&!1] 4
|
||||||
[0&1] 4 {1 2 4}
|
[0&1] 4 {1 2 4}
|
||||||
--END--
|
--END--
|
||||||
"""), [9, 6, 7, 7, 6, 6, 6])
|
"""), [9, 6, 6, 6, 7, 6, 6])
|
||||||
|
|
||||||
test(spot.automaton("""
|
test(spot.automaton("""
|
||||||
HOA: v1
|
HOA: v1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue