An algorithm to complement TGBA into SABA.
* src/saba/sabacomplementtgba.hh, src/saba/sabacomplementtgba.cc: New. The algorithm. * src/saba/Makefile.am: Adjust. * src/sabatest/sabacomplementtgba.cc, src/sabatest/Makefile.am, src/sabatest/defs.in: New. Test the algorithm. * configure.ac, src/Makefile.am: Adjust to the new directory `sabatest'.
This commit is contained in:
parent
7cb6ff331d
commit
d659001f0e
6 changed files with 739 additions and 0 deletions
40
src/sabatest/Makefile.am
Normal file
40
src/sabatest/Makefile.am
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
## Copyright (C) 2009 Laboratoire d'Informatique de
|
||||
## Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
## Université Pierre et Marie Curie.
|
||||
##
|
||||
## 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.
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/.. $(BUDDY_CPPFLAGS)
|
||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
||||
LDADD = ../libspot.la
|
||||
|
||||
# These are the most used test programs, and they are also useful
|
||||
# to run manually outside the test suite. Always build them.
|
||||
# noinst_PROGRAMS =
|
||||
|
||||
check_SCRIPTS = defs
|
||||
# Keep this sorted alphabetically.
|
||||
check_PROGRAMS = \
|
||||
sabacomplementtgba
|
||||
|
||||
# Keep this sorted alphabetically.
|
||||
sabacomplementtgba_SOURCES = sabacomplementtgba.cc
|
||||
|
||||
# Keep this sorted by STRENGTH. Test basic things first,
|
||||
# because such failures will be easier to diagnose and fix.
|
||||
# TESTS =
|
||||
87
src/sabatest/defs.in
Normal file
87
src/sabatest/defs.in
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# -*- shell-script -*-
|
||||
# Copyright (C) 2003, 2004, 2006, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
# et Marie Curie.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Ensure we are running from the right directory.
|
||||
test -f ./defs || {
|
||||
echo "defs: not found in current directory" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# If srcdir is not set, then we are not running from `make check'.
|
||||
if test -z "$srcdir"; then
|
||||
# compute $srcdir.
|
||||
srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
|
||||
test $srcdir = $0 && srcdir=.
|
||||
fi
|
||||
|
||||
# Ensure $srcdir is set correctly.
|
||||
test -f $srcdir/defs.in || {
|
||||
echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "== Running test $0"
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
|
||||
|
||||
testSubDir=$me.dir
|
||||
chmod -R a+rwx $testSubDir > /dev/null 2>&1
|
||||
rm -rf $testSubDir > /dev/null 2>&1
|
||||
mkdir $testSubDir
|
||||
cd $testSubDir
|
||||
|
||||
# Adjust srcdir now that we are in a subdirectory. We still want to
|
||||
# source directory corresponding to the build directory that contains
|
||||
# $testSubDir.
|
||||
case $srcdir in
|
||||
# I
|
||||
[\\/$]* | ?:[\\/]* );;
|
||||
*) srcdir=../$srcdir
|
||||
esac
|
||||
|
||||
DOT='@DOT@'
|
||||
top_builddir='../@top_builddir@'
|
||||
LBTT="@LBTT@"
|
||||
LBTT_TRANSLATE="@LBTT_TRANSLATE@"
|
||||
VALGRIND='@VALGRIND@'
|
||||
|
||||
run()
|
||||
{
|
||||
expected_exitcode=$1
|
||||
shift
|
||||
exitcode=0
|
||||
if test -n "$VALGRIND"; then
|
||||
exec 6>valgrind.err
|
||||
GLIBCPP_FORCE_NEW=1 \
|
||||
../../../libtool --mode=execute \
|
||||
$VALGRIND --tool=memcheck --leak-check=yes --log-fd=6 -q "$@" ||
|
||||
exitcode=$?
|
||||
cat valgrind.err 1>&2
|
||||
test -z "`sed 1q valgrind.err`" || exit 50
|
||||
rm -f valgrind.err
|
||||
else
|
||||
"$@" || exitcode=$?
|
||||
fi
|
||||
test $exitcode = $expected_exitcode || exit 1
|
||||
}
|
||||
|
||||
set -x
|
||||
69
src/sabatest/sabacomplementtgba.cc
Normal file
69
src/sabatest/sabacomplementtgba.cc
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
#include <saba/saba.hh>
|
||||
#include <saba/sabacomplementtgba.hh>
|
||||
#include <tgba/tgba.hh>
|
||||
#include <tgbaparse/public.hh>
|
||||
#include <tgba/tgbatba.hh>
|
||||
#include <sabaalgos/sabadotty.hh>
|
||||
#include <tgbaalgos/ltl2tgba_fm.hh>
|
||||
#include <ltlparse/public.hh>
|
||||
|
||||
void usage(const std::string& argv0)
|
||||
{
|
||||
std::cerr
|
||||
<< "usage " << argv0 << " [options]" << std::endl
|
||||
<< "options:" << std::endl
|
||||
<< "-f formula display the saba of !forumula"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::string formula;
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (!strcmp(argv[i], "-f"))
|
||||
{
|
||||
if (i + 1 >= argc)
|
||||
{
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
formula = argv[++i];
|
||||
}
|
||||
else
|
||||
{
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (formula.empty())
|
||||
{
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
spot::bdd_dict* dict = new spot::bdd_dict();
|
||||
spot::tgba* a;
|
||||
spot::ltl::formula* f1 = 0;
|
||||
|
||||
spot::ltl::parse_error_list p1;
|
||||
f1 = spot::ltl::parse(formula, p1);
|
||||
if (spot::ltl::format_parse_errors(std::cerr, formula, p1))
|
||||
return 2;
|
||||
|
||||
a = spot::ltl_to_tgba_fm(f1, dict);
|
||||
|
||||
spot::saba_complement_tgba* complement =
|
||||
new spot::saba_complement_tgba(a);
|
||||
|
||||
spot::saba_dotty_reachable(std::cout, complement);
|
||||
|
||||
delete complement;
|
||||
delete a;
|
||||
f1->destroy();
|
||||
delete dict;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue