simplify: GF(f)=GF(dnf(f)) FG(f)=FG(cnf(f))

These rules come from Delag's paper, and help some cases
in issue #385.

* spot/tl/simplify.cc: Implement the simplification.
* doc/tl/tl.tex, NEWS: Document it.
* tests/core/385.test: New file.
* tests/Makefile.am: Add it.
* tests/core/reduccmp.test: More tests.
* tests/core/ltl2tgba2.test: Adjust one improved case.
* tests/python/automata.ipynb, tests/python/twagraph-internals.ipynb:
Adjust expected output, as the cnf/dnf reorder some subformulas.
This commit is contained in:
Alexandre Duret-Lutz 2019-06-17 00:19:02 +02:00
parent df326e032b
commit da5d23f0a2
9 changed files with 2517 additions and 2291 deletions

45
tests/core/385.test Executable file
View file

@ -0,0 +1,45 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2019 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
set -e
# Formulas from issue #385.
ltl2tgba -G --stats=%s,%f> out <<EOF
GFX((e & XXXa) -> (e & X!d))
G(Gc | Fa | F!G(c | Ge))
Ge | XGF(Ge & X(c & Fd))
G!GXXe -> GF(b & c & Gc)
G!(Gd & (c | Fb))
XF(F(Gc & Xb) -> a)
EOF
# Some of the following are still not optimal.
cat >expected <<EOF
1,GF(!a | !d | !e)
6,G(Gc | F(a | (!c & F!e)))
2,Ge | G(Fd & FGe & Fc)
1,F(G(Fb & FGc) | Ge)
4,G(F!d | (!c & G!b))
3,F(GF!c | G!b) | XFa
EOF
diff out expected

View file

@ -369,7 +369,7 @@ diff output expected
cat >formulas <<EOF
GF((a & XXa) | (!a & XX!a)), 4,8, 4,8, 6,14, 7,14, 4,8
GF((a & XXXa) | (!a & XXX!a)), 7,14, 8,16, 8,18, 15,30, 8,16
GF(((a & Xb) | XXc) & Xd), 4,64, 4,64, 5,80, 5,80, 4,64
GF(((a & Xb) | XXc) & Xd), 3,58, 4,64, 3,58, 5,80, 4,64
GF((b | Fa) & (b R Xb)), 2,4, 2,4, 3,6, 3,12, 2,4
G(F(a & Xa) & F(a & X!a)), 2,4, 2,4, 4,8, 4,8, 3,6
G(!p0 & F(p1 & XG!p1)), 1,0, 1,0, 1,0, 1,0, 1,0

View file

@ -346,6 +346,8 @@ F(G(a & Fb)), G(Fb & FGa)
G(F(a & Gb)), G(Fa & FGb)
Ge | XGF(Ge & X(c & Fd)), Ge | G(Fd & FGe & Fc)
G!GXXe -> GF(b & c & Gc), F(G(Fb & FGc) | Ge)
GFX((e & XXXa) -> (e & X!d)), GF(!a | !d | !e)
!GFX((e & XXXa) -> (e & X!d)), FG(a & d & e)
# Because reduccmp will translate the formula,
# this also check for an old bug in ltl2tgba_fm.