improve fuse_marks_here by detecting more patterns
This remove some restrictions that prevented fuse_marks_here from simplifying certain patterns, as noted in the first comment of issue #405. * spot/twaalgos/cleanacc.cc (find_interm_rec, find_fusable): Remove some unnecessary restrictions to singleton marks, and replace the hack put one non-singleton mark at the beginning of the singleton list by a sort. * tests/python/simplacc.py: Add two test cases. * tests/python/automata.ipynb, tests/core/remfin.test: Improve expected results. * NEWS: Mention the bug.
This commit is contained in:
parent
ce695e67f9
commit
c005041e53
5 changed files with 87 additions and 70 deletions
|
|
@ -390,7 +390,7 @@ namespace spot
|
|||
case acc_cond::acc_op::FinNeg:
|
||||
{
|
||||
auto m = pos[-1].mark;
|
||||
if (op == wanted && m.is_singleton())
|
||||
if (op == wanted)
|
||||
{
|
||||
res |= m;
|
||||
}
|
||||
|
|
@ -427,7 +427,7 @@ namespace spot
|
|||
if (op == wanted)
|
||||
{
|
||||
auto m = pos[-1].mark;
|
||||
if (!seen && m.is_singleton())
|
||||
if (!seen)
|
||||
{
|
||||
seen = true;
|
||||
res |= m;
|
||||
|
|
@ -512,9 +512,9 @@ namespace spot
|
|||
case acc_cond::acc_op::Inf:
|
||||
case acc_cond::acc_op::Fin:
|
||||
{
|
||||
auto m = pos[-1].mark;
|
||||
if (op == wanted && m.is_singleton())
|
||||
singletons.emplace_back(m, pos);
|
||||
if (op == wanted)
|
||||
singletons.emplace_back(pos[-1].mark,
|
||||
pos);
|
||||
pos -= 2;
|
||||
}
|
||||
break;
|
||||
|
|
@ -526,20 +526,20 @@ namespace spot
|
|||
// {b,d} can receive {a} if they
|
||||
// (b and d) are both used once.
|
||||
if (auto m = find_interm_rec(pos))
|
||||
{
|
||||
singletons.emplace_back(m, pos);
|
||||
// move this to the front, to
|
||||
// be sure it is the first
|
||||
// recipient tried.
|
||||
swap(singletons.front(),
|
||||
singletons.back());
|
||||
}
|
||||
singletons.emplace_back(m, pos);
|
||||
pos -= pos->sub.size + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (pos > rend);
|
||||
|
||||
// sort the singletons vector: we want
|
||||
// those that are not really singleton to
|
||||
// be first to they can become recipient
|
||||
std::partition(singletons.begin(), singletons.end(),
|
||||
[&] (auto s)
|
||||
{ return !s.first.is_singleton(); });
|
||||
|
||||
acc_cond::mark_t can_receive = {};
|
||||
for (auto p: singletons)
|
||||
if ((p.first & once) == p.first)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue