Rename is_safety_automaton() as is_guarantee_automaton() and

implement is_safety_mwdba().

Note: I swapped the name of safety and guarantee when I
implemented is_safety_automaton() on 2010-03-20.  Fortunately,
is_safety_automaton() was only used where is_guarantee_automaton()
would have been correct.

* src/tgbaalgos/safety.cc (is_guarantee_automaton): Rename as ...
(is_guarantee_automaton): ... this.
(is_safety_mwdba): New function.
* src/tgbaalgos/safety.hh: Adjust and add documentation.
* src/tgbaalgos/minimize.cc: Use is_guarantee_automaton() instead
of is_safety_automaton().
* src/tgbatests/safety.test: Rename as ...
* src/tgbatests/obligation.test: ... this, and augment the
test.
* src/tgbatest/Makefile.am: Adjust.
* src/tgbatest/ltl2tgba.cc (-O): Display whether a formula
represent a safety, guarantee, or obligation property.
* NEWS: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2011-01-27 18:21:27 +01:00
parent 14b701b54d
commit db124d02c0
9 changed files with 260 additions and 129 deletions

116
src/tgbatest/obligation.test Executable file
View file

@ -0,0 +1,116 @@
#!/bin/sh
# Copyright (C) 2010, 2011 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 2 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 Spot; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./defs
set +x
set -e
cat >formulas.txt <<EOF
SA G(!p)
SA Fr->(!p U r)
SA G(q->G(!p))
SA G((q&!r&Fr)->(!p U r))
SA G(q&!r->((!p U r)|G!p ))
SA (!r U (p&!r))|(G!r)
SA G(q&!r->((!r U (p&!r))|G!r))
SA (!p U ((p U ((!p U ((p U G!p)|Gp))|G!p))|Gp))|G!p
SA Fr->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|(!p U r)))))))))
SA Fq->(!q U (q&((!p U ((p U ((!p U ((p U G!p)|Gp))|G!p))|Gp))|G!p)))
SA G((q&Fr)->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|(!p U r))))))))))
SA G(q->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|((!p U r)|G!p)|Gp)))))))))
SA G(p)
SA Fr->(p U r)
SA G(q->G(p))
SA G((p&!r&Fr)->(p U r))
SA G(q&!r->((p U r)|Gp))
SA Fr->(!p U (s|r))
SA G((q&!r&Fr)->(!p U (s|r)))
SA G(q&!r->((!p U (s|r))|G!p))
SA Fr->(p->(!r U (s&!r))) U r
SA G((q&!r&Fr)->(p->(!r U (s&!r))) U r)
SA Fp->(!p U (s&!p&X(!p U t)))
SA Fr->(!p U (r|(s&!p&X(!p U t))))
SA (G!q)|(!q U (q&Fp->(!p U (s&!p&X(!p U t)))))
SA G((q&Fr)->(!p U (r|(s&!p&X(!p U t)))))
SA G(q->(Fp->(!p U (r|(s&!p&X(!p U t))))))
SA (F(s&XFt))->((!s) U p)
SA Fr->((!(s&(!r)&X(!r U (t&!r))))U(r|p))
SA (G!q)|((!q)U(q&((F(s&XFt))->((!s) U p))))
SA G((q&Fr)->((!(s&(!r)&X(!r U (t&!r))))U(r|p)))
SA Fr->(p->(!r U (s&!r&X(!r U t)))) U r
SA G((q&Fr)->(p->(!r U (s&!r&X(!r U t)))) U r)
SA Fr->(p->(!r U (s&!r&!z&X((!r&!z) U t)))) U r
SA G((q&Fr)->(p->(!r U (s&!r&!z&X((!r&!z) U t)))) U r)
GU Fp
OB G(!q)|F(q&Fp)
OB (!p U s)|Gp
SA G(q->(!(s&(!r)&X(!r U (t&!r)))U(r|p)|G(!(s&XFt))))
OB Fr->(s&X(!r U t)->X(!r U (t&Fp))) U r
NO G(q&!r->(!r U (p&!r)))
NO G!q|F(q&((!p U s)|G!p))
NO G(p->Fs)
NO G(q->G(p->Fs))
NO G(q&!r->(((p->(!r U (s&!r))) U r)|G(p->(!r U (s&!r)))))
NO G(s&XFt->X(F(t&Fp)))
NO G(q->G(s&XFt->X(!t U (t&Fp))))
NO G((q&Fr)->(s&X(!r U t)->X(!r U (t&Fp))) U r)
NO G(q->(s&X(!r U t)->X(!r U (t&Fp)))U(r|G(s&X(!r U t)->X(!r U (t&Fp)))))
NO G(p->F(s&XFt))
NO G(q->G(p->(s&XFt)))
NO G(q->(p->(!r U (s&!r&X(!r U t))))U(r|G(p->(s&XFt))))
NO G(p->F(s&!z&X(!z U t)))
NO G(q->G(p->(s&!z&X(!z U t))))
NO G(q->(p->(!r U (s&!r&!z&X((!r&!z) U t))))U(r|G(p->(s&!z&X(!z U t)))))
EOF
grok()
{
case $1 in
"this is a safety property"*) echo SA;;
"this is a guarantee property"*) echo GU;;
"this is an obligation property"*) echo OB;;
"this is not an obligation property"*) echo NO;;
*) echo XX;;
esac
}
success=:
while read exp f; do
x=`../ltl2tgba -O "$f"`
y=`../ltl2tgba -O "!($f)"`
resx=`grok "$x"`
resy=`grok "$y"`
echo "$resx $f"
if test "$resx" != "$exp"; then
echo "Expected $exp, got $resx"; exit 1
fi
echo "$resy !($f)"
case $resx,$resy in
SA,GU);;
GU,SA);;
OB,OB);;
NO,NO);;
*) echo "Incompatible results: $resx,$resy"; exit 1;;
esac
done < formulas.txt
exit 0