fix a memory leak in basic LTL simplifications

When something like XFa & FXa is reduced, the subformulae XFa and FXa
are both rewritten separately to XFa, and then the vector of arguments
of the And operators, [XFa,XFa], is passed through a specialized loop
that searches of the form X(...) that can potentially be simplified with
some other terms.  This loop converts the vector [XFa,XFa] into the set
{XFa,XFa}={XFa} and forgot to deal with the case where the insertion
would actually not add an existing subformula.

* src/ltlvisit/simplify.cc: Fix the code for Or, and And.
* src/ltltest/reduc0.test: New file, to test it.
* src/ltltest/Makefile.am (TESTS): Add it.
* src/ltltest/reduccmp.test: Add an extra test that does not
trigger the bug (because reduccmp.test uses more than basic
optimizations, and the implication-based simplifications are
already able to detect that XFa and FXa are equivalent).
This commit is contained in:
Alexandre Duret-Lutz 2013-03-28 17:24:20 +01:00
parent 4b70453d74
commit a9fc213a44
4 changed files with 72 additions and 15 deletions

View file

@ -99,6 +99,9 @@ for x in ../reduccmp ../reductaustr; do
run 0 $x 'FX(a)' 'XF(a)'
run 0 $x 'GX(a)' 'XG(a)'
run 0 $x '(Xf W 0) | X(f W 0)' 'XGf'
run 0 $x 'XFa & FXa' 'XFa'
run 0 $x 'GF(a | Xb)' 'GF(a | b)'
run 0 $x 'GF(a | Fb)' 'GF(a | b)'
run 0 $x 'GF(Xa | Fb)' 'GF(a | b)'