Implement a favor_even_univ option in the rewriting rules.

The set of rules enabled by favor_even_univ try to "lift" the
subformulae that are both eventual and universal, so they appear
higher in the AST.  This is contrary to what we used to do (and still
do when the option is unset), were we try to postpone such subformulae
(by moving them down the AST).  It is still a bit experimental.

* src/ltlvisit/simplify.hh: Add option favor_event_univ.
* src/ltlvisit/simplify.cc: Implement new rewriting rules.
* doc/tl/tl.tex: Document them.
* src/tgbatest/ltl2tgba.cc: Add option -ra to enable them.
* src/tgbatest/spotlbtt.test: Test the translation with this option.
* src/ltltest/reduc.cc, src/ltltest/equals.cc: Add option
to enable the new rules.
* src/ltltest/eventuniv.test: New file to test them.
* src/ltltest/Makefile.am: Add it.
This commit is contained in:
Alexandre Duret-Lutz 2012-06-11 19:09:34 +02:00
parent 969d927145
commit 9caa9ad134
9 changed files with 489 additions and 43 deletions

View file

@ -36,6 +36,7 @@ check_PROGRAMS = \
nenoform \
reduc \
reduccmp \
reduceu \
reductau \
reductaustr \
syntimpl \
@ -58,6 +59,8 @@ nenoform_CPPFLAGS = $(AM_CPPFLAGS) -DNENOFORM
reduc_SOURCES = reduc.cc
reduccmp_SOURCES = equals.cc
reduccmp_CPPFLAGS = $(AM_CPPFLAGS) -DREDUC
reduceu_SOURCES = equals.cc
reduceu_CPPFLAGS = $(AM_CPPFLAGS) -DREDUC -DEVENT_UNIV
reductau_SOURCES = equals.cc
reductau_CPPFLAGS = $(AM_CPPFLAGS) -DREDUC_TAU
reductaustr_SOURCES = equals.cc
@ -99,7 +102,8 @@ TESTS = \
reduc0.test \
reducpsl.test \
reduccmp.test \
uwrm.test
uwrm.test \
eventuniv.test
distclean-local:
rm -rf $(TESTS:.test=.dir)

View file

@ -104,6 +104,9 @@ main(int argc, char** argv)
#endif
#ifdef REDUC
spot::ltl::ltl_simplifier_options opt(true, true, true, false, false);
# ifdef EVENT_UNIV
opt.favor_event_univ = true;
# endif
spot::ltl::ltl_simplifier simp(opt);
{
const spot::ltl::formula* tmp;

60
src/ltltest/eventuniv.test Executable file
View file

@ -0,0 +1,60 @@
#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 2013 Laboratoire de Recherche et Developpement
# 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
check()
{
run 0 ../reduceu "$@"
}
check 'Xa | GFb' 'Xa | GFb'
check 'X(a | GXFb)' 'Xa | GFb'
check 'Xa & GFb' 'Xa & GFb'
check 'X(a & GXFb)' 'Xa & GFb'
check 'F(a & b & GFc & FGd)' 'F(a & b) & G(Fc & FGd)'
check 'Fa | Fb | GFc | GFd' 'F(a|b) | GF(c | d)'
check 'Fa | Fb | GFc | GFd | FGe' 'F(a|b) | F(G(e) | GF(c | d))'
cehck 'Ga | Gb | GFd | FGe | FGf' 'Ga | Gb | F(GFd | Ge | Gf)'
check 'G(Ga & Fb & c & GFd)' 'G(a&c) & G(Fb & Fd)'
check 'G(Ga & GFb & c & GFd)' 'G(a&c) & G(Fb & Fd)'
check 'G(a & GFb & c & GFd)' 'G(a&c) & G(Fb & Fd)'
check 'G(Ga & Fb & c & GFd & FGe)' 'G(a & c) & G(Fb & Fd & FGe)'
check 'G(Ga & XFGb & c & FGd & FGe)' 'FG(b & d & e) & G(a & c)'
check 'G(Ga & GXFb & c & FGd & FGe & Fc)' 'G(Fb & FG(d & e)) & G(a & c)'
check 'Ga & Gb & GFd & FGe & FGf' 'G(Fd & FG(e & f)) & G(a & b)'
check 'G(Ga & Gb & GFd & FGe) & FGf' 'G(Fd & FG(e & f)) & G(a & b)'
check 'a U (b | Fc)' '(a U b) | Fc'
check 'a W (b | Fc)' '(a W b) | Fc'
check 'a U (b & GFc)' '(a U b) & GFc'
check 'a W (b & GFc)' 'a W (b & GFc)' # Unchanged
check '(a | Gc) W g' '(a W g) | Gc'
check '(a | Gc) U g' '(a | Gc) U g' # Unchanged
check '(a & GFc) M b' '(a M b) & GFc'
check '(a | GFc) M b' '(a | GFc) M b' # Unchanged
check '(a & GFc) R b' '(a & GFc) R b' # Unchanged
check '(a | GFc) R b' '(a | GFc) R b' # Unchanged
check 'a R (b & Gc)' '(a R b) & Gc'
check 'a M (b & Gc)' '(a M b) & Gc'

View file

@ -134,6 +134,13 @@ main(int argc, char** argv)
o.containment_checks = true;
o.containment_checks_stronger = true;
break;
case 15:
o.reduce_basics = true;
o.event_univ = true;
o.containment_checks = true;
o.containment_checks_stronger = true;
o.favor_event_univ = true;
break;
default:
return 2;
}