tl: new simplification rules

Related to issue #385.

* doc/tl/tl.tex, NEWS: Document the rules.
* spot/tl/simplify.cc: Implement the rules.
* tests/core/reduccmp.test, tests/core/ltl2tgba2.test: Add tests.
* tests/core/degenscc.test: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2019-05-18 11:34:09 +02:00
parent 066133b829
commit b726d78cbd
6 changed files with 129 additions and 36 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Laboratoire de Recherche et Développement de
# Copyright (C) 2017, 2019 Laboratoire de Recherche et Développement de
# l'Epita (LRDE).
#
# This file is part of Spot, a model checking library.
@ -28,28 +28,34 @@ set -e
# The following cases were found with
#
# % randltl -n -1 3 | ltl2tgba | autfilt --acc-sets=3.. |
# autfilt -B --stats='%C,%c,%M' | awk -F, '{ if ($1 < $2) { print $0; } }'
#
# before patching degeneralize, but today replacing -B by -Bx'!degen-remscc'
# should do the same.
# autfilt -Bx'!degen-remscc' --stats='%C,%c,%M' |
# awk -F, '{ if ($1 < $2) { print $0; } }'
cat >input <<EOF
p2 & GF(G(p0 & !p1) | (F!p0 & Fp1))
GF((Fp2 & X((p0 & Gp1) | (!p0 & F!p1))) | (G!p2 & X((p0 & F!p1) | (!p0 & Gp1))))
GF(p0 | GF((p2 M p1) | (Fp1 & F!p0) | G(p0 & !p1)))
((Gp2&FG((Gp1&Xp0)|(F!p1&X!p0)))|(F!p2 & GF((Gp1 & X!p0)|(Xp0 & F!p1)))) W !p0
((Gp2&FG((Gp1&Xp0)|(F!p1&X!p0)))|(F!p2 & GF((Gp1 & X!p0) | (Xp0 & F!p1)))) W !p0
G(Fp0 & (F!p1 U (G!p2 M !p0)))
G(((Fp1 & (p1 W Fp0)) | (G!p1 & (!p1 M G!p0))) M FG!p2)
Xp0 R F((p0 & FG(Gp2 U p1)) | (!p0 & GF(F!p2 R !p1)))
GF(p0 & (((p1 & Fp2) | (!p1 & G!p2)) M Gp1))
F(G!p0 | GF((Gp0 & (!p2 R !p1)) | ((p2 U p1) & F!p0)))
p1|X(p1 R F((((p2&G!p0)|(!p2&Fp0))&FGp0)|(((p2 & Fp0) | (!p2 & G!p0)) & GF!p0)))
G(!p1 | (!p2 & F!p1) | (GFp2 U p0))
X(p1 | GF((Fp2 & F!p1) | G(p1 & !p2)))
GF((Fp2&(p0 U((p1&GFp0)|(!p1&FG!p0))))|(G!p2&(!p0 R((p1&FG!p0)|(!p1&GFp0)))))
GF((XFp1 & ((p0 & G!p2) | (!p0 & Fp2))) | (XG!p1 & ((p0 & Fp2) | (!p0 & G!p2))))
F(!p2 | GF((Fp0 & ((p0 & Gp1)|(!p0&F!p1)))|(G!p0&((p0&F!p1)|(!p0&Gp1)))))
G(XF((p2 & F!p1) | (!p2 & Gp1)) | (p1 & Fp0))
!p0 | GF((p1 & (Xp2 W Gp2)) | (!p1 & (X!p2 M F!p2)))
G!p0 | G((Fp1 U p2) & F!p2)
EOF
# We want to make sure the degeneralized automaton as less SCCs
# We want to make sure the degeneralized automaton has fewer SCCs
# (it can be less if the simulation on the BA is lukier than on the TGBA)
ltl2tgba < input | autfilt -B --stats=": '%M'; test %C -ge %c" > test.sh
sh -x -e test.sh
# Make sur that this degen-remscc optimizition is actually doing something.
# Make sure that this degen-remscc optimizition is actually doing something.
# The following test could fail in the future if we improve the translation
# of some of these formulas. In that case, regenerate the list of test
# formula using the command displayed above.

View file

@ -365,22 +365,31 @@ diff output expected
# The first four formulas appear in a NEWS entry for Spot 2.6
# The 5th one is from issue #267.
# The 6th one is from issue #358.
# formula 7-12 are from issue #385.
cat >formulas <<EOF
GF((a & XXa) | (!a & XX!a)), 4,8, 4,8, 6,14, 7,14
GF((a & XXXa) | (!a & XXX!a)), 7,14, 8,16, 8,18, 15,30
GF(((a & Xb) | XXc) & Xd), 4,64, 4,64, 5,80, 5,80
GF((b | Fa) & (b R Xb)), 2,4, 2,4, 3,6, 3,12
G(F(a & Xa) & F(a & X!a)), 2,4, 2,4, 4,8, 4,8
G(!p0 & F(p1 & XG!p1)), 1,0, 1,0, 1,0, 1,0
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((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
FG(a | Fb), 3,15, 3,15, 3,15, 3,15, 1,4
FG(a & Fb), 2,7, 2,7, 3,9, 3,9, 1,4
GF(a & Gb), 2,7, 2,7, 3,9, 3,9, 1,4
GF(a | Gb), 2,7, 2,7, 3,12, 3,12, 1,4
Ge | GF(Ge & X(c & Fd)), 4,31, 4,31, 6,39, 6,39, 2,16
F(GF(b & Gc) | Ge), 3,22, 3,22, 4,26, 4,26, 1,8
EOF
# Call perl in the middle of all this to make sure
# \r is removed fom %>. Issue #380.
ltl2tgba -Fformulas/1 --stats='%f, %s,%t' |
ltl2tgba -D -F-/1 --stats='%f,%>, %s,%t' |
perl -pi -e 's/$/\r/' |
ltl2tgba -B -F-/1 --stats='%f,%>, %s,%t' |
ltl2tgba -BD -F-/1 --stats='%f,%>, %s,%t' > output
ltlfilt -Fformulas/1 --stats='%f,%f,%>' |
ltl2tgba -F-/2 --stats='%<,%<, %s,%t' |
ltl2tgba -D -F-/2 --stats='%<,%<,%>, %s,%t' |
perl -p -e 's/$/\r/' |
ltl2tgba -B -F-/2 --stats='%<,%<,%>, %s,%t' |
ltl2tgba -BD -F-/2 --stats='%<,%<,%>, %s,%t' |
ltl2tgba -GD -F-/2 --stats='%<,%>, %s,%t' > output
diff formulas output

View file

@ -335,6 +335,18 @@ Xa&Xb&GFc&GFd&Ge, X(a&b&G(Fc&Fd))&Ge
GFc|GFd|FGe|FGf, F(GF(c|d)|Ge|Gf)
G(GFc|GFd|FGe|FGf), F(GF(c|d)|Ge|Gf)
F(G(a | Gb)), F(Ga | Gb)
G(F(a & Fb)), G(Fa & Fb)
# These two are not reduced by default
F(G(a | Fb)), F(G(a | Fb))
G(F(a | Gb)), G(F(a | Gb))
# issue #385
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)
# Because reduccmp will translate the formula,
# this also check for an old bug in ltl2tgba_fm.
{(c&!c)[->0..1]}!, 0