Implement 11 rewritings for []->.

* src/ltlvisit/simplify.cc: Here.
* doc/tl/tl.tex: Document then.
* src/ltlast/bunop.hh (as_KleenStar): New helper function.
* src/ltltest/reduccmp.test: Add more tests.
* src/ltltest/reduc.cc: Also display the resulting formula
without reduce_size_stricly.
This commit is contained in:
Alexandre Duret-Lutz 2012-04-26 17:13:56 +02:00
parent 6eb830c8ae
commit 6f46345c3a
5 changed files with 291 additions and 8 deletions

View file

@ -209,6 +209,7 @@ main(int argc, char** argv)
int length_f1_before = spot::ltl::length(f1);
std::string f1s_before = spot::ltl::to_string(f1);
std::string f1l;
spot::ltl::formula* input_f = f1;
f1 = simp_size->simplify(input_f);
@ -222,11 +223,11 @@ main(int argc, char** argv)
else
{
spot::ltl::formula* maybe_larger = simp->simplify(input_f);
f1l = spot::ltl::to_string(maybe_larger);
if (!simp->are_equivalent(input_f, maybe_larger))
{
std::cerr << "Incorrect reduction (reduce_size_strictly=0) from `"
<< f1s_before << "' to `" << spot::ltl::to_string(f1)
<< "'." << std::endl;
<< f1s_before << "' to `" << f1l << "'." << std::endl;
exit_code = 3;
}
maybe_larger->destroy();
@ -253,8 +254,10 @@ main(int argc, char** argv)
if (!f2 && (!hidereduc || (length_f1_after > length_f1_before)))
{
std::cout << length_f1_before << " " << length_f1_after
<< " '" << f1s_before << "' reduce to '" << f1s_after << "'"
<< std::endl;
<< " '" << f1s_before << "' reduce to '" << f1s_after << "'";
if (f1l != "" && f1l != f1s_after)
std::cout << " or (w/o rss) to '" << f1l << "'";
std::cout << std::endl;
}
if (f2)

View file

@ -290,8 +290,22 @@ for x in ../reduccmp ../reductaustr; do
'{{r1*&r2*}:{b1&&b2}} <>-> x'
run 0 $x '{{a;b*;c}&{d;e*}&{f*;g}&{h*}} <>-> x' \
'{{f*;g}&{h*}&{{a&&d};{e* & {b*;c}}}} <>-> x'
run 0 $x '{a&b&c*}|->!Xb' '{(a&&b)|((a&&b):c*)}|-> X!b'
run 0 $x '{a&b&c*}|->!Xb' '(X!b | !(a & b)) & (!(a & b) | !c | X(!c R !b))'
run 0 $x '{a;(b*;c*;([*0]+{d;e}))*}!' '{a;{b|c|{d;e}}*}!'
run 0 $x '{[*]}[]->b' 'Gb'
run 0 $x '{a;[*]}[]->b' 'Gb | !a'
run 0 $x '{[*];a}[]->b' 'G(b | !a)'
run 0 $x '{a;b;[*]}[]->c' '!a | X(!b | Gc)'
run 0 $x '{a;a;[*]}[]->c' '!a | X(!a | Gc)'
run 0 $x '{s[*]}[]->b' 'b W !s'
run 0 $x '{s[+]}[]->b' 'b W !s'
run 0 $x '{s[*2..]}[]->b' '!s | X(b W !s)'
run 0 $x '{a;b*;c;d*}[]->e' '!a | X(!b R ((e & X(e W !d)) | !c))'
run 0 $x '{a:b*:c:d*}[]->e' '!a | ((!c | (e W !d)) W !b)'
run 0 $x '{a|b*|c|d*}[]->e' '(e | !(a | c)) & (e W !b) & (e W !d)'
run 0 $x '{{[*0] | a};b;{[*0] | a};c;e[*]} []-> f' \
'{{[*0] | a};b;{[*0] | a}} []-> X((f & X(f W !e)) | !c)'
# not reduced
run 0 $x '{a;(b[*2..4];c*;([*0]+{d;e}))*}!' \
'{a;(b[*2..4];c*;([*0]+{d;e}))*}!'