Add support for ELTL (AST & parser), and an adaptation of LaCIM
for ELTL. This is a new version of the work started in 2008 with LTL and ELTL formulae now sharing the same class hierarchy. * configure.ac: Adjust for src/eltlparse/ and src/eltltest/ directories, and call AX_BOOST_BASE. * m4/boost.m4: New file defining AX_BOOST_BASE([MINIMUM-VERSION]). * src/Makefile.am: Add eltlparse and eltltest. * src/eltlparse/: New directory. Contains the ELTL parser. * src/eltltest/: New directory. Contains tests related to ELTL (parser and AST). * src/ltlast/Makefile.am: Adjust for ELTL AST files. * src/ltlast/automatop.cc, src/ltlast/automatop.hh: New files. Represent automaton operators nodes used in ELTL ASTs. * src/ltlast/nfa.cc, src/ltlast/nfa.hh: New files. Represent simple NFAs used internally by automatop nodes. * src/ltlast/allnode.hh, src/ltlast/predecl.hh, src/ltlast/visitor.hh: Adjust for automatop. * src/ltlvisit/basicreduce.cc, src/ltlvisit/clone.cc, src/ltlvisit/clone.hh, src/ltlvisit/contain.cc, src/ltlvisit/dotty.cc, src/ltlvisit/nenoform.cc, src/ltlvisit/postfix.cc, src/ltlvisit/postfix.hh, src/ltlvisit/reduce.cc, src/ltlvisit/syntimpl.cc, src/ltlvisit/tostring.cc: Because LTL and ELTL formulae share the same class hierarchy, LTL visitors need to handle automatop nodes to compile. When it's meaningful the visitor applies on automatop nodes or simply assert(0) otherwise. * src/tgba/tgbabddconcretefactory.cc (create_anonymous_state), src/tgba/tgbabddconcretefactory.hh (create_anonymous_state): New function used by the LaCIM translation algorithm for ELTL. * src/tgbaalgos/Makefile.am: Adjust for eltl2tgba_lacim* files. * src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/eltl2tgba_lacim.hh: New files. Implementation of the LaCIM translation algorithm for ELTL. * src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_lacim.cc: Handle automatop nodes in the translation by an assert(0). * src/tgbatest/Makefile.am: Adjust for eltl2tgba.* files. * src/src/tgbatest/eltl2tgba.cc, src/tgbatest/eltl2tgba.test: New files
This commit is contained in:
parent
90332d8d77
commit
2fbcd7e52f
46 changed files with 2509 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ 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 = ltl2tgba randtgba
|
||||
noinst_PROGRAMS = eltl2tgba ltl2tgba randtgba
|
||||
|
||||
check_SCRIPTS = defs
|
||||
# Keep this sorted alphabetically.
|
||||
|
|
@ -46,6 +46,7 @@ check_PROGRAMS = \
|
|||
# Keep this sorted alphabetically.
|
||||
bddprod_SOURCES = ltlprod.cc
|
||||
bddprod_CXXFLAGS = -DBDD_CONCRETE_PRODUCT
|
||||
eltl2tgba_SOURCES = eltl2tgba.cc
|
||||
explicit_SOURCES = explicit.cc
|
||||
expldot_SOURCES = powerset.cc
|
||||
expldot_CXXFLAGS = -DDOTTY
|
||||
|
|
@ -65,6 +66,7 @@ tripprod_SOURCES = tripprod.cc
|
|||
# Keep this sorted by STRENGTH. Test basic things first,
|
||||
# because such failures will be easier to diagnose and fix.
|
||||
TESTS = \
|
||||
eltl2tgba.test \
|
||||
explicit.test \
|
||||
tgbaread.test \
|
||||
readsave.test \
|
||||
|
|
|
|||
109
src/tgbatest/eltl2tgba.cc
Normal file
109
src/tgbatest/eltl2tgba.cc
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
// Copyright (C) 2008 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.
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include "eltlparse/public.hh"
|
||||
#include "tgbaalgos/eltl2tgba_lacim.hh"
|
||||
#include "tgbaalgos/dotty.hh"
|
||||
#include "tgbaalgos/save.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
|
||||
void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << "Usage: "<< prog << " [OPTIONS...] formula [file]" << std::endl
|
||||
<< " "<< prog << " -F [OPTIONS...] file [file]" << std::endl
|
||||
<< std::endl
|
||||
<< "Options:" << std::endl
|
||||
<< " -F read the formula from the file (extended input format)"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
std::string
|
||||
ltl_defs()
|
||||
{
|
||||
std::string s = "\
|
||||
X=(0 1 true \
|
||||
1 2 $0 \
|
||||
accept 2) \
|
||||
U=(0 0 $0 \
|
||||
0 1 $1 \
|
||||
accept 1) \
|
||||
G=(0 0 $0)";
|
||||
return s;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
syntax(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
spot::eltl::parse_error_list p;
|
||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||
spot::ltl::formula* f = 0;
|
||||
int formula_index = 0;
|
||||
|
||||
if (strcmp(argv[1], "-F") == 0)
|
||||
{
|
||||
f = spot::eltl::parse_file(argv[2], p, env, false);
|
||||
formula_index = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::stringstream oss;
|
||||
oss << ltl_defs() << "%" << argv[1];
|
||||
f = spot::eltl::parse_string(oss.str(), p, env, false);
|
||||
formula_index = 1;
|
||||
}
|
||||
|
||||
if (spot::eltl::format_parse_errors(std::cerr, p))
|
||||
{
|
||||
if (f != 0)
|
||||
std::cout << f->dump() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
assert(f != 0);
|
||||
std::cerr << f->dump() << std::endl;
|
||||
|
||||
spot::bdd_dict* dict = new spot::bdd_dict();
|
||||
spot::tgba_bdd_concrete* concrete = spot::eltl_to_tgba_lacim(f, dict);
|
||||
|
||||
spot::dotty_reachable(std::cout, concrete);
|
||||
if (argc >= formula_index + 1)
|
||||
{
|
||||
std::ofstream ofs(argv[formula_index + 1]);
|
||||
spot::tgba_save_reachable(ofs, concrete);
|
||||
ofs.close();
|
||||
}
|
||||
|
||||
spot::ltl::destroy(f);
|
||||
delete concrete;
|
||||
delete dict;
|
||||
}
|
||||
114
src/tgbatest/eltl2tgba.test
Executable file
114
src/tgbatest/eltl2tgba.test
Executable file
|
|
@ -0,0 +1,114 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./defs || exit -1
|
||||
set -e
|
||||
|
||||
# Check if the TGBA was corretly constructed.
|
||||
check_construct()
|
||||
{
|
||||
run 0 ./eltl2tgba -F "$1" input
|
||||
}
|
||||
|
||||
# Check if the TGBA behaves correctly by doing an emptiness check on
|
||||
# the product between the constructed TGBA and a given formula
|
||||
# translated using FM.
|
||||
check_true()
|
||||
{
|
||||
run 0 ./ltl2tgba -e -Pinput -f "$1"
|
||||
}
|
||||
check_false()
|
||||
{
|
||||
run 1 ./ltl2tgba -e -Pinput -f "$1"
|
||||
}
|
||||
|
||||
# Create the prelude file.
|
||||
cat >input1 <<EOF
|
||||
X=(
|
||||
0 1 true
|
||||
1 2 \$0
|
||||
accept 2
|
||||
)
|
||||
U=(
|
||||
0 0 \$0
|
||||
0 1 \$1
|
||||
accept 1
|
||||
)
|
||||
G=(
|
||||
0 0 \$0
|
||||
)
|
||||
EOF
|
||||
|
||||
cat >input <<EOF
|
||||
A=(
|
||||
)
|
||||
%
|
||||
!0|1
|
||||
EOF
|
||||
|
||||
check_construct input
|
||||
check_true 'Ga'
|
||||
|
||||
cat >input <<EOF
|
||||
include input1
|
||||
%
|
||||
U(a,b)
|
||||
EOF
|
||||
|
||||
check_construct input
|
||||
check_true 'a U b'
|
||||
check_false '!(a U b)'
|
||||
check_false 'G(a&!b)'
|
||||
|
||||
cat >input <<EOF
|
||||
include input1
|
||||
%
|
||||
!U(a,b)
|
||||
EOF
|
||||
|
||||
check_construct input
|
||||
check_true '!(a U b)'
|
||||
check_true 'G(a&!b)'
|
||||
check_false 'a U b'
|
||||
|
||||
cat >input <<EOF
|
||||
include input1
|
||||
%
|
||||
X(a)
|
||||
EOF
|
||||
|
||||
check_construct input
|
||||
check_true 'Xa'
|
||||
check_true 'G(a)'
|
||||
check_false '!Xa'
|
||||
check_false 'G(!a)'
|
||||
|
||||
cat >input <<EOF
|
||||
include input1
|
||||
%
|
||||
X(X(a))
|
||||
EOF
|
||||
|
||||
check_construct input
|
||||
check_true 'XXa'
|
||||
check_false '!XXa'
|
||||
|
||||
cat >input <<EOF
|
||||
include input1
|
||||
%
|
||||
G(a)
|
||||
EOF
|
||||
|
||||
check_construct input
|
||||
check_true 'Ga'
|
||||
check_false '!Ga'
|
||||
|
||||
cat >input <<EOF
|
||||
T=(
|
||||
0 1 true
|
||||
1 0 \$0
|
||||
)
|
||||
%
|
||||
T(f)
|
||||
EOF
|
||||
|
||||
check_construct input
|
||||
Loading…
Add table
Add a link
Reference in a new issue