formula: add a missing trivial rewriting in SERE

We should have [*0]|f ≡ f when f is a SERE that already accept the
empty word.  Fixes issue #454.

* spot/tl/formula.cc: Implement the rewriting.
* tests/core/reduccmp.test: Add a test case.
* doc/tl/tl.tex, NEWS: Document it.
This commit is contained in:
Alexandre Duret-Lutz 2024-07-25 17:56:04 +02:00
parent bcdfe44c44
commit 44efc96595
4 changed files with 31 additions and 17 deletions

View file

@ -357,7 +357,16 @@ namespace spot
break;
case op::OrRat:
neutral = ff();
neutral2 = nullptr;
{
// If this OrRat contains an operand that accept [*0] but
// isn't [*0], then any [+0] can be removed.
bool eword_accepted =
std::find_if(v.begin(), v.end(),
[](const fnode* f) {
return f->accepts_eword() && !f->is_eword();
}) != v.end();
neutral2 = eword_accepted ? eword() : nullptr;
}
abs = one_star();
abs2 = nullptr;
weak_abs = one_plus();