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:
parent
4b70453d74
commit
a9fc213a44
4 changed files with 72 additions and 15 deletions
|
|
@ -95,6 +95,7 @@ TESTS = \
|
|||
isop.test \
|
||||
syntimpl.test \
|
||||
reduc.test \
|
||||
reduc0.test \
|
||||
reducpsl.test \
|
||||
reduccmp.test \
|
||||
uwrm.test
|
||||
|
|
|
|||
26
src/ltltest/reduc0.test
Executable file
26
src/ltltest/reduc0.test
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#! /bin/sh
|
||||
# Copyright (C) 2013 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
#
|
||||
# Spot is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
# License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs || exit 1
|
||||
set -e
|
||||
|
||||
# These two reductions used to cause a memory leak.
|
||||
run 0 ../reduc 0 'XFa & FXa' 'XFa'
|
||||
run 0 ../reduc 0 '(Xf W 0) | X(f W 0)' 'XGf'
|
||||
|
||||
|
|
@ -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)'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue