snf: Fix the handling of bounded repetition.
star_normal_form() used to be called under bounded
repetitions like [*0..4], but some of these rewritings
are only correct for [*0..]. For instance
(a*|1)[*] can be rewritten to 1[*]
but (a*|1)[*0..1] cannot be rewritten to 1[*0..1]
it would be correct to rewrite the latter as (a[+]|1)[*0..1],
canceling the empty word in a*.
Also (a*;b*)[*] can be rewritten to (a|b)[*]
but (a*;b*)[*0..1] cannot be rewritten to (a|b)[*0..1]
and it cannot either be rewritten to (a[+]|b[+])[*0..1].
This patch introduces a new function to implement
rewritings under bounded repetition.
* src/ltlvisit/snf.hh, src/ltlvisit/snf.cc (star_normal_form_unbounded):
New function.
* src/ltlvisit/simplify.cc: Use it.
* src/ltltest/reduccmp.test: Add tests.
* doc/tl/tl.tex: Document the rewritings implemented.
This commit is contained in:
parent
53de8fc3a4
commit
05ed3def00
5 changed files with 112 additions and 21 deletions
|
|
@ -106,6 +106,16 @@ namespace spot
|
|||
old->first->destroy();
|
||||
}
|
||||
}
|
||||
{
|
||||
snf_cache::iterator i = snfb_cache_.begin();
|
||||
snf_cache::iterator end = snfb_cache_.end();
|
||||
while (i != end)
|
||||
{
|
||||
snf_cache::iterator old = i++;
|
||||
old->second->destroy();
|
||||
old->first->destroy();
|
||||
}
|
||||
}
|
||||
{
|
||||
f2f_map::iterator i = bool_isop_.begin();
|
||||
f2f_map::iterator end = bool_isop_.end();
|
||||
|
|
@ -387,6 +397,13 @@ namespace spot
|
|||
return ltl::star_normal_form(f, &snf_cache_);
|
||||
}
|
||||
|
||||
const formula*
|
||||
star_normal_form_bounded(const formula* f)
|
||||
{
|
||||
return ltl::star_normal_form_bounded(f, &snfb_cache_);
|
||||
}
|
||||
|
||||
|
||||
const formula*
|
||||
boolean_to_isop(const formula* f)
|
||||
{
|
||||
|
|
@ -406,6 +423,7 @@ namespace spot
|
|||
f2f_map nenoform_;
|
||||
syntimpl_cache_t syntimpl_;
|
||||
snf_cache snf_cache_;
|
||||
snf_cache snfb_cache_;
|
||||
f2f_map bool_isop_;
|
||||
};
|
||||
|
||||
|
|
@ -1080,7 +1098,10 @@ namespace spot
|
|||
min = 0;
|
||||
if (min == 0)
|
||||
{
|
||||
const formula* s = c_->star_normal_form(h);
|
||||
const formula* s =
|
||||
bo->max() == bunop::unbounded ?
|
||||
c_->star_normal_form(h) :
|
||||
c_->star_normal_form_bounded(h);
|
||||
h->destroy();
|
||||
h = s;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue