Commit 5a2e4f54 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

fix is_generalized_rabin() and is_generalized_streett()

Fixes #325.

* spot/twa/acc.cc: Here.
* tests/core/accsimpl.test: New test case.
* NEWS: Mention the issue.
parent 9ec6e917
......@@ -12,6 +12,12 @@ New in spot 2.5.0.dev (not yet released)
- iar() and iar_maybe() properly handle Rabin-like conditions.
- is_generalized_rabin() had a typo that caused some non-simplified
acceptance conditions like Fin(0)|(Fin(0)&Inf(1)) to be
incorrectly detecteded as generalized-Rabin 2 0 1 and then output
as Fin(0)|(Fin(1)&Inf(2)) instead. Likewise for
is_generalized_streett
New in spot 2.5 (2018-01-20)
Build:
......
......@@ -666,7 +666,7 @@ namespace spot
auto s = code_.back().sub.size;
acc_cond::mark_t seen_fin = 0U;
acc_cond::mark_t seen_inf = 0U;
// Each pairs is the position of a Fin followed
// Each pair is the position of a Fin followed
// by the number of Inf.
std::map<unsigned, unsigned> p;
while (s)
......@@ -697,7 +697,7 @@ namespace spot
unsigned i = m2.count();
// If we have seen this pair already, it must have the
// same size.
if (p.emplace(m1.max_set(), i).first->second != i)
if (p.emplace(m1.max_set() - 1, i).first->second != i)
return false;
assert(i > 0);
unsigned j = m1.max_set(); // == n+1
......@@ -705,7 +705,6 @@ namespace spot
if (!m2.has(j++))
return false;
while (--i);
seen_fin |= m1;
seen_inf |= m2;
}
......@@ -715,8 +714,10 @@ namespace spot
for (auto s: m1.sets())
// If we have seen this pair already, it must have the
// same size.
if (p.emplace(s, 0U).first->second != 0U)
return false;
{
if (p.emplace(s, 0U).first->second != 0U)
return false;
}
seen_fin |= m1;
}
else
......@@ -777,7 +778,7 @@ namespace spot
unsigned i = m2.count();
// If we have seen this pair already, it must have the
// same size.
if (p.emplace(m1.max_set(), i).first->second != i)
if (p.emplace(m1.max_set() - 1, i).first->second != i)
return false;
assert(i > 0);
unsigned j = m1.max_set(); // == n+1
......
......@@ -28,3 +28,26 @@ set -e
ltlcross -f FGa \
'ltl2tgba -G -D %f | autfilt --complement >%O' \
'ltl2tgba -G -D %f | autfilt --complement | autfilt --simplify-acceptance >%O'
cat >325 <<EOF
HOA: v1
States: 1
Start: 0
AP: 2 "a" "b"
acc-name: Rabin 3
Acceptance: 6 (Fin(0) & Inf(1)) | (Fin(2) & Inf(3)) | (Fin(4) & Inf(5))
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
--BODY--
State: 0
[!0&!1] 0 {0 4}
[!0&1] 0 {0 3 4}
[0&!1] 0 {2 5}
[0&1] 0 {1 2 5}
--END--
EOF
autfilt --simplify-acceptance 325 > 325s
exp='4 Fin(0) | (Fin(0) & Inf(1)) | (Fin(2) & Inf(3))'
test "$exp" = "`autfilt --stats='%a %g' 325s`"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment