Implement is_safety_automaton().
* src/tgbaalgos/safety.hh, src/tgbaalgos/safety.cc: New files. * src/tgbaalgos/Makefile.am: Add them. * src/tgbatests/ltl2tgba.cc: Add option "-O". * src/tgbaalgos/scc.hh: Update documentation. * src/tgbatest/Makefile.am (TESTS): Add safety.test. * src/tgbatest/safety.test: New file.
This commit is contained in:
parent
99c1b607de
commit
0af8d03261
8 changed files with 264 additions and 6 deletions
|
|
@ -92,6 +92,7 @@ TESTS = \
|
|||
reduccmp.test \
|
||||
reductgba.test \
|
||||
scc.test \
|
||||
safety.test \
|
||||
randtgba.test \
|
||||
emptchk.test \
|
||||
emptchke.test \
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
#include "tgbaalgos/replayrun.hh"
|
||||
#include "tgbaalgos/rundotdec.hh"
|
||||
#include "tgbaalgos/sccfilter.hh"
|
||||
#include "tgbaalgos/safety.hh"
|
||||
#include "tgbaalgos/eltl2tgba_lacim.hh"
|
||||
#include "eltlparse/public.hh"
|
||||
#include "misc/timer.hh"
|
||||
|
|
@ -256,6 +257,8 @@ syntax(char* prog)
|
|||
<< std::endl
|
||||
<< " -NN output the never clain for Spin, with commented states"
|
||||
<< " (implies -D)" << std::endl
|
||||
<< " -O tell whether the automaton is a safety automaton"
|
||||
<< std::endl
|
||||
<< " -t output automaton in LBTT's format" << std::endl
|
||||
<< std::endl
|
||||
|
||||
|
|
@ -522,6 +525,10 @@ main(int argc, char** argv)
|
|||
output = 8;
|
||||
spin_comments = true;
|
||||
}
|
||||
else if (!strcmp(argv[formula_index], "-O"))
|
||||
{
|
||||
output = 13;
|
||||
}
|
||||
else if (!strcmp(argv[formula_index], "-p"))
|
||||
{
|
||||
post_branching = true;
|
||||
|
|
@ -1087,6 +1094,12 @@ main(int argc, char** argv)
|
|||
case 12:
|
||||
stats_reachable(a).dump(std::cout);
|
||||
break;
|
||||
case 13:
|
||||
std::cout << (is_safety_automaton(a) ?
|
||||
"is a safety automaton" :
|
||||
"may not be a safety automaton")
|
||||
<< std::endl;
|
||||
break;
|
||||
default:
|
||||
assert(!"unknown output option");
|
||||
}
|
||||
|
|
|
|||
108
src/tgbatest/safety.test
Executable file
108
src/tgbatest/safety.test
Executable file
|
|
@ -0,0 +1,108 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2010 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 -e
|
||||
|
||||
cat >safety.txt <<EOF
|
||||
G(!p)
|
||||
Fr->(!p U r)
|
||||
G(q->G(!p))
|
||||
G((q&!r&Fr)->(!p U r))
|
||||
G(q&!r->((!p U r)|G!p ))
|
||||
(!r U (p&!r))|(G!r)
|
||||
G(q&!r->((!r U (p&!r))|G!r))
|
||||
(!p U ((p U ((!p U ((p U G!p)|Gp))|G!p))|Gp))|G!p
|
||||
Fr->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|(!p U r)))))))))
|
||||
Fq->(!q U (q&((!p U ((p U ((!p U ((p U G!p)|Gp))|G!p))|Gp))|G!p)))
|
||||
G((q&Fr)->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|(!p U r))))))))))
|
||||
G(q->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|((!p U r)|G!p)|Gp)))))))))
|
||||
G(p)
|
||||
Fr->(p U r)
|
||||
G(q->G(p))
|
||||
G((p&!r&Fr)->(p U r))
|
||||
G(q&!r->((p U r)|Gp))
|
||||
Fr->(!p U (s|r))
|
||||
G((q&!r&Fr)->(!p U (s|r)))
|
||||
G(q&!r->((!p U (s|r))|G!p))
|
||||
Fr->(p->(!r U (s&!r))) U r
|
||||
G((q&!r&Fr)->(p->(!r U (s&!r))) U r)
|
||||
Fp->(!p U (s&!p&X(!p U t)))
|
||||
Fr->(!p U (r|(s&!p&X(!p U t))))
|
||||
(G!q)|(!q U (q&Fp->(!p U (s&!p&X(!p U t)))))
|
||||
G((q&Fr)->(!p U (r|(s&!p&X(!p U t)))))
|
||||
G(q->(Fp->(!p U (r|(s&!p&X(!p U t))))))
|
||||
(F(s&XFt))->((!s) U p)
|
||||
Fr->((!(s&(!r)&X(!r U (t&!r))))U(r|p))
|
||||
(G!q)|((!q)U(q&((F(s&XFt))->((!s) U p))))
|
||||
G((q&Fr)->((!(s&(!r)&X(!r U (t&!r))))U(r|p)))
|
||||
Fr->(p->(!r U (s&!r&X(!r U t)))) U r
|
||||
G((q&Fr)->(p->(!r U (s&!r&X(!r U t)))) U r)
|
||||
Fr->(p->(!r U (s&!r&!z&X((!r&!z) U t)))) U r
|
||||
G((q&Fr)->(p->(!r U (s&!r&!z&X((!r&!z) U t)))) U r)
|
||||
EOF
|
||||
|
||||
# The negation of the first 4 formulae are not safety properties, but they
|
||||
# are obligation properties.
|
||||
cat >non-safety.txt <<EOF
|
||||
Fp
|
||||
G(!q)|F(q&Fp)
|
||||
(!p U s)|Gp
|
||||
G(q->(!(s&(!r)&X(!r U (t&!r)))U(r|p)|G(!(s&XFt))))
|
||||
Fr->(s&X(!r U t)->X(!r U (t&Fp))) U r
|
||||
G(q&!r->(!r U (p&!r)))
|
||||
G!q|F(q&((!p U s)|G!p))
|
||||
G(p->Fs)
|
||||
G(q->G(p->Fs))
|
||||
G(q&!r->(((p->(!r U (s&!r))) U r)|G(p->(!r U (s&!r)))))
|
||||
G(s&XFt->X(F(t&Fp)))
|
||||
G(q->G(s&XFt->X(!t U (t&Fp))))
|
||||
G((q&Fr)->(s&X(!r U t)->X(!r U (t&Fp))) U r)
|
||||
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)))))
|
||||
G(p->F(s&XFt))
|
||||
G(q->G(p->(s&XFt)))
|
||||
G(q->(p->(!r U (s&!r&X(!r U t))))U(r|G(p->(s&XFt))))
|
||||
G(p->F(s&!z&X(!z U t)))
|
||||
G(q->G(p->(s&!z&X(!z U t))))
|
||||
G(q->(p->(!r U (s&!r&!z&X((!r&!z) U t))))U(r|G(p->(s&!z&X(!z U t)))))
|
||||
EOF
|
||||
|
||||
success=:
|
||||
while read f; do
|
||||
x=`../ltl2tgba -f -R3f -O "!($f)"`
|
||||
case $x in
|
||||
*may*) echo "MNO !($f)"; success=false;;
|
||||
*) echo "OBL !($f)";;
|
||||
esac
|
||||
done < safety.txt
|
||||
|
||||
echo ====
|
||||
|
||||
while read f; do
|
||||
x=`../ltl2tgba -f -R3f -O "!($f)"`
|
||||
case $x in
|
||||
*may*) echo "MNO !($f)";;
|
||||
*) echo "OBL !($f)"; success=false;;
|
||||
esac
|
||||
done < non-safety.txt
|
||||
|
||||
$success
|
||||
Loading…
Add table
Add a link
Reference in a new issue