move spot/bin/ and spot/tests/ up by one level
* spot/bin/: Move... * bin/: ... here. * spot/tests/: Move... * tests/: ... here. * Makefile.am, README, bench/stutter/Makefile.am, bench/stutter/stutter_invariance_formulas.cc, doc/Makefile.am, configure.ac, debian/rules, spot/Makefile.am, spot/ltsmin/Makefile.am, spot/ltsmin/kripke.test, spot/sanity/style.test, python/tests/run.in: Adjust.
This commit is contained in:
parent
ff4837f4f2
commit
134dfc73de
220 changed files with 35 additions and 30 deletions
70
tests/.gitignore
vendored
Normal file
70
tests/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
acc
|
||||
apcollect
|
||||
bddprod
|
||||
bitvect
|
||||
blue_counter
|
||||
checkpsl
|
||||
checkta
|
||||
complement
|
||||
consterm
|
||||
defs
|
||||
.deps
|
||||
*.dot
|
||||
eltl2tgba
|
||||
emptchk
|
||||
defs
|
||||
equals
|
||||
expect
|
||||
expldot
|
||||
explicit
|
||||
explicit2
|
||||
explicit3
|
||||
explprod
|
||||
graph
|
||||
genltl
|
||||
input
|
||||
intvcomp
|
||||
intvcmp2
|
||||
kind
|
||||
length
|
||||
.libs
|
||||
ikwiad
|
||||
ltl2dot
|
||||
ltl2text
|
||||
ltlmagic
|
||||
ltlprod
|
||||
ltlrel
|
||||
lunabbrev
|
||||
Makefile
|
||||
Makefile.in
|
||||
maskacc
|
||||
mixprod
|
||||
nequals
|
||||
nenoform
|
||||
ngraph
|
||||
output1
|
||||
output2
|
||||
parse_print
|
||||
powerset
|
||||
*.ps
|
||||
randltl
|
||||
randtgba
|
||||
readsat
|
||||
readsave
|
||||
reduc
|
||||
reduceu
|
||||
reductau
|
||||
reductaustr
|
||||
reduccmp
|
||||
reductgba
|
||||
stdout
|
||||
spotlbtt
|
||||
syntimpl
|
||||
taatgba
|
||||
tgbagraph
|
||||
tgbaread
|
||||
tostring
|
||||
tripprod
|
||||
tunabbrev
|
||||
tunenoform
|
||||
unabbrevwm
|
||||
253
tests/Makefile.am
Normal file
253
tests/Makefile.am
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
## Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire de
|
||||
## Recherche et Développement de l'Epita (LRDE).
|
||||
## Copyright (C) 2003, 2004, 2005, 2006 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) $(BUDDY_CPPFLAGS)
|
||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
||||
LDADD = $(top_builddir)/spot/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 = ikwiad randtgba
|
||||
|
||||
check_SCRIPTS = defs
|
||||
# Keep this sorted alphabetically.
|
||||
check_PROGRAMS = \
|
||||
acc \
|
||||
bitvect \
|
||||
complement \
|
||||
checkpsl \
|
||||
checkta \
|
||||
consterm \
|
||||
emptchk \
|
||||
equals \
|
||||
graph \
|
||||
kind \
|
||||
length \
|
||||
intvcomp \
|
||||
intvcmp2 \
|
||||
ltlprod \
|
||||
ltl2dot \
|
||||
ltl2text \
|
||||
ltlrel \
|
||||
lunabbrev \
|
||||
nequals \
|
||||
nenoform \
|
||||
ngraph \
|
||||
parse_print \
|
||||
readsat \
|
||||
reduc \
|
||||
reduccmp \
|
||||
reduceu \
|
||||
reductaustr \
|
||||
syntimpl \
|
||||
taatgba \
|
||||
tgbagraph \
|
||||
tostring \
|
||||
tunabbrev \
|
||||
tunenoform
|
||||
|
||||
# Keep this sorted alphabetically.
|
||||
acc_SOURCES = acc.cc
|
||||
bitvect_SOURCES = bitvect.cc
|
||||
checkpsl_SOURCES = checkpsl.cc
|
||||
checkta_SOURCES = checkta.cc
|
||||
complement_SOURCES = complementation.cc
|
||||
emptchk_SOURCES = emptchk.cc
|
||||
graph_SOURCES = graph.cc
|
||||
ikwiad_SOURCES = ikwiad.cc
|
||||
intvcomp_SOURCES = intvcomp.cc
|
||||
intvcmp2_SOURCES = intvcmp2.cc
|
||||
ltlprod_SOURCES = ltlprod.cc
|
||||
ngraph_SOURCES = ngraph.cc
|
||||
parse_print_SOURCES = parse_print_test.cc
|
||||
randtgba_SOURCES = randtgba.cc
|
||||
readsat_SOURCES = readsat.cc
|
||||
taatgba_SOURCES = taatgba.cc
|
||||
tgbagraph_SOURCES = twagraph.cc
|
||||
consterm_SOURCES = consterm.cc
|
||||
equals_SOURCES = equalsf.cc
|
||||
kind_SOURCES = kind.cc
|
||||
length_SOURCES = length.cc
|
||||
ltl2dot_SOURCES = readltl.cc
|
||||
ltl2dot_CPPFLAGS = $(AM_CPPFLAGS) -DDOTTY
|
||||
ltl2text_SOURCES = readltl.cc
|
||||
ltlrel_SOURCES = ltlrel.cc
|
||||
lunabbrev_SOURCES = equalsf.cc
|
||||
lunabbrev_CPPFLAGS = $(AM_CPPFLAGS) -DUNABBREV='"^ie"'
|
||||
nenoform_SOURCES = equalsf.cc
|
||||
nenoform_CPPFLAGS = $(AM_CPPFLAGS) -DNENOFORM
|
||||
nequals_SOURCES = equalsf.cc
|
||||
nequals_CPPFLAGS = $(AM_CPPFLAGS) -DNEGATE
|
||||
reduc_SOURCES = reduc.cc
|
||||
reduccmp_SOURCES = equalsf.cc
|
||||
reduccmp_CPPFLAGS = $(AM_CPPFLAGS) -DREDUC
|
||||
reduceu_SOURCES = equalsf.cc
|
||||
reduceu_CPPFLAGS = $(AM_CPPFLAGS) -DREDUC -DEVENT_UNIV
|
||||
reductaustr_SOURCES = equalsf.cc
|
||||
reductaustr_CPPFLAGS = $(AM_CPPFLAGS) -DREDUC_TAUSTR
|
||||
syntimpl_SOURCES = syntimpl.cc
|
||||
tostring_SOURCES = tostring.cc
|
||||
tunabbrev_SOURCES = equalsf.cc
|
||||
tunabbrev_CPPFLAGS = $(AM_CPPFLAGS) -DUNABBREV='"^ieFG"'
|
||||
tunenoform_SOURCES = equalsf.cc
|
||||
tunenoform_CPPFLAGS = $(AM_CPPFLAGS) -DNENOFORM -DUNABBREV='"^ieFG"'
|
||||
|
||||
|
||||
# Keep this sorted by STRENGTH. Test basic things first,
|
||||
# because such failures will be easier to diagnose and fix.
|
||||
TESTS = $(TESTS_ltl) $(TESTS_graph) $(TESTS_kripke) $(TESTS_twa)
|
||||
|
||||
TESTS_ltl = \
|
||||
bare.test \
|
||||
parse.test \
|
||||
parseerr.test \
|
||||
utf8.test \
|
||||
length.test \
|
||||
equals.test \
|
||||
tostring.test \
|
||||
lunabbrev.test \
|
||||
tunabbrev.test \
|
||||
nenoform.test \
|
||||
tunenoform.test \
|
||||
unabbrevwm.test \
|
||||
consterm.test \
|
||||
kind.test \
|
||||
remove_x.test \
|
||||
ltlrel.test \
|
||||
ltlgrind.test \
|
||||
ltlcrossgrind.test \
|
||||
ltlfilt.test \
|
||||
exclusive-ltl.test \
|
||||
latex.test \
|
||||
lbt.test \
|
||||
lenient.test \
|
||||
rand.test \
|
||||
isop.test \
|
||||
syntimpl.test \
|
||||
reduc.test \
|
||||
reduc0.test \
|
||||
reducpsl.test \
|
||||
reduccmp.test \
|
||||
uwrm.test \
|
||||
eventuniv.test \
|
||||
stutter-ltl.test
|
||||
|
||||
TESTS_graph = \
|
||||
graph.test \
|
||||
ngraph.test \
|
||||
tgbagraph.test
|
||||
|
||||
TESTS_kripke = \
|
||||
kripke.test
|
||||
|
||||
TESTS_twa = \
|
||||
acc.test \
|
||||
acc2.test \
|
||||
intvcomp.test \
|
||||
bitvect.test \
|
||||
ltlcross3.test \
|
||||
taatgba.test \
|
||||
renault.test \
|
||||
nondet.test \
|
||||
det.test \
|
||||
neverclaimread.test \
|
||||
parseaut.test \
|
||||
optba.test \
|
||||
complete.test \
|
||||
complement.test \
|
||||
remfin.test \
|
||||
dstar.test \
|
||||
readsave.test \
|
||||
ltldo.test \
|
||||
ltldo2.test \
|
||||
maskacc.test \
|
||||
maskkeep.test \
|
||||
prodor.test \
|
||||
simdet.test \
|
||||
sim2.test \
|
||||
sim3.test \
|
||||
ltl2tgba.test \
|
||||
ltl2neverclaim.test \
|
||||
ltl2neverclaim-lbtt.test \
|
||||
ltlprod.test \
|
||||
explprod.test \
|
||||
explpro2.test \
|
||||
explpro3.test \
|
||||
explpro4.test \
|
||||
tripprod.test \
|
||||
dupexp.test \
|
||||
exclusive-tgba.test \
|
||||
remprop.test \
|
||||
degendet.test \
|
||||
degenid.test \
|
||||
degenlskip.test \
|
||||
randomize.test \
|
||||
lbttparse.test \
|
||||
scc.test \
|
||||
sccdot.test \
|
||||
sccsimpl.test \
|
||||
sepsets.test \
|
||||
dbacomp.test \
|
||||
obligation.test \
|
||||
wdba.test \
|
||||
wdba2.test \
|
||||
babiak.test \
|
||||
monitor.test \
|
||||
dra2dba.test \
|
||||
unambig.test \
|
||||
ltlcross4.test \
|
||||
ltl3dra.test \
|
||||
ltl2dstar.test \
|
||||
ltl2dstar2.test \
|
||||
ltl2dstar3.test \
|
||||
ltl2dstar4.test \
|
||||
ltl2ta.test \
|
||||
ltl2ta2.test \
|
||||
randaut.test \
|
||||
randtgba.test \
|
||||
isomorph.test \
|
||||
uniq.test \
|
||||
sbacc.test \
|
||||
stutter-tgba.test \
|
||||
strength.test \
|
||||
emptchk.test \
|
||||
emptchke.test \
|
||||
dfs.test \
|
||||
ltlcrossce.test \
|
||||
ltlcrossce2.test \
|
||||
emptchkr.test \
|
||||
ltlcounter.test \
|
||||
basimul.test \
|
||||
satmin.test \
|
||||
satmin2.test \
|
||||
spotlbtt.test \
|
||||
ltlcross.test \
|
||||
spotlbtt2.test \
|
||||
ltlcross2.test \
|
||||
complementation.test \
|
||||
randpsl.test \
|
||||
cycles.test
|
||||
|
||||
EXTRA_DIST = $(TESTS)
|
||||
|
||||
distclean-local:
|
||||
rm -rf $(TESTS:.test=.dir)
|
||||
173
tests/acc.cc
Normal file
173
tests/acc.cc
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <spot/twa/acc.hh>
|
||||
|
||||
static void check(spot::acc_cond& ac, spot::acc_cond::mark_t m)
|
||||
{
|
||||
std::cout << '#' << m.count() << ": " << ac.format(m);
|
||||
if (!m)
|
||||
std::cout << "empty";
|
||||
if (ac.accepting(m))
|
||||
std::cout << " accepting";
|
||||
std::cout << '\n';
|
||||
}
|
||||
|
||||
static void print(const std::vector<std::vector<int>>& res)
|
||||
{
|
||||
for (auto& v: res)
|
||||
{
|
||||
std::cout << '{';
|
||||
const char* comma = "";
|
||||
for (int s: v)
|
||||
{
|
||||
std::cout << comma;
|
||||
if (s < 0)
|
||||
std::cout << '!' << (-s - 1);
|
||||
else
|
||||
std::cout << s;
|
||||
comma = ", ";
|
||||
}
|
||||
std::cout << "}\n";
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
spot::acc_cond ac(4);
|
||||
ac.set_generalized_buchi();
|
||||
std::cout << ac.get_acceptance() << '\n';
|
||||
|
||||
auto m1 = spot::acc_cond::mark_t({0, 2});
|
||||
auto m2 = spot::acc_cond::mark_t({0, 3});
|
||||
auto m3 = spot::acc_cond::mark_t({2, 1});
|
||||
|
||||
check(ac, m1);
|
||||
check(ac, m2);
|
||||
check(ac, m3);
|
||||
check(ac, m1 | m2);
|
||||
check(ac, m2 & m1);
|
||||
check(ac, m1 | m2 | m3);
|
||||
|
||||
ac.add_set();
|
||||
ac.set_generalized_buchi();
|
||||
|
||||
check(ac, m1);
|
||||
check(ac, m2);
|
||||
check(ac, m3);
|
||||
check(ac, m1 | m2);
|
||||
check(ac, m2 & m1);
|
||||
check(ac, m1 | m2 | m3);
|
||||
|
||||
check(ac, m2 & m3);
|
||||
check(ac, ac.comp(m2 & m3));
|
||||
|
||||
spot::acc_cond ac2(ac.num_sets());
|
||||
ac2.set_generalized_buchi();
|
||||
check(ac2, m3);
|
||||
|
||||
spot::acc_cond ac3(ac.num_sets() + ac2.num_sets());
|
||||
ac3.set_generalized_buchi();
|
||||
std::cout << ac.num_sets() << " + "
|
||||
<< ac2.num_sets() << " = " << ac3.num_sets() << '\n';
|
||||
auto m5 = m2 | (m3 << ac.num_sets());
|
||||
check(ac3, m5);
|
||||
auto m6 = ac.comp(m2 & m3) | (m3 << ac.num_sets());
|
||||
check(ac3, m6);
|
||||
auto m7 = ac.comp(m2 & m3) | (ac.all_sets() << ac.num_sets());
|
||||
check(ac3, m7);
|
||||
|
||||
const char* comma = "";
|
||||
for (auto i: m7.sets())
|
||||
{
|
||||
std::cout << comma << i;
|
||||
comma = ",";
|
||||
};
|
||||
std::cout << '\n';
|
||||
|
||||
spot::acc_cond ac4;
|
||||
ac4.set_generalized_buchi();
|
||||
check(ac4, ac4.all_sets());
|
||||
check(ac4, ac4.comp(ac4.all_sets()));
|
||||
|
||||
check(ac, (m1 | m2).remove_some(2));
|
||||
|
||||
std::vector<spot::acc_cond::mark_t> s = { m1, m2, m3 };
|
||||
check(ac, ac.useless(s.begin(), s.end()));
|
||||
s.push_back(ac.mark(4));
|
||||
auto u = ac.useless(s.begin(), s.end());
|
||||
check(ac, u);
|
||||
std::cout << "stripping\n";
|
||||
for (auto& v: s)
|
||||
{
|
||||
check(ac, v);
|
||||
check(ac, v.strip(u));
|
||||
}
|
||||
|
||||
|
||||
auto code1 = ac.inf({0, 1, 3});
|
||||
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
|
||||
code1 |= ac.fin({2});
|
||||
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
|
||||
code1 |= ac.fin({0});
|
||||
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
|
||||
code1 |= ac.fin({});
|
||||
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
|
||||
code1 &= ac.inf({});
|
||||
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
|
||||
auto code2 = code1;
|
||||
code1 &= ac.fin({0, 1});
|
||||
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
|
||||
code1 &= ac.fin({});
|
||||
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
|
||||
code2 |= ac.fin({0, 1});
|
||||
std::cout << code2.size() << ' ' << code2 << ' ' << code2.is_dnf() << '\n';
|
||||
auto code3 = ac.inf({0, 1});
|
||||
code3 &= ac.fin({2, 3});
|
||||
std::cout << code3.size() << ' ' << code3 << ' ' << code3.is_dnf() << '\n';
|
||||
|
||||
// code3 == (Fin(2)|Fin(3)) & (Inf(0)&Inf(1))
|
||||
// {0}
|
||||
// {1}
|
||||
// {2, 3}
|
||||
std::cout << code3 << ' ' << "{0} true\n";
|
||||
spot::acc_cond::mark_t m = 0U;
|
||||
m.set(0);
|
||||
print(code3.missing(m, true));
|
||||
std::cout << code3 << ' ' << "{0} false\n";
|
||||
print(code3.missing(m, false));
|
||||
|
||||
std::cout << spot::acc_cond::acc_code("t") << '\n';
|
||||
std::cout << spot::acc_cond::acc_code("f") << '\n';
|
||||
std::cout << spot::acc_cond::acc_code("Fin(2)") << '\n';
|
||||
std::cout << spot::acc_cond::acc_code("Inf(2)") << '\n';
|
||||
std::cout << spot::acc_cond::acc_code("Fin(2) | Inf(2)") << '\n';
|
||||
std::cout << spot::acc_cond::acc_code("Inf(2) & Fin(2)") << '\n';
|
||||
auto c1 = spot::acc_cond::acc_code("Fin(0)|Inf(1)&Fin(2)|Fin(3)");
|
||||
auto c2 = spot::acc_cond::acc_code
|
||||
("( Fin ( 0 )) | (Inf ( 1) & Fin(2 ))| Fin (3) ");
|
||||
std::cout << c1 << '\n';
|
||||
std::cout << c2 << '\n';
|
||||
assert(c1 == c2);
|
||||
}
|
||||
88
tests/acc.test
Executable file
88
tests/acc.test
Executable file
|
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >expect <<EOF
|
||||
Inf(0)&Inf(1)&Inf(2)&Inf(3)
|
||||
#2: {0,2}
|
||||
#2: {0,3}
|
||||
#2: {1,2}
|
||||
#3: {0,2,3}
|
||||
#1: {0}
|
||||
#4: {0,1,2,3} accepting
|
||||
#2: {0,2}
|
||||
#2: {0,3}
|
||||
#2: {1,2}
|
||||
#3: {0,2,3}
|
||||
#1: {0}
|
||||
#4: {0,1,2,3}
|
||||
#0: empty
|
||||
#5: {0,1,2,3,4} accepting
|
||||
#2: {1,2}
|
||||
5 + 5 = 10
|
||||
#4: {0,3,6,7}
|
||||
#7: {0,1,2,3,4,6,7}
|
||||
#10: {0,1,2,3,4,5,6,7,8,9} accepting
|
||||
0,1,2,3,4,5,6,7,8,9
|
||||
#0: empty accepting
|
||||
#0: empty accepting
|
||||
#1: {3}
|
||||
#4: {0,1,2,3}
|
||||
#2: {0,2}
|
||||
stripping
|
||||
#2: {0,2}
|
||||
#0: empty
|
||||
#2: {0,3}
|
||||
#1: {1}
|
||||
#2: {1,2}
|
||||
#1: {0}
|
||||
#1: {4}
|
||||
#1: {2}
|
||||
2 Inf(0)&Inf(1)&Inf(3) 1
|
||||
5 Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
|
||||
7 Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
|
||||
7 Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
|
||||
7 Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
|
||||
10 (Fin(0)|Fin(1)) & (Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3))) 0
|
||||
2 f 1
|
||||
9 (Fin(0)|Fin(1)) | Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
|
||||
5 (Fin(2)|Fin(3)) & (Inf(0)&Inf(1)) 0
|
||||
(Fin(2)|Fin(3)) & (Inf(0)&Inf(1)) {0} true
|
||||
{1}
|
||||
{!2, !3}
|
||||
(Fin(2)|Fin(3)) & (Inf(0)&Inf(1)) {0} false
|
||||
{!1, 2}
|
||||
{!1, 3}
|
||||
t
|
||||
f
|
||||
Fin(2)
|
||||
Inf(2)
|
||||
Fin(2) | Inf(2)
|
||||
Fin(2) & Inf(2)
|
||||
Fin(0) | (Fin(2) & Inf(1)) | Fin(3)
|
||||
Fin(0) | (Fin(2) & Inf(1)) | Fin(3)
|
||||
EOF
|
||||
|
||||
run 0 ../acc | tee stdout
|
||||
diff stdout expect
|
||||
115
tests/acc2.test
Executable file
115
tests/acc2.test
Executable file
|
|
@ -0,0 +1,115 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
../../bin/ltl2tgba -H 'GFa & GFb' > in
|
||||
grep 'Acceptance:' in > expected
|
||||
../../bin/ltl2tgba -H 'GFa & GFb' --stats='Acceptance: %a %g' > out1
|
||||
../../bin/autfilt -H in --stats='Acceptance: %A %G' > out2
|
||||
diff out1 expected
|
||||
diff out2 expected
|
||||
|
||||
cat >header <<EOF
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
EOF
|
||||
|
||||
cat >body <<EOF
|
||||
--BODY--
|
||||
State: 0
|
||||
[0&1] 0 {0 1}
|
||||
[!0&!1] 0
|
||||
[!0&1] 0 {1}
|
||||
[0&!1] 0 {0}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
#------------- DNF -------------
|
||||
|
||||
res="(Fin(1) & Fin(2) & Inf(0)) | (Inf(0)&Inf(1)&Inf(3))"
|
||||
cat >acceptances<<EOF
|
||||
2 Inf(0)&Inf(1), 2 Inf(0)&Inf(1)
|
||||
2 Fin(0) & Inf(1), 2 Fin(0) & Inf(1)
|
||||
2 t, 2 t
|
||||
2 f, 2 f
|
||||
3 (Inf(1) | Fin(2)) & Inf(0), 3 (Inf(0)&Inf(1)) | (Fin(2) & Inf(0))
|
||||
4 (Inf(1) | Fin(2)) & (Fin(1) | Inf(3)) & Inf(0), 4 $res
|
||||
4 $res, 4 $res
|
||||
3 (Fin(0)|Fin(1)) & Fin(2), 3 (Fin(0) & Fin(2)) | (Fin(1) & Fin(2))
|
||||
EOF
|
||||
|
||||
while IFS=, read a b
|
||||
do
|
||||
(cat header; echo 'Acceptance:' $a; cat body) |
|
||||
../../bin/autfilt -H --dnf-acc --stats '%A %G, %a %g'
|
||||
done < acceptances > output
|
||||
|
||||
diff acceptances output
|
||||
|
||||
#------------- CNF -------------
|
||||
|
||||
res="(Fin(2) | Inf(1)) & (Fin(1) | Inf(3)) & Inf(0)"
|
||||
cat >acceptances<<EOF
|
||||
2 Inf(0)&Inf(1), 2 Inf(0)&Inf(1)
|
||||
2 Fin(0) & Inf(1), 2 Fin(0) & Inf(1)
|
||||
2 t, 2 t
|
||||
2 f, 2 f
|
||||
3 (Inf(1) | Fin(2)) & Inf(0), 3 (Fin(2) | Inf(1)) & Inf(0)
|
||||
4 (Fin(1) & Fin(2) & Inf(0)) | (Inf(0)&Inf(1)&Inf(3)), 4 $res
|
||||
4 $res, 4 $res
|
||||
3 (Fin(0) & Fin(2)) | (Fin(1) & Fin(2)), 3 (Fin(0)|Fin(1)) & Fin(2)
|
||||
EOF
|
||||
|
||||
while IFS=, read a b
|
||||
do
|
||||
(cat header; echo 'Acceptance:' $a; cat body) |
|
||||
../../bin/autfilt -H --cnf-acc --stats '%A %G, %a %g'
|
||||
done < acceptances > output
|
||||
|
||||
diff acceptances output
|
||||
|
||||
#------------- COMP -------------
|
||||
|
||||
a="(Inf(1) | Fin(2)) & (Fin(1) | Inf(3)) & Inf(0)"
|
||||
b="(Fin(1) & Inf(2)) | (Fin(3) & Inf(1)) | Fin(0)"
|
||||
cat >acceptances<<EOF
|
||||
2 Inf(0)&Inf(1), 2 Fin(0)|Fin(1)
|
||||
2 Fin(0) & Inf(1), 2 Inf(0) | Fin(1)
|
||||
2 t, 2 f
|
||||
2 f, 2 t
|
||||
3 (Inf(1) | Fin(2)) & Inf(0), 3 (Fin(1) & Inf(2)) | Fin(0)
|
||||
4 $a, 4 $b
|
||||
4 $b, 4 (Inf(1) | Fin(2)) & (Inf(3) | Fin(1)) & Inf(0)
|
||||
3 (Fin(0)|Fin(1)) & Fin(2), 3 (Inf(0)&Inf(1)) | Inf(2)
|
||||
EOF
|
||||
|
||||
while IFS=, read a b
|
||||
do
|
||||
(cat header; echo 'Acceptance:' $a; cat body) |
|
||||
../../bin/autfilt -H --complement-acc --stats '%A %G, %a %g'
|
||||
done < acceptances > output
|
||||
|
||||
diff acceptances output
|
||||
48
tests/babiak.test
Executable file
48
tests/babiak.test
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2011, 2012, 2013 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# While running some benchmark, Tomáš Babiak found that Spot took too
|
||||
# much time (i.e. >1h) to translate those six formulae. It turns out
|
||||
# that the WDBA minimization was performed after the degeneralization
|
||||
# algorithm, while this is not necessary (WDBA will produce a BA, so
|
||||
# we may as well skip degeneralization). Translating these formulae
|
||||
# in the test-suite ensure that they don't take too much time (the
|
||||
# buildfarm will timeout if it does).
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >formulae <<EOF
|
||||
(p6 V X(G(F(F(X X(F X(F((G X F p1)|((F p5)U p1))))U((F p4)&(!p2|(G p0))))))))
|
||||
(F((G 1)&(!p6 V X!p2)))V((F((G X(!p1 V!p3))V F!p2))U(X((G p3)U(p6 U p7))V X p5))
|
||||
(((F p0)V((F p3)&!p4))V((((!p0|!p5)V X!p5)V p6)U(p5|(!p3 U(G(p1 U p2))))))
|
||||
(G(((F((p3 &!p3)|(G((G!p2)V!p5))))|(p1 V!p4))U((X(G((F!p0)U!p6))U X!p2)|!p7)))
|
||||
X((X(!p1 V F!p6)V F!p4)U p2)&(F(G((0 U(F p6))U((p1 U(G(p4 U F p0)))U X p7))))
|
||||
(G(G(((F p5)U((((F!p1)V(p2 &!p4))|!p2)|((X!p7 U!p4)V(F(F((G p2)&p5))))))U p6)))
|
||||
EOF
|
||||
|
||||
ltl2tgba=../ikwiad
|
||||
|
||||
../../bin/ltlcross <formulae \
|
||||
"$ltl2tgba -t %f >%T" \
|
||||
"$ltl2tgba -N -r4 -R3f %f >%N" \
|
||||
"$ltl2tgba -N -r7 -R3 -x -Rm %f >%N" \
|
||||
"$ltl2tgba -t -r7 -R3 -f -x -DS -Rm %f >%T"
|
||||
33
tests/bare.test
Executable file
33
tests/bare.test
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
test "`../../bin/ltlfilt -p -f 'GFP_0.b_c'`" = "G(F(P_0.b_c))"
|
||||
test "`../../bin/ltlfilt -f 'GFP_0.b_c'`" = "GFP_0.b_c"
|
||||
foo=`../../bin/ltlfilt -p -f 'GF"P_0.b_c"'`
|
||||
test "$foo" = "G(F(P_0.b_c))"
|
||||
|
||||
foo=`../../bin/ltlfilt -p -f '"a.b" U c.d.e'`
|
||||
test "$foo" = "(a.b) U (c.d.e)"
|
||||
|
||||
foo=`../../bin/ltlfilt -f '"a.b" U c.d.e'`
|
||||
test "$foo" = "a.b U c.d.e"
|
||||
74
tests/basimul.test
Executable file
74
tests/basimul.test
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2014 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
|
||||
|
||||
# This bug was found while working on the state-based acceptance
|
||||
# output for the LBTT format. Using ba-simul=2 causes reverse
|
||||
# simulation to be applied to the BA automaton obtained after
|
||||
# degeneralization. Unfortunately in Spot 1.1, reverse simulation is
|
||||
# only implemented on TGBA, and when applied to a TGBA that is a BA,
|
||||
# it may merge one state that is accepting with one state that is not
|
||||
# accepting, just because they have the same incoming transitions.
|
||||
# (Applying direct simulation on a TGBA that is a BA is not a problem,
|
||||
# since an accepting state will never have the same outgoing
|
||||
# transitions as a BA.)
|
||||
|
||||
# In previous tests, we did not notice the bug because the --lbtt
|
||||
# output was always using transition-based acceptance (the equivalent
|
||||
# of --lbtt=t today), so the result of the reverse-simulation on the
|
||||
# BA was output as a TGBA with a single acceptance set, and some state
|
||||
# had both accepting and non-accepting transitions because of the
|
||||
# merge. Unfortunately, this is not a Büchi automaton. Using the
|
||||
# --spin output, or the new (state-based) --lbtt output highlights the
|
||||
# bug.
|
||||
|
||||
# In the cases below, the following configurations used to fail
|
||||
# cross-comparison with the other "sane" configurations, at least
|
||||
# with the first formula. (The other three formulas were added because
|
||||
# they also triggered related issues while debugging the first one.)
|
||||
# --lbtt -x ba-simul=2
|
||||
# --lbtt -x ba-simul=3
|
||||
# --spin -x ba-simul=2
|
||||
# --spin -x ba-simul=3
|
||||
|
||||
../../bin/ltlcross --seed=0 --products=5 --json=out.json \
|
||||
-f 'X((F(Xa | b) W c) U (Xc W (a & d)))' \
|
||||
-f '((<> p5 V ((p0 U p1) <-> (p5 \/ p1))) -> ((<> p4 V p2) M p2))' \
|
||||
-f '!p2 & (Fp5 R (((p0 U p1) & (p5 | p1)) | (!p5 & (!p0 R !p1))))' \
|
||||
-f '! ((p0 /\ p4) <-> ! ((! p0 U (p0 W p4)) /\ (X p5 -> ([] p3 /\ p5))))' \
|
||||
-f '(X <> (<> X p0 /\ X (p5 <-> p0)) W (p3 W p0))' \
|
||||
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=0 %f >%T" \
|
||||
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=1 %f >%T" \
|
||||
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=2 %f >%T" \
|
||||
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=3 %f >%T" \
|
||||
"$ltl2tgba --ba --high --lbtt -x ba-simul=0 %f >%T" \
|
||||
"$ltl2tgba --ba --high --lbtt -x ba-simul=1 %f >%T" \
|
||||
"$ltl2tgba --ba --high --lbtt -x ba-simul=2 %f >%T" \
|
||||
"$ltl2tgba --ba --high --lbtt -x ba-simul=3 %f >%T" \
|
||||
"$ltl2tgba --ba --high --spin -x ba-simul=0 %f >%N" \
|
||||
"$ltl2tgba --ba --high --spin -x ba-simul=1 %f >%N" \
|
||||
"$ltl2tgba --ba --high --spin -x ba-simul=2 %f >%N" \
|
||||
"$ltl2tgba --ba --high --spin -x ba-simul=3 %f >%N"
|
||||
136
tests/bitvect.cc
Normal file
136
tests/bitvect.cc
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <spot/misc/bitvect.hh>
|
||||
|
||||
static void ruler()
|
||||
{
|
||||
std::cout << "\n ";
|
||||
for (size_t x = 0; x < 76; ++x)
|
||||
if (x % 10 == 0)
|
||||
std::cout << x / 10;
|
||||
else
|
||||
std::cout << '_';
|
||||
std::cout << "\n ";
|
||||
for (size_t x = 0; x < 76; ++x)
|
||||
std::cout << x % 10;
|
||||
std::cout << "\n\n";
|
||||
}
|
||||
|
||||
#define ECHO(name) std::cout << #name": " << *name << '\n'
|
||||
|
||||
int main()
|
||||
{
|
||||
ruler();
|
||||
spot::bitvect* v = spot::make_bitvect(15);
|
||||
ECHO(v);
|
||||
v->set(10);
|
||||
v->set(7);
|
||||
v->set(12);
|
||||
ECHO(v);
|
||||
|
||||
ruler();
|
||||
spot::bitvect* w = spot::make_bitvect(42);
|
||||
w->set(30);
|
||||
w->set(41);
|
||||
w->set(13);
|
||||
w->set(7);
|
||||
ECHO(w);
|
||||
*w ^= *v;
|
||||
ECHO(w);
|
||||
|
||||
ruler();
|
||||
spot::bitvect* x = spot::make_bitvect(75);
|
||||
x->set(70);
|
||||
x->set(60);
|
||||
ECHO(x);
|
||||
*x |= *w;
|
||||
ECHO(x);
|
||||
|
||||
std::cout << "subset? " << w->is_subset_of(*x)
|
||||
<< ' ' << v->is_subset_of(*w) << '\n';
|
||||
|
||||
for (size_t i = 0; i < 30; ++i)
|
||||
w->push_back((i & 3) == 0);
|
||||
ECHO(w);
|
||||
*x &= *w;
|
||||
ECHO(x);
|
||||
x->set_all();
|
||||
ECHO(x);
|
||||
|
||||
ruler();
|
||||
|
||||
w->push_back(0x09, 4);
|
||||
ECHO(w);
|
||||
spot::bitvect* y = w->extract_range(0, 71);
|
||||
ECHO(y);
|
||||
delete y;
|
||||
y = w->extract_range(0, 64);
|
||||
ECHO(y);
|
||||
delete y;
|
||||
y = w->extract_range(64, 75);
|
||||
ECHO(y);
|
||||
delete y;
|
||||
y = w->extract_range(0, 75);
|
||||
ECHO(y);
|
||||
delete y;
|
||||
y = w->extract_range(7, 64);
|
||||
ECHO(y);
|
||||
delete y;
|
||||
y = w->extract_range(7, 72);
|
||||
ECHO(y);
|
||||
delete y;
|
||||
|
||||
delete v;
|
||||
delete w;
|
||||
delete x;
|
||||
|
||||
ruler();
|
||||
|
||||
spot::bitvect_array* a = spot::make_bitvect_array(60, 10);
|
||||
for (size_t y = 0; y < a->size(); ++y)
|
||||
for (size_t x = 0; x < 60; ++x)
|
||||
{
|
||||
if (((x ^ y) & 3) < 2)
|
||||
a->at(y).set(x);
|
||||
}
|
||||
std::cout << *a;
|
||||
|
||||
ruler();
|
||||
|
||||
for (size_t i = 0; i < 12; ++i)
|
||||
a->at(4).push_back((i & 2) == 0);
|
||||
a->at(6) = a->at(4);
|
||||
a->at(8) = a->at(7);
|
||||
a->at(6) ^= a->at(8);
|
||||
|
||||
std::cout << *a;
|
||||
|
||||
std::cout << "Comp: "
|
||||
<< (a->at(0) == a->at(1))
|
||||
<< (a->at(0) == a->at(2))
|
||||
<< (a->at(1) != a->at(2))
|
||||
<< (a->at(0) < a->at(2))
|
||||
<< (a->at(0) > a->at(2))
|
||||
<< (a->at(3) < a->at(4))
|
||||
<< (a->at(5) > a->at(6)) << std::endl;
|
||||
|
||||
delete a;
|
||||
}
|
||||
92
tests/bitvect.test
Executable file
92
tests/bitvect.test
Executable file
|
|
@ -0,0 +1,92 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
run 0 ../bitvect | tee stderr
|
||||
cat >expected <<EOF
|
||||
|
||||
0_________1_________2_________3_________4_________5_________6_________7_____
|
||||
0123456789012345678901234567890123456789012345678901234567890123456789012345
|
||||
|
||||
v: 000000000000000
|
||||
v: 000000010010100
|
||||
|
||||
0_________1_________2_________3_________4_________5_________6_________7_____
|
||||
0123456789012345678901234567890123456789012345678901234567890123456789012345
|
||||
|
||||
w: 000000010000010000000000000000100000000001
|
||||
w: 000000000010110000000000000000100000000001
|
||||
|
||||
0_________1_________2_________3_________4_________5_________6_________7_____
|
||||
0123456789012345678901234567890123456789012345678901234567890123456789012345
|
||||
|
||||
x: 000000000000000000000000000000000000000000000000000000000000100000000010000
|
||||
x: 000000000010110000000000000000100000000001000000000000000000100000000010000
|
||||
subset? 1 0
|
||||
w: 000000000010110000000000000000100000000001100010001000100010001000100010
|
||||
x: 000000000010110000000000000000100000000001000000000000000000000000000010000
|
||||
x: 111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
|
||||
0_________1_________2_________3_________4_________5_________6_________7_____
|
||||
0123456789012345678901234567890123456789012345678901234567890123456789012345
|
||||
|
||||
w: 0000000000101100000000000000001000000000011000100010001000100010001000101001
|
||||
y: 00000000001011000000000000000010000000000110001000100010001000100010001
|
||||
y: 0000000000101100000000000000001000000000011000100010001000100010
|
||||
y: 00100010100
|
||||
y: 000000000010110000000000000000100000000001100010001000100010001000100010100
|
||||
y: 000101100000000000000001000000000011000100010001000100010
|
||||
y: 00010110000000000000000100000000001100010001000100010001000100010
|
||||
|
||||
0_________1_________2_________3_________4_________5_________6_________7_____
|
||||
0123456789012345678901234567890123456789012345678901234567890123456789012345
|
||||
|
||||
0: 110011001100110011001100110011001100110011001100110011001100
|
||||
1: 110011001100110011001100110011001100110011001100110011001100
|
||||
2: 001100110011001100110011001100110011001100110011001100110011
|
||||
3: 001100110011001100110011001100110011001100110011001100110011
|
||||
4: 110011001100110011001100110011001100110011001100110011001100
|
||||
5: 110011001100110011001100110011001100110011001100110011001100
|
||||
6: 001100110011001100110011001100110011001100110011001100110011
|
||||
7: 001100110011001100110011001100110011001100110011001100110011
|
||||
8: 110011001100110011001100110011001100110011001100110011001100
|
||||
9: 110011001100110011001100110011001100110011001100110011001100
|
||||
|
||||
0_________1_________2_________3_________4_________5_________6_________7_____
|
||||
0123456789012345678901234567890123456789012345678901234567890123456789012345
|
||||
|
||||
0: 110011001100110011001100110011001100110011001100110011001100
|
||||
1: 110011001100110011001100110011001100110011001100110011001100
|
||||
2: 001100110011001100110011001100110011001100110011001100110011
|
||||
3: 001100110011001100110011001100110011001100110011001100110011
|
||||
4: 110011001100110011001100110011001100110011001100110011001100110011001100
|
||||
5: 110011001100110011001100110011001100110011001100110011001100
|
||||
6: 111111111111111111111111111111111111111111111111111111111111110011001100
|
||||
7: 001100110011001100110011001100110011001100110011001100110011
|
||||
8: 001100110011001100110011001100110011001100110011001100110011
|
||||
9: 110011001100110011001100110011001100110011001100110011001100
|
||||
Comp: 1011010
|
||||
EOF
|
||||
|
||||
diff expected stderr
|
||||
109
tests/checkpsl.cc
Normal file
109
tests/checkpsl.cc
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/twaalgos/ltl2tgba_fm.hh>
|
||||
#include <spot/twaalgos/ltl2taa.hh>
|
||||
#include <spot/twaalgos/sccfilter.hh>
|
||||
#include <spot/twaalgos/product.hh>
|
||||
#include <spot/twaalgos/dot.hh>
|
||||
|
||||
static void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << prog << " file" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
syntax(argv[0]);
|
||||
std::ifstream input(argv[1]);
|
||||
if (!input)
|
||||
{
|
||||
std::cerr << "failed to open " << argv[1] << '\n';
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
auto d = spot::make_bdd_dict();
|
||||
|
||||
std::string s;
|
||||
unsigned line = 0;
|
||||
while (std::getline(input, s))
|
||||
{
|
||||
++line;
|
||||
std::cerr << line << ": " << s << '\n';
|
||||
if (s.empty() || s[0] == '#') // Skip comments
|
||||
continue;
|
||||
|
||||
spot::parse_error_list pe;
|
||||
auto fpos = spot::parse_infix_psl(s, pe);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, s, pe))
|
||||
return 2;
|
||||
|
||||
auto fneg = spot::formula::Not(fpos);
|
||||
|
||||
{
|
||||
auto apos = scc_filter(ltl_to_tgba_fm(fpos, d));
|
||||
auto aneg = scc_filter(ltl_to_tgba_fm(fneg, d));
|
||||
if (!spot::product(apos, aneg)->is_empty())
|
||||
{
|
||||
std::cerr << "non-empty intersection between pos and neg (FM)\n";
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto apos = scc_filter(ltl_to_tgba_fm(fpos, d, true));
|
||||
auto aneg = scc_filter(ltl_to_tgba_fm(fneg, d, true));
|
||||
if (!spot::product(apos, aneg)->is_empty())
|
||||
{
|
||||
std::cerr << "non-empty intersection between pos and neg (FM -x)\n";
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
if (fpos.is_ltl_formula())
|
||||
{
|
||||
auto apos =
|
||||
scc_filter(make_twa_graph(ltl_to_taa(fpos, d),
|
||||
spot::twa::prop_set::all()));
|
||||
auto aneg =
|
||||
scc_filter(make_twa_graph(ltl_to_taa(fneg, d),
|
||||
spot::twa::prop_set::all()));
|
||||
if (!spot::product(apos, aneg)->is_empty())
|
||||
{
|
||||
std::cerr << "non-empty intersection between pos and neg (TAA)\n";
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert(spot::fnode::instances_check());
|
||||
return 0;
|
||||
}
|
||||
227
tests/checkta.cc
Normal file
227
tests/checkta.cc
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/twaalgos/ltl2tgba_fm.hh>
|
||||
#include <spot/twaalgos/sccfilter.hh>
|
||||
#include <spot/twaalgos/degen.hh>
|
||||
#include <spot/twaalgos/stats.hh>
|
||||
#include <spot/taalgos/minimize.hh>
|
||||
#include <spot/taalgos/tgba2ta.hh>
|
||||
#include <spot/taalgos/dot.hh>
|
||||
#include <spot/taalgos/stats.hh>
|
||||
|
||||
static void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << prog << " file" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
static void
|
||||
stats(std::string title, const spot::ta_ptr& ta)
|
||||
{
|
||||
auto s = stats_reachable(ta);
|
||||
|
||||
std::cout << std::left << std::setw(20) << title << " | "
|
||||
<< std::right << std::setw(6) << s.states << " | "
|
||||
<< std::setw(6) << s.edges << " | "
|
||||
<< std::setw(6) << s.acceptance_states << '\n';
|
||||
}
|
||||
|
||||
static void
|
||||
stats(std::string title, const spot::twa_ptr& tg)
|
||||
{
|
||||
auto s = stats_reachable(tg);
|
||||
|
||||
std::cout << std::left << std::setw(20) << title << " | "
|
||||
<< std::right << std::setw(6) << s.states << " | "
|
||||
<< std::setw(6) << s.edges << " | "
|
||||
<< std::setw(6) << "XXX" << '\n';
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
syntax(argv[0]);
|
||||
std::ifstream input(argv[1]);
|
||||
if (!input)
|
||||
{
|
||||
std::cerr << "failed to open " << argv[1] << '\n';
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
auto d = spot::make_bdd_dict();
|
||||
|
||||
std::string s;
|
||||
while (std::getline(input, s))
|
||||
{
|
||||
std::cout << "in: " << s << '\n';
|
||||
if (s.empty() || s[0] == '#') // Skip comments
|
||||
continue;
|
||||
|
||||
spot::parse_error_list pe;
|
||||
auto f = spot::parse_infix_psl(s, pe);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, s, pe))
|
||||
return 2;
|
||||
|
||||
|
||||
{
|
||||
auto a = ltl_to_tgba_fm(f, d);
|
||||
bdd ap_set = atomic_prop_collect_as_bdd(f, a);
|
||||
|
||||
// run 0 ../ikwiad -TGTA -ks "$1"
|
||||
// run 0 ../ikwiad -TGTA -RT -ks "$1"
|
||||
{
|
||||
auto t = spot::tgba_to_tgta(a, ap_set);
|
||||
stats("-TGTA", t);
|
||||
stats("-TGTA -RT", minimize_tgta(t));
|
||||
}
|
||||
|
||||
{
|
||||
// run 0 ../ikwiad -TA -ks "$1"
|
||||
// run 0 ../ikwiad -TA -RT -ks "$1"
|
||||
auto t = spot::tgba_to_ta(a, ap_set,
|
||||
false, // degen (-DS)
|
||||
false, // artificial_initial_state (-in)
|
||||
false, // single_pass (-sp),
|
||||
false); // artificial_livelock (-lv)
|
||||
stats("-TA", t);
|
||||
stats("-TA -RT", minimize_ta(t));
|
||||
}
|
||||
|
||||
{
|
||||
// run 0 ../ikwiad -TA -lv -ks "$1"
|
||||
// run 0 ../ikwiad -TA -lv -RT -ks "$1"
|
||||
auto t = spot::tgba_to_ta(a, ap_set,
|
||||
false, // degen (-DS)
|
||||
false, // artificial_initial_state (-in)
|
||||
false, // single_pass (-sp),
|
||||
true); // artificial_livelock (-lv)
|
||||
stats("-TA -lv", t);
|
||||
stats("-TA -lv -RT", minimize_ta(t));
|
||||
}
|
||||
|
||||
{
|
||||
// run 0 ../ikwiad -TA -sp -ks "$1"
|
||||
// run 0 ../ikwiad -TA -sp -RT -ks "$1"
|
||||
auto t = spot::tgba_to_ta(a, ap_set,
|
||||
false, // degen (-DS)
|
||||
false, // artificial_initial_state (-in)
|
||||
true, // single_pass (-sp),
|
||||
false); // artificial_livelock (-lv)
|
||||
stats("-TA -sp", t);
|
||||
stats("-TA -sp -RT", minimize_ta(t));
|
||||
}
|
||||
|
||||
{
|
||||
// run 0 ../ikwiad -TA -lv -sp -ks "$1"
|
||||
// run 0 ../ikwiad -TA -lv -sp -RT -ks "$1"
|
||||
auto t = spot::tgba_to_ta(a, ap_set,
|
||||
false, // degen (-DS)
|
||||
false, // artificial_initial_state (-in)
|
||||
true, // single_pass (-sp),
|
||||
true); // artificial_livelock (-lv)
|
||||
stats("-TA -lv -sp", t);
|
||||
stats("-TA -lv -sp -RT", minimize_ta(t));
|
||||
}
|
||||
|
||||
a = spot::degeneralize(a);
|
||||
|
||||
{
|
||||
// run 0 ../ikwiad -TA -DS -ks "$1"
|
||||
// run 0 ../ikwiad -TA -DS -RT -ks "$1"
|
||||
auto t = spot::tgba_to_ta(a, ap_set,
|
||||
true, // degen (-DS)
|
||||
false, // artificial_initial_state (-in)
|
||||
false, // single_pass (-sp),
|
||||
false); // artificial_livelock (-lv)
|
||||
stats("-TA -DS", t);
|
||||
stats("-TA -DS -RT", minimize_ta(t));
|
||||
}
|
||||
|
||||
{
|
||||
// run 0 ../ikwiad -TA -DS -lv -ks "$1"
|
||||
// run 0 ../ikwiad -TA -DS -lv -RT -ks "$1"
|
||||
auto t = spot::tgba_to_ta(a, ap_set,
|
||||
true, // degen (-DS)
|
||||
false, // artificial_initial_state (-in)
|
||||
false, // single_pass (-sp),
|
||||
true); // artificial_livelock (-lv)
|
||||
stats("-TA -DS -lv", t);
|
||||
stats("-TA -DS -lv -RT", minimize_ta(t));
|
||||
}
|
||||
|
||||
{
|
||||
// run 0 ../ikwiad -TA -DS -sp -ks "$1"
|
||||
// run 0 ../ikwiad -TA -DS -sp -RT -ks "$1"
|
||||
auto t = spot::tgba_to_ta(a, ap_set,
|
||||
true, // degen (-DS)
|
||||
false, // artificial_initial_state (-in)
|
||||
true, // single_pass (-sp),
|
||||
false); // artificial_livelock (-lv)
|
||||
stats("-TA -DS -sp", t);
|
||||
stats("-TA -DS -sp -RT", minimize_ta(t));
|
||||
}
|
||||
|
||||
{
|
||||
// run 0 ../ikwiad -TA -DS -lv -sp -ks "$1"
|
||||
// run 0 ../ikwiad -TA -DS -lv -sp -RT -ks "$1"
|
||||
auto t = spot::tgba_to_ta(a, ap_set,
|
||||
true, // degen (-DS)
|
||||
false, // artificial_initial_state (-in)
|
||||
true, // single_pass (-sp),
|
||||
true); // artificial_livelock (-lv)
|
||||
stats("-TA -DS -lv -sp", t);
|
||||
stats("-TA -DS -lv -sp -RT", minimize_ta(t));
|
||||
}
|
||||
}
|
||||
// Some cases with -x -R3 -DS -in
|
||||
{
|
||||
auto a = spot::degeneralize(scc_filter(ltl_to_tgba_fm(f, d, true)));
|
||||
bdd ap_set = atomic_prop_collect_as_bdd(f, a);
|
||||
|
||||
{
|
||||
// run 0 ../ikwiad -x -R3 -DS -TA -in -ks "$1"
|
||||
// run 0 ../ikwiad -x -R3 -DS -TA -in -RT -ks "$1"
|
||||
auto t = spot::tgba_to_ta(a, ap_set,
|
||||
true, // degen (-DS)
|
||||
false, // artificial_initial_state (-in)
|
||||
false, // single_pass (-sp),
|
||||
true); // artificial_livelock (-lv)
|
||||
stats("-x -TA -DS -in", t);
|
||||
stats("-x -TA -DS -in -RT", minimize_ta(t));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
assert(spot::fnode::instances_check());
|
||||
return 0;
|
||||
}
|
||||
98
tests/complement.test
Executable file
98
tests/complement.test
Executable file
|
|
@ -0,0 +1,98 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
autfilt=../../bin/autfilt
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
randaut=../../bin/randaut
|
||||
|
||||
$randaut -H -A 'random 0..4' -Q1..10 -D -n 50 0..2 >aut
|
||||
run 0 $autfilt --complement -H aut >/dev/null
|
||||
|
||||
cat >in <<EOF
|
||||
HOA: v1
|
||||
States: 0
|
||||
Acceptance: 0 t
|
||||
--BODY--
|
||||
--END--
|
||||
EOF
|
||||
$autfilt --complement -H in >out
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
properties: deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
--END--
|
||||
EOF
|
||||
diff out expected
|
||||
|
||||
|
||||
$ltl2tgba -H 'GFa & GFb' Xa | $autfilt --complement -H >out
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: generalized-co-Buchi 2
|
||||
Acceptance: 2 Fin(0)|Fin(1)
|
||||
properties: trans-labels explicit-labels trans-acc complete
|
||||
properties: deterministic stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[0&1] 0 {0 1}
|
||||
[!0&!1] 0
|
||||
[!0&1] 0 {1}
|
||||
[0&!1] 0 {0}
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 1
|
||||
AP: 1 "a"
|
||||
acc-name: co-Buchi
|
||||
Acceptance: 1 Fin(0)
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
properties: deterministic terminal
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 2
|
||||
[!0] 3
|
||||
State: 1
|
||||
[t] 0
|
||||
State: 2 {0}
|
||||
[t] 2
|
||||
State: 3
|
||||
[t] 3
|
||||
--END--
|
||||
EOF
|
||||
diff out expected
|
||||
|
||||
|
||||
$ltl2tgba -H 'FGa' | $autfilt --complement 2>out && exit 1
|
||||
grep 'deterministic' out
|
||||
258
tests/complementation.cc
Normal file
258
tests/complementation.cc
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <spot/twaalgos/dot.hh>
|
||||
#include <spot/twaalgos/hoa.hh>
|
||||
#include <spot/parseaut/public.hh>
|
||||
#include <spot/twa/twaproduct.hh>
|
||||
#include <spot/twaalgos/gtec/gtec.hh>
|
||||
#include <spot/twaalgos/ltl2tgba_fm.hh>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/twaalgos/stats.hh>
|
||||
#include <spot/twaalgos/emptiness.hh>
|
||||
#include <spot/twaalgos/stats.hh>
|
||||
#include <spot/twaalgos/emptiness_stats.hh>
|
||||
#include <spot/twaalgos/degen.hh>
|
||||
|
||||
#include <spot/twa/twasafracomplement.hh>
|
||||
|
||||
static void usage(const char* prog)
|
||||
{
|
||||
std::cout << "usage: " << prog << " [options]" << std::endl;
|
||||
std::cout << "with options" << std::endl
|
||||
<< "-H Output in HOA\n"
|
||||
<< "-s buchi_automaton display the safra automaton\n"
|
||||
<< "-a buchi_automaton display the complemented automaton\n"
|
||||
<< "-astat buchi_automaton statistics for !a\n"
|
||||
<< "-fstat formula statistics for !A_f\n"
|
||||
<< "-f formula test !A_f and !A_!f\n"
|
||||
<< "-p formula print the automaton for f\n";
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char *file = nullptr;
|
||||
bool print_safra = false;
|
||||
bool print_automaton = false;
|
||||
//bool check = false;
|
||||
int return_value = 0;
|
||||
bool stats = false;
|
||||
bool formula = false;
|
||||
bool print_formula = false;
|
||||
bool save_hoa = false;
|
||||
|
||||
if (argc < 3)
|
||||
{
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (argv[i][0] == '-')
|
||||
{
|
||||
if (strcmp(argv[i] + 1, "H") == 0)
|
||||
{
|
||||
save_hoa = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i] + 1, "astat") == 0)
|
||||
{
|
||||
stats = true;
|
||||
formula = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i] + 1, "fstat") == 0)
|
||||
{
|
||||
stats = true;
|
||||
formula = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (argv[i][1])
|
||||
{
|
||||
case 's':
|
||||
print_safra = true; break;
|
||||
case 'a':
|
||||
print_automaton = true; break;
|
||||
case 'f':
|
||||
//check = true;
|
||||
break;
|
||||
case 'p':
|
||||
print_formula = true; break;
|
||||
default:
|
||||
std::cerr << "unrecognized option `-" << argv[i][1]
|
||||
<< '\'' << std::endl;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
file = argv[i];
|
||||
}
|
||||
|
||||
if (!file)
|
||||
{
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto dict = spot::make_bdd_dict();
|
||||
if (print_automaton || print_safra)
|
||||
{
|
||||
spot::environment& env(spot::default_environment::instance());
|
||||
auto h = spot::parse_aut(file, dict, env);
|
||||
if (h->format_errors(std::cerr))
|
||||
return 2;
|
||||
spot::twa_graph_ptr a = h->aut;
|
||||
|
||||
spot::twa_ptr complement = nullptr;
|
||||
|
||||
complement = spot::make_safra_complement(a);
|
||||
|
||||
if (print_automaton)
|
||||
{
|
||||
if (save_hoa)
|
||||
spot::print_hoa(std::cout, complement, nullptr);
|
||||
else
|
||||
spot::print_dot(std::cout, complement);
|
||||
}
|
||||
|
||||
if (print_safra)
|
||||
{
|
||||
auto safra_complement =
|
||||
std::dynamic_pointer_cast<spot::tgba_safra_complement>(complement);
|
||||
spot::display_safra(safra_complement);
|
||||
}
|
||||
}
|
||||
else if (print_formula)
|
||||
{
|
||||
spot::parse_error_list p1;
|
||||
auto f1 = spot::parse_infix_psl(file, p1);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, file, p1))
|
||||
return 2;
|
||||
|
||||
auto a = spot::ltl_to_tgba_fm(f1, dict);
|
||||
spot::twa_ptr complement = nullptr;
|
||||
complement = spot::make_safra_complement(a);
|
||||
|
||||
spot::print_dot(std::cout, complement);
|
||||
}
|
||||
else if (stats)
|
||||
{
|
||||
spot::twa_graph_ptr a;
|
||||
spot::formula f1 = nullptr;
|
||||
|
||||
if (formula)
|
||||
{
|
||||
spot::parse_error_list p1;
|
||||
f1 = spot::parse_infix_psl(file, p1);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, file, p1))
|
||||
return 2;
|
||||
|
||||
a = spot::ltl_to_tgba_fm(f1, dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto h = spot::parse_aut(file, dict);
|
||||
if (h->format_errors(std::cerr))
|
||||
return 2;
|
||||
a = h->aut;
|
||||
}
|
||||
|
||||
auto safra_complement = spot::make_safra_complement(a);
|
||||
|
||||
spot::twa_statistics a_size = spot::stats_reachable(a);
|
||||
std::cout << "Original: "
|
||||
<< a_size.states << ", "
|
||||
<< a_size.edges << ", "
|
||||
<< a->acc().num_sets()
|
||||
<< std::endl;
|
||||
|
||||
auto buchi = spot::degeneralize(a);
|
||||
std::cout << "Buchi: "
|
||||
<< buchi->num_states()
|
||||
<< buchi->num_edges()
|
||||
<< buchi->acc().num_sets()
|
||||
<< std::endl;
|
||||
|
||||
spot::twa_statistics b_size = spot::stats_reachable(safra_complement);
|
||||
std::cout << "Safra Complement: "
|
||||
<< b_size.states << ", "
|
||||
<< b_size.edges << ", "
|
||||
<< safra_complement->acc().num_sets()
|
||||
<< std::endl;
|
||||
|
||||
if (formula)
|
||||
{
|
||||
auto a2 = spot::ltl_to_tgba_fm(spot::formula::Not(f1), dict);
|
||||
spot::twa_statistics a_size = spot::stats_reachable(a2);
|
||||
std::cout << "Not Formula: "
|
||||
<< a_size.states << ", "
|
||||
<< a_size.edges << ", "
|
||||
<< a2->acc().num_sets()
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spot::parse_error_list p1;
|
||||
auto f1 = spot::parse_infix_psl(file, p1);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, file, p1))
|
||||
return 2;
|
||||
|
||||
auto Af = spot::ltl_to_tgba_fm(f1, dict);
|
||||
auto nf1 = spot::formula::Not(f1);
|
||||
auto Anf = spot::ltl_to_tgba_fm(nf1, dict);
|
||||
auto nAf = spot::make_safra_complement(Af);
|
||||
auto nAnf = spot::make_safra_complement(Anf);
|
||||
auto ec = spot::couvreur99(spot::otf_product(nAf, nAnf));
|
||||
auto res = ec->check();
|
||||
spot::twa_statistics a_size = spot::stats_reachable(ec->automaton());
|
||||
std::cout << "States: "
|
||||
<< a_size.states << std::endl
|
||||
<< "Transitions: "
|
||||
<< a_size.edges << std::endl
|
||||
<< "Acc Cond: "
|
||||
<< ec->automaton()->acc().num_sets()
|
||||
<< std::endl;
|
||||
if (res)
|
||||
{
|
||||
std::cout << "FAIL\n";
|
||||
return_value = 1;
|
||||
if (auto run = res->accepting_run())
|
||||
{
|
||||
spot::print_dot(std::cout, ec->automaton());
|
||||
std::cout << run;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "OK\n";
|
||||
}
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
69
tests/complementation.test
Executable file
69
tests/complementation.test
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2011, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
while read f; do
|
||||
run 0 ../complement -f "$f"
|
||||
done <<EOF
|
||||
GFa
|
||||
FGa
|
||||
<>p1->p0
|
||||
<>p1->(p0 U p1)
|
||||
[](p0-><>p3)
|
||||
a U b
|
||||
GFa&&FGa
|
||||
[] ((p2 && ! p1) -> (p0 U (p1 || [] p0)))
|
||||
[] (p2 -> ((! p0 && ! p1) U (p1 || ((p0 && ! p1) U (p1 || ((! p0 && ! p1) \
|
||||
U (p1 || ((p0 && ! p1) U ((p1 || (! p0 U (p1 || [] ! p0))) || [] p0)))))))))
|
||||
EOF
|
||||
|
||||
# The following test-case was supplied by Martin Dieguez Lodeiro to
|
||||
# demonstrate a bug in our Safra implementation.
|
||||
cat >x.hoa <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 1 "p"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
[0] 1
|
||||
State: 1
|
||||
[t] 1
|
||||
[0] 2 {0}
|
||||
State: 2
|
||||
[t] 1
|
||||
[0] 2 {0}
|
||||
--END--
|
||||
EOF
|
||||
# x.tgba accepts some run
|
||||
run 0 ../ikwiad -XH -e x.hoa
|
||||
# so does its complement
|
||||
run 0 ../complement -H -a x.hoa > nx.hoa
|
||||
run 0 ../ikwiad -XH -e nx.hoa
|
||||
# however the intersection of both should not
|
||||
# accept any run.
|
||||
run 1 ../../bin/autfilt -q nx.hoa --intersect x.hoa
|
||||
119
tests/complete.test
Executable file
119
tests/complete.test
Executable file
|
|
@ -0,0 +1,119 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
cat >automaton <<EOF
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
Acceptance: 1 Fin(0)
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
State: 1
|
||||
[0] 1
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
Acceptance: 2 t
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
State: 1
|
||||
[0] 1
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
Acceptance: 0 f
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
State: 1
|
||||
[0] 1
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
acc-name: co-Buchi
|
||||
Acceptance: 1 Fin(0)
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
properties: deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
[!0] 2
|
||||
State: 1
|
||||
[0] 1
|
||||
[!0] 2
|
||||
State: 2 {0}
|
||||
[t] 2
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
properties: deterministic
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
[0] 1
|
||||
[!0] 2
|
||||
State: 1 {0}
|
||||
[0] 1
|
||||
[!0] 2
|
||||
State: 2
|
||||
[t] 2
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
acc-name: none
|
||||
Acceptance: 0 f
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
properties: deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
[!0] 1
|
||||
State: 1
|
||||
[0] 1
|
||||
[!0] 1
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt -CH automaton >out
|
||||
cat out
|
||||
diff out expected
|
||||
78
tests/consterm.cc
Normal file
78
tests/consterm.cc
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2010, 2011, 2012, 2015 Laboratoire de Recherche et
|
||||
// Dévelopement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <spot/tl/parse.hh>
|
||||
|
||||
static void
|
||||
syntax(char *prog)
|
||||
{
|
||||
std::cerr << prog << " formula" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
syntax(argv[0]);
|
||||
|
||||
std::ifstream input(argv[1]);
|
||||
if (!input)
|
||||
{
|
||||
std::cerr << "failed to open " << argv[1] << '\n';
|
||||
return 2;
|
||||
}
|
||||
|
||||
std::string s;
|
||||
while (std::getline(input, s))
|
||||
{
|
||||
if (s[0] == '#') // Skip comments
|
||||
{
|
||||
std::cerr << s << '\n';
|
||||
continue;
|
||||
}
|
||||
std::istringstream ss(s);
|
||||
std::string form;
|
||||
bool expected;
|
||||
std::getline(ss, form, ',');
|
||||
ss >> expected;
|
||||
|
||||
spot::parse_error_list p1;
|
||||
auto f1 = spot::parse_infix_sere(form, p1);
|
||||
if (spot::format_parse_errors(std::cerr, form, p1))
|
||||
return 2;
|
||||
|
||||
bool b = f1.accepts_eword();
|
||||
std::cout << form << ',' << b << '\n';
|
||||
if (b != expected)
|
||||
{
|
||||
std::cerr << "computed '" << b
|
||||
<< "' but expected '" << expected << "'\n";
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
assert(spot::fnode::instances_check());
|
||||
return 0;
|
||||
}
|
||||
54
tests/consterm.test
Executable file
54
tests/consterm.test
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2010, 2015 Laboratoire de Recherche et Devéloppement
|
||||
# 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Check for the constant_term visitor
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
cat >input2 <<EOF
|
||||
1,0
|
||||
0,0
|
||||
[*0],1
|
||||
a*,1
|
||||
0*,1
|
||||
a[*0],1
|
||||
a[*0..],1
|
||||
a[*0..3],1
|
||||
a[*1..3],0
|
||||
a[*3],0
|
||||
a[*..4][*3],1
|
||||
a[*1..4][*3],0
|
||||
a[*1..4][*0..3],1
|
||||
((a ; b) + c),0
|
||||
((a ; b) + [*0]),1
|
||||
((a ; b) + [*0]) & e,0
|
||||
((a ; b) + [*0]) & [*0],1
|
||||
((a ; b) + [*0]) & (a* + b),1
|
||||
# test braces
|
||||
{{a ; b} + {[*0]}} & {a* + b},1
|
||||
(a + [*0]);(b + [*0]);(c + [*0]),1
|
||||
(a + [*0]);(b + e);(c + [*0]),0
|
||||
(a + [*0]);(b + e)*;(c + [*0]),1
|
||||
EOF
|
||||
|
||||
run 0 ../consterm input2
|
||||
74
tests/cycles.test
Executable file
74
tests/cycles.test
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
# Fig.1 from Johnson's SIAM J. Comput. 1975 paper.
|
||||
cat >johnson-fig1.hoa <<EOF
|
||||
HOA: v1
|
||||
States: 12
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 1
|
||||
[t] 3
|
||||
[t] 4
|
||||
State: 1
|
||||
[t] 2
|
||||
State: 2
|
||||
[t] 5
|
||||
[t] 6
|
||||
State: 3
|
||||
[t] 2
|
||||
State: 4
|
||||
[t] 2
|
||||
State: 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
State: 6
|
||||
[t] 8
|
||||
[t] 10
|
||||
[t] 11
|
||||
State: 7
|
||||
[t] 0
|
||||
[t] 6
|
||||
State: 8
|
||||
[t] 2
|
||||
[t] 9
|
||||
State: 9
|
||||
[t] 6
|
||||
State: 10
|
||||
[t] 9
|
||||
State: 11
|
||||
[t] 9
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -KC -XH johnson-fig1.hoa > out
|
||||
test `wc -l < out` -eq 10
|
||||
|
||||
run 0 ../ikwiad -KW '(Ga -> Gb) W c' > out
|
||||
test `grep 'is weak' out | wc -l` -eq 4
|
||||
test `grep 'is not weak' out | wc -l` -eq 1
|
||||
59
tests/dbacomp.test
Executable file
59
tests/dbacomp.test
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
# This automaton used to trigger a bug in the complementation: its
|
||||
# intersection with the complement was not empty!
|
||||
cat >input.hoa <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 4 "a" "d" "b" "c"
|
||||
acc-name: generalized-Buchi 3
|
||||
Acceptance: 3 Inf(0)&Inf(1)&Inf(2)
|
||||
properties: trans-labels explicit-labels trans-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0&1 | 0&2] 0 {1 2}
|
||||
[!0&1 | !0&2] 0 {0 1 2}
|
||||
[0&!1&!2&!3] 1
|
||||
[!0&!1&!2&!3] 1 {0}
|
||||
State: 1
|
||||
[0&2&3] 0 {1 2}
|
||||
[!0&2&3] 0 {0 1 2}
|
||||
[0&!2&!3] 1
|
||||
[!0&!2&!3] 1 {0}
|
||||
[0&2&!3] 2 {1}
|
||||
[!0&2&!3] 2 {0 1}
|
||||
State: 2
|
||||
[0&1&3 | 0&2&3] 0 {1 2}
|
||||
[!0&1&3 | !0&2&3] 0 {0 1 2}
|
||||
[0&!1&!2&!3] 1
|
||||
[!0&!1&!2&!3] 1 {0}
|
||||
[0&1&!3 | 0&2&!3] 2 {1}
|
||||
[!0&1&!3 | !0&2&!3] 2 {0 1}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
# Check emptiness of product with complement.
|
||||
run 0 ../ikwiad -H -DC -C -XH input.hoa > output.hoa
|
||||
run 1 ../../bin/autfilt -q input.hoa --intersect output.hoa
|
||||
100
tests/defs.in
Normal file
100
tests/defs.in
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
# -*- mode: shell-script; coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2012, 2013, 2015 Laboratoire de Recherche
|
||||
# et Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004, 2006 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 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
|
||||
# $srcdir to point to the source directory corresponding to the build
|
||||
# directory that contains $testSubDir.
|
||||
case $srcdir in
|
||||
[\\/$]* | ?:[\\/]* );;
|
||||
*) srcdir=../$srcdir
|
||||
esac
|
||||
|
||||
DOT='@DOT@'
|
||||
top_builddir='../@top_builddir@'
|
||||
LBTT="@LBTT@"
|
||||
LBTT_TRANSLATE="@LBTT_TRANSLATE@"
|
||||
VALGRIND='@VALGRIND@'
|
||||
SPIN='@SPIN@'
|
||||
LTL2BA='@LTL2BA@'
|
||||
PYTHON='@PYTHON@'
|
||||
top_srcdir='../@top_srcdir@'
|
||||
|
||||
# The test cases assume these variable are undefined
|
||||
unset SPOT_DOTEXTRA
|
||||
unset SPOT_DOTDEFAULT
|
||||
|
||||
need_lbtt()
|
||||
{
|
||||
# LBTT may not have been installed or compiled.
|
||||
("$LBTT" --version) || exit 77
|
||||
}
|
||||
|
||||
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
|
||||
38
tests/degendet.test
Executable file
38
tests/degendet.test
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2011, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# The following command, reported by Tomáš Babiak, used to output many
|
||||
# different automata, because state addresses were used to order the
|
||||
# successors in the degeneralization.
|
||||
|
||||
# Make sure all these runs output the same automaton.
|
||||
|
||||
# With valgrind
|
||||
run 0 ../ikwiad -r7 -x -R3 -N "XF(Gp2 | F(p0 U (p1 & (! p4 | p3))))" > out1
|
||||
# Without valgrind
|
||||
for i in 2 3 4 5; do
|
||||
../ikwiad -r7 -x -R3 -N "XF(Gp2 | F(p0 U (p1 & (! p4 | p3))))" > out
|
||||
cmp out out1 || exit 1
|
||||
done
|
||||
256
tests/degenid.test
Executable file
256
tests/degenid.test
Executable file
|
|
@ -0,0 +1,256 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2011, 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# Make sure degeneralization is idempotent
|
||||
|
||||
for f in 'FGa|GFb' 'GFa & GFb & GFc' 'GF(a->FGb)&GF(c->FGd)'; do
|
||||
for opt in -DS -DT; do
|
||||
../ikwiad $opt -H "$f" > autX.spot
|
||||
../ikwiad -XH -kt autX.spot > base.size
|
||||
cat base.size
|
||||
for x in X XX XXX; do
|
||||
../ikwiad -XH $opt -H aut$x.spot > autX$x.spot
|
||||
../ikwiad -XH -kt autX$x.spot > new.size
|
||||
cat new.size
|
||||
cmp base.size new.size
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
# This is another 6-state degeneralized automaton that
|
||||
# we used the "redegeneralize" to a 8-state BA...
|
||||
cat > bug <<EOF
|
||||
HOA: v1
|
||||
States: 6
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
[!0 | !1] 1
|
||||
[0&1] 2
|
||||
State: 1 {0}
|
||||
[!0&1] 1
|
||||
[!0&!1] 3
|
||||
[0] 4
|
||||
State: 2
|
||||
[0&!1] 0
|
||||
[!0&!1] 1
|
||||
[0&1] 2
|
||||
[!0&1] 5
|
||||
State: 3
|
||||
[0&1] 0
|
||||
[!0&1] 1
|
||||
[!0&!1] 3
|
||||
[0&!1] 4
|
||||
State: 4
|
||||
[1] 0
|
||||
[0&!1] 2
|
||||
[!0&!1] 5
|
||||
State: 5
|
||||
[!1] 0
|
||||
[!0&1] 3
|
||||
[0&1] 4
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -ks -XH -DS bug > out
|
||||
grep 'states: 6' out
|
||||
|
||||
|
||||
# This 8-state degeneralized automaton used
|
||||
# to be "degeneralized" to a 9-state BA...
|
||||
cat > bug2 <<EOF
|
||||
HOA: v1
|
||||
States: 8
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 1
|
||||
State: 1 {0}
|
||||
[t] 2
|
||||
State: 2
|
||||
[0&!1] 2
|
||||
[0&1] 3
|
||||
[!0&!1] 4
|
||||
[!0&1] 5
|
||||
State: 3 {0}
|
||||
[0] 2
|
||||
[!0] 4
|
||||
State: 4
|
||||
[0&!1] 2
|
||||
[0&1] 3
|
||||
[!0&1] 5
|
||||
[!0&!1] 6
|
||||
State: 5 {0}
|
||||
[0&!1] 2
|
||||
[0&1] 3
|
||||
[!0&1] 5
|
||||
[!0&!1] 6
|
||||
State: 6
|
||||
[0&!1] 2
|
||||
[0&1] 3
|
||||
[!0&!1] 6
|
||||
[!0&1] 7
|
||||
State: 7
|
||||
[0] 3
|
||||
[!0] 7
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -ks -XH -DS bug2 >out
|
||||
grep 'states: 8' out
|
||||
|
||||
|
||||
# This automaton should have a 3-state BA, but it's really
|
||||
# easy to obtain a 4-state BA when tweaking the degeneralization
|
||||
# to ignore arc entering an SCC.
|
||||
test 3 = "`../../bin/ltl2tgba -B 'G(a|G(b|Fc))' --stats=%s`"
|
||||
|
||||
|
||||
# This 7-state DRA (built with
|
||||
# ltlfilt -f 'F(a & GFb) | (Fc & Fa & F(c & GF!b))' -l |
|
||||
# ltl2dstar --ltl2nba=spin:ltl2tgba@-sD - -
|
||||
# should be converted in into a 5-state DBA.
|
||||
cat >in.dra <<EOF
|
||||
DRA v2 explicit
|
||||
Comment: "Union{Safra[NBA=3],Safra[NBA=5]}"
|
||||
States: 7
|
||||
Acceptance-Pairs: 2
|
||||
Start: 5
|
||||
AP: 3 "a" "b" "c"
|
||||
---
|
||||
State: 0
|
||||
Acc-Sig: +0 +1
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
State: 1
|
||||
Acc-Sig: +1
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
State: 2
|
||||
Acc-Sig: +0
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
State: 3
|
||||
Acc-Sig: +0
|
||||
6
|
||||
6
|
||||
3
|
||||
3
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
State: 4
|
||||
Acc-Sig:
|
||||
4
|
||||
0
|
||||
4
|
||||
0
|
||||
4
|
||||
0
|
||||
4
|
||||
0
|
||||
State: 5
|
||||
Acc-Sig:
|
||||
5
|
||||
3
|
||||
5
|
||||
3
|
||||
4
|
||||
0
|
||||
4
|
||||
0
|
||||
State: 6
|
||||
Acc-Sig:
|
||||
6
|
||||
6
|
||||
3
|
||||
3
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/dstar2tgba in.dra -BD --stats=%s > out.stat
|
||||
test 5 = "`cat out.stat`"
|
||||
|
||||
# Only one state should be accepting. In spot 1.2.x an initial state
|
||||
# in a trivial SCC was marked as accepting: this is superfluous.
|
||||
../../bin/ltl2tgba -BH 'a & GFb & GFc' > out
|
||||
cat out
|
||||
cat >expected<<EOF
|
||||
HOA: v1
|
||||
name: "a & G(Fb & Fc)"
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
properties: stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
State: 1 {0}
|
||||
[1&2] 1
|
||||
[!1&2] 2
|
||||
[!2] 3
|
||||
State: 2
|
||||
[1] 1
|
||||
[!1] 2
|
||||
State: 3
|
||||
[1&2] 1
|
||||
[!1&2] 2
|
||||
[!2] 3
|
||||
--END--
|
||||
EOF
|
||||
diff out expected
|
||||
134
tests/degenlskip.test
Executable file
134
tests/degenlskip.test
Executable file
|
|
@ -0,0 +1,134 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# Make sure degen-skip=0 and degen-skip=1 produce the expected
|
||||
# automata for 'GFa & GFb'
|
||||
|
||||
../../bin/ltl2tgba -B 'GFa & GFb' --hoa > out1
|
||||
../../bin/ltl2tgba -B -x degen-lskip=1 'GFa & GFb' --hoa > out2
|
||||
../../bin/ltl2tgba -B -x degen-lskip=0 'GFa & GFb' --hoa > out3
|
||||
../../bin/ltl2tgba -B -x degen-lskip=1,degen-lowinit=1 'GFa & GFb' --hoa > out4
|
||||
../../bin/ltl2tgba -B -x degen-lskip=0,degen-lowinit=1 'GFa & GFb' --hoa > out5
|
||||
|
||||
diff out1 out2
|
||||
cmp out2 out3 && exit 1
|
||||
|
||||
cat <<EOF >expected2
|
||||
HOA: v1
|
||||
name: "G(Fa & Fb)"
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
[0&1] 0
|
||||
[!1] 1
|
||||
[!0&1] 2
|
||||
State: 1
|
||||
[0&1] 0
|
||||
[!1] 1
|
||||
[!0&1] 2
|
||||
State: 2
|
||||
[0] 0
|
||||
[!0] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
|
||||
cat <<EOF >expected3
|
||||
HOA: v1
|
||||
name: "G(Fa & Fb)"
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
[t] 1
|
||||
State: 1
|
||||
[!1] 1
|
||||
[1] 2
|
||||
State: 2
|
||||
[0] 0
|
||||
[!0] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat <<EOF >expected4
|
||||
HOA: v1
|
||||
name: "G(Fa & Fb)"
|
||||
States: 3
|
||||
Start: 1
|
||||
AP: 2 "a" "b"
|
||||
Acceptance: 1 Inf(0)
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
[0&1] 0
|
||||
[!1] 1
|
||||
[!0&1] 2
|
||||
State: 1
|
||||
[0&1] 0
|
||||
[!1] 1
|
||||
[!0&1] 2
|
||||
State: 2
|
||||
[0] 0
|
||||
[!0] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat <<EOF >expected5
|
||||
HOA: v1
|
||||
name: "G(Fa & Fb)"
|
||||
States: 3
|
||||
Start: 2
|
||||
AP: 2 "a" "b"
|
||||
Acceptance: 1 Inf(0)
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
[t] 2
|
||||
State: 1
|
||||
[0] 0
|
||||
[!0] 1
|
||||
State: 2
|
||||
[1] 1
|
||||
[!1] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
|
||||
run 0 ../../bin/autfilt -q -F out2 --isomorph expected2
|
||||
run 0 ../../bin/autfilt -q -F out3 --isomorph expected3
|
||||
|
||||
cat out4 out5
|
||||
|
||||
../../bin/autfilt -q out4 --isomorph expected2 && exit 1
|
||||
../../bin/autfilt -q out5 --isomorph expected3 && exit 1
|
||||
|
||||
../../bin/autfilt -q out4 --isomorph expected4
|
||||
../../bin/autfilt -q out5 --isomorph expected5
|
||||
161
tests/det.test
Executable file
161
tests/det.test
Executable file
|
|
@ -0,0 +1,161 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
|
||||
cat >formulas <<'EOF'
|
||||
1,13,X((a M F((!b & !c) | (b & c))) W (G!c U b))
|
||||
1,5,X(((a & b) R (!a U !c)) R b)
|
||||
1,9,XXG(Fa U Xb)
|
||||
1,5,(!a M !b) W F!c
|
||||
1,3,(b & Fa & GFc) R a
|
||||
1,2,(a R (b W a)) W G(!a M (b | c))
|
||||
1,11,(Fa W b) R (!a | Fc)
|
||||
1,7,X(G(!a M !b) | G(a | G!a))
|
||||
1,2,Fa W Gb
|
||||
1,3,Ga | GFb
|
||||
1,9,G((G!a & ((!b & X!c) | (b & Xc))) | (Fa & ((!b & Xc) | (b & X!c))))
|
||||
1,5,a M G(F!b | X!a)
|
||||
1,4,G!a R XFb
|
||||
1,4,XF(!a | GFb)
|
||||
1,6,G(F!a U !a) U Xa
|
||||
1,5,(a | G(a M !b)) W Fc
|
||||
1,6,Fa W Xb
|
||||
1,10,X(a R ((!b & F!c) M X!a))
|
||||
1,2,XG!a R Fb
|
||||
1,4,GFc | (a & Fb)
|
||||
1,6,X(a R (Fb R F!b))
|
||||
1,2,G(Xa M Fa)
|
||||
1,4,X(Gb | GFa)
|
||||
1,9,X(Gc | XG((b & Ga) | (!b & F!a)))
|
||||
1,2,Ga R Fb
|
||||
1,3,G(a U (b | X((!a & !c) | (a & c))))
|
||||
1,5,XG((G!a & F!b) | (Fa & (a | Gb)))
|
||||
1,10,(a U X!a) | XG(!b & XFc)
|
||||
1,4,X(G!a | GFa)
|
||||
1,4,G(G!a | F!c | G!b)
|
||||
EOF
|
||||
|
||||
$ltl2tgba -x tba-det --det --stats '%d,%s,%f' -F formulas/3 > out
|
||||
diff formulas out
|
||||
|
||||
cat >in.hoa <<'EOF'
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[!0] 0
|
||||
[0] 1 {0}
|
||||
State: 1
|
||||
[!0] 0
|
||||
[0] 2 {0}
|
||||
State: 2
|
||||
[!0] 0
|
||||
[0] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >ex.hoa <<'EOF'
|
||||
HOA: v1
|
||||
States: 5
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc inherently-weak
|
||||
--BODY--
|
||||
State: 0
|
||||
[!0] 0
|
||||
[0] 1
|
||||
[!0] 3
|
||||
State: 1
|
||||
[!0] 0
|
||||
[0] 2
|
||||
[!0] 3
|
||||
State: 2
|
||||
[!0] 0
|
||||
[0] 2
|
||||
[!0] 3
|
||||
[0] 4
|
||||
State: 3 {0}
|
||||
[!0] 3
|
||||
State: 4 {0}
|
||||
[!0] 3
|
||||
[0] 4
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -H -DC -XH in.hoa > out.hoa
|
||||
run 1 ../../bin/autfilt -q --are-isomorph in.hoa out.hoa
|
||||
run 0 ../../bin/autfilt -q --are-isomorph ex.hoa out.hoa
|
||||
|
||||
run 0 ../ikwiad -x -DC 'GFa & XGFb' > out.tgba
|
||||
cat >ex.tgba <<EOF
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 0
|
||||
0 [label="0"]
|
||||
0 -> 1 [label="1"]
|
||||
1 [label="1"]
|
||||
1 -> 1 [label="1"]
|
||||
1 -> 2 [label="!a"]
|
||||
1 -> 3 [label="!b"]
|
||||
2 [label="2", peripheries=2]
|
||||
2 -> 2 [label="!a"]
|
||||
3 [label="3", peripheries=2]
|
||||
3 -> 3 [label="!b"]
|
||||
}
|
||||
EOF
|
||||
diff out.tgba ex.tgba
|
||||
|
||||
|
||||
# This formula produce a co-deterministic automaton that is not deterministic,
|
||||
# and a bug in the cosimulation caused the result to be marked as deterministic.
|
||||
run 0 ../../bin/ltl2tgba -H '(0 R Xa) R (a xor Fa)' > out.hoa
|
||||
grep deterministic out.hoa && exit 1
|
||||
|
||||
|
||||
# These highlighted a bug in the bitvector routines because their
|
||||
# state count is a multiple of 64.
|
||||
cat >input <<EOF
|
||||
G(!a | Xa),2
|
||||
G(!a | XXa),4
|
||||
G(!a | XXXa),8
|
||||
G(!a | XXXXa),16
|
||||
G(!a | XXXXXa),32
|
||||
G(!a | XXXXXXa),64
|
||||
G(!a | XXXXXXXa),128
|
||||
G(!a | XXXXXXXXa),256
|
||||
EOF
|
||||
run 0 ../../bin/ltl2tgba -D -F input/1 --stats='%f,%s' > output
|
||||
cat output
|
||||
diff input output
|
||||
|
||||
true
|
||||
243
tests/dfs.test
Executable file
243
tests/dfs.test
Executable file
|
|
@ -0,0 +1,243 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2015 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004, 2005 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# All examples are TBA (i.e. they have a unique
|
||||
# acceptance condition). Accepting arcs are
|
||||
# represented by double arrows.
|
||||
#
|
||||
# s1=>s2->s3->(large composant from s4 to s9)
|
||||
# ^ |
|
||||
# |_______|
|
||||
|
||||
cat >blue_counter <<'EOF'
|
||||
HOA: v1
|
||||
States: 9
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
[t] 1
|
||||
State: 1
|
||||
[t] 2
|
||||
State: 2
|
||||
[t] 0
|
||||
[t] 3
|
||||
State: 3
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 4
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 5
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 6
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 7
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 8
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -CR -eSE05 -XH blue_counter
|
||||
run 0 ../ikwiad -CR -eTau03_opt -XH blue_counter
|
||||
|
||||
# s1->s2->s3->(large composant from s4 to s9)
|
||||
# ^ ||
|
||||
# ||______||
|
||||
# ||______||
|
||||
|
||||
cat >blue_last <<'EOF'
|
||||
HOA: v1
|
||||
States: 9
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 1
|
||||
State: 1
|
||||
[t] 2
|
||||
State: 2
|
||||
[t] 0 {0}
|
||||
[t] 3
|
||||
State: 3
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 4
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 5
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 6
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 7
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 8
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -CR -eSE05 -XH blue_last
|
||||
run 0 ../ikwiad -CR -eTau03_opt -XH blue_last
|
||||
|
||||
# _______
|
||||
# | |
|
||||
# | v
|
||||
# s1->s2->s3->(large composant from s4 to s9)
|
||||
# || ^
|
||||
# ||______||
|
||||
# ||______||
|
||||
|
||||
cat >red <<'EOF'
|
||||
HOA: v1
|
||||
States: 9
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 1
|
||||
[t] 2 {0}
|
||||
State: 1
|
||||
[t] 2
|
||||
State: 2
|
||||
[t] 0
|
||||
[t] 3
|
||||
State: 3
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 4
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 5
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 6
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 7
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
State: 8
|
||||
[t] 3
|
||||
[t] 4
|
||||
[t] 5
|
||||
[t] 6
|
||||
[t] 7
|
||||
[t] 8
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -CR -eSE05 -XH red
|
||||
run 0 ../ikwiad -CR -eTau03_opt -XH red
|
||||
|
||||
rm -f red blue_counter blue_last
|
||||
333
tests/dra2dba.test
Executable file
333
tests/dra2dba.test
Executable file
|
|
@ -0,0 +1,333 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# This failure to produce a deterministic automaton was noticed by
|
||||
# Alexandre Lewkowicz.
|
||||
|
||||
# The following is the output of
|
||||
# ltlfilt -f 'G(F!a | (Fb U c))' -l |
|
||||
# ltl2dstar --ltl2nba=spin:$HOME/usr/bin/ltl2tgba@-s - -
|
||||
|
||||
cat > in.dra <<EOF
|
||||
DRA v2 explicit
|
||||
Comment: "Safra[NBA=8]"
|
||||
States: 29
|
||||
Acceptance-Pairs: 3
|
||||
Start: 7
|
||||
AP: 3 "a" "b" "c"
|
||||
---
|
||||
State: 0
|
||||
Acc-Sig: -2
|
||||
21
|
||||
0
|
||||
20
|
||||
1
|
||||
15
|
||||
4
|
||||
13
|
||||
22
|
||||
State: 1
|
||||
Acc-Sig: -2
|
||||
21
|
||||
0
|
||||
20
|
||||
1
|
||||
13
|
||||
22
|
||||
13
|
||||
22
|
||||
State: 2
|
||||
Acc-Sig: -2
|
||||
15
|
||||
3
|
||||
13
|
||||
12
|
||||
15
|
||||
2
|
||||
13
|
||||
14
|
||||
State: 3
|
||||
Acc-Sig: -2
|
||||
16
|
||||
3
|
||||
20
|
||||
12
|
||||
15
|
||||
2
|
||||
13
|
||||
14
|
||||
State: 4
|
||||
Acc-Sig: -2
|
||||
15
|
||||
3
|
||||
13
|
||||
12
|
||||
15
|
||||
4
|
||||
13
|
||||
22
|
||||
State: 5
|
||||
Acc-Sig: -2
|
||||
15
|
||||
17
|
||||
13
|
||||
12
|
||||
15
|
||||
5
|
||||
13
|
||||
14
|
||||
State: 6
|
||||
Acc-Sig: -2
|
||||
28
|
||||
6
|
||||
20
|
||||
18
|
||||
15
|
||||
5
|
||||
13
|
||||
14
|
||||
State: 7
|
||||
Acc-Sig: -1 -2
|
||||
13
|
||||
19
|
||||
13
|
||||
18
|
||||
13
|
||||
13
|
||||
13
|
||||
13
|
||||
State: 8
|
||||
Acc-Sig: -1 -2
|
||||
23
|
||||
9
|
||||
13
|
||||
1
|
||||
23
|
||||
8
|
||||
13
|
||||
22
|
||||
State: 9
|
||||
Acc-Sig: -1 -2
|
||||
24
|
||||
9
|
||||
20
|
||||
1
|
||||
23
|
||||
8
|
||||
13
|
||||
22
|
||||
State: 10
|
||||
Acc-Sig: -1 -2
|
||||
26
|
||||
11
|
||||
25
|
||||
10
|
||||
13
|
||||
22
|
||||
13
|
||||
22
|
||||
State: 11
|
||||
Acc-Sig: -1 -2
|
||||
26
|
||||
11
|
||||
25
|
||||
10
|
||||
23
|
||||
8
|
||||
13
|
||||
22
|
||||
State: 12
|
||||
Acc-Sig: +0 -1 -2
|
||||
21
|
||||
0
|
||||
20
|
||||
1
|
||||
13
|
||||
22
|
||||
13
|
||||
22
|
||||
State: 13
|
||||
Acc-Sig: +0 -1 -2
|
||||
13
|
||||
11
|
||||
13
|
||||
10
|
||||
13
|
||||
13
|
||||
13
|
||||
13
|
||||
State: 14
|
||||
Acc-Sig: +0 -1 -2
|
||||
13
|
||||
19
|
||||
13
|
||||
18
|
||||
13
|
||||
22
|
||||
13
|
||||
22
|
||||
State: 15
|
||||
Acc-Sig: +0 -1 -2
|
||||
23
|
||||
6
|
||||
13
|
||||
18
|
||||
23
|
||||
23
|
||||
13
|
||||
13
|
||||
State: 16
|
||||
Acc-Sig: +0 -1 -2
|
||||
24
|
||||
6
|
||||
20
|
||||
18
|
||||
23
|
||||
23
|
||||
13
|
||||
13
|
||||
State: 17
|
||||
Acc-Sig: +0 -1 -2
|
||||
24
|
||||
9
|
||||
20
|
||||
1
|
||||
23
|
||||
8
|
||||
13
|
||||
22
|
||||
State: 18
|
||||
Acc-Sig: +0 -1 -2
|
||||
26
|
||||
11
|
||||
25
|
||||
10
|
||||
13
|
||||
22
|
||||
13
|
||||
22
|
||||
State: 19
|
||||
Acc-Sig: +0 -1 -2
|
||||
26
|
||||
11
|
||||
25
|
||||
10
|
||||
23
|
||||
8
|
||||
13
|
||||
22
|
||||
State: 20
|
||||
Acc-Sig: +0 -1 -2
|
||||
26
|
||||
19
|
||||
25
|
||||
18
|
||||
13
|
||||
13
|
||||
13
|
||||
13
|
||||
State: 21
|
||||
Acc-Sig: +0 -1 -2
|
||||
26
|
||||
19
|
||||
25
|
||||
18
|
||||
23
|
||||
23
|
||||
13
|
||||
13
|
||||
State: 22
|
||||
Acc-Sig: +1 -2
|
||||
13
|
||||
19
|
||||
13
|
||||
18
|
||||
13
|
||||
22
|
||||
13
|
||||
22
|
||||
State: 23
|
||||
Acc-Sig: +1 -2
|
||||
23
|
||||
6
|
||||
13
|
||||
18
|
||||
23
|
||||
23
|
||||
13
|
||||
13
|
||||
State: 24
|
||||
Acc-Sig: +1 -2
|
||||
24
|
||||
6
|
||||
20
|
||||
18
|
||||
23
|
||||
23
|
||||
13
|
||||
13
|
||||
State: 25
|
||||
Acc-Sig: +1 -2
|
||||
26
|
||||
19
|
||||
25
|
||||
18
|
||||
13
|
||||
13
|
||||
13
|
||||
13
|
||||
State: 26
|
||||
Acc-Sig: +1 -2
|
||||
26
|
||||
19
|
||||
25
|
||||
18
|
||||
23
|
||||
23
|
||||
13
|
||||
13
|
||||
State: 27
|
||||
Acc-Sig: +1 -2
|
||||
28
|
||||
6
|
||||
20
|
||||
18
|
||||
15
|
||||
5
|
||||
13
|
||||
14
|
||||
State: 28
|
||||
Acc-Sig: +2
|
||||
28
|
||||
27
|
||||
20
|
||||
18
|
||||
15
|
||||
15
|
||||
13
|
||||
13
|
||||
EOF
|
||||
|
||||
test `../../bin/dstar2tgba -D in.dra --stats="%d:%s:%e"` = "1:23:143"
|
||||
|
||||
299
tests/dstar.test
Executable file
299
tests/dstar.test
Executable file
|
|
@ -0,0 +1,299 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Do some quick translations to make sure the neverclaims produced by
|
||||
# spot actually look correct! We do that by parsing them via ltlcross.
|
||||
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
|
||||
# DRA generated with
|
||||
# ltlfilt -f 'a U b' -l | ltl2dstar --ltl2nba=spin:path/ltl2tgba@-s - -
|
||||
cat >dra.dstar <<EOF
|
||||
DRA v2 explicit
|
||||
Comment: "Safra[NBA=2]"
|
||||
States: 3
|
||||
Acceptance-Pairs: 1
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
---
|
||||
State: 0
|
||||
Acc-Sig:
|
||||
1
|
||||
0
|
||||
2
|
||||
2
|
||||
State: 1
|
||||
Acc-Sig: -0
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
State: 2
|
||||
Acc-Sig: +0
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -XD dra.dstar | tee stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 0
|
||||
0 [label="0"]
|
||||
0 -> 0 [label="a & !b"]
|
||||
0 -> 1 [label="!a & !b"]
|
||||
0 -> 2 [label="b"]
|
||||
1 [label="1\n{0}"]
|
||||
1 -> 1 [label="1"]
|
||||
2 [label="2\n{1}"]
|
||||
2 -> 2 [label="1"]
|
||||
}
|
||||
EOF
|
||||
|
||||
diff expected stdout
|
||||
|
||||
|
||||
run 0 ../ikwiad -XDB -R3 dra.dstar | tee stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 0
|
||||
0 [label="0"]
|
||||
0 -> 0 [label="a & !b"]
|
||||
0 -> 1 [label="b"]
|
||||
1 [label="1", peripheries=2]
|
||||
1 -> 1 [label="1"]
|
||||
}
|
||||
EOF
|
||||
|
||||
diff expected stdout
|
||||
|
||||
|
||||
|
||||
# DSA generated with
|
||||
# ltlfilt -f 'FGa' -l |
|
||||
# ltl2dstar --automata=streett --ltl2nba=spin:path/ltl2tgba@-s - -
|
||||
cat >dsa.dstar <<EOF
|
||||
DSA v2 explicit
|
||||
Comment: "Streett{Safra[NBA=2]}"
|
||||
States: 3
|
||||
Acceptance-Pairs: 1
|
||||
Start: 1
|
||||
AP: 1 "a"
|
||||
---
|
||||
State: 0
|
||||
Acc-Sig: +0
|
||||
0
|
||||
2
|
||||
State: 1
|
||||
Acc-Sig:
|
||||
0
|
||||
0
|
||||
State: 2
|
||||
Acc-Sig:
|
||||
0
|
||||
2
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -XDB dsa.dstar | tee stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 1
|
||||
0 [label="0"]
|
||||
0 -> 0 [label="!a"]
|
||||
0 -> 2 [label="a"]
|
||||
1 [label="1"]
|
||||
1 -> 0 [label="1"]
|
||||
2 [label="2"]
|
||||
2 -> 0 [label="!a"]
|
||||
2 -> 2 [label="a"]
|
||||
2 -> 3 [label="a"]
|
||||
3 [label="3", peripheries=2]
|
||||
3 -> 3 [label="a"]
|
||||
}
|
||||
EOF
|
||||
|
||||
diff expected stdout
|
||||
|
||||
# These one could be reduced to 2 5 0 0 and 3 8 1 0
|
||||
test "`../../bin/dstar2tgba -D dsa.dstar --stats '%s %t %p %d'`" = "4 8 0 0"
|
||||
test "`../../bin/dstar2tgba -DC dsa.dstar --stats '%s %t %p %d'`" = "5 11 1 0"
|
||||
|
||||
|
||||
|
||||
# DRA generated with
|
||||
# ltlfilt -f 'Ga | Fb' -l | ltl2dstar --ltl2nba=spin:path/ltl2tgba@-Ds - -
|
||||
# (State name and comments added by hand to test the parser.)
|
||||
cat >dra.dstar <<EOF
|
||||
DRA v2 explicit
|
||||
Comment: "Union{Safra[NBA=1],Safra[NBA=2]}"
|
||||
States: 5
|
||||
Acceptance-Pairs: 2
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
---
|
||||
State: 0 "bla"
|
||||
Acc-Sig:
|
||||
1
|
||||
2 /* This is a comment */
|
||||
3
|
||||
4
|
||||
State: 1 "foo"
|
||||
Acc-Sig: -0
|
||||
1
|
||||
1 // This is another comment.
|
||||
3
|
||||
3
|
||||
State: 2 "baz"
|
||||
Acc-Sig: +0
|
||||
1
|
||||
2
|
||||
// more
|
||||
/// comment
|
||||
3
|
||||
4
|
||||
State: 3 "str\n\"ing"
|
||||
Acc-Sig: -0 +1
|
||||
3 /***
|
||||
**** Some multiline comment
|
||||
***/
|
||||
3
|
||||
3
|
||||
3
|
||||
State: 4 "more\"string\""
|
||||
Acc-Sig: +0 +1
|
||||
3
|
||||
4
|
||||
3
|
||||
4
|
||||
/* Same automaton with DSA instead of DRA, no comments, and less \n */
|
||||
DSA v2 explicit
|
||||
States: 5
|
||||
Acceptance-Pairs: 2
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
---
|
||||
State: 0 "bla" Acc-Sig: 1 2 3 4
|
||||
State: 1 "foo" Acc-Sig: -0 1 1 3 3
|
||||
State: 2 "baz" Acc-Sig: +0 1 2 3 4
|
||||
State: 3 "str\n\"ing" Acc-Sig: -0 +1 3 3 3 3
|
||||
State: 4 "more\"string\"" Acc-Sig: +0 +1 3 4 3 4
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt -B dra.dstar | tee stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 0
|
||||
0 [label="0"]
|
||||
0 -> 1 [label="!a & !b"]
|
||||
0 -> 2 [label="a & !b"]
|
||||
0 -> 3 [label="!a & b"]
|
||||
0 -> 4 [label="a & b"]
|
||||
1 [label="1"]
|
||||
1 -> 1 [label="!b"]
|
||||
1 -> 3 [label="b"]
|
||||
2 [label="2", peripheries=2]
|
||||
2 -> 1 [label="!a & !b"]
|
||||
2 -> 2 [label="a & !b"]
|
||||
2 -> 3 [label="!a & b"]
|
||||
2 -> 4 [label="a & b"]
|
||||
3 [label="3", peripheries=2]
|
||||
3 -> 3 [label="1"]
|
||||
4 [label="4", peripheries=2]
|
||||
4 -> 3 [label="!a"]
|
||||
4 -> 4 [label="a"]
|
||||
}
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 0
|
||||
0 [label="0"]
|
||||
0 -> 1 [label="!a & !b"]
|
||||
0 -> 2 [label="a & !b"]
|
||||
1 [label="1", peripheries=2]
|
||||
1 -> 1 [label="!b"]
|
||||
2 [label="2"]
|
||||
2 -> 1 [label="!a & !b"]
|
||||
2 -> 2 [label="a & !b"]
|
||||
}
|
||||
EOF
|
||||
|
||||
diff expected stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
3 12 1 1 dra.dstar:1.1-42.70
|
||||
2 4 0 1 dra.dstar:43.1-54.1
|
||||
EOF
|
||||
|
||||
../../bin/dstar2tgba --name=%F:%L -D dra.dstar --stats '%s %t %p %d %m' > out
|
||||
cat out
|
||||
diff expected out
|
||||
|
||||
|
||||
# This has caused a crash at some point when dealing with 0-sized
|
||||
# bitsets to represent acceptance sets.
|
||||
cat >aut.dsa <<EOF
|
||||
DSA v2 explicit
|
||||
Comment: "Streett{Safra[NBA=1]}"
|
||||
States: 1
|
||||
Acceptance-Pairs: 0
|
||||
Start: 0
|
||||
AP: 0
|
||||
---
|
||||
State: 0
|
||||
Acc-Sig:
|
||||
0
|
||||
EOF
|
||||
run 0 ../../bin/dstar2tgba --name=%F --dot=nt aut.dsa | tee stdout
|
||||
|
||||
cat >expected<<EOF
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
label="aut.dsa"
|
||||
labelloc="t"
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 0
|
||||
0 [label="0"]
|
||||
0 -> 0 [label="1\n{0}"]
|
||||
}
|
||||
EOF
|
||||
|
||||
diff expected stdout
|
||||
48
tests/dupexp.test
Executable file
48
tests/dupexp.test
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2014, 2015 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
dorun()
|
||||
{
|
||||
run 0 ../ikwiad -f "$1" >output1
|
||||
run 0 ../ikwiad -f -S "$1" >output2
|
||||
test `wc -l <output1` = `wc -l <output2`
|
||||
}
|
||||
|
||||
dorun 'a'
|
||||
dorun 'a U b'
|
||||
dorun 'X a'
|
||||
dorun 'a & b & c'
|
||||
dorun 'a | b | (c U (d & (g U (h ^ i))))'
|
||||
dorun 'Xa & (b U !a) & (b U !a)'
|
||||
dorun 'Fa & Xb & GFc & Gd'
|
||||
dorun 'Fa & Xa & GFc & Gc'
|
||||
dorun 'Fc & X(a | Xb) & GF(a | Xb) & Gc'
|
||||
dorun '!((FF a) <=> (F x))'
|
||||
dorun '!((FF a) <=> (F a))'
|
||||
dorun 'Xa && (!a U b) && !b && X!b'
|
||||
dorun '(a U !b) && Gb'
|
||||
203
tests/emptchk.cc
Normal file
203
tests/emptchk.cc
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/twaalgos/ltl2tgba_fm.hh>
|
||||
#include <spot/twaalgos/ltl2taa.hh>
|
||||
#include <spot/twaalgos/sccfilter.hh>
|
||||
#include <spot/twaalgos/degen.hh>
|
||||
#include <spot/twa/twaproduct.hh>
|
||||
#include <spot/twaalgos/gtec/gtec.hh>
|
||||
#include <spot/twaalgos/dot.hh>
|
||||
#include <spot/twaalgos/emptiness.hh>
|
||||
|
||||
static void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << prog << " file" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
syntax(argv[0]);
|
||||
std::ifstream input(argv[1]);
|
||||
if (!input)
|
||||
{
|
||||
std::cerr << "failed to open " << argv[1] << '\n';
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
auto d = spot::make_bdd_dict();
|
||||
|
||||
std::string s;
|
||||
unsigned line = 0;
|
||||
while (std::getline(input, s))
|
||||
{
|
||||
++line;
|
||||
std::cout << "========================================================\n";
|
||||
std::cout << line << ": " << s << '\n';
|
||||
if (s.empty() || s[0] == '#') // Skip comments
|
||||
continue;
|
||||
|
||||
std::vector<std::string> tokens;
|
||||
{
|
||||
std::istringstream ss(s);
|
||||
std::string form;
|
||||
while (std::getline(ss, form, ','))
|
||||
{
|
||||
std::string tmp;
|
||||
while (form.size() > 0 && form.back() == '\\'
|
||||
&& std::getline(ss, tmp, ','))
|
||||
{
|
||||
form.back() = ',';
|
||||
form += tmp;
|
||||
}
|
||||
tokens.push_back(form);
|
||||
}
|
||||
}
|
||||
|
||||
if (tokens.size() != 2)
|
||||
{
|
||||
std::cerr << "Expecting two tokens on input line.\n";
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int runs = atoi(tokens[0].c_str());
|
||||
|
||||
spot::parse_error_list pe;
|
||||
auto f = spot::parse_infix_psl(tokens[1], pe);
|
||||
if (spot::format_parse_errors(std::cerr, tokens[1], pe))
|
||||
return 2;
|
||||
|
||||
auto d = spot::make_bdd_dict();
|
||||
|
||||
// Build many different automata from this formula.
|
||||
spot::const_twa_ptr aut[4];
|
||||
{
|
||||
auto a = spot::ltl_to_taa(f, d);
|
||||
aut[0] = a;
|
||||
auto all = spot::twa::prop_set::all();
|
||||
aut[1] = spot::degeneralize_tba(spot::make_twa_graph(a, all));
|
||||
}
|
||||
{
|
||||
auto a = spot::ltl_to_tgba_fm(f, d);
|
||||
aut[2] = a;
|
||||
aut[3] = spot::degeneralize(a);
|
||||
}
|
||||
|
||||
const char* algos[] = {
|
||||
"Cou99", "Cou99(shy)",
|
||||
"CVWY90", "CVWY90(bsh=10M)", "CVWY90(repeated)",
|
||||
"SE05", "SE05(bsh=10M)", "SE05(repeated)",
|
||||
"Tau03_opt", "GV04",
|
||||
};
|
||||
|
||||
for (auto& algo: algos)
|
||||
{
|
||||
const char* err;
|
||||
auto i = spot::make_emptiness_check_instantiator(algo, &err);
|
||||
if (!i)
|
||||
{
|
||||
std::cerr << "Failed to parse `" << err << '\'' << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
for (unsigned j = 0; j < sizeof(aut)/sizeof(*aut); ++j)
|
||||
{
|
||||
auto a = aut[j];
|
||||
std::cout << "** Testing aut[" << j << "] using " << algo << '\n';
|
||||
unsigned n_acc = a->acc().num_sets();
|
||||
unsigned n_max = i->max_acceptance_conditions();
|
||||
if (n_max < n_acc)
|
||||
{
|
||||
std::cout << "Skipping because automaton has " << n_acc
|
||||
<< " acceptance sets, and " << algo
|
||||
<< " accepts at most " << n_max << ".\n";
|
||||
continue;
|
||||
}
|
||||
unsigned n_min = i->min_acceptance_conditions();
|
||||
if (n_min > n_acc)
|
||||
{
|
||||
std::cout << "Skipping because automaton has " << n_acc
|
||||
<< " acceptance sets, and " << algo
|
||||
<< " wants at least " << n_min << ".\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
auto ec = i->instantiate(a);
|
||||
bool search_many = i->options().get("repeated");
|
||||
assert(ec);
|
||||
int ce_found = 0;
|
||||
do
|
||||
{
|
||||
if (auto res = ec->check())
|
||||
{
|
||||
++ce_found;
|
||||
std::cout << ce_found << " counterexample found\n";
|
||||
if (auto run = res->accepting_run())
|
||||
{
|
||||
spot::print_dot(std::cout, run->as_twa());
|
||||
}
|
||||
std::cout << '\n';
|
||||
if (runs == 0)
|
||||
{
|
||||
std::cerr << "ERROR: Expected no counterexample.\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ce_found)
|
||||
std::cout << "No more counterexample found.\n\n";
|
||||
else
|
||||
std::cout << "No counterexample found.\n\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (search_many);
|
||||
|
||||
// The expected number of runs is only for TAA translations
|
||||
if (search_many && runs > ce_found && j < 2)
|
||||
{
|
||||
std::cerr << "ERROR: only " << ce_found
|
||||
<< " counterexamples founds, expected at least "
|
||||
<< runs << '\n';
|
||||
exit(1);
|
||||
}
|
||||
if (!search_many && ec->safe() && runs && !ce_found)
|
||||
{
|
||||
std::cerr << "ERROR: expected a counterexample.\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert(spot::fnode::instances_check());
|
||||
return 0;
|
||||
}
|
||||
44
tests/emptchk.test
Executable file
44
tests/emptchk.test
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2008, 2009, 2010, 2014 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004, 2005 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat > emptchk.txt <<EOF
|
||||
1, a
|
||||
1, a U b
|
||||
1, X a
|
||||
1, a & b & c
|
||||
1, a | b | (c U (d & (g U (h ^ i))))
|
||||
1, Xa & (b U !a) & (b U !a)
|
||||
1, Fa & Xb & GFc & Gd
|
||||
2, Fa & Xa & GFc & Gc
|
||||
1, Fc & X(a | Xb) & GF(a | Xb) & Gc
|
||||
2, !((FF a) <=> (F x))
|
||||
0, Xa && (!a U b) && !b && X!b
|
||||
0, (a U !b) && Gb
|
||||
EOF
|
||||
|
||||
run 0 ../emptchk emptchk.txt
|
||||
220
tests/emptchke.test
Executable file
220
tests/emptchke.test
Executable file
|
|
@ -0,0 +1,220 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2014, 2015 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004, 2005 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
expect_ce()
|
||||
{
|
||||
run 0 ../ikwiad -CR -e -XH "$1"
|
||||
run 0 ../ikwiad -CR -e -DT -XH "$1"
|
||||
run 0 ../ikwiad -CR -e'Cou99(shy)' -XH "$1"
|
||||
run 0 ../ikwiad -CR -e'Cou99(shy)' -DT -XH "$1"
|
||||
run 0 ../ikwiad -CR -eCVWY90 -XH "$1"
|
||||
run 0 ../ikwiad -CR -eGV04 -XH "$1"
|
||||
run 0 ../ikwiad -CR -eSE05 -XH "$1"
|
||||
run 0 ../ikwiad -CR -eTau03 -XH "$1"
|
||||
}
|
||||
|
||||
cat >input <<'EOF'
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0 {0 1}
|
||||
[0&!1] 1
|
||||
State: 1 {0}
|
||||
[0] 2
|
||||
State: 2
|
||||
[t] 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
expect_ce input
|
||||
|
||||
# ________
|
||||
# / v
|
||||
# >a--->d--->g
|
||||
# /^ /^ /^
|
||||
# L | L | L |{A}
|
||||
# b->c e->f h->i
|
||||
#
|
||||
cat >input <<'EOF'
|
||||
HOA: v1
|
||||
States: 9
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 1
|
||||
[t] 3
|
||||
[t] 6
|
||||
State: 1
|
||||
[t] 2
|
||||
State: 2
|
||||
[t] 0
|
||||
State: 3
|
||||
[t] 4
|
||||
[t] 6
|
||||
State: 4
|
||||
[t] 5
|
||||
State: 5
|
||||
[t] 3
|
||||
State: 6
|
||||
[t] 7
|
||||
State: 7
|
||||
[t] 8
|
||||
State: 8 {0}
|
||||
[t] 6
|
||||
--END--
|
||||
EOF
|
||||
|
||||
expect_ce input
|
||||
|
||||
# v
|
||||
# d->a
|
||||
# ^ |
|
||||
# | v
|
||||
# c<-b<-.
|
||||
# ^ |A |B
|
||||
# B| v |
|
||||
# `--e->f
|
||||
#
|
||||
# The arcs are ordered so that Couvreur99 succeed after exploring
|
||||
# the following subgraph (which is one accepting SCC):
|
||||
#
|
||||
# v
|
||||
# d->a
|
||||
# ^ |
|
||||
# | v
|
||||
# c<-b<-.
|
||||
# |A |B
|
||||
# v |
|
||||
# e->f
|
||||
#
|
||||
# However when computing a counter-example the greedy BFS algorithm
|
||||
# will fail to return the minimal a->b->e->f->b run. Indeed it first
|
||||
# walks through a->b->e (which gives acceptance condition A), and
|
||||
# prefer to continue with e->c (because it gives acceptance condition B),
|
||||
# and finally closes the cycle with c->d->a
|
||||
#
|
||||
cat >input <<'EOF'
|
||||
HOA: v1
|
||||
States: 6
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc complete
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 1
|
||||
State: 1
|
||||
[t] 2
|
||||
[t] 4 {0}
|
||||
State: 2
|
||||
[t] 3
|
||||
State: 3
|
||||
[t] 0
|
||||
State: 4
|
||||
[t] 2 {1}
|
||||
[t] 5
|
||||
State: 5
|
||||
[t] 1 {1}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
expect_ce input
|
||||
|
||||
|
||||
# This graph was randomly generated, and contains one accepting path.
|
||||
# It triggered a bug in our implementation of GV04 (that didn't see any
|
||||
# accepting path).
|
||||
cat >input <<EOF
|
||||
HOA: v1
|
||||
States: 20
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 1
|
||||
State: 1
|
||||
[t] 2
|
||||
[t] 3
|
||||
State: 2
|
||||
[t] 4
|
||||
[t] 5 {0}
|
||||
[t] 6
|
||||
State: 3
|
||||
[t] 6
|
||||
[t] 7
|
||||
State: 4
|
||||
[t] 8
|
||||
State: 5
|
||||
[t] 9
|
||||
State: 6
|
||||
[t] 2
|
||||
State: 7
|
||||
[t] 10
|
||||
[t] 11
|
||||
State: 8
|
||||
[t] 12
|
||||
State: 9
|
||||
[t] 13
|
||||
State: 10
|
||||
[t] 13
|
||||
[t] 14
|
||||
[t] 15
|
||||
State: 11
|
||||
[t] 2
|
||||
State: 12
|
||||
[t] 3
|
||||
State: 13
|
||||
[t] 16
|
||||
State: 14
|
||||
State: 15
|
||||
[t] 4
|
||||
State: 16
|
||||
[t] 17
|
||||
State: 17
|
||||
[t] 18
|
||||
State: 18
|
||||
[t] 10
|
||||
[t] 19
|
||||
State: 19
|
||||
--END--
|
||||
EOF
|
||||
|
||||
expect_ce input
|
||||
55
tests/emptchkr.test
Executable file
55
tests/emptchkr.test
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2015 Laboratoire de Recherche de
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Emptiness check on randomly generated state spaces.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# With no acceptance condition, everyone should agree and find a run.
|
||||
# Do not spend to much time checking this.
|
||||
run 0 ../randtgba -e 10 -s 0 -r -m
|
||||
# Test some statistic output
|
||||
run 0 ../randtgba -z -e 10 -s 0 -r -m
|
||||
run 0 ../randtgba -1 -e 10 -s 0 -r -m
|
||||
|
||||
# One acceptance condition
|
||||
run 0 ../randtgba -e 100 -s 0 -r -m -a 1 0.1 -d 0.01
|
||||
run 0 ../randtgba -e 100 -s 50 -r -m -a 1 0.1 -d 0.02
|
||||
run 0 ../randtgba -e 100 -s 100 -r -m -a 1 0.1 -d 0.04
|
||||
run 0 ../randtgba -e 100 -s 150 -r -m -a 1 0.1 -d 0.08
|
||||
|
||||
# Four acceptance conditions
|
||||
run 0 ../randtgba -e 100 -s 200 -r -m -a 4 0.1 -d 0.01
|
||||
run 0 ../randtgba -e 100 -s 250 -r -m -a 4 0.1 -d 0.02
|
||||
run 0 ../randtgba -e 100 -s 300 -r -m -a 4 0.1 -d 0.04
|
||||
run 0 ../randtgba -e 100 -s 350 -r -m -a 4 0.1 -d 0.08
|
||||
run 0 ../randtgba -e 100 -s 400 -r -m -a 4 0.2 -d 0.01
|
||||
run 0 ../randtgba -e 100 -s 450 -r -m -a 4 0.2 -d 0.02
|
||||
run 0 ../randtgba -e 100 -s 500 -r -m -a 4 0.2 -d 0.04
|
||||
run 0 ../randtgba -e 100 -s 550 -r -m -a 4 0.2 -d 0.08
|
||||
|
||||
# Bigger automata. With valgrind this is slow, so we do less.
|
||||
run 0 ../randtgba -e 10 -s 0 -n 500 -r -m -a 1 0.0003 -d 0.01
|
||||
run 0 ../randtgba -e 10 -s 0 -n 500 -r -m -a 4 0.0011 -D -d 0.01
|
||||
227
tests/equals.test
Executable file
227
tests/equals.test
Executable file
|
|
@ -0,0 +1,227 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2011, 2012, 2014, 2015 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Check for the equals visitor
|
||||
|
||||
. ./defs || exit 1
|
||||
set -e
|
||||
|
||||
cat >equal.txt <<\EOF
|
||||
# A few things which are equal
|
||||
a, a
|
||||
~a, !a
|
||||
1, 1
|
||||
0, 0
|
||||
a => b, a --> b
|
||||
a <-> b, a <--> b
|
||||
G a , G a
|
||||
a U b, a U b
|
||||
a & b, a & b
|
||||
a & b, b & a
|
||||
a & b & c, c & a && b
|
||||
a & b & c, b & c & a
|
||||
a && b & a, b & a & b
|
||||
a & b, b & a & b
|
||||
a & b, b & a & a
|
||||
a & b & (c |(f U g)|| e), b & a & a & (c | e |(f U g)| e | c) & b
|
||||
a & a, a
|
||||
a & a & true, a
|
||||
a & false & a, false
|
||||
a | false | a, a
|
||||
true | a | a, true
|
||||
Ga=1*Gb=0, (G(a)) & (G(!b))
|
||||
FFx, Fx
|
||||
FFFFFx, Fx
|
||||
GGx, Gx
|
||||
GGGGGx, Gx
|
||||
!!x, x
|
||||
!!!!!x, !x
|
||||
{[*0];x}<>->1, {x}<>->1
|
||||
{x;[*0]}<>->1, {x}<>-> 1
|
||||
{[*0];x;[*0];[*0]}<>->1, {x}<>->1
|
||||
{[*0];x;[*0];x;[*0]}<>->1, {x;x}<>->1
|
||||
{x;x;x;[*0];x;x}<>->1, {x;x;x;x;x}<>->1
|
||||
{x;0;x;x;x}<>->1, 0
|
||||
{x;0;x;x;x}[]->1, 1
|
||||
{0*;1}<>->x, x
|
||||
{[*0]*;1}<>->x, x
|
||||
{x;x}<>->FF(0), 0
|
||||
{x;x}<>->GX(1), {x;x}<>->1
|
||||
{x;x}[]->GX(1), 1
|
||||
{x;x}[]->FF(0), {x;x}[]->0
|
||||
{x;x}[]->y, {x;x}|->y
|
||||
{x;x}[]->y, {x;x}(y)
|
||||
{a*}!, {a*}<>->1
|
||||
{a -> b} (c), !(a->b)|c
|
||||
{a & !b}!, a & !b
|
||||
{a;[*0]}|->!Xb, !a | !Xb
|
||||
{{a;b}:b:c:d*:e:f}!, {{a;b}:{b && c }:d[*]:{e && f}}!
|
||||
{a:b:c}|->!Xb, !(a&&b&&c) | !Xb
|
||||
{a:b:c*}|->!Xb, {(a&&b):c*}|-> !Xb
|
||||
{a&b&c*}|->!Xb, {(a&&b)&c*}|-> !Xb
|
||||
{[*]&&a&&[*]}!, a
|
||||
{[*]||a||[*]}!, {[*]}!
|
||||
{0&{f;g*}}!, 0
|
||||
{1&{f;g*}}!, {f;g*}!
|
||||
# Precedence
|
||||
a & b ^ c | d, d | c ^ b & a
|
||||
|
||||
# Corner cases parsing
|
||||
FFG__GFF, F(F(G("__GFF")))
|
||||
|
||||
# Trivial simplifications
|
||||
{0*}<>->a, {[*0]}<>->a
|
||||
{[*0]*}<>->a, {[*0]}<>->a
|
||||
{Exp**}<>->a, {Exp*}<>->a
|
||||
FF(Exp), F(Exp)
|
||||
GG(Exp), G(Exp)
|
||||
F(0), 0
|
||||
G(0), 0
|
||||
F(1), 1
|
||||
G(1), 1
|
||||
F({[*0]}<>->1), F({[*0]}<>->1)
|
||||
G({[*0]}<>->1), G({[*0]}<>->1)
|
||||
F({1}<>->1), 1
|
||||
G({1}<>->1), 1
|
||||
!1, 0
|
||||
!0, 1
|
||||
!!Exp, Exp
|
||||
|
||||
(1 => Exp), Exp
|
||||
(0 => Exp), 1
|
||||
(Exp => 1), 1
|
||||
(Exp => 0), !Exp
|
||||
(Exp => Exp), 1
|
||||
(1 ^ Exp), !Exp
|
||||
(0 ^ Exp), Exp
|
||||
(Exp ^ Exp), 0
|
||||
(0 <=> Exp), !Exp
|
||||
(1 <=> Exp), Exp
|
||||
(Exp <=> Exp), 1
|
||||
(Exp U 1), 1
|
||||
(Exp U 0), 0
|
||||
(0 U Exp), Exp
|
||||
(Exp U Exp), Exp
|
||||
(Exp R 1), 1
|
||||
(Exp R 0), 0
|
||||
(Exp R Exp), Exp
|
||||
(1 R Exp), Exp
|
||||
(Exp W 1), 1
|
||||
(0 W Exp), Exp
|
||||
(1 W Exp), 1
|
||||
(Exp W Exp), Exp
|
||||
(Exp M 0), 0
|
||||
(1 M Exp), Exp
|
||||
(0 M Exp), 0
|
||||
(Exp M Exp), Exp
|
||||
|
||||
{1:{a;b}:1:c*}!, {{a;b}:c*}!
|
||||
{c*:1:{a;b}:1}!, {c*:{a;b}}!
|
||||
|
||||
{z;a*;b*;*;c;d;*;b*;e;a*;*;b*}, {z;[*];c;d;[*];e;[*]}
|
||||
{((a;b)|[*0]);[*];c}!, {[*];c}!
|
||||
{a;a;a*;a;b;b[*];c[*2:3];c[*4:5]}, {a[*3..];b[+];c[*6..8]}
|
||||
|
||||
{a[*0]}, {[*0]}
|
||||
{a[*..]}, {a[*]}
|
||||
{a[*2..3][*4..5]}, {a[*8..15]}
|
||||
{a[*4..5][*2..3]}, {a[*4..5][*2..3]}
|
||||
{a[*2:3][*]}, {a[*2 to 3][*]}
|
||||
{a[*1..3][*]}, {a[*]}
|
||||
{a[*][*2..3]}, {a[*]}
|
||||
{a[*..3][*2]}, {a[*..6]}
|
||||
{a[*..3][*to2]}, {a[*:6]}
|
||||
{a[*..3][*2..$]}, {a[*]}
|
||||
{a[*..3][*2:]}, {a[*:inf]}
|
||||
{a[*1..]}, {a[+]}
|
||||
{a[*1]}, {a}
|
||||
{a[+][*1..3]}, {a[+]}
|
||||
{a[*1..3][+]}, {a[+]}
|
||||
{[*2][+]}, {[*2][+]}
|
||||
{[+][*2]}, {[*2..inf]}
|
||||
|
||||
{0[=2]}, 0
|
||||
{0[=2..]}, 0
|
||||
{0[=1..10]}, 0
|
||||
{0[=0]}, {[*]}
|
||||
{0[=0..10]}, {*}
|
||||
{0[=0..]}, {*}
|
||||
{1[=0]}, {[*0]}
|
||||
{1[=1..2]}, {[*1\,2]}
|
||||
{1[=..4]}, {1[*..4]}
|
||||
{b[=0]}, {(!b)[*]}
|
||||
{b[=0to$]}, {*}
|
||||
|
||||
{0[->10..100];b}, 0
|
||||
{0[->1..];b}, 0
|
||||
{0[->0\,100];b}, b
|
||||
{0[->0..$];b}, b
|
||||
!{1[->0];b}, !b
|
||||
{1[->10\,20];b}, {[*10..20];b}
|
||||
{1[->..];b}, {[*1..];b}
|
||||
{{a&!c}[->0];b}, b
|
||||
|
||||
{(a|c)[:*0..3];d}, {1;d}
|
||||
{(a|c)[:*1..3];d}, {(a|c);d}
|
||||
{0[:*0..3];d}, {1;d}
|
||||
{0[:*1..3];d}, 0
|
||||
{1[:*0..3];d}, {1;d}
|
||||
{1[:*1..3];d}, {1;d}
|
||||
{[*0][:*0..3];d}, {1;d}
|
||||
{[*0][:*1..3];d}, 0
|
||||
{(a*;b|c)[:*1to3][:*2:4]}, {(a*;b|c)[:*2..12]}
|
||||
{(a*;b|c)[:*][:+]}, {(a*;b|c)[:*]}
|
||||
{(a*;b|c)[:*0]}, 1
|
||||
{(a*;b|c)[:*1]}, {(a*;b|c)}
|
||||
{(a;b):(a;b):(a;b)[:*2]:(a;b):b*:b*:(c;d)[:*1]}, {(a;b)[:*5]:b*[:*2]:(c;d)}
|
||||
EOF
|
||||
|
||||
|
||||
cat >nequal.txt <<\EOF
|
||||
# other formulae which are not
|
||||
a, b
|
||||
1, 0
|
||||
a => b, b => a
|
||||
a => b, a <=> b
|
||||
a => b, a U b
|
||||
a R b, a U b
|
||||
a & b & c, c & a
|
||||
b & c, c & a & b
|
||||
a & b & (c |(f U g)| e), b & a & a & (c | e |(g U g)| e | c) & b
|
||||
{a*}, {a*}<>->1
|
||||
!{a*}, {a*}<>->1
|
||||
{a*}, {a*}!
|
||||
!{a*}, {a*}!
|
||||
|
||||
# 1 should not be removed in the following two formulae
|
||||
{1&{g*}}!, {g*}!
|
||||
{1|{b;c}}<>->a, {b;c}<>->a
|
||||
# make sure twin arguments are not reduced in Fusion.
|
||||
{(a;!a)*:(a;!a)*:b}!, {(a;!a)*:b}!
|
||||
# make sure 1:a* is not reduced to a*.
|
||||
{(1:a*);b}!, {a*;b}!
|
||||
EOF
|
||||
|
||||
run 0 ../equals equal.txt
|
||||
run 0 ../nequals nequal.txt
|
||||
220
tests/equalsf.cc
Normal file
220
tests/equalsf.cc
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2015 Laboratoire de
|
||||
// Recherche et Développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2003, 2004, 2006 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/tl/unabbrev.hh>
|
||||
#include <spot/tl/nenoform.hh>
|
||||
#include <spot/tl/simplify.hh>
|
||||
#include <spot/tl/print.hh>
|
||||
|
||||
static void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << prog << " [-E] file" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
bool check_first = true;
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-E"))
|
||||
{
|
||||
check_first = false;
|
||||
argv[1] = argv[0];
|
||||
++argv;
|
||||
--argc;
|
||||
}
|
||||
if (argc != 2)
|
||||
syntax(argv[0]);
|
||||
std::ifstream input(argv[1]);
|
||||
if (!input)
|
||||
{
|
||||
std::cerr << "failed to open " << argv[1] << '\n';
|
||||
return 2;
|
||||
}
|
||||
|
||||
std::string s;
|
||||
unsigned line = 0;
|
||||
while (std::getline(input, s))
|
||||
{
|
||||
++line;
|
||||
std::cerr << line << ": " << s << '\n';
|
||||
if (s[0] == '#') // Skip comments
|
||||
continue;
|
||||
std::vector<std::string> formulas;
|
||||
{
|
||||
std::istringstream ss(s);
|
||||
std::string form;
|
||||
while (std::getline(ss, form, ','))
|
||||
{
|
||||
std::string tmp;
|
||||
while (form.size() > 0 && form.back() == '\\'
|
||||
&& std::getline(ss, tmp, ','))
|
||||
{
|
||||
form.back() = ',';
|
||||
form += tmp;
|
||||
}
|
||||
formulas.push_back(form);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned size = formulas.size();
|
||||
if (size == 0) // Skip empty lines
|
||||
continue;
|
||||
|
||||
if (size == 1)
|
||||
{
|
||||
std::cerr << "Not enough formulas on line " << line << '\n';
|
||||
return 2;
|
||||
}
|
||||
|
||||
spot::parse_error_list p2;
|
||||
auto f2 = spot::parse_infix_psl(formulas[size - 1], p2);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, formulas[size - 1], p2))
|
||||
return 2;
|
||||
|
||||
for (unsigned n = 0; n < size - 1; ++n)
|
||||
{
|
||||
|
||||
spot::parse_error_list p1;
|
||||
auto f1 = spot::parse_infix_psl(formulas[n], p1);
|
||||
|
||||
if (check_first &&
|
||||
spot::format_parse_errors(std::cerr, formulas[n], p1))
|
||||
return 2;
|
||||
|
||||
int exit_code = 0;
|
||||
|
||||
{
|
||||
#if defined UNABBREV || defined NENOFORM
|
||||
spot::formula tmp;
|
||||
#endif
|
||||
#ifdef UNABBREV
|
||||
tmp = f1;
|
||||
f1 = spot::unabbreviate(f1, UNABBREV);
|
||||
f1.dump(std::cout) << std::endl;
|
||||
#endif
|
||||
#ifdef NENOFORM
|
||||
tmp = f1;
|
||||
f1 = spot::negative_normal_form(f1);
|
||||
f1.dump(std::cout) << std::endl;
|
||||
#endif
|
||||
#ifdef REDUC
|
||||
spot::tl_simplifier_options opt(true, true, true,
|
||||
false, false);
|
||||
# ifdef EVENT_UNIV
|
||||
opt.favor_event_univ = true;
|
||||
# endif
|
||||
spot::tl_simplifier simp(opt);
|
||||
{
|
||||
spot::formula tmp;
|
||||
tmp = f1;
|
||||
f1 = simp.simplify(f1);
|
||||
|
||||
if (!simp.are_equivalent(f1, tmp))
|
||||
{
|
||||
std::cerr
|
||||
<< "Source and simplified formulae are not equivalent!\n";
|
||||
spot::print_psl(std::cerr << "Simplified: ", f1) << '\n';
|
||||
exit_code = 1;
|
||||
}
|
||||
}
|
||||
f1.dump(std::cout) << std::endl;
|
||||
#endif
|
||||
#ifdef REDUC_TAU
|
||||
spot::tl_simplifier_options opt(false, false, false,
|
||||
true, false);
|
||||
spot::tl_simplifier simp(opt);
|
||||
{
|
||||
spot::formula tmp;
|
||||
tmp = f1;
|
||||
f1 = simp.simplify(f1);
|
||||
|
||||
if (!simp.are_equivalent(f1, tmp))
|
||||
{
|
||||
std::cerr
|
||||
<< "Source and simplified formulae are not equivalent!\n";
|
||||
spot::print_psl(std::cerr << "Simplified: ", f1) << '\n';
|
||||
exit_code = 1;
|
||||
}
|
||||
}
|
||||
f1.dump(std::cout) << std::endl;
|
||||
#endif
|
||||
#ifdef REDUC_TAUSTR
|
||||
spot::tl_simplifier_options opt(false, false, false,
|
||||
true, true);
|
||||
spot::tl_simplifier simp(opt);
|
||||
{
|
||||
spot::formula tmp;
|
||||
tmp = f1;
|
||||
f1 = simp.simplify(f1);
|
||||
|
||||
if (!simp.are_equivalent(f1, tmp))
|
||||
{
|
||||
std::cerr
|
||||
<< "Source and simplified formulae are not equivalent!\n";
|
||||
spot::print_psl(std::cerr << "Simplified: ", f1) << '\n';
|
||||
exit_code = 1;
|
||||
}
|
||||
}
|
||||
f1.dump(std::cout) << std::endl;
|
||||
#endif
|
||||
|
||||
exit_code |= f1 != f2;
|
||||
|
||||
#if (!defined(REDUC) && !defined(REDUC_TAU) && !defined(REDUC_TAUSTR))
|
||||
spot::tl_simplifier simp;
|
||||
#endif
|
||||
|
||||
if (!simp.are_equivalent(f1, f2))
|
||||
{
|
||||
#if (!defined(REDUC) && !defined(REDUC_TAU) && !defined(REDUC_TAUSTR))
|
||||
std::cerr
|
||||
<< "Source and destination formulae are not equivalent!\n";
|
||||
#else
|
||||
std::cerr
|
||||
<< "Simpl. and destination formulae are not equivalent!\n";
|
||||
#endif
|
||||
exit_code = 1;
|
||||
}
|
||||
|
||||
#if NEGATE
|
||||
exit_code ^= 1;
|
||||
#endif
|
||||
if (exit_code)
|
||||
return exit_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert(spot::fnode::instances_check());
|
||||
return 0;
|
||||
}
|
||||
64
tests/eventuniv.test
Executable file
64
tests/eventuniv.test
Executable file
|
|
@ -0,0 +1,64 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et
|
||||
# Developpement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs || exit 1
|
||||
set -e
|
||||
|
||||
cat >reduceu.txt <<EOF
|
||||
Xa | GFb, Xa | GFb
|
||||
X(a | GXFb), Xa | GFb
|
||||
Xa & GFb, Xa & GFb
|
||||
X(a & GXFb), Xa & GFb
|
||||
|
||||
F(a & b & GFc & FGd), F(a & b) & G(Fc & FGd)
|
||||
Fa | Fb | GFc | GFd, F(a|b) | GF(c | d)
|
||||
Fa | Fb | GFc | GFd | FGe, F(a|b) | F(G(e) | GF(c | d))
|
||||
Ga | Gb | GFd | FGe | FGf, Ga | Gb | F(GFd | Ge | Gf)
|
||||
|
||||
G(Ga & Fb & c & GFd), G(a&c) & G(Fb & Fd)
|
||||
G(Ga & GFb & c & GFd), G(a&c) & G(Fb & Fd)
|
||||
G(a & GFb & c & GFd), G(a&c) & G(Fb & Fd)
|
||||
G(Ga & Fb & c & GFd & FGe), G(a & c) & G(Fb & Fd & FGe)
|
||||
G(Ga & XFGb & c & FGd & FGe), FG(b & d & e) & G(a & c)
|
||||
G(Ga & GXFb & c & FGd & FGe & Fc), G(Fb & FG(d & e)) & G(a & c)
|
||||
Ga & Gb & GFd & FGe & FGf, G(Fd & FG(e & f)) & G(a & b)
|
||||
G(Ga & Gb & GFd & FGe) & FGf, G(Fd & FG(e & f)) & G(a & b)
|
||||
|
||||
a U (b | Fc), (a U b) | Fc
|
||||
a W (b | Fc), (a W b) | Fc
|
||||
a U (b & GFc), (a U b) & GFc
|
||||
# Unchanged
|
||||
a W (b & GFc), a W (b & GFc)
|
||||
# Unchanged
|
||||
(a | Gc) W g, (a | Gc) W g
|
||||
# Unchanged
|
||||
(a | Gc) U g, (a | Gc) U g
|
||||
(a & GFc) M b, (a M b) & GFc
|
||||
# Unchanged
|
||||
(a | GFc) M b, (a | GFc) M b
|
||||
# Unchanged
|
||||
(a & GFc) R b, (a & GFc) R b
|
||||
# Unchanged
|
||||
(a | GFc) R b, (a | GFc) R b
|
||||
a R (b & Gc), (a R b) & Gc
|
||||
a M (b & Gc), (a M b) & Gc
|
||||
EOF
|
||||
|
||||
run 0 ../reduceu reduceu.txt
|
||||
56
tests/exclusive-ltl.test
Executable file
56
tests/exclusive-ltl.test
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
cat >formulas <<EOF
|
||||
GFa
|
||||
a U b
|
||||
a U b U c
|
||||
a U b U d U e
|
||||
a U b U c U d U e
|
||||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
GFa
|
||||
(a U b) & G!(a & b)
|
||||
(a U (b U c)) & G(!(a & b) & !(a & c) & !(b & c))
|
||||
(a U (b U (d U e))) & G(!(a & b) & !(d & e))
|
||||
(a U (b U (c U (d U e)))) & G(!(a & b) & !(a & c) & !(b & c) & !(d & e))
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/ltlfilt --exclusive-ap=a,b,c --exclusive-ap=d,e formulas >out
|
||||
cat out
|
||||
diff out expected
|
||||
|
||||
run 0 ../../bin/ltlfilt --exclusive-ap='"a" ,b, "c" ' --exclusive-ap=' d , e' \
|
||||
formulas >out
|
||||
cat out
|
||||
diff out expected
|
||||
|
||||
../../bin/ltlfilt --exclusive-ap='"a","b' 2>stderr && exit 1
|
||||
grep 'missing closing ."' stderr
|
||||
../../bin/ltlfilt --exclusive-ap='a,,b' 2>stderr && exit 1
|
||||
grep "unexpected ',' in a,,b" stderr
|
||||
../../bin/ltlfilt --exclusive-ap='"a"b' 2>stderr && exit 1
|
||||
grep "unexpected character 'b' in \"a\"b" stderr
|
||||
162
tests/exclusive-tgba.test
Executable file
162
tests/exclusive-tgba.test
Executable file
|
|
@ -0,0 +1,162 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
cat >automaton <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
State: 1
|
||||
[1] 2
|
||||
[2&!1] 2
|
||||
State: 2 {0}
|
||||
[1] 2
|
||||
[0&1] 1
|
||||
[1&2] 3
|
||||
State: 3
|
||||
[t] 3
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0&!1&!2] 1
|
||||
State: 1
|
||||
[!0&1&!2] 2
|
||||
[!0&!1&2] 2
|
||||
State: 2 {0}
|
||||
[!0&1&!2] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expected-simpl <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
State: 1
|
||||
[1 | 2] 2
|
||||
State: 2 {0}
|
||||
[1] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt -H --exclusive-ap=a,b,c --exclusive-ap=d,e \
|
||||
automaton >out
|
||||
cat out
|
||||
diff out expected
|
||||
|
||||
run 0 ../../bin/autfilt -H --exclusive-ap=a,b,c --exclusive-ap=d,e \
|
||||
--simplify-exclusive-ap automaton >out2
|
||||
cat out2
|
||||
diff out2 expected-simpl
|
||||
|
||||
cat >automaton <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
State: 1
|
||||
[1] 2
|
||||
[0&!1] 2
|
||||
State: 2 {0}
|
||||
[1] 2
|
||||
[0&1] 1
|
||||
[1&0] 3
|
||||
State: 3
|
||||
[t] 3
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0&!1] 1
|
||||
State: 1
|
||||
[!0&1] 2
|
||||
[0&!1] 2
|
||||
State: 2 {0}
|
||||
[!0&1] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expected-simpl <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
State: 1
|
||||
[0 | 1] 2
|
||||
State: 2 {0}
|
||||
[1] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt -H --exclusive-ap=a,b,c --exclusive-ap=d,e \
|
||||
automaton >out
|
||||
cat out
|
||||
diff out expected
|
||||
|
||||
run 0 ../../bin/autfilt -H --exclusive-ap=a,b,c --exclusive-ap=d,e \
|
||||
--simplify-exclusive-ap automaton >out2
|
||||
cat out2
|
||||
diff out2 expected-simpl
|
||||
83
tests/explpro2.test
Executable file
83
tests/explpro2.test
Executable file
|
|
@ -0,0 +1,83 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
|
||||
# de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004, 2005, 2006, 2008, 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[!0] 1 {0}
|
||||
[!1] 2 {1}
|
||||
State: 1
|
||||
State: 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >input2 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "b" "a"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1 {0}
|
||||
[1] 2 {1}
|
||||
State: 1
|
||||
State: 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expected <<'EOF'
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "b" "a"
|
||||
acc-name: generalized-Buchi 4
|
||||
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
|
||||
properties: trans-labels explicit-labels trans-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0&!1] 1 {0 2}
|
||||
[!0&1] 2 {1 3}
|
||||
State: 1
|
||||
State: 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt input1 --product input2 --hoa | tee stdout
|
||||
run 0 ../../bin/autfilt -F stdout --isomorph expected
|
||||
|
||||
rm input1 input2 stdout expected
|
||||
82
tests/explpro3.test
Executable file
82
tests/explpro3.test
Executable file
|
|
@ -0,0 +1,82 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
|
||||
# de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[!0] 1
|
||||
[!1] 2
|
||||
State: 1
|
||||
State: 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >input2 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "b" "a"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1 {0}
|
||||
[1] 2 {1}
|
||||
State: 1
|
||||
State: 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "b" "a"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0&!1] 1 {0}
|
||||
[!0&1] 2 {1}
|
||||
State: 1
|
||||
State: 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt input1 --product input2 --hoa | tee stdout
|
||||
run 0 ../../bin/autfilt -F stdout --isomorph expected
|
||||
rm input1 input2 stdout expected
|
||||
91
tests/explpro4.test
Executable file
91
tests/explpro4.test
Executable file
|
|
@ -0,0 +1,91 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2014, 2015 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2006 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[!0] 0
|
||||
[0] 0 {0}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >input2 <<EOF
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Fin(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 0
|
||||
[!0] 0 {0}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expected <<'EOF'
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
Acceptance: 2 Inf(0) & Fin(1)
|
||||
properties: trans-labels explicit-labels trans-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[!0] 0 {1}
|
||||
[0] 0 {0}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >unexpected <<'EOF'
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
Acceptance: 2 Inf(0) & Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[!0] 0 {1}
|
||||
[0] 0 {0}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt input1 --product input2 --hoa | tee stdout
|
||||
run 0 ../../bin/autfilt -q stdout --isomorph expected
|
||||
run 1 ../../bin/autfilt -q stdout --isomorph unexpected
|
||||
|
||||
true
|
||||
102
tests/explprod.test
Executable file
102
tests/explprod.test
Executable file
|
|
@ -0,0 +1,102 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2008, 2009, 2013, 2014 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004, 2005 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 3 "a" "b" "c"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
[0] 1
|
||||
[1] 2
|
||||
State: 1
|
||||
State: 2 {0}
|
||||
[!0] 0
|
||||
[2] 1
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >input2 <<EOF
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 2 "b" "a"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0 {0}
|
||||
[0] 1
|
||||
State: 1 {1}
|
||||
[1] 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 3 "b" "a" "c"
|
||||
acc-name: generalized-Buchi 3
|
||||
Acceptance: 3 Inf(0)&Inf(1)&Inf(2)
|
||||
properties: trans-labels explicit-labels state-acc
|
||||
--BODY--
|
||||
State: 0 {0 1}
|
||||
[0&1] 1
|
||||
[0] 2
|
||||
State: 1
|
||||
State: 2 {0 2}
|
||||
[1&2] 3
|
||||
State: 3
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt input1 --product input2 --hoa | tee stdout
|
||||
diff stdout expected
|
||||
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt input1 --product input2 --hoa --small | tee stdout
|
||||
run 0 ../../bin/autfilt -F stdout --isomorph expected
|
||||
|
||||
rm input1 input2 stdout expected
|
||||
321
tests/graph.cc
Normal file
321
tests/graph.cc
Normal file
|
|
@ -0,0 +1,321 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement
|
||||
// de l'Epita.
|
||||
//
|
||||
// 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <spot/graph/graph.hh>
|
||||
|
||||
template <typename SL, typename TL>
|
||||
void
|
||||
dot_state(std::ostream& out, spot::digraph<SL, TL>& g, unsigned n)
|
||||
{
|
||||
out << " [label=\"" << g.state_data(n) << "\"]\n";
|
||||
}
|
||||
|
||||
template <typename TL>
|
||||
void
|
||||
dot_state(std::ostream& out, spot::digraph<void, TL>&, unsigned)
|
||||
{
|
||||
out << '\n';
|
||||
}
|
||||
|
||||
template <typename SL, typename TL, typename TR>
|
||||
void
|
||||
dot_trans(std::ostream& out, spot::digraph<SL, TL>&, TR& tr)
|
||||
{
|
||||
out << " [label=\"" << tr.data() << "\"]\n";
|
||||
}
|
||||
|
||||
template <typename SL, typename TR>
|
||||
void
|
||||
dot_trans(std::ostream& out, spot::digraph<SL, void>&, TR&)
|
||||
{
|
||||
out << '\n';
|
||||
}
|
||||
|
||||
|
||||
template <typename SL, typename TL>
|
||||
void
|
||||
dot(std::ostream& out, spot::digraph<SL, TL>& g)
|
||||
{
|
||||
out << "digraph {\n";
|
||||
unsigned c = g.num_states();
|
||||
for (unsigned s = 0; s < c; ++s)
|
||||
{
|
||||
out << ' ' << s;
|
||||
dot_state(out, g, s);
|
||||
for (auto& t: g.out(s))
|
||||
{
|
||||
out << ' ' << s << " -> " << t.dst;
|
||||
dot_trans(out, g, t);
|
||||
}
|
||||
}
|
||||
out << "}\n";
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
g1(const spot::digraph<void, void>& g,
|
||||
unsigned s, int e)
|
||||
{
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s))
|
||||
{
|
||||
(void) t;
|
||||
++f;
|
||||
}
|
||||
return f == e;
|
||||
}
|
||||
|
||||
static bool
|
||||
f1()
|
||||
{
|
||||
spot::digraph<void, void> g(3);
|
||||
|
||||
auto s1 = g.new_state();
|
||||
auto s2 = g.new_state();
|
||||
auto s3 = g.new_state();
|
||||
g.new_edge(s1, s2);
|
||||
g.new_edge(s1, s3);
|
||||
g.new_edge(s2, s3);
|
||||
g.new_edge(s3, s1);
|
||||
g.new_edge(s3, s2);
|
||||
g.new_edge(s3, s3);
|
||||
|
||||
dot(std::cout, g);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
(void) t;
|
||||
++f;
|
||||
}
|
||||
return f == 2
|
||||
&& g1(g, s3, 3)
|
||||
&& g1(g, s2, 1)
|
||||
&& g1(g, s1, 2);
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
f2()
|
||||
{
|
||||
spot::digraph<int, void> g(3);
|
||||
|
||||
auto s1 = g.new_state(1);
|
||||
auto s2 = g.new_state(2);
|
||||
auto s3 = g.new_state(3);
|
||||
g.new_edge(s1, s2);
|
||||
g.new_edge(s1, s3);
|
||||
g.new_edge(s2, s3);
|
||||
g.new_edge(s3, s2);
|
||||
|
||||
dot(std::cout, g);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += g.state_data(t.dst);
|
||||
}
|
||||
return f == 5;
|
||||
}
|
||||
|
||||
static bool
|
||||
f3()
|
||||
{
|
||||
spot::digraph<void, int> g(3);
|
||||
|
||||
auto s1 = g.new_state();
|
||||
auto s2 = g.new_state();
|
||||
auto s3 = g.new_state();
|
||||
g.new_edge(s1, s2, 1);
|
||||
g.new_edge(s1, s3, 2);
|
||||
g.new_edge(s2, s3, 3);
|
||||
g.new_edge(s3, s2, 4);
|
||||
|
||||
dot(std::cout, g);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += t.label;
|
||||
}
|
||||
return f == 3 && g.states().size() == 3;
|
||||
}
|
||||
|
||||
static bool
|
||||
f4()
|
||||
{
|
||||
spot::digraph<int, int> g(3);
|
||||
|
||||
auto s1 = g.new_state(2);
|
||||
auto s2 = g.new_state(3);
|
||||
auto s3 = g.new_state(4);
|
||||
g.new_edge(s1, s2, 1);
|
||||
g.new_edge(s1, s3, 2);
|
||||
g.new_edge(s2, s3, 3);
|
||||
g.new_edge(s3, s2, 4);
|
||||
|
||||
dot(std::cout, g);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += t.label * g.state_data(t.dst);
|
||||
}
|
||||
return f == 11;
|
||||
}
|
||||
|
||||
static bool
|
||||
f5()
|
||||
{
|
||||
spot::digraph<void, std::pair<int, float>> g(3);
|
||||
|
||||
auto s1 = g.new_state();
|
||||
auto s2 = g.new_state();
|
||||
auto s3 = g.new_state();
|
||||
g.new_edge(s1, s2, std::make_pair(1, 1.2f));
|
||||
g.new_edge(s1, s3, std::make_pair(2, 1.3f));
|
||||
g.new_edge(s2, s3, std::make_pair(3, 1.4f));
|
||||
g.new_edge(s3, s2, std::make_pair(4, 1.5f));
|
||||
|
||||
int f = 0;
|
||||
float h = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += std::get<0>(t);
|
||||
h += std::get<1>(t);
|
||||
}
|
||||
return f == 3 && (h > 2.49 && h < 2.51);
|
||||
}
|
||||
|
||||
static bool
|
||||
f6()
|
||||
{
|
||||
spot::digraph<void, std::pair<int, float>> g(3);
|
||||
|
||||
auto s1 = g.new_state();
|
||||
auto s2 = g.new_state();
|
||||
auto s3 = g.new_state();
|
||||
g.new_edge(s1, s2, 1, 1.2f);
|
||||
g.new_edge(s1, s3, 2, 1.3f);
|
||||
g.new_edge(s2, s3, 3, 1.4f);
|
||||
g.new_edge(s3, s2, 4, 1.5f);
|
||||
|
||||
int f = 0;
|
||||
float h = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += t.first;
|
||||
h += t.second;
|
||||
}
|
||||
return f == 3 && (h > 2.49 && h < 2.51);
|
||||
}
|
||||
|
||||
static bool
|
||||
f7()
|
||||
{
|
||||
spot::digraph<int, int, true> g(3);
|
||||
auto s1 = g.new_state(2);
|
||||
auto s2 = g.new_state(3);
|
||||
auto s3 = g.new_state(4);
|
||||
g.new_edge(s1, {s2, s3}, 1);
|
||||
g.new_edge(s1, {s3}, 2);
|
||||
g.new_edge(s2, {s3}, 3);
|
||||
g.new_edge(s3, {s2}, 4);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
for (auto& tt: t.dst)
|
||||
{
|
||||
f += t.label * g.state_data(tt);
|
||||
}
|
||||
}
|
||||
return f == 15;
|
||||
}
|
||||
|
||||
|
||||
struct int_pair
|
||||
{
|
||||
int one;
|
||||
int two;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, int_pair p)
|
||||
{
|
||||
os << '(' << p.one << ',' << p.two << ')';
|
||||
return os;
|
||||
}
|
||||
|
||||
#if __GNUC__ <= 4 && __GNUC_MINOR__ <= 6
|
||||
int_pair(int one, int two)
|
||||
: one(one), two(two)
|
||||
{
|
||||
}
|
||||
|
||||
int_pair()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static bool
|
||||
f8()
|
||||
{
|
||||
spot::digraph<int_pair, int_pair> g(3);
|
||||
auto s1 = g.new_state(2, 4);
|
||||
auto s2 = g.new_state(3, 6);
|
||||
auto s3 = g.new_state(4, 8);
|
||||
g.new_edge(s1, s2, 1, 3);
|
||||
g.new_edge(s1, s3, 2, 5);
|
||||
g.new_edge(s2, s3, 3, 7);
|
||||
g.new_edge(s3, s2, 4, 9);
|
||||
|
||||
dot(std::cout, g);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += t.one * g.state_data(t.dst).one;
|
||||
f += t.two * g.state_data(t.dst).two;
|
||||
}
|
||||
return f == 69;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
bool a1 = f1();
|
||||
bool a2 = f2();
|
||||
bool a3 = f3();
|
||||
bool a4 = f4();
|
||||
bool a5 = f5();
|
||||
bool a6 = f6();
|
||||
bool a7 = f7();
|
||||
bool a8 = f8();
|
||||
std::cout << a1 << ' '
|
||||
<< a2 << ' '
|
||||
<< a3 << ' '
|
||||
<< a4 << ' '
|
||||
<< a5 << ' '
|
||||
<< a6 << ' '
|
||||
<< a7 << ' '
|
||||
<< a8 << '\n';
|
||||
return !(a1 && a2 && a3 && a4 && a5 && a6 && a7 && a8);
|
||||
}
|
||||
87
tests/graph.test
Executable file
87
tests/graph.test
Executable file
|
|
@ -0,0 +1,87 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# While running some benchmark, Tomáš Babiak found that Spot took too
|
||||
# much time (i.e. >1h) to translate those six formulae. It turns out
|
||||
# that the WDBA minimization was performed after the degeneralization
|
||||
# algorithm, while this is not necessary (WDBA will produce a BA, so
|
||||
# we may as well skip degeneralization). Translating these formulae
|
||||
# in the test-suite ensure that they don't take too much time (the
|
||||
# buildfarm will timeout if it does).
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
run 0 ../graph > stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
digraph {
|
||||
0
|
||||
0 -> 1
|
||||
0 -> 2
|
||||
1
|
||||
1 -> 2
|
||||
2
|
||||
2 -> 0
|
||||
2 -> 1
|
||||
2 -> 2
|
||||
}
|
||||
digraph {
|
||||
0 [label="1"]
|
||||
0 -> 1
|
||||
0 -> 2
|
||||
1 [label="2"]
|
||||
1 -> 2
|
||||
2 [label="3"]
|
||||
2 -> 1
|
||||
}
|
||||
digraph {
|
||||
0
|
||||
0 -> 1 [label="1"]
|
||||
0 -> 2 [label="2"]
|
||||
1
|
||||
1 -> 2 [label="3"]
|
||||
2
|
||||
2 -> 1 [label="4"]
|
||||
}
|
||||
digraph {
|
||||
0 [label="2"]
|
||||
0 -> 1 [label="1"]
|
||||
0 -> 2 [label="2"]
|
||||
1 [label="3"]
|
||||
1 -> 2 [label="3"]
|
||||
2 [label="4"]
|
||||
2 -> 1 [label="4"]
|
||||
}
|
||||
digraph {
|
||||
0 [label="(2,4)"]
|
||||
0 -> 1 [label="(1,3)"]
|
||||
0 -> 2 [label="(2,5)"]
|
||||
1 [label="(3,6)"]
|
||||
1 -> 2 [label="(3,7)"]
|
||||
2 [label="(4,8)"]
|
||||
2 -> 1 [label="(4,9)"]
|
||||
}
|
||||
1 1 1 1 1 1 1 1
|
||||
EOF
|
||||
|
||||
diff stdout expected
|
||||
|
||||
1626
tests/ikwiad.cc
Normal file
1626
tests/ikwiad.cc
Normal file
File diff suppressed because it is too large
Load diff
135
tests/intvcmp2.cc
Normal file
135
tests/intvcmp2.cc
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2014, 2015 Laboratoire de Recherche et Developpement
|
||||
// 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <spot/misc/intvcmp2.hh>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
static int
|
||||
check_aa(int* data, int size, unsigned expected = 0)
|
||||
{
|
||||
int* comp = new int[size * 2];
|
||||
size_t csize = size * 2;
|
||||
spot::int_array_array_compress2(data, size, comp, csize);
|
||||
|
||||
std::cout << "AC[" << csize << "] ";
|
||||
for (size_t i = 0; i < csize; ++i)
|
||||
std::cout << comp[i] << ' ';
|
||||
std::cout << std::endl;
|
||||
|
||||
int* decomp = new int[size + 30];
|
||||
spot::int_array_array_decompress2(comp, csize, decomp, size);
|
||||
|
||||
std::cout << "AD[" << size << "] ";
|
||||
for (int i = 0; i < size; ++i)
|
||||
std::cout << decomp[i] << ' ';
|
||||
std::cout << std::endl;
|
||||
|
||||
int res = memcmp(data, decomp, size * sizeof(int));
|
||||
|
||||
if (res)
|
||||
{
|
||||
std::cout << "*** cmp error *** " << res << std::endl;
|
||||
std::cout << "AE[" << size << "] ";
|
||||
for (int i = 0; i < size; ++i)
|
||||
std::cout << data[i] << ' ';
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
if (expected && (csize * sizeof(int) != expected))
|
||||
{
|
||||
std::cout << "*** size error *** (expected "
|
||||
<< expected << " bytes, got " << csize * sizeof(int)
|
||||
<< " bytes)" << std::endl;
|
||||
res = 1;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
delete[] comp;
|
||||
delete[] decomp;
|
||||
return !!res;
|
||||
}
|
||||
|
||||
static int
|
||||
check(int* comp, int size, unsigned expected = 0)
|
||||
{
|
||||
return
|
||||
//check_vv(comp, size, expected) +
|
||||
//check_av(comp, size, expected) +
|
||||
check_aa(comp, size, expected);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int errors = 0;
|
||||
|
||||
int comp1[] = { 1, 0, 0, 0, 0, 0, 3, 3, 4, 0, 0, 0 };
|
||||
errors += check(comp1, sizeof(comp1) / sizeof(*comp1));
|
||||
|
||||
int comp2[] = { 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 1 };
|
||||
errors += check(comp2, sizeof(comp2) / sizeof(*comp2));
|
||||
|
||||
int comp3[] = { 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1,
|
||||
0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
||||
0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1,
|
||||
0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0 };
|
||||
errors += check(comp3, sizeof(comp3) / sizeof(*comp3));
|
||||
|
||||
int comp4[] = { 1, 2, 1, 2, 1, 2, 2, 0 }; // 32 bits
|
||||
errors += check(comp4, sizeof(comp4) / sizeof(*comp4), 4);
|
||||
|
||||
int comp5[] = { 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0 }; // 64 bits
|
||||
errors += check(comp5, sizeof(comp5) / sizeof(*comp5), 8);
|
||||
|
||||
int comp6[] = { 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0,
|
||||
1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0 }; // 128 bits
|
||||
errors += check(comp6, sizeof(comp6) / sizeof(*comp6), 16);
|
||||
|
||||
int comp7[] = { 4, 8, 10, 3, 49, 50, 0, 20, 13 };
|
||||
errors += check(comp7, sizeof(comp7) / sizeof(*comp7));
|
||||
|
||||
int comp8[] = { 4959, 6754, 8133, 10985, 11121, 14413, 17335, 20754,
|
||||
21317, 30008, 30381, 33494, 34935, 41210, 41417 };
|
||||
errors += check(comp8, sizeof(comp8) / sizeof(*comp8));
|
||||
|
||||
int comp9[] = { 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
errors += check(comp9, sizeof(comp9) / sizeof(*comp9));
|
||||
|
||||
int comp10[] = { 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
|
||||
9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 10,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 9 };
|
||||
errors += check(comp10, sizeof(comp10) / sizeof(*comp10));
|
||||
|
||||
int comp11[] = { 2, 254, 254, 0, 1, 4, 0, 0, 0, 1, 0, 1, 253, 0 };
|
||||
errors += check(comp11, sizeof(comp11) / sizeof(*comp11));
|
||||
|
||||
return errors;
|
||||
}
|
||||
225
tests/intvcomp.cc
Normal file
225
tests/intvcomp.cc
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2014, 2015 Laboratoire de Recherche et
|
||||
// Developpement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <spot/misc/intvcomp.hh>
|
||||
#include <cstring>
|
||||
|
||||
static int
|
||||
check_vv(int* data, int size, unsigned expected = 0)
|
||||
{
|
||||
|
||||
std::vector<int> input;
|
||||
input.reserve(size);
|
||||
for (int i = 0; i < size; ++i)
|
||||
input.push_back(data[i]);
|
||||
|
||||
std::vector<unsigned int> output;
|
||||
spot::int_vector_vector_compress(input, output);
|
||||
|
||||
std::cout << "WC[" << output.size() << "] ";
|
||||
for (size_t i = 0; i < output.size(); ++i)
|
||||
std::cout << output[i] << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
std::vector<int> decomp;
|
||||
spot::int_vector_vector_decompress(output, decomp, size);
|
||||
|
||||
std::cout << "WD[" << decomp.size() << "] ";
|
||||
for (size_t i = 0; i < decomp.size(); ++i)
|
||||
std::cout << decomp[i] << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
int res = (decomp != input);
|
||||
|
||||
if (res)
|
||||
{
|
||||
std::cout << "*** cmp error *** " << std::endl;
|
||||
std::cout << "WE[" << size << "] ";
|
||||
for (int i = 0; i < size; ++i)
|
||||
std::cout << data[i] << ' ';
|
||||
std::cout << '\n';
|
||||
}
|
||||
|
||||
if (expected && (output.size() * sizeof(int) != expected))
|
||||
{
|
||||
std::cout << "*** size error *** (expected "
|
||||
<< expected << " bytes, got " << output.size() * sizeof(int)
|
||||
<< " bytes)" << std::endl;
|
||||
res = 1;
|
||||
}
|
||||
|
||||
std::cout << '\n';
|
||||
|
||||
return !!res;
|
||||
}
|
||||
|
||||
static int
|
||||
check_av(int* data, int size, unsigned expected = 0)
|
||||
{
|
||||
const std::vector<unsigned int>* v =
|
||||
spot::int_array_vector_compress(data, size);
|
||||
|
||||
std::cout << "VC[" << v->size() << "] ";
|
||||
for (size_t i = 0; i < v->size(); ++i)
|
||||
std::cout << (*v)[i] << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
int* decomp = new int[size];
|
||||
spot::int_vector_array_decompress(v, decomp, size);
|
||||
|
||||
std::cout << "VD[" << size << "] ";
|
||||
for (int i = 0; i < size; ++i)
|
||||
std::cout << decomp[i] << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
int res = memcmp(data, decomp, size * sizeof(int));
|
||||
|
||||
if (res)
|
||||
{
|
||||
std::cout << "*** cmp error *** " << res << std::endl;
|
||||
std::cout << "VE[" << size << "] ";
|
||||
for (int i = 0; i < size; ++i)
|
||||
std::cout << data[i] << ' ';
|
||||
std::cout << '\n';
|
||||
}
|
||||
|
||||
if (expected && (v->size() * sizeof(int) != expected))
|
||||
{
|
||||
std::cout << "*** size error *** (expected "
|
||||
<< expected << " bytes, got " << v->size() * sizeof(int)
|
||||
<< " bytes)" << std::endl;
|
||||
res = 1;
|
||||
}
|
||||
|
||||
std::cout << '\n';
|
||||
|
||||
delete v;
|
||||
delete[] decomp;
|
||||
return !!res;
|
||||
}
|
||||
|
||||
static int
|
||||
check_aa(int* data, int size, unsigned expected = 0)
|
||||
{
|
||||
int* comp = new int[size *2];
|
||||
size_t csize = size * 2;
|
||||
spot::int_array_array_compress(data, size, comp, csize);
|
||||
|
||||
std::cout << "AC[" << csize << "] ";
|
||||
for (size_t i = 0; i < csize; ++i)
|
||||
std::cout << comp[i] << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
int* decomp = new int[size];
|
||||
spot::int_array_array_decompress(comp, csize, decomp, size);
|
||||
|
||||
std::cout << "AD[" << size << "] ";
|
||||
for (int i = 0; i < size; ++i)
|
||||
std::cout << decomp[i] << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
int res = memcmp(data, decomp, size * sizeof(int));
|
||||
|
||||
if (res)
|
||||
{
|
||||
std::cout << "*** cmp error *** " << res << std::endl;
|
||||
std::cout << "AE[" << size << "] ";
|
||||
for (int i = 0; i < size; ++i)
|
||||
std::cout << data[i] << ' ';
|
||||
std::cout << '\n';
|
||||
}
|
||||
|
||||
if (expected && (csize * sizeof(int) != expected))
|
||||
{
|
||||
std::cout << "*** size error *** (expected "
|
||||
<< expected << " bytes, got " << csize * sizeof(int)
|
||||
<< " bytes)" << std::endl;
|
||||
res = 1;
|
||||
}
|
||||
|
||||
std::cout << '\n';
|
||||
|
||||
delete[] comp;
|
||||
delete[] decomp;
|
||||
return !!res;
|
||||
}
|
||||
|
||||
static int
|
||||
check(int* comp, int size, unsigned expected = 0)
|
||||
{
|
||||
return
|
||||
check_vv(comp, size, expected) +
|
||||
check_av(comp, size, expected) +
|
||||
check_aa(comp, size, expected);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int errors = 0;
|
||||
|
||||
int comp1[] = { 1, 0, 0, 0, 0, 0, 3, 3, 4, 0, 0, 0 };
|
||||
errors += check(comp1, sizeof(comp1) / sizeof(*comp1));
|
||||
|
||||
int comp2[] = { 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 1 };
|
||||
errors += check(comp2, sizeof(comp2) / sizeof(*comp2));
|
||||
|
||||
int comp3[] = { 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1,
|
||||
0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
||||
0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1,
|
||||
0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0 };
|
||||
errors += check(comp3, sizeof(comp3) / sizeof(*comp3));
|
||||
|
||||
int comp4[] = { 1, 2, 1, 2, 1, 2, 2, 0 }; // 32 bits
|
||||
errors += check(comp4, sizeof(comp4) / sizeof(*comp4), 4);
|
||||
|
||||
int comp5[] = { 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0 }; // 64 bits
|
||||
errors += check(comp5, sizeof(comp5) / sizeof(*comp5), 8);
|
||||
|
||||
int comp6[] = { 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0,
|
||||
1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0 }; // 128 bits
|
||||
errors += check(comp6, sizeof(comp6) / sizeof(*comp6), 16);
|
||||
|
||||
int comp7[] = { -4, -8, -10, 3, 49, 50, 0, 20, 13 };
|
||||
errors += check(comp7, sizeof(comp7) / sizeof(*comp7));
|
||||
|
||||
int comp8[] = { 4959, 6754, 8133, 10985, 11121, 14413, 17335, 20754,
|
||||
21317, 30008, 30381, 33494, 34935, 41210, 41417 };
|
||||
errors += check(comp8, sizeof(comp8) / sizeof(*comp8));
|
||||
|
||||
int comp9[] = { 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
errors += check(comp9, sizeof(comp9) / sizeof(*comp9));
|
||||
|
||||
int comp10[] = { 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
|
||||
9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 10,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 9 };
|
||||
errors += check(comp10, sizeof(comp10) / sizeof(*comp10));
|
||||
|
||||
return errors;
|
||||
}
|
||||
27
tests/intvcomp.test
Executable file
27
tests/intvcomp.test
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2011, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
run 0 ../intvcomp
|
||||
run 0 ../intvcmp2
|
||||
111
tests/isomorph.test
Executable file
111
tests/isomorph.test
Executable file
|
|
@ -0,0 +1,111 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
for i in 0 1 2; do
|
||||
../../bin/randaut a b --seed=$i -Q10 --hoa >iso$i
|
||||
../../bin/autfilt iso$i --randomize --hoa >aut$i
|
||||
done
|
||||
for i in 3 4 5; do
|
||||
../../bin/randaut a b --seed=$i -Q10 -D --hoa >iso$i
|
||||
../../bin/autfilt iso$i --randomize --hoa >aut$i
|
||||
done
|
||||
|
||||
cat aut0 aut1 aut2 aut3 aut4 aut5 > all
|
||||
(for i in 0 1 2 3 4 5; do
|
||||
run 0 ../../bin/autfilt all --are-isomorphic iso$i --hoa
|
||||
done) > output
|
||||
diff all output
|
||||
|
||||
# Test if two isomorphic automata with different initial states are detected.
|
||||
cat >aut1 <<EOF
|
||||
HOA: v1
|
||||
name: "1"
|
||||
States: 4
|
||||
Start: 1
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0 [t] 1 [t] 1
|
||||
State: 1 [t] 2 [t] 2
|
||||
State: 2 [t] 3 [t] 3
|
||||
State: 3 [t] 0 [t] 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >aut2 <<EOF
|
||||
HOA: v1
|
||||
name: "1"
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0 [t] 1 [t] 1
|
||||
State: 1 [t] 3 [t] 3
|
||||
State: 3 [t] 2 [t] 2
|
||||
State: 2 [t] 0 [t] 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
# Check that the number of ingoing and outgoing transitions of a state matters,
|
||||
# even if they behave similarly.
|
||||
cat >aut3 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0 [t] 1 [t] 2
|
||||
State: 1 [t] 1 [t] 1
|
||||
State: 2 [t] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >aut4 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0 [t] 1 [t] 2
|
||||
State: 1 [t] 1
|
||||
State: 2 [t] 2 [t] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt aut1 --are-isomorphic aut2
|
||||
run 0 ../../bin/autfilt aut3 --are-isomorphic aut4
|
||||
|
||||
run 0 ../../bin/autfilt -u aut1 aut2 aut2 aut3 -c >out
|
||||
test 2 = "`cat out`"
|
||||
55
tests/isop.test
Executable file
55
tests/isop.test
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
cat >input<<EOF
|
||||
(a -> b) & (b -> d)
|
||||
(a -> b) & Xc & (b -> d)
|
||||
GF((a | b) & (b | d))
|
||||
{((a -> b) & (b -> d))*;a*}<>->((a | b) & (!b | !a))
|
||||
EOF
|
||||
|
||||
# Make sure --boolean-to-isop works as expected...
|
||||
run 0 ../../bin/ltlfilt --boolean-to-isop input > output
|
||||
|
||||
cat> expected<<EOF
|
||||
(!a & !b) | (b & d)
|
||||
(!a | b) & (!b | d) & Xc
|
||||
GF(b | (a & d))
|
||||
{{{!a && !b} | {b && d}}[*];a[*]}<>-> ((!a & b) | (a & !b))
|
||||
EOF
|
||||
|
||||
cat output
|
||||
diff output expected
|
||||
|
||||
# Make sure it would not give the same output without the option...
|
||||
run 0 ../../bin/ltlfilt input > output
|
||||
|
||||
cat> expected<<EOF
|
||||
(a -> b) & (b -> d)
|
||||
(a -> b) & (b -> d) & Xc
|
||||
GF((a | b) & (b | d))
|
||||
{{{a -> b} && {b -> d}}[*];a[*]}<>-> ((a | b) & (!a | !b))
|
||||
EOF
|
||||
|
||||
cat output
|
||||
diff output expected
|
||||
79
tests/kind.cc
Normal file
79
tests/kind.cc
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2010, 2012, 2015 Laboratoire de Recherche et
|
||||
// Developement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <spot/tl/parse.hh>
|
||||
|
||||
static void
|
||||
syntax(char *prog)
|
||||
{
|
||||
std::cerr << prog << " formula" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
syntax(argv[0]);
|
||||
|
||||
std::ifstream input(argv[1]);
|
||||
if (!input)
|
||||
{
|
||||
std::cerr << "failed to open " << argv[1] << '\n';
|
||||
return 2;
|
||||
}
|
||||
|
||||
std::string s;
|
||||
while (std::getline(input, s))
|
||||
{
|
||||
if (s[0] == '#') // Skip comments
|
||||
{
|
||||
std::cerr << s << '\n';
|
||||
continue;
|
||||
}
|
||||
std::istringstream ss(s);
|
||||
std::string form;
|
||||
std::string expected;
|
||||
std::getline(ss, form, ',');
|
||||
std::getline(ss, expected);
|
||||
|
||||
spot::parse_error_list p1;
|
||||
auto f1 = spot::parse_infix_psl(form, p1);
|
||||
if (spot::format_parse_errors(std::cerr, form, p1))
|
||||
return 2;
|
||||
|
||||
std::ostringstream so;
|
||||
spot::print_formula_props(so, f1, true);
|
||||
auto sost = so.str();
|
||||
std::cout << form << ',' << sost << '\n';
|
||||
if (sost != expected)
|
||||
{
|
||||
std::cerr << "computed '" << sost
|
||||
<< "' but expected '" << expected << "'\n";
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
assert(spot::fnode::instances_check());
|
||||
return 0;
|
||||
}
|
||||
138
tests/kind.test
Executable file
138
tests/kind.test
Executable file
|
|
@ -0,0 +1,138 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2010, 2011, 2012, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Check for the constant_term visitor
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
cat >input<<EOF
|
||||
a,B&!xfLPSFsgopra
|
||||
a<->b,BxfLPSFsgopra
|
||||
!a,B&!xfLPSFsgopra
|
||||
!(a|b),B&xfLPSFsgopra
|
||||
F(a),&!xLPegopra
|
||||
G(a),&!xLPusopra
|
||||
a U b,&!xfLPgopra
|
||||
a U Fb,&!xLPegopra
|
||||
Ga U b,&!xLPopra
|
||||
1 U a,&!xfLPegopra
|
||||
a W b,&!xfLPsopra
|
||||
a W 0,&!xfLPusopra
|
||||
a M b,&!xfLPgopra
|
||||
a M 1,&!xfLPegopra
|
||||
a R b,&!xfLPsopra
|
||||
0 R b,&!xfLPusopra
|
||||
a R (b R (c R d)),&!xfLPsopra
|
||||
a U (b U (c U d)),&!xfLPgopra
|
||||
a W (b W (c W d)),&!xfLPsopra
|
||||
a M (b M (c M d)),&!xfLPgopra
|
||||
Fa -> Fb,xLPopra
|
||||
Ga -> Fb,xLPgopra
|
||||
Fa -> Gb,xLPsopra
|
||||
(Ga|Fc) -> Fb,xLPopra
|
||||
(Ga|Fa) -> Gb,xLPopra
|
||||
{a;c*;b}|->!Xb,&fPsopra
|
||||
{a;c*;b}|->X!b,&!fPsopra
|
||||
{a;c*;b}|->!Fb,&Psopra
|
||||
{a;c*;b}|->G!b,&!Psopra
|
||||
{a;c*;b}|->!Gb,&Pra
|
||||
{a;c*;b}|->F!b,&!Pra
|
||||
{a;c*;b}|->GFa,&!Pra
|
||||
{a;c*;b}|->FGa,&!Pa
|
||||
{a[+];c[+];b*}|->!Fb,&xPsopra
|
||||
{a[+];c*;b[+]}|->G!b,&!xPsopra
|
||||
{a*;c[+];b[+]}|->!Gb,&xPra
|
||||
{a[+];c*;b[+]}|->F!b,&!xPra
|
||||
{a[+];c[+];b*}|->GFa,&!xPra
|
||||
{a*;c[+];b[+]}|->FGa,&!xPa
|
||||
{a;c;b|(d;e)}|->!Xb,&fPFsgopra
|
||||
{a;c;b|(d;e)}|->X!b,&!fPFsgopra
|
||||
{a;c;b|(d;e)}|->!Fb,&Psopra
|
||||
{a;c;b|(d;e)}|->G!b,&!Psopra
|
||||
{a;c;b|(d;e)}|->!Gb,&Pgopra
|
||||
{a;c;b|(d;e)}|->F!b,&!Pgopra
|
||||
{a;c;b|(d;e)}|->GFa,&!Pra
|
||||
{a;c;b|(d;e)}|->FGa,&!Ppa
|
||||
{a[+] && c[+]}|->!Xb,&fPsopra
|
||||
{a[+] && c[+]}|->X!b,&!fPsopra
|
||||
{a[+] && c[+]}|->!Fb,&xPsopra
|
||||
{a[+] && c[+]}|->G!b,&!xPsopra
|
||||
{a[+] && c[+]}|->!Gb,&xPra
|
||||
{a[+] && c[+]}|->F!b,&!xPra
|
||||
{a[+] && c[+]}|->GFa,&!xPra
|
||||
{a[+] && c[+]}|->FGa,&!xPa
|
||||
{a;c*;b}<>->!Gb,&Pgopra
|
||||
{a;c*;b}<>->F!b,&!Pgopra
|
||||
{a;c*;b}<>->FGb,&!Ppa
|
||||
{a;c*;b}<>->!GFb,&Ppa
|
||||
{a;c*;b}<>->GFb,&!Pa
|
||||
{a;c*;b}<>->!FGb,&Pa
|
||||
{a*;c[+];b[+]}<>->!FGb,&xPa
|
||||
{a;c|d;b}<>->!Gb,&Pgopra
|
||||
{a;c|d;b}<>->G!b,&!Psopra
|
||||
{a;c|d;b}<>->FGb,&!Ppa
|
||||
{a;c|d;b}<>->!GFb,&Ppa
|
||||
{a;c|d;b}<>->GFb,&!Pra
|
||||
{a;c|d;_b}<>->!FGb,&Pr
|
||||
# Equivalent to a&b&c&d
|
||||
{a:b:c:d}!,B&!xfLPSFsgopra
|
||||
a&b&c&d,B&!xfLPSFsgopra
|
||||
(Xa <-> XXXc) U (b & Fe),LPgopra
|
||||
(!X(a|X(!b))&(FX(g xor h)))U(!G(a|b)),LPegopra
|
||||
(!X(a|X(!b))&(GX(g xor h)))R(!F(a|b)),LPusopra
|
||||
(!X(a|X(!b))&(GX(g xor h)))U(!G(a|b)),LPeopra
|
||||
(!X(a|X(!b))&(FX(g xor h)))R(!F(a|b)),LPuopra
|
||||
(!X(a|X(!b))&(GX(g xor h)))U(!F(a|b)),LPpa
|
||||
(!X(a|X(!b))&(FX(g xor h)))R(!G(a|b)),LPra
|
||||
(!X(a|GXF(!b))&(FGX(g xor h)))U(!F(a|b)),LPpa
|
||||
(!X(a|GXF(!b))&(FGX(g xor h)))R(!F(a|b)),LPupa
|
||||
(!X(a|FXG(!b))&(GFX(g xor h)))R(!G(a|b)),LPra
|
||||
(!X(a|FXG(!b))&(GFX(g xor h)))U(!G(a|b)),LPera
|
||||
(!X(a|GXF(!b))&(FGX(g xor h)))U(!G(a|Fb)),LPepa
|
||||
(!X(a|GXF(!b))&(FGX(g xor h)))U(!F(a|Gb)),LPa
|
||||
(!X(a|FXG(!b))&(GFX(g xor h)))R(!F(a|Gb)),LPura
|
||||
(!X(a|FXG(!b))&(GFX(g xor h)))R(!G(a|Fb)),LPa
|
||||
GFa M GFb,&!xLPeua
|
||||
FGa M FGb,&!xLPeupa
|
||||
Fa M GFb,&!xLPera
|
||||
GFa W GFb,&!xLPeura
|
||||
FGa W FGb,&!xLPeua
|
||||
Ga W FGb,&!xLPupa
|
||||
Ga W b,&!xLPsopra
|
||||
Fa M b,&!xLPgopra
|
||||
{a;b*;c},&!fPsopra
|
||||
{a;b*;c}!,&!fPgopra
|
||||
# The negative normal form is {a;b*;c}[]->1
|
||||
!{a;b*;c}!,&fPsopra
|
||||
{a;b*;p112}[]->0,&!fPsopra
|
||||
!{a;b*;c.2},&!fPgopr
|
||||
!{a[+];b*;c[+]},&!xfPgopra
|
||||
{a[+];b*;c[+]},&!xfPsopra
|
||||
{a[+] && b || c[+]},&!fPsopra
|
||||
{a[+] && b[+] || c[+]},&!xfPsopra
|
||||
{p[+]:p[+]},&!xfPsoprla
|
||||
(!p W Gp) | ({(!p[*];(p[+]:(p[*];!p[+])))[:*4][:+]}<>-> (!p W Gp)),&!xPpla
|
||||
{b[+][:*0..3]},&!fPsopra
|
||||
EOF
|
||||
|
||||
run 0 ../kind input
|
||||
139
tests/kripke.test
Executable file
139
tests/kripke.test
Executable file
|
|
@ -0,0 +1,139 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2011, 2012, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
Acceptance: 0 t
|
||||
properties: state-labels
|
||||
--BODY--
|
||||
State: [!1] 0
|
||||
1
|
||||
State: [0&1] 1
|
||||
2
|
||||
State: [0] 2
|
||||
3 0
|
||||
State: [1] 3
|
||||
0
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 0
|
||||
Acceptance: 0 t
|
||||
properties: state-labels
|
||||
--BODY--
|
||||
State: [t] 0 0 1
|
||||
State: [t] 1 0 1
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
Acceptance: 0 t
|
||||
properties: state-labels
|
||||
--BODY--
|
||||
State: [0&1] 0 0
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 6
|
||||
Start: 0
|
||||
AP: 0
|
||||
Acceptance: 0 t
|
||||
properties: state-labels
|
||||
--BODY--
|
||||
State: [t] 0
|
||||
1 2 3 4 5
|
||||
State: [f] 1
|
||||
State: [f] 2
|
||||
State: [f] 3
|
||||
State: [f] 4
|
||||
State: [f] 5
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../parse_print input1 > input1.out
|
||||
run 0 ../parse_print input1.out > input1.out2
|
||||
|
||||
|
||||
cat >input2 <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 0
|
||||
Acceptance: 0 t
|
||||
properties: state-labels
|
||||
--BODY--
|
||||
State: [t] 0
|
||||
1 2 3
|
||||
--END--
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 0
|
||||
Acceptance: 1 Fin(0)
|
||||
properties: state-labels
|
||||
--BODY--
|
||||
State: [t] 0
|
||||
0 1 {0}
|
||||
State: 1
|
||||
[t] 0 [f] 1
|
||||
--END--
|
||||
DRA v2 explicit
|
||||
Comment: "Safra[NBA=2]"
|
||||
States: 3
|
||||
Acceptance-Pairs: 1
|
||||
Start: 0
|
||||
AP: 1 "a"
|
||||
---
|
||||
State: 0
|
||||
Acc-Sig:
|
||||
1
|
||||
2
|
||||
State: 1
|
||||
Acc-Sig: -0
|
||||
1
|
||||
1
|
||||
State: 2
|
||||
Acc-Sig: +0
|
||||
2
|
||||
2
|
||||
EOF
|
||||
|
||||
../parse_print input2 2>output2.err && exit 1
|
||||
cat output2.err
|
||||
cat >expected2<<EOF
|
||||
input2:9.1: state 1 has no definition
|
||||
input2:9.3: state 2 has no definition
|
||||
input2:9.5: state 3 has no definition
|
||||
input2:15.13-20: the acceptance for Kripke structure must be '0 t'
|
||||
input2:20.1-8: Kripke structures should have labeled states
|
||||
input2:21.1-3: transition label used although the automaton was...
|
||||
input2:16.13-24: ... declared with 'properties: state-labels' here
|
||||
input2:23.1-3: cannot read a Kripke structure out of a DSTAR automaton
|
||||
EOF
|
||||
|
||||
diff output2.err expected2
|
||||
65
tests/latex.test
Executable file
65
tests/latex.test
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
# Skip this test if we don't find a sufficiently complete LaTeX
|
||||
# installation
|
||||
|
||||
(latexmk --version) || exit 77
|
||||
(pdflatex --version) || exit 77
|
||||
(kpsewhich txfonts.sty) || exit 77
|
||||
(kpsewhich amsmath.sty) || exit 77
|
||||
|
||||
cat >input <<\EOF
|
||||
XGFa <-> FGX(!b & !c) | (b ^ a)
|
||||
a U b W c R (d & e) M f
|
||||
{a;b[=2];((c:d*) && f*);e[*2..]}<>-> {((a | [*0])*;b[+]) & (c1[->2])}[]-> h
|
||||
{a;b;c} []=> {d*;e} <>=> !f
|
||||
!{a;b*;c}! -> d
|
||||
{a*;(b;c)[:*3..4];(c;d)[:+];d}!
|
||||
G(uglyname->Fuglierlongname42)
|
||||
"#foo/$bar$" U "baz~yes^no"
|
||||
EOF
|
||||
|
||||
(
|
||||
cat <<\EOF
|
||||
\documentclass{article}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{spotltl}
|
||||
\begin{document}
|
||||
\begin{tabular}{ll}
|
||||
EOF
|
||||
( ../../bin/ltlfilt --latex input --format='\texttt{%F:%L} & $%f$ \\';
|
||||
../../bin/genltl --go-theta=1..3 --latex \
|
||||
--format='\texttt{--%F:%L} & $%f$ \\')
|
||||
cat <<\EOF
|
||||
\end{tabular}
|
||||
\end{document}
|
||||
EOF
|
||||
) > output.tex
|
||||
|
||||
TEXINPUTS=$top_srcdir/doc/tl: \
|
||||
latexmk -f -silent -pdf -ps- -dvi- -pvc- output.tex
|
||||
|
||||
# latexmk will have a non-zero exit status on failure, so we will
|
||||
# detect that. However the file output.pdf really ought to be
|
||||
# controled by eye...
|
||||
111
tests/lbt.test
Executable file
111
tests/lbt.test
Executable file
|
|
@ -0,0 +1,111 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
randltl=../../bin/randltl
|
||||
genltl=../../bin/genltl
|
||||
|
||||
# Some example formulas taken from Ruediger Ehlers's dbaminimizer
|
||||
# http://react.cs.uni-saarland.de/tools/dbaminimizer
|
||||
# which are expected to be processed by ltl2dstar.
|
||||
cat >formulas <<'EOF'
|
||||
& G F a G F b
|
||||
X X a
|
||||
G F e a X X b
|
||||
G F e a X X X b
|
||||
G i a X X X b
|
||||
G F i a X X X b
|
||||
& G i a F b G i b F c
|
||||
G i a F b
|
||||
& G i a F b G c
|
||||
& & G ! c G i a F b G i b F c
|
||||
& G i a F b G i c F d
|
||||
& i G a F b i G ! a F ! b
|
||||
& G i a F b G i ! a F ! b
|
||||
U p & q X U r s
|
||||
U p & q X & r F & s X F & u X F & v X F w
|
||||
F & p X & q X F r
|
||||
F & q X U p r
|
||||
G i p U q r
|
||||
F & p X F & q X F & r X F s
|
||||
& & & & G F p G F q G F r G F s G F u
|
||||
| | U p U q r U q U r p U r U p q
|
||||
| | G F a G F b G F c
|
||||
G F a
|
||||
U a U b U c d
|
||||
G U a U b U ! a ! b
|
||||
EOF
|
||||
|
||||
# More examples taken from scheck's test suite.
|
||||
# http://tcs.legacy.ics.tkk.fi/users/tlatvala/scheck/
|
||||
cat >>formulas <<EOF
|
||||
| F X p1 F X p2
|
||||
| | X p7 F p6 & | | t p3 p7 U | f p3 p3
|
||||
F p99
|
||||
X p3
|
||||
X ! p3
|
||||
X t
|
||||
X X X p3
|
||||
F X X X t
|
||||
! G p5
|
||||
| X p0 F p5
|
||||
| F p2 F p9
|
||||
! | G p0 & G p1 F p3
|
||||
& U & X p0 X p4 F p1 X X U X F p5 U p0 X X p3
|
||||
| p3 p5
|
||||
& p1 p6
|
||||
| p1 | p2 p1
|
||||
| & p1 p3 p3
|
||||
p6
|
||||
U p1 ! p2
|
||||
| p5 U p2 p2
|
||||
& p5 U p2 p2
|
||||
U F p5 ! p1
|
||||
U p0 & | p0 p5 p1
|
||||
EOF
|
||||
|
||||
# More examples randomly generated
|
||||
$randltl -l -n 100 a p1 "X" "U" "U12" >> formulas
|
||||
|
||||
# Some examples from scalables formulas
|
||||
$genltl --rv-counter=1..10 --go-theta=1..10 -l >> formulas
|
||||
|
||||
count=`wc -l < formulas`
|
||||
|
||||
test $count -eq 168
|
||||
|
||||
run 0 $ltlfilt --lbt-input formulas > formulas.2
|
||||
run 0 $ltlfilt -l formulas.2 > formulas.3
|
||||
run 0 $ltlfilt -l --lbt-input formulas > formulas.4
|
||||
test `wc -l < formulas.2` -eq 168
|
||||
test `wc -l < formulas.3` -eq 168
|
||||
test `wc -l < formulas.4` -eq 168
|
||||
|
||||
run 0 $ltlfilt formulas.2 --csv-escape --format='%L,%f' > formulas.5
|
||||
run 0 $ltlfilt formulas.5/2 --csv-escape --format='%L,%f' > formulas.6
|
||||
cmp formulas.5 formulas.6
|
||||
|
||||
# Make sure ltl2dstar-style litterals always get quoted.
|
||||
test "`$ltlfilt -l --lbt-input -f 'G F a'`" = 'G F "a"'
|
||||
# Original lbt-style litterals are unquoted.
|
||||
test "`$ltlfilt -l --lbt-input -f 'G F p42'`" = 'G F p42'
|
||||
180
tests/lbttparse.test
Executable file
180
tests/lbttparse.test
Executable file
|
|
@ -0,0 +1,180 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
for f in 'p0 U p1 U p2' 'Gp00 | Gp13 | Gp42' '{(1;1)*}[]->p1'
|
||||
do
|
||||
# Make sure Spot can read the LBTT it produces
|
||||
run 0 ../../bin/ltl2tgba --lbtt "$f" > out
|
||||
s=`wc -l < out`
|
||||
if ../../bin/ltl2tgba -H "$f" | grep 'properties:.*state-acc'; then
|
||||
head -n 1 out | grep t && exit 1
|
||||
else
|
||||
head -n 1 out | grep t
|
||||
fi
|
||||
run 0 ../../bin/autfilt --lbtt out > out2
|
||||
s2=`wc -l < out2`
|
||||
test "$s" -eq "$s2"
|
||||
|
||||
# The LBTT output use 2 lines par state, one line per transition,
|
||||
# and one extra line for header.
|
||||
run 0 ../../bin/ltl2tgba "$f" --stats 'expr %s \* 2 + %e + 1' > size
|
||||
l=$(eval "$(cat size)")
|
||||
test "$s" -eq "$l"
|
||||
|
||||
# Make sure we output the state-based format
|
||||
# for BA...
|
||||
run 0 ../../bin/ltl2tgba --ba --lbtt --low --any "$f" >out4
|
||||
head -n 1 out4 | grep t && exit 1
|
||||
s4=`wc -l < out4`
|
||||
test "$s" -eq "$s4"
|
||||
run 0 ../../bin/autfilt --lbtt out4 > out5
|
||||
run 0 ../../bin/autfilt out4 --are-isomorphic out5
|
||||
# ... unless --lbtt=t is used.
|
||||
run 0 ../../bin/ltl2tgba --ba --lbtt=t --low --any "$f" >out6
|
||||
head -n 1 out6 | grep t
|
||||
s6=`wc -l < out6`
|
||||
test "$s" -eq "$s6"
|
||||
run 0 ../../bin/autfilt --lbtt out6 > out7
|
||||
run 0 ../../bin/autfilt out6 --are-isomorphic out7
|
||||
done
|
||||
|
||||
|
||||
# multiple inputs (from different tools)
|
||||
|
||||
cat >input <<EOF
|
||||
/* This is the output of 'lbt' on the formula 'U p0 p1'. */
|
||||
4 1
|
||||
0 1 -1
|
||||
1 p0
|
||||
2 p1
|
||||
-1
|
||||
1 0 -1
|
||||
1 p0
|
||||
2 p1
|
||||
-1
|
||||
2 0 0 -1
|
||||
3 t
|
||||
-1
|
||||
3 0 0 -1
|
||||
3 t
|
||||
-1
|
||||
/* This kind of output is returned by wring2lbtt, on the same formula.
|
||||
(Newer versions of LBTT reject this input with missing new lines.) */
|
||||
4 1 0 1 -1 1 p0
|
||||
2 p1
|
||||
-1 1 0 -1 1 p0
|
||||
2 p1
|
||||
-1 2 0 0 -1 3 t
|
||||
-1 3 0 0 -1 3 t
|
||||
-1
|
||||
/* This is an automaton without state and three acceptance sets.
|
||||
Spot is not able to deal with automata that do not have initial
|
||||
state, so it will add a dummy state. */
|
||||
0 3
|
||||
/* Another example from wring2lbtt (or modella), showing that the
|
||||
acceptance set of the states is not always numbered from 0. */
|
||||
6 1 0 1 -1 1 | & ! p0 ! p1 & p0 ! p1
|
||||
2 & ! p0 ! p1
|
||||
3 | & p0 p1 & ! p0 p1
|
||||
-1 1 0 -1 4 ! p1
|
||||
-1 2 0 -1 2 & ! p0 ! p1
|
||||
3 | & p0 p1 & ! p0 p1
|
||||
-1 3 0 -1 5 t
|
||||
-1 4 0 1 -1 4 ! p1
|
||||
-1 5 0 1 -1 5 t
|
||||
-1
|
||||
/* this one show that state numbers do not always start from 0 */
|
||||
1 1t
|
||||
1 1
|
||||
1 -1 !p0
|
||||
1 0 -1 p0
|
||||
-1
|
||||
/* This is the output of 'lbt' on the formula 'U p0 p1', but with
|
||||
states 1 and 2 changed to 100 and 200 */
|
||||
4 1
|
||||
0 1 -1
|
||||
100 p0
|
||||
200 p1
|
||||
-1
|
||||
100 0 -1
|
||||
100 p0
|
||||
200 p1
|
||||
-1
|
||||
200 0 0 -1
|
||||
3 t
|
||||
-1
|
||||
3 0 0 -1
|
||||
3 t
|
||||
-1
|
||||
/* This is the output of 'lbt' on the formula 'U p0 p1', but with
|
||||
states 0 and 2 changed to 100 and 200. This make sure the renaming
|
||||
also applies to the initial state.
|
||||
*/
|
||||
4 1
|
||||
100 1 -1
|
||||
1 p0
|
||||
200 p1
|
||||
-1
|
||||
1 0 -1
|
||||
1 p0
|
||||
200 p1
|
||||
-1
|
||||
200 0 0 -1
|
||||
3 t
|
||||
-1
|
||||
3 0 0 -1
|
||||
3 t
|
||||
-1
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt --stats '%s %t %e %a' input > output
|
||||
cat >expected<<EOF
|
||||
4 16 6 1
|
||||
4 16 6 1
|
||||
1 0 0 3
|
||||
6 20 9 1
|
||||
1 2 2 1
|
||||
4 16 6 1
|
||||
4 16 6 1
|
||||
EOF
|
||||
|
||||
diff output expected
|
||||
|
||||
cat > input <<EOF
|
||||
1 2t
|
||||
0 1
|
||||
0 -1 & ! "a" ! "b" !
|
||||
0 0 -1 & "a" ! "b" /* comments are OK */
|
||||
0 1 -1 & ! "a" /* here too */ "b"
|
||||
0 0 1 -1 & "a" "b"
|
||||
-1
|
||||
EOF
|
||||
cat >expected <<EOF
|
||||
input:3.5-20: failed to parse guard: & ! "a" ! "b" !
|
||||
input:3.20: syntax error, unexpected '!', expecting end of formula
|
||||
input:3.20: ignoring trailing garbage
|
||||
EOF
|
||||
../../bin/autfilt -q input 2> stderr && exit 1
|
||||
cat stderr
|
||||
diff stderr expected
|
||||
62
tests/length.cc
Normal file
62
tests/length.cc
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2012, 2015 Laboratoire de Recherche et Developement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/tl/length.hh>
|
||||
|
||||
static void
|
||||
syntax(char *prog)
|
||||
{
|
||||
std::cerr << prog << " formula" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
if (argc < 2 || argc > 3)
|
||||
syntax(argv[0]);
|
||||
|
||||
bool boolone = false;
|
||||
if (!strcmp(argv[1], "-b"))
|
||||
{
|
||||
boolone = true;
|
||||
++argv;
|
||||
}
|
||||
|
||||
{
|
||||
spot::parse_error_list p1;
|
||||
auto f1 = spot::parse_infix_psl(argv[1], p1);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, argv[1], p1))
|
||||
return 2;
|
||||
|
||||
if (boolone)
|
||||
std::cout << spot::length_boolone(f1) << std::endl;
|
||||
else
|
||||
std::cout << spot::length(f1) << std::endl;
|
||||
}
|
||||
|
||||
assert(spot::fnode::instances_check());
|
||||
return 0;
|
||||
}
|
||||
39
tests/length.test
Executable file
39
tests/length.test
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
len()
|
||||
{
|
||||
test `run 0 ../length "$1"` = $2
|
||||
test `run 0 ../length -b "$1"` = $3
|
||||
}
|
||||
|
||||
len 'a U Xc' 4 4
|
||||
len 'a&b&c' 5 1
|
||||
len 'a|b|c' 5 1
|
||||
len '!a|b|!c' 7 1
|
||||
len '!(!a|b|!c)' 8 1
|
||||
len '!X(!a|b|!c)' 9 3
|
||||
len 'Xa|(b|c)' 6 4
|
||||
len 'Xa&(b|c)' 6 4
|
||||
57
tests/lenient.test
Executable file
57
tests/lenient.test
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
|
||||
cat >input <<EOF
|
||||
(a < b) U (b == c - 1)
|
||||
((a < b) U {b == c - 1})
|
||||
(((a < b) U (b == c - 1)))
|
||||
(((((a < b))) U (b == c - 1)))
|
||||
(((a < b) U (((b == c - 1)))))
|
||||
(((a < b ) U ({( b == c - 1 )})))
|
||||
((((( a < b))) U ( b == c - 1)))
|
||||
((((( a < b))) U { b == c - 1}!))
|
||||
()a
|
||||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
Xa
|
||||
EOF
|
||||
|
||||
run 0 $ltlfilt --lenient input > output
|
||||
cmp output expected
|
||||
|
||||
|
||||
|
||||
run 2 $ltlfilt --lenient -f 'F( )' 2> stderr
|
||||
grep 'unexpected empty block' stderr
|
||||
97
tests/ltl2dstar.test
Executable file
97
tests/ltl2dstar.test
Executable file
|
|
@ -0,0 +1,97 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Do some quick translations to make sure the neverclaims produced by
|
||||
# spot actually look correct! We do that by parsing them via ltlcross.
|
||||
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
# Skip this test if ltl2dstar is not installed.
|
||||
(ltl2dstar --version) || exit 77
|
||||
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
ltlcross=../../bin/ltlcross
|
||||
randltl=../../bin/randltl
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
dstar2tgba=../../bin/dstar2tgba
|
||||
|
||||
$ltlfilt -f 'a U b' -l |
|
||||
ltl2dstar --ltl2nba=spin:$ltl2tgba@-s - - |
|
||||
$dstar2tgba --stats '%s %e %t %a %d' |
|
||||
tee out
|
||||
|
||||
test "`cat out`" = '2 3 7 1 1'
|
||||
|
||||
RAB=--automata=rabin
|
||||
STR=--automata=streett
|
||||
|
||||
$randltl -n 15 a b | $ltlfilt --nnf --remove-wm |
|
||||
$ltlcross -F - -f 'GFa & GFb & GFc' -f '(GFa -> GFb) & (GFc -> GFd)' \
|
||||
--timeout=30 \
|
||||
"$ltl2tgba -s %f >%N" \
|
||||
"ltl2dstar $RAB --output=nba --ltl2nba=spin:$ltl2tgba@-s %L %T" \
|
||||
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L %D" \
|
||||
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L - | $dstar2tgba --low -s >%N" \
|
||||
"ltl2dstar $STR --output=nba --ltl2nba=spin:$ltl2tgba@-s %L %T" \
|
||||
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L %D" \
|
||||
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L - | $dstar2tgba --low -s >%N" \
|
||||
--csv=out.csv
|
||||
|
||||
# A bug in ltlcross <=1.2.5 caused it to not use the complement of the
|
||||
# negative automaton.
|
||||
$ltlcross -f 'GFa' --verbose \
|
||||
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L %D" \
|
||||
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L %D" 2>err
|
||||
test `grep -c 'info: check_empty.*Comp' err` = 2
|
||||
$ltlcross -f 'FGa' --verbose \
|
||||
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L %D" \
|
||||
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L %D" 2>err
|
||||
test `grep -c 'info: check_empty.*Comp' err` = 2
|
||||
|
||||
|
||||
# Make sure ltldo preserve the Rabin acceptance by default
|
||||
../../bin/ltldo \
|
||||
"ltl2dstar --ltl2nba=spin:$ltl2tgba@-s --output-format=hoa %L %O" \
|
||||
-f 'GFa -> GFb' -Hi > out.hoa
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 5
|
||||
Start: 3
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Rabin 2
|
||||
Acceptance: 4 (Fin(0) & Inf(1)) | (Fin(2) & Inf(3))
|
||||
properties: implicit-labels state-acc complete deterministic
|
||||
--BODY--
|
||||
State: 0 {1 3}
|
||||
2 4 0 1
|
||||
State: 1 {0 3}
|
||||
2 4 0 1
|
||||
State: 2 {1}
|
||||
2 4 0 1
|
||||
State: 3 {0}
|
||||
0 1 0 1
|
||||
State: 4 {0}
|
||||
2 4 0 1
|
||||
--END--
|
||||
EOF
|
||||
diff out.hoa expected
|
||||
100
tests/ltl2dstar2.test
Executable file
100
tests/ltl2dstar2.test
Executable file
|
|
@ -0,0 +1,100 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Do some quick translations to make sure the neverclaims produced by
|
||||
# spot actually look correct! We do that by parsing them via ltlcross.
|
||||
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
# Skip this test if ltl2dstar is not installed.
|
||||
(ltl2dstar --version) || exit 77
|
||||
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
dstar2tgba=../../bin/dstar2tgba
|
||||
randltl=../../bin/randltl
|
||||
|
||||
|
||||
# Make sure all recurrence formulas are translated into deterministic
|
||||
# Büchi automata by the DRA->TGBA converter.
|
||||
# (Note that ltl2tgba is not called with -D when want to make
|
||||
# sure we get a deterministic output even if the automaton generated
|
||||
# by Spot initially was non-deterministic)
|
||||
|
||||
$randltl -n -1 a b --tree-size=5..15 |
|
||||
$ltlfilt --syntactic-recurrence --remove-wm -r -u \
|
||||
--size-min=4 --size-max=15 --relabel=abc |
|
||||
head -n 20 > formulas
|
||||
|
||||
$randltl -n -1 a b --tree-size=5..15 |
|
||||
$ltlfilt -v --obligation |
|
||||
$ltlfilt --syntactic-recurrence --remove-wm -r -u \
|
||||
--size-min=4 --size-max=15 --relabel=abc |
|
||||
head -n 20 >> formulas
|
||||
|
||||
while read f; do
|
||||
$ltlfilt -f "$f" -l |
|
||||
ltl2dstar --ltl2nba=spin:$ltl2tgba@-s - foo
|
||||
echo "$f"
|
||||
det=`$dstar2tgba foo --stats '%d'`
|
||||
test $det -eq 1;
|
||||
done < formulas
|
||||
|
||||
echo ==========================
|
||||
|
||||
# For obligation formulas, the output of dstar2tgba should
|
||||
# have the same size as the input when option -D is used.
|
||||
$randltl -n -1 a b --tree-size=5..15 |
|
||||
$ltlfilt --obligation --size-min=4 --size-max=15 --relabel=abc \
|
||||
--remove-wm -r -u |
|
||||
head -n 20 > formulas
|
||||
|
||||
while read f; do
|
||||
expected=`$ltl2tgba "$f" -BD --stats '%s %e 1 %d'`
|
||||
$ltlfilt -f "$f" -l |
|
||||
ltl2dstar --ltl2nba=spin:$ltl2tgba@-Ds - foo
|
||||
echo "$f"
|
||||
output=`$dstar2tgba foo -BD --stats '%s %e %d 1'`
|
||||
# the '1 %d' matching '%d 1' makes sure input and output are deterministic.
|
||||
test "$output" = "$expected";
|
||||
done < formulas
|
||||
|
||||
echo ==========================
|
||||
|
||||
# Now make sure that some obviously non-deterministic property
|
||||
# are not translated to deterministic.
|
||||
|
||||
cat >formulas <<EOF
|
||||
FGa
|
||||
GFa->GFb
|
||||
GFa & FGb
|
||||
FGa | FGb
|
||||
FGa & FGb
|
||||
EOF
|
||||
|
||||
while read f; do
|
||||
$ltlfilt -f "$f" -l |
|
||||
ltl2dstar --ltl2nba=spin:$ltl2tgba@-s - foo
|
||||
echo "$f"
|
||||
det=`$dstar2tgba foo --stats '%d'`
|
||||
test $det -eq 0;
|
||||
done < formulas
|
||||
48
tests/ltl2dstar3.test
Executable file
48
tests/ltl2dstar3.test
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Test ltl2dstar's HOA output with ltlcross.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
# Skip this test if ltl2dstar is not installed.
|
||||
(ltl2dstar --version) || exit 77
|
||||
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
ltlcross=../../bin/ltlcross
|
||||
randltl=../../bin/randltl
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
dstar2tgba=../../bin/dstar2tgba
|
||||
|
||||
RAB='--automata=rabin --output-format=hoa'
|
||||
STR='--automata=streett --output-format=hoa'
|
||||
|
||||
# Run ltlcross without product, because this requires too much memory.
|
||||
$randltl -n 25 a b | $ltlfilt --remove-wm |
|
||||
$ltlcross -F- -f 'GFa & GFb & GFc' -f '(GFa -> GFb) & (GFc -> GFd)' \
|
||||
--timeout=30 --verbose --csv=out.csv --products=0 \
|
||||
"$ltl2tgba -s %f >%N" \
|
||||
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L %H" \
|
||||
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L %H"
|
||||
|
||||
grep '"in_type"' out.csv && exit 1
|
||||
exit 0
|
||||
69
tests/ltl2dstar4.test
Executable file
69
tests/ltl2dstar4.test
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Do some quick translations to make sure the neverclaims produced by
|
||||
# spot actually look correct! We do that by parsing them via ltlcross.
|
||||
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
# Skip this test if ltl2dstar is not installed.
|
||||
(ltl2dstar --version) || exit 77
|
||||
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
ltlcross=../../bin/ltlcross
|
||||
randltl=../../bin/randltl
|
||||
autfilt=../../bin/autfilt
|
||||
ltldo=../../bin/ltldo
|
||||
|
||||
STR='--automata=streett --output-format=hoa'
|
||||
|
||||
$ltlfilt -f '(GFa -> GFb) & (GFc -> GFd)' -l |
|
||||
ltl2dstar --ltl2nba=spin:$ltl2tgba@-s $STR - - |
|
||||
$autfilt --tgba --stats '%S %E %A %s %e %t %a %d' |
|
||||
tee out
|
||||
test "`cat out`" = '9 144 4 25 149 416 2 0'
|
||||
|
||||
$ltlfilt -f '(GFa -> GFb) & (GFc -> GFd)' -l |
|
||||
ltl2dstar --ltl2nba=spin:$ltl2tgba@-s $STR - - |
|
||||
SPOT_STREETT_CONV_MIN=1 $autfilt --tgba --stats '%S %E %A %s %e %t %a %d' |
|
||||
tee out
|
||||
test "`cat out`" = '9 144 4 25 218 482 2 0'
|
||||
|
||||
|
||||
LTL2DSTAR="ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L"
|
||||
|
||||
# Generate 50 formulas for which the streett automaton has at least 3
|
||||
# acceptance sets.
|
||||
$randltl --ltl-priorities=W=0,M=0 -n 1000 3 |
|
||||
$ltldo "$LTL2DSTAR ->%O" -F- --name=%f -H | tee streett |
|
||||
$autfilt --acc-set=3.. --stats=%M | head -n 50 > formulas
|
||||
|
||||
# Add 50 formulas that use less acceptance sets
|
||||
$autfilt streett --acc-set=0..2 --stats=%M | head -n 50 >> formulas
|
||||
|
||||
$ltlcross -F formulas --timeout=30 \
|
||||
"$ltl2tgba -H %f >%O" \
|
||||
"$LTL2DSTAR %O" \
|
||||
"$LTL2DSTAR - | SPOT_STREETT_CONV_MIN=0 $autfilt --tgba -H >%O" \
|
||||
"$LTL2DSTAR - | SPOT_STREETT_CONV_MIN=1 $autfilt --tgba -H >%O" \
|
||||
--csv=out.csv
|
||||
103
tests/ltl2neverclaim-lbtt.test
Executable file
103
tests/ltl2neverclaim-lbtt.test
Executable file
|
|
@ -0,0 +1,103 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2010, 2012, 2013 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Do some quick translations to make sure the neverclaims produced by
|
||||
# spot actually look correct!
|
||||
|
||||
# This test is separate from spotlbtt.test, because lbtt-translate
|
||||
# will refuse to pass M and W to a tool (spot) that masquerades as
|
||||
# Spin.
|
||||
|
||||
. ./defs
|
||||
need_lbtt
|
||||
|
||||
set -e
|
||||
|
||||
cat > config <<EOF
|
||||
Algorithm
|
||||
{
|
||||
Name = "Spot (Couvreur -- FM)"
|
||||
Path = "${LBTT_TRANSLATE}"
|
||||
Parameters = "--spot '../ikwiad -F -f -t'"
|
||||
Enabled = yes
|
||||
}
|
||||
|
||||
Algorithm
|
||||
{
|
||||
Name = "Spot (Couvreur -- FM), with reductions"
|
||||
Path = "${LBTT_TRANSLATE}"
|
||||
Parameters = "--spot '../ikwiad -r4 -R3f -F -f -t'"
|
||||
Enabled = no
|
||||
}
|
||||
|
||||
Algorithm
|
||||
{
|
||||
Name = "Spot (Couvreur -- FM), degeneralized via never claim"
|
||||
Path = "${LBTT_TRANSLATE}"
|
||||
Parameters = "--spin '../ikwiad -F -f -N'"
|
||||
Enabled = yes
|
||||
}
|
||||
|
||||
Algorithm
|
||||
{
|
||||
Name = "Spot (Couvreur -- FM), reductions, degeneralized via never claim"
|
||||
Path = "${LBTT_TRANSLATE}"
|
||||
Parameters = "--spin '../ikwiad -F -f -r4 -R3 -N'"
|
||||
Enabled = yes
|
||||
}
|
||||
|
||||
GlobalOptions
|
||||
{
|
||||
Rounds = 100
|
||||
Interactive = Never
|
||||
# Verbosity = 5
|
||||
# ComparisonCheck = no
|
||||
# ConsistencyCheck = no
|
||||
# IntersectionCheck = no
|
||||
}
|
||||
|
||||
FormulaOptions
|
||||
{
|
||||
Size = 1...13
|
||||
Propositions = 6
|
||||
|
||||
AbbreviatedOperators = Yes
|
||||
GenerateMode = Normal
|
||||
OutputMode = Normal
|
||||
PropositionPriority = 50
|
||||
|
||||
TruePriority = 1
|
||||
FalsePriority = 1
|
||||
|
||||
AndPriority = 10
|
||||
OrPriority = 10
|
||||
XorPriority = 0
|
||||
# EquivalencePriority = 0
|
||||
|
||||
BeforePriority = 0
|
||||
StrongReleasePriority = 0
|
||||
WeakUntilPriority = 0
|
||||
|
||||
DefaultOperatorPriority = 5
|
||||
}
|
||||
EOF
|
||||
|
||||
${LBTT}
|
||||
rm config
|
||||
35
tests/ltl2neverclaim.test
Executable file
35
tests/ltl2neverclaim.test
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2010, 2012, 2013 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Do some quick translations to make sure the neverclaims produced by
|
||||
# spot actually look correct! We do that by parsing them via ltlcross.
|
||||
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
ltl2tgba=../ikwiad
|
||||
|
||||
../../bin/randltl -n 100 p1 p2 p3 p4 p5 p6 --tree-size 5..15 |
|
||||
../../bin/ltlcross \
|
||||
"$ltl2tgba -t %f > %T" \
|
||||
"$ltl2tgba -t -r4 -R3f %f > %T" \
|
||||
"$ltl2tgba -N %f > %N" \
|
||||
"$ltl2tgba -N -r4 -R3f %f > %N"
|
||||
438
tests/ltl2ta.test
Executable file
438
tests/ltl2ta.test
Executable file
|
|
@ -0,0 +1,438 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# This only runs various configuration of the translation algorithms
|
||||
# through valgrind, and checks for differences in the size of the
|
||||
# resulting automata. The actual language of the automata is not
|
||||
# tested. The columns in the following table are:
|
||||
# ltl2tgba options | states | transitions | acc states
|
||||
cat >checkta.txt <<\EOF
|
||||
in: a
|
||||
-TGTA | 4 | 8 | XXX
|
||||
-TGTA -RT | 2 | 3 | XXX
|
||||
-TA | 3 | 3 | 3
|
||||
-TA -RT | 2 | 2 | 2
|
||||
-TA -lv | 3 | 3 | 2
|
||||
-TA -lv -RT | 2 | 2 | 1
|
||||
-TA -sp | 3 | 3 | 2
|
||||
-TA -sp -RT | 2 | 2 | 1
|
||||
-TA -lv -sp | 3 | 3 | 2
|
||||
-TA -lv -sp -RT | 2 | 2 | 1
|
||||
-TA -DS | 3 | 3 | 3
|
||||
-TA -DS -RT | 2 | 2 | 2
|
||||
-TA -DS -lv | 3 | 3 | 3
|
||||
-TA -DS -lv -RT | 2 | 2 | 2
|
||||
-TA -DS -sp | 3 | 3 | 3
|
||||
-TA -DS -sp -RT | 2 | 2 | 2
|
||||
-TA -DS -lv -sp | 3 | 3 | 3
|
||||
-TA -DS -lv -sp -RT | 2 | 2 | 2
|
||||
-x -TA -DS -in | 3 | 3 | 3
|
||||
-x -TA -DS -in -RT | 2 | 2 | 2
|
||||
in: a U b
|
||||
-TGTA | 8 | 34 | XXX
|
||||
-TGTA -RT | 4 | 18 | XXX
|
||||
-TA | 7 | 20 | 6
|
||||
-TA -RT | 4 | 11 | 3
|
||||
-TA -lv | 8 | 22 | 5
|
||||
-TA -lv -RT | 5 | 13 | 2
|
||||
-TA -sp | 7 | 22 | 4
|
||||
-TA -sp -RT | 4 | 13 | 1
|
||||
-TA -lv -sp | 8 | 22 | 5
|
||||
-TA -lv -sp -RT | 5 | 13 | 2
|
||||
-TA -DS | 7 | 20 | 6
|
||||
-TA -DS -RT | 4 | 11 | 3
|
||||
-TA -DS -lv | 8 | 22 | 5
|
||||
-TA -DS -lv -RT | 5 | 13 | 2
|
||||
-TA -DS -sp | 7 | 22 | 4
|
||||
-TA -DS -sp -RT | 4 | 13 | 1
|
||||
-TA -DS -lv -sp | 8 | 22 | 5
|
||||
-TA -DS -lv -sp -RT | 5 | 13 | 2
|
||||
-x -TA -DS -in | 8 | 22 | 5
|
||||
-x -TA -DS -in -RT | 5 | 13 | 2
|
||||
in: F a
|
||||
-TGTA | 5 | 12 | XXX
|
||||
-TGTA -RT | 4 | 10 | XXX
|
||||
-TA | 4 | 4 | 3
|
||||
-TA -RT | 3 | 3 | 2
|
||||
-TA -lv | 5 | 5 | 3
|
||||
-TA -lv -RT | 4 | 4 | 2
|
||||
-TA -sp | 4 | 5 | 2
|
||||
-TA -sp -RT | 3 | 4 | 1
|
||||
-TA -lv -sp | 5 | 5 | 3
|
||||
-TA -lv -sp -RT | 4 | 4 | 2
|
||||
-TA -DS | 4 | 4 | 3
|
||||
-TA -DS -RT | 3 | 3 | 2
|
||||
-TA -DS -lv | 5 | 5 | 3
|
||||
-TA -DS -lv -RT | 4 | 4 | 2
|
||||
-TA -DS -sp | 4 | 5 | 2
|
||||
-TA -DS -sp -RT | 3 | 4 | 1
|
||||
-TA -DS -lv -sp | 5 | 5 | 3
|
||||
-TA -DS -lv -sp -RT | 4 | 4 | 2
|
||||
-x -TA -DS -in | 5 | 5 | 3
|
||||
-x -TA -DS -in -RT | 4 | 4 | 2
|
||||
in: a & b & c
|
||||
-TGTA | 10 | 74 | XXX
|
||||
-TGTA -RT | 2 | 9 | XXX
|
||||
-TA | 9 | 63 | 9
|
||||
-TA -RT | 2 | 14 | 2
|
||||
-TA -lv | 9 | 63 | 8
|
||||
-TA -lv -RT | 2 | 14 | 1
|
||||
-TA -sp | 9 | 63 | 8
|
||||
-TA -sp -RT | 2 | 14 | 1
|
||||
-TA -lv -sp | 9 | 63 | 8
|
||||
-TA -lv -sp -RT | 2 | 14 | 1
|
||||
-TA -DS | 9 | 63 | 9
|
||||
-TA -DS -RT | 2 | 14 | 2
|
||||
-TA -DS -lv | 9 | 63 | 9
|
||||
-TA -DS -lv -RT | 2 | 14 | 2
|
||||
-TA -DS -sp | 9 | 63 | 9
|
||||
-TA -DS -sp -RT | 2 | 14 | 2
|
||||
-TA -DS -lv -sp | 9 | 63 | 9
|
||||
-TA -DS -lv -sp -RT | 2 | 14 | 2
|
||||
-x -TA -DS -in | 9 | 63 | 9
|
||||
-x -TA -DS -in -RT | 2 | 14 | 2
|
||||
in: a | b | (c U (d & (g U (h ^ i))))
|
||||
-TGTA | 431 | 57396 | XXX
|
||||
-TGTA -RT | 10 | 1445 | XXX
|
||||
-TA | 430 | 51816 | 328
|
||||
-TA -RT | 126 | 15351 | 105
|
||||
-TA -lv | 431 | 56744 | 129
|
||||
-TA -lv -RT | 128 | 16342 | 2
|
||||
-TA -sp | 430 | 56744 | 128
|
||||
-TA -sp -RT | 127 | 16342 | 1
|
||||
-TA -lv -sp | 431 | 56744 | 129
|
||||
-TA -lv -sp -RT | 128 | 16342 | 2
|
||||
-TA -DS | 430 | 51816 | 328
|
||||
-TA -DS -RT | 127 | 15478 | 106
|
||||
-TA -DS -lv | 431 | 56744 | 129
|
||||
-TA -DS -lv -RT | 128 | 16342 | 2
|
||||
-TA -DS -sp | 430 | 56744 | 128
|
||||
-TA -DS -sp -RT | 127 | 16342 | 1
|
||||
-TA -DS -lv -sp | 431 | 56744 | 129
|
||||
-TA -DS -lv -sp -RT | 128 | 16342 | 2
|
||||
-x -TA -DS -in | 431 | 56744 | 129
|
||||
-x -TA -DS -in -RT | 128 | 16342 | 2
|
||||
in: a & (b U !a) & (b U !a)
|
||||
-TGTA | 8 | 30 | XXX
|
||||
-TGTA -RT | 4 | 14 | XXX
|
||||
-TA | 7 | 20 | 6
|
||||
-TA -RT | 2 | 5 | 1
|
||||
-TA -lv | 8 | 22 | 5
|
||||
-TA -lv -RT | 4 | 10 | 2
|
||||
-TA -sp | 7 | 22 | 4
|
||||
-TA -sp -RT | 3 | 10 | 1
|
||||
-TA -lv -sp | 8 | 22 | 5
|
||||
-TA -lv -sp -RT | 4 | 10 | 2
|
||||
-TA -DS | 7 | 20 | 6
|
||||
-TA -DS -RT | 3 | 8 | 2
|
||||
-TA -DS -lv | 8 | 22 | 5
|
||||
-TA -DS -lv -RT | 4 | 10 | 2
|
||||
-TA -DS -sp | 7 | 22 | 4
|
||||
-TA -DS -sp -RT | 3 | 10 | 1
|
||||
-TA -DS -lv -sp | 8 | 22 | 5
|
||||
-TA -DS -lv -sp -RT | 4 | 10 | 2
|
||||
-x -TA -DS -in | 8 | 22 | 5
|
||||
-x -TA -DS -in -RT | 4 | 10 | 2
|
||||
in: Fa & b & GFc & Gd
|
||||
-TGTA | 21 | 219 | XXX
|
||||
-TGTA -RT | 7 | 71 | XXX
|
||||
-TA | 20 | 182 | 7
|
||||
-TA -RT | 10 | 98 | 3
|
||||
-TA -lv | 21 | 203 | 5
|
||||
-TA -lv -RT | 11 | 112 | 2
|
||||
-TA -sp | 20 | 194 | 4
|
||||
-TA -sp -RT | 10 | 106 | 1
|
||||
-TA -lv -sp | 21 | 203 | 5
|
||||
-TA -lv -sp -RT | 11 | 112 | 2
|
||||
-TA -DS | 28 | 294 | 15
|
||||
-TA -DS -RT | 12 | 126 | 5
|
||||
-TA -DS -lv | 29 | 315 | 13
|
||||
-TA -DS -lv -RT | 13 | 140 | 4
|
||||
-TA -DS -sp | 28 | 309 | 12
|
||||
-TA -DS -sp -RT | 12 | 137 | 3
|
||||
-TA -DS -lv -sp | 29 | 315 | 13
|
||||
-TA -DS -lv -sp -RT | 13 | 140 | 4
|
||||
-x -TA -DS -in | 29 | 254 | 9
|
||||
-x -TA -DS -in -RT | 12 | 96 | 3
|
||||
in: Fa & a & GFc & Gc
|
||||
-TGTA | 4 | 8 | XXX
|
||||
-TGTA -RT | 3 | 6 | XXX
|
||||
-TA | 3 | 3 | 3
|
||||
-TA -RT | 2 | 2 | 2
|
||||
-TA -lv | 3 | 3 | 2
|
||||
-TA -lv -RT | 2 | 2 | 1
|
||||
-TA -sp | 3 | 3 | 2
|
||||
-TA -sp -RT | 2 | 2 | 1
|
||||
-TA -lv -sp | 3 | 3 | 2
|
||||
-TA -lv -sp -RT | 2 | 2 | 1
|
||||
-TA -DS | 3 | 3 | 3
|
||||
-TA -DS -RT | 2 | 2 | 2
|
||||
-TA -DS -lv | 3 | 3 | 2
|
||||
-TA -DS -lv -RT | 2 | 2 | 1
|
||||
-TA -DS -sp | 3 | 3 | 2
|
||||
-TA -DS -sp -RT | 2 | 2 | 1
|
||||
-TA -DS -lv -sp | 3 | 3 | 2
|
||||
-TA -DS -lv -sp -RT | 2 | 2 | 1
|
||||
-x -TA -DS -in | 3 | 3 | 2
|
||||
-x -TA -DS -in -RT | 2 | 2 | 1
|
||||
in: Fc & (a | b) & GF(a | b) & Gc
|
||||
-TGTA | 8 | 34 | XXX
|
||||
-TGTA -RT | 8 | 34 | XXX
|
||||
-TA | 7 | 21 | 6
|
||||
-TA -RT | 7 | 21 | 6
|
||||
-TA -lv | 7 | 21 | 3
|
||||
-TA -lv -RT | 7 | 21 | 3
|
||||
-TA -sp | 7 | 21 | 3
|
||||
-TA -sp -RT | 7 | 21 | 3
|
||||
-TA -lv -sp | 7 | 21 | 3
|
||||
-TA -lv -sp -RT | 7 | 21 | 3
|
||||
-TA -DS | 11 | 51 | 10
|
||||
-TA -DS -RT | 11 | 51 | 10
|
||||
-TA -DS -lv | 11 | 51 | 7
|
||||
-TA -DS -lv -RT | 11 | 51 | 7
|
||||
-TA -DS -sp | 11 | 51 | 7
|
||||
-TA -DS -sp -RT | 11 | 51 | 7
|
||||
-TA -DS -lv -sp | 11 | 51 | 7
|
||||
-TA -DS -lv -sp -RT | 11 | 51 | 7
|
||||
-x -TA -DS -in | 11 | 33 | 5
|
||||
-x -TA -DS -in -RT | 11 | 33 | 5
|
||||
in: a R (b R c)
|
||||
-TGTA | 17 | 124 | XXX
|
||||
-TGTA -RT | 6 | 30 | XXX
|
||||
-TA | 16 | 95 | 16
|
||||
-TA -RT | 6 | 29 | 6
|
||||
-TA -lv | 17 | 103 | 14
|
||||
-TA -lv -RT | 8 | 42 | 6
|
||||
-TA -sp | 16 | 103 | 13
|
||||
-TA -sp -RT | 7 | 42 | 5
|
||||
-TA -lv -sp | 17 | 103 | 14
|
||||
-TA -lv -sp -RT | 8 | 42 | 6
|
||||
-TA -DS | 16 | 95 | 16
|
||||
-TA -DS -RT | 6 | 29 | 6
|
||||
-TA -DS -lv | 16 | 95 | 16
|
||||
-TA -DS -lv -RT | 6 | 29 | 6
|
||||
-TA -DS -sp | 16 | 95 | 16
|
||||
-TA -DS -sp -RT | 6 | 29 | 6
|
||||
-TA -DS -lv -sp | 16 | 95 | 16
|
||||
-TA -DS -lv -sp -RT | 6 | 29 | 6
|
||||
-x -TA -DS -in | 16 | 92 | 16
|
||||
-x -TA -DS -in -RT | 6 | 26 | 6
|
||||
in: (a U b) U (c U d)
|
||||
-TGTA | 77 | 1521 | XXX
|
||||
-TGTA -RT | 18 | 409 | XXX
|
||||
-TA | 76 | 1210 | 48
|
||||
-TA -RT | 29 | 493 | 9
|
||||
-TA -lv | 77 | 1418 | 17
|
||||
-TA -lv -RT | 31 | 652 | 2
|
||||
-TA -sp | 76 | 1418 | 16
|
||||
-TA -sp -RT | 30 | 652 | 1
|
||||
-TA -lv -sp | 77 | 1418 | 17
|
||||
-TA -lv -sp -RT | 31 | 652 | 2
|
||||
-TA -DS | 76 | 1210 | 48
|
||||
-TA -DS -RT | 30 | 508 | 10
|
||||
-TA -DS -lv | 77 | 1418 | 17
|
||||
-TA -DS -lv -RT | 31 | 652 | 2
|
||||
-TA -DS -sp | 76 | 1418 | 16
|
||||
-TA -DS -sp -RT | 30 | 652 | 1
|
||||
-TA -DS -lv -sp | 77 | 1418 | 17
|
||||
-TA -DS -lv -sp -RT | 31 | 652 | 2
|
||||
-x -TA -DS -in | 76 | 1308 | 17
|
||||
-x -TA -DS -in -RT | 26 | 500 | 2
|
||||
in: ((Gp2)U(F(1)))&(p1 R(p2 R p0))
|
||||
-TGTA | 17 | 124 | XXX
|
||||
-TGTA -RT | 6 | 30 | XXX
|
||||
-TA | 16 | 95 | 16
|
||||
-TA -RT | 6 | 29 | 6
|
||||
-TA -lv | 17 | 103 | 14
|
||||
-TA -lv -RT | 8 | 42 | 6
|
||||
-TA -sp | 16 | 103 | 13
|
||||
-TA -sp -RT | 7 | 42 | 5
|
||||
-TA -lv -sp | 17 | 103 | 14
|
||||
-TA -lv -sp -RT | 8 | 42 | 6
|
||||
-TA -DS | 16 | 95 | 16
|
||||
-TA -DS -RT | 6 | 29 | 6
|
||||
-TA -DS -lv | 16 | 95 | 16
|
||||
-TA -DS -lv -RT | 6 | 29 | 6
|
||||
-TA -DS -sp | 16 | 95 | 16
|
||||
-TA -DS -sp -RT | 6 | 29 | 6
|
||||
-TA -DS -lv -sp | 16 | 95 | 16
|
||||
-TA -DS -lv -sp -RT | 6 | 29 | 6
|
||||
-x -TA -DS -in | 16 | 92 | 16
|
||||
-x -TA -DS -in -RT | 6 | 26 | 6
|
||||
in: a U (b U c)
|
||||
-TGTA | 22 | 196 | XXX
|
||||
-TGTA -RT | 6 | 59 | XXX
|
||||
-TA | 21 | 144 | 16
|
||||
-TA -RT | 9 | 62 | 5
|
||||
-TA -lv | 22 | 164 | 9
|
||||
-TA -lv -RT | 11 | 85 | 2
|
||||
-TA -sp | 21 | 164 | 8
|
||||
-TA -sp -RT | 10 | 85 | 1
|
||||
-TA -lv -sp | 22 | 164 | 9
|
||||
-TA -lv -sp -RT | 11 | 85 | 2
|
||||
-TA -DS | 21 | 144 | 16
|
||||
-TA -DS -RT | 10 | 69 | 6
|
||||
-TA -DS -lv | 22 | 164 | 9
|
||||
-TA -DS -lv -RT | 11 | 85 | 2
|
||||
-TA -DS -sp | 21 | 164 | 8
|
||||
-TA -DS -sp -RT | 10 | 85 | 1
|
||||
-TA -DS -lv -sp | 22 | 164 | 9
|
||||
-TA -DS -lv -sp -RT | 11 | 85 | 2
|
||||
-x -TA -DS -in | 22 | 164 | 9
|
||||
-x -TA -DS -in -RT | 11 | 85 | 2
|
||||
in: !(Ga U b)
|
||||
-TGTA | 11 | 50 | XXX
|
||||
-TGTA -RT | 5 | 23 | XXX
|
||||
-TA | 10 | 31 | 8
|
||||
-TA -RT | 4 | 13 | 3
|
||||
-TA -lv | 11 | 37 | 6
|
||||
-TA -lv -RT | 6 | 20 | 3
|
||||
-TA -sp | 10 | 37 | 5
|
||||
-TA -sp -RT | 5 | 20 | 2
|
||||
-TA -lv -sp | 11 | 37 | 6
|
||||
-TA -lv -sp -RT | 6 | 20 | 3
|
||||
-TA -DS | 10 | 31 | 8
|
||||
-TA -DS -RT | 5 | 16 | 4
|
||||
-TA -DS -lv | 11 | 37 | 7
|
||||
-TA -DS -lv -RT | 6 | 20 | 4
|
||||
-TA -DS -sp | 10 | 37 | 6
|
||||
-TA -DS -sp -RT | 5 | 20 | 3
|
||||
-TA -DS -lv -sp | 11 | 37 | 7
|
||||
-TA -DS -lv -sp -RT | 6 | 20 | 4
|
||||
-x -TA -DS -in | 11 | 37 | 7
|
||||
-x -TA -DS -in -RT | 6 | 20 | 4
|
||||
in: # Make sure '(G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))'
|
||||
in: # has 21 states and 96 transitions before minimization, and
|
||||
in: # has 20 states and 89 transitions, after minimization.
|
||||
in: (G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))
|
||||
-TGTA | 21 | 127 | XXX
|
||||
-TGTA -RT | 17 | 93 | XXX
|
||||
-TA | 20 | 92 | 12
|
||||
-TA -RT | 15 | 57 | 9
|
||||
-TA -lv | 21 | 104 | 6
|
||||
-TA -lv -RT | 17 | 75 | 4
|
||||
-TA -sp | 20 | 100 | 5
|
||||
-TA -sp -RT | 16 | 70 | 3
|
||||
-TA -lv -sp | 21 | 104 | 6
|
||||
-TA -lv -sp -RT | 17 | 75 | 4
|
||||
-TA -DS | 20 | 92 | 13
|
||||
-TA -DS -RT | 18 | 81 | 12
|
||||
-TA -DS -lv | 21 | 104 | 7
|
||||
-TA -DS -lv -RT | 20 | 99 | 7
|
||||
-TA -DS -sp | 20 | 100 | 6
|
||||
-TA -DS -sp -RT | 19 | 95 | 6
|
||||
-TA -DS -lv -sp | 21 | 104 | 7
|
||||
-TA -DS -lv -sp -RT | 20 | 99 | 7
|
||||
-x -TA -DS -in | 19 | 66 | 5
|
||||
-x -TA -DS -in -RT | 15 | 52 | 5
|
||||
in: GFa & GFb & GFc & GFd & GFe & GFg
|
||||
-TGTA | 65 | 4160 | XXX
|
||||
-TGTA -RT | 65 | 4160 | XXX
|
||||
-TA | 64 | 4032 | 1
|
||||
-TA -RT | 64 | 4032 | 1
|
||||
-TA -lv | 64 | 4032 | 1
|
||||
-TA -lv -RT | 64 | 4032 | 1
|
||||
-TA -sp | 64 | 4032 | 1
|
||||
-TA -sp -RT | 64 | 4032 | 1
|
||||
-TA -lv -sp | 64 | 4032 | 1
|
||||
-TA -lv -sp -RT | 64 | 4032 | 1
|
||||
-TA -DS | 448 | 52416 | 70
|
||||
-TA -DS -RT | 448 | 52416 | 70
|
||||
-TA -DS -lv | 448 | 52416 | 70
|
||||
-TA -DS -lv -RT | 448 | 52416 | 70
|
||||
-TA -DS -sp | 448 | 52416 | 70
|
||||
-TA -DS -sp -RT | 448 | 52416 | 70
|
||||
-TA -DS -lv -sp | 448 | 52416 | 70
|
||||
-TA -DS -lv -sp -RT | 448 | 52416 | 70
|
||||
-x -TA -DS -in | 449 | 28608 | 65
|
||||
-x -TA -DS -in -RT | 320 | 20352 | 65
|
||||
in: Gq|Gr|(G(q|FGp)&G(r|FG!p))
|
||||
-TGTA | 65 | 842 | XXX
|
||||
-TGTA -RT | 21 | 294 | XXX
|
||||
-TA | 64 | 740 | 26
|
||||
-TA -RT | 22 | 264 | 14
|
||||
-TA -lv | 65 | 776 | 15
|
||||
-TA -lv -RT | 23 | 288 | 7
|
||||
-TA -sp | 64 | 764 | 14
|
||||
-TA -sp -RT | 22 | 280 | 6
|
||||
-TA -lv -sp | 65 | 776 | 15
|
||||
-TA -lv -sp -RT | 23 | 288 | 7
|
||||
-TA -DS | 64 | 740 | 34
|
||||
-TA -DS -RT | 26 | 366 | 20
|
||||
-TA -DS -lv | 65 | 776 | 25
|
||||
-TA -DS -lv -RT | 27 | 396 | 13
|
||||
-TA -DS -sp | 64 | 764 | 24
|
||||
-TA -DS -sp -RT | 26 | 386 | 12
|
||||
-TA -DS -lv -sp | 65 | 776 | 25
|
||||
-TA -DS -lv -sp -RT | 27 | 396 | 13
|
||||
-x -TA -DS -in | 33 | 152 | 19
|
||||
-x -TA -DS -in -RT | 21 | 112 | 11
|
||||
in: FG((WaitRight4 M (HasRight1 W GWaitLeft0)) M HasLeft4)
|
||||
-TGTA | 45 | 730 | XXX
|
||||
-TGTA -RT | 35 | 598 | XXX
|
||||
-TA | 44 | 602 | 16
|
||||
-TA -RT | 33 | 482 | 9
|
||||
-TA -lv | 45 | 676 | 9
|
||||
-TA -lv -RT | 35 | 566 | 4
|
||||
-TA -sp | 44 | 667 | 8
|
||||
-TA -sp -RT | 34 | 545 | 3
|
||||
-TA -lv -sp | 45 | 676 | 9
|
||||
-TA -lv -sp -RT | 35 | 566 | 4
|
||||
-TA -DS | 54 | 722 | 26
|
||||
-TA -DS -RT | 42 | 600 | 19
|
||||
-TA -DS -lv | 55 | 800 | 19
|
||||
-TA -DS -lv -RT | 44 | 694 | 13
|
||||
-TA -DS -sp | 54 | 795 | 18
|
||||
-TA -DS -sp -RT | 43 | 683 | 12
|
||||
-TA -DS -lv -sp | 55 | 800 | 19
|
||||
-TA -DS -lv -sp -RT | 44 | 694 | 13
|
||||
-x -TA -DS -in | 55 | 700 | 11
|
||||
-x -TA -DS -in -RT | 39 | 566 | 8
|
||||
in: G(F(GWaitLeft7 U Idle4) U (WaitLeft2 M IsEating2))
|
||||
-TGTA | 69 | 1539 | XXX
|
||||
-TGTA -RT | 49 | 935 | XXX
|
||||
-TA | 68 | 1443 | 16
|
||||
-TA -RT | 56 | 1179 | 15
|
||||
-TA -lv | 68 | 1443 | 16
|
||||
-TA -lv -RT | 56 | 1179 | 15
|
||||
-TA -sp | 68 | 1443 | 16
|
||||
-TA -sp -RT | 56 | 1179 | 15
|
||||
-TA -lv -sp | 68 | 1443 | 16
|
||||
-TA -lv -sp -RT | 56 | 1179 | 15
|
||||
-TA -DS | 124 | 2964 | 44
|
||||
-TA -DS -RT | 100 | 2285 | 42
|
||||
-TA -DS -lv | 125 | 3028 | 42
|
||||
-TA -DS -lv -RT | 101 | 2339 | 40
|
||||
-TA -DS -sp | 124 | 3012 | 41
|
||||
-TA -DS -sp -RT | 100 | 2324 | 39
|
||||
-TA -DS -lv -sp | 125 | 3028 | 42
|
||||
-TA -DS -lv -sp -RT | 101 | 2339 | 40
|
||||
-x -TA -DS -in | 125 | 1838 | 25
|
||||
-x -TA -DS -in -RT | 89 | 1344 | 25
|
||||
EOF
|
||||
|
||||
sed -n 's/in: \(.*\)/\1/p' checkta.txt > input.txt
|
||||
run 0 ../checkta input.txt | tee output.txt
|
||||
diff checkta.txt output.txt
|
||||
28
tests/ltl2ta2.test
Executable file
28
tests/ltl2ta2.test
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# This used to trigger an assert because of BA simulation not
|
||||
# returning an instance of spot::sba.
|
||||
run 0 ../../bin/ltl2tgta --ta 'G(F(a U b) U (c M d))'
|
||||
221
tests/ltl2tgba.test
Executable file
221
tests/ltl2tgba.test
Executable file
|
|
@ -0,0 +1,221 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire
|
||||
# de Recherche et Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >check.txt <<\EOF
|
||||
a
|
||||
a U b
|
||||
X a
|
||||
a & b & c
|
||||
a | b | (c U (d & (g U (h ^ i))))
|
||||
Xa & (b U !a) & (b U !a)
|
||||
Fa & Xb & GFc & Gd
|
||||
Fa & Xa & GFc & Gc
|
||||
Fc & X(a | Xb) & GF(a | Xb) & Gc
|
||||
a R (b R c)
|
||||
(a U b) U (c U d)
|
||||
|
||||
((Xp2)U(X(1)))&(p1 R(p2 R p0))
|
||||
|
||||
{a*;c}<>->GFb
|
||||
{((a*;b;c)*)&((b*;a;c)*)}<>->x
|
||||
{(g;y;r)*}<>->x
|
||||
G({(g;y;r)*}<>->x)
|
||||
G({(a;b)*}<>->x)&G({(c;d)*}<>->y)
|
||||
# try sub-braces
|
||||
G({{a;b}*}[]->x)&G({{c;d}*}[]->y)
|
||||
{([*0] + a):c*:([*0] + b)}<>->d
|
||||
{a;e;f:(g*);h}<>->d
|
||||
{(a:b)* & (c*:d)}<>->e
|
||||
{(a:b)*}
|
||||
G{(a:b)*}
|
||||
{a;b}
|
||||
{(a;b)*}
|
||||
G{(a;b)*}
|
||||
{a*}[]->{b*}
|
||||
{a*}[]=>{b*}
|
||||
{a*&b}
|
||||
{a*&b*}
|
||||
{((!c;b*) & d);e}
|
||||
{(a* & (c;b*) & d);e}
|
||||
{[*2];a[*2..4]}|->b
|
||||
{a[*2..5] && b[*..3]}|->c
|
||||
{{[+];a;[+]} && {[+];b;[+]}}<>->c
|
||||
{(a[->3]) & {[+];b}}<>->c
|
||||
# This formula (built by a random formula generator), exhibited an
|
||||
# infinite recursion in the translation:
|
||||
{(a|[*0])[*];1}
|
||||
# Example from "Beyond Hardware Verification" by Glazberg, Moulin, Orni,
|
||||
# Ruah, Zarpas (2007).
|
||||
{[*];req;ack}|=>{start;busy[*];done}
|
||||
# Examples from "Property-by-Example Guide: a Handbook of PSL Examples"
|
||||
# by Ben David and Orni (2005)/
|
||||
# - 2.27.A
|
||||
{end[=3]}(false)
|
||||
# - 3.5.A
|
||||
{[*]; {read[=3]} && {write[=2]}} |=> {(!read && !write)[*]; ready}
|
||||
# - 2.33 (abridged to fit in 80 cols)
|
||||
{[*];st&&comp_d_en;!comp_d_en&&good_c;{st_v[->]}&&{stop[=0];true}}|->{!d_out}
|
||||
|
||||
# Some tricky cases that require the rational automaton to be pruned
|
||||
# before it is used in the translation.
|
||||
{{b[*];c} | {{a && !a}}[=2]}
|
||||
{((a&!b);((!a&!b)*))&&(!b*;(!a&b))}
|
||||
# When translating this formula, we expect the translator to ignore
|
||||
# `a;(f&!f)[=2];c' on one side because it as already seen it on the
|
||||
# other side.
|
||||
{c;a;(f&!f)[=2];c}|{b;a;(!f&f)[=2];c}
|
||||
|
||||
# these were mis-translated in Spot 0.9
|
||||
G!{(b;1)*;a}
|
||||
(G!{(b;1)*;a} && ({1;1[*3]*}[]->{(b&!a)[*2];!b&!a}))
|
||||
EOF
|
||||
|
||||
run 0 ../checkpsl check.txt
|
||||
|
||||
# Make sure False has one acceptance set when generating Büchi automata
|
||||
test 1 -eq `../../bin/ltl2tgba -B false --stats %a`
|
||||
|
||||
# In particular, Spot 0.9 would incorrectly reject the sequence:
|
||||
# (a̅b;a̅b;a̅b̅);(a̅b;a̅b;a̅b̅);(a̅b;a̅b;a̅b̅);... in 'G!{(b;1)*;a}'
|
||||
# This means the following automaton was incorrectly empty in Spot 0.9.
|
||||
run 0 ../ikwiad -e -R3 '(G!{(b;1)*;a} && ({1;1[*3]*}[]->{(b&!a)[*2];!b&!a}))'
|
||||
|
||||
# Make sure 'a U (b U c)' has 3 states and 6 transitions,
|
||||
# before and after degeneralization.
|
||||
for opt in '' -DT -DS; do
|
||||
../ikwiad -ks -f -R3 $opt 'a U (b U c)' > stdout
|
||||
grep 'edges: 6$' stdout
|
||||
grep 'states: 3$' stdout
|
||||
done
|
||||
|
||||
# Make sure '!(Ga U b)' has 3 states and 6 transitions,
|
||||
# before and after degeneralization.
|
||||
for opt in '' -DT -DS; do
|
||||
../ikwiad -kt -f -R3 $opt '!(Ga U b)' > stdout
|
||||
grep 'transitions: 11$' stdout
|
||||
grep 'edges: 6$' stdout
|
||||
grep 'states: 3$' stdout
|
||||
done
|
||||
|
||||
# Make sure 'Ga U b' has 4 states and 6 transitions,
|
||||
# before and after degeneralization.
|
||||
for opt in '' -DT -DS; do
|
||||
../ikwiad -kt -f -R3 $opt 'Ga U b' > stdout
|
||||
grep 'transitions: 12$' stdout
|
||||
grep 'edges: 6$' stdout
|
||||
grep 'states: 4$' stdout
|
||||
done
|
||||
|
||||
# Make sure '(G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))'
|
||||
# has 6 states and 15 transitions, before and after degeneralization.
|
||||
f='(G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))'
|
||||
for opt in '' -DT -DS; do
|
||||
../ikwiad -ks -f -R3 $opt "$f" > stdout
|
||||
grep 'edges: 15$' stdout
|
||||
grep 'states: 6$' stdout
|
||||
../ikwiad -ks -f -R3f $opt "$f" > stdout
|
||||
grep 'edges: 15$' stdout
|
||||
grep 'states: 6$' stdout
|
||||
done
|
||||
|
||||
# Make sure 'GFa & GFb & GFc & GFd & GFe & GFf'
|
||||
# has 7 states and 34 transitions after degeneralization.
|
||||
f='GFa & GFb & GFc & GFd & GFe & GFg'
|
||||
../ikwiad -ks -DS -x -f "$f" > stdout
|
||||
grep 'edges: 34$' stdout
|
||||
grep 'states: 7$' stdout
|
||||
|
||||
# Make sure 'Ga & XXXX!a' is minimized to one state.
|
||||
f='Ga & XXXX!a'
|
||||
../ikwiad -ks -f "$f" > stdout
|
||||
grep 'edges: 4$' stdout
|
||||
grep 'states: 5$' stdout
|
||||
../ikwiad -ks -Rm -f "$f" > stdout
|
||||
grep 'edges: 0$' stdout
|
||||
grep 'states: 1$' stdout
|
||||
|
||||
# Make sure a monitor for F(a & F(b)) accepts everything.
|
||||
run 0 ../ikwiad -M -f "F(a & F(b))" | grep ' ->' > stdout
|
||||
cat >expected <<EOF
|
||||
I -> 0
|
||||
0 -> 0 [label="1"]
|
||||
EOF
|
||||
cmp stdout expected
|
||||
|
||||
# This formula caused a segfault with Spot 0.7.
|
||||
run 0 ../ikwiad -Rm -ks -f "Gq|Gr|(G(q|FGp)&G(r|FG!p))" >stdout
|
||||
grep 'edges: 5$' stdout
|
||||
grep 'states: 3$' stdout
|
||||
|
||||
# Adding -R3 used to make it work...
|
||||
run 0 ../ikwiad -R3 -Rm -ks -f "Gq|Gr|(G(q|FGp)&G(r|FG!p))" >stdout
|
||||
grep 'edges: 5$' stdout
|
||||
grep 'states: 3$' stdout
|
||||
|
||||
# Make sure FGa|GFb has the same number of states/transitions when
|
||||
# output as a never claim or are a degeneralized BA in HOAF.
|
||||
# The option -R1q -R1t used to cause two degeneralizations to
|
||||
# occur.
|
||||
run 0 ../ikwiad -R1q -R1t -N 'FGa|FGb' > out.never
|
||||
run 0 ../ikwiad -XN -kt out.never > count.never
|
||||
run 0 ../ikwiad -R1q -R1t -DS -H 'FGa|FGb' > out.hoa
|
||||
run 0 ../ikwiad -XH -kt out.hoa > count.hoa
|
||||
cmp count.never count.hoa
|
||||
|
||||
# The following automaton should have only 4 states.
|
||||
run 0 ../ikwiad -R3 -ks -f '(p&XF!p)|(!p&XFp)|X(Fp&F!p)' >stdout
|
||||
grep 'edges: 7$' stdout
|
||||
grep 'states: 4$' stdout
|
||||
|
||||
# A bug in the translation of !{xxx} when xxx reduces to false caused
|
||||
# the following formula to be considered equivalent to anything...
|
||||
../../bin/ltlfilt -f '!{[*2] && [*0..1]}' --equivalent-to 'false' && exit 1
|
||||
../../bin/ltlfilt -f '!{[*2] && [*0..1]}' --equivalent-to 'true'
|
||||
|
||||
# Test some equivalences fixed in Spot 1.1.4
|
||||
../../bin/ltlfilt -f '{{a;b}[*]}' --equivalent-to 'a & Xb'
|
||||
../../bin/ltlfilt -r -f '{{a;b}[*]}' --equivalent-to 'a & Xb'
|
||||
../../bin/ltlfilt -f '!{{a;b}[*]}' --equivalent-to '!a | X!b'
|
||||
../../bin/ltlfilt -r -f '!{{a;b}[*]}' --equivalent-to '!a | X!b'
|
||||
../../bin/ltlfilt -f '{a[*];b[*]}' --equivalent-to 'a | b'
|
||||
../../bin/ltlfilt -r -f '{a[*];b[*]}' --equivalent-to 'a | b'
|
||||
|
||||
|
||||
# A couple of tests for the [:*i..j] operator
|
||||
../../bin/ltlfilt -q -f '{{a;b}[:*1..2];c}' \
|
||||
--equivalent-to '(a&X(b&Xc)) | a&(X(b&a&X(b&Xc)))'
|
||||
../../bin/ltlfilt -q -r -f '{{a;b}[:*1..2];c}' \
|
||||
--equivalent-to '(a&X(b&Xc)) | a&(X(b&a&X(b&Xc)))'
|
||||
../../bin/ltlfilt -q -f '{{a*}[:+];c}' --equivalent-to 'Xc R a'
|
||||
../../bin/ltlfilt -q -r -f '{{a*}[:+];c}' --equivalent-to 'Xc R a'
|
||||
../../bin/ltlfilt -q -f '{c && {b | [*0]}[:+]}' --equivalent-to 'c & b'
|
||||
../../bin/ltlfilt -q -r -f '{c && {b | [*0]}[:+]}' --equivalent-to 'c & b'
|
||||
|
||||
# test unknown dot options
|
||||
../../bin/ltl2tgba --dot=@ a 2>stderr && exit 1
|
||||
grep 'ltl2tgba: unknown option.*@' stderr
|
||||
37
tests/ltl3dra.test
Executable file
37
tests/ltl3dra.test
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Do some quick translations to make sure the neverclaims produced by
|
||||
# spot actually look correct! We do that by parsing them via ltlcross.
|
||||
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
# Skip this test if ltl3dra is not installed.
|
||||
(ltl3dra -v) || exit 77
|
||||
|
||||
# This used to crash ltlcross because the number of
|
||||
# acceptance sets generated was to high.
|
||||
../../bin/ltlcross '../../bin/ltl2tgba' 'ltl3dra' -f '(<>((((p0) &&
|
||||
(!(<>(p2)))) || ((!(p0)) && (<>(p2)))) U ((<>(((p0) && (!([](((!(p1))
|
||||
&& ([](p3))) || ((p1) && (!([](p3)))))))) || ((!(p0)) && ([](((!(p1))
|
||||
&& ([](p3))) || ((p1) && (!([](p3))))))))) && (((p0) && (!(<>(p2))))
|
||||
|| ((!(p0)) && (<>(p2)))))))'
|
||||
60
tests/ltlcounter.test
Executable file
60
tests/ltlcounter.test
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2011, 2012, 2014 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
pwd
|
||||
lc="../../bin/genltl"
|
||||
|
||||
run='run 0'
|
||||
|
||||
check_formula()
|
||||
{
|
||||
# First, check the satisfiability of the formula with Spot
|
||||
$run ../ikwiad -CR -e -x -f "$1" >/dev/null
|
||||
# Also check the satisfiability of the degeneralized formula
|
||||
$run ../ikwiad -CR -e -DT -x -f "$1" >/dev/null
|
||||
$run ../ikwiad -CR -e -DS -x -f "$1" >/dev/null
|
||||
}
|
||||
|
||||
# Kristin Y. Rozier reported that the formulae with n=10 were badly
|
||||
# translated. Each of these formulae should have exactly one
|
||||
# accepting path, but in this case the emptiness returned an automata
|
||||
# without cycle. It turned out the function used to compare LTL
|
||||
# formulae was bugged when two LTL formulae had the same hash value,
|
||||
# so the translation of the formula stopped midway, on a formula it
|
||||
# thought it had already seen.
|
||||
|
||||
check_range()
|
||||
{
|
||||
"$lc" --rv-counter $1 --rv-counter-linear $1 \
|
||||
--rv-counter-carry $1 --rv-counter-carry-linear $1 |
|
||||
while read line; do
|
||||
check_formula "$line"
|
||||
done
|
||||
}
|
||||
|
||||
check_range 1..2
|
||||
# Do not run the larger formulae with valgrind, it is too slow
|
||||
run=
|
||||
check_range 3..11
|
||||
61
tests/ltlcross.test
Executable file
61
tests/ltlcross.test
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2013, 2014 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
ltl2tgba=../ikwiad
|
||||
|
||||
|
||||
(
|
||||
# Some formulas supplied by Joachim Klein. The first two were
|
||||
# incorrectly translated by ltl_to_tgba_fm(), while the other have
|
||||
# shown some bugs in other translators.
|
||||
cat <<EOF
|
||||
G(Fa & ((a M b) U ((c U !d) M d)))
|
||||
XF(p2 R (!Fp1 W p1))
|
||||
X p0 || ((X p0) V <>p0)
|
||||
p0 xor (p0 W X!p0)
|
||||
p0 & (!p0 W Xp0)
|
||||
EOF
|
||||
# Random formulas
|
||||
../../bin/randltl -n 100 p1 p2 p3 p4 p5 p6 --tree-size 5..15
|
||||
) |
|
||||
../../bin/ltlcross --products=2 \
|
||||
"$ltl2tgba -t -f %f > %T" \
|
||||
"$ltl2tgba -t -f -y %f > %T" \
|
||||
"$ltl2tgba -t -f -fu %f > %T" \
|
||||
"$ltl2tgba -t -f -r4 %f > %T" \
|
||||
"$ltl2tgba -t -f -R3 %f > %T" \
|
||||
"$ltl2tgba -t -f -R3 -Rm %f > %T" \
|
||||
"$ltl2tgba -t -f -R3 -RM %f > %T" \
|
||||
"$ltl2tgba -t -f -DT %f > %T" \
|
||||
"$ltl2tgba -t -f -DS %f > %T" \
|
||||
"$ltl2tgba -t -f -r4 -R3 -RDS %f > %T" \
|
||||
"$ltl2tgba -t -f -r4 -R3 -RRS %f > %T" \
|
||||
"$ltl2tgba -t -f -r4 -R3 -RIS %f > %T" \
|
||||
"$ltl2tgba -t -f -r4 -R3 -RDS -DS %f > %T" \
|
||||
"$ltl2tgba -t -f -x -p %f > %T" \
|
||||
"$ltl2tgba -t -f -x -p -L %f > %T" \
|
||||
"$ltl2tgba -t -f -x -p -DT %f > %T" \
|
||||
"$ltl2tgba -t -f -x -p -L -DT %f > %T" \
|
||||
"$ltl2tgba -t -taa -r4 %f > %T" \
|
||||
"$ltl2tgba -t -taa -r4 -c %f > %T" \
|
||||
"$ltl2tgba -t -taa -r4 -R3 -RDS %f > %T"
|
||||
48
tests/ltlcross2.test
Executable file
48
tests/ltlcross2.test
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
|
||||
../../bin/randltl -P -n 100 p1 p2 p3 p4 p5 p6 --tree-size 5..15 --seed=314 |
|
||||
../../bin/ltlcross --products=3 --timeout=60 \
|
||||
"$ltl2tgba --lbtt --any --low %f > %T" \
|
||||
"$ltl2tgba --lbtt --any --medium %f > %T" \
|
||||
"$ltl2tgba --hoa --any --high %f > %H" \
|
||||
"$ltl2tgba --lbtt --deterministic --low %f > %T" \
|
||||
"$ltl2tgba --lbtt --deterministic --medium %f > %T" \
|
||||
"$ltl2tgba --lbtt --deterministic --high %f > %T" \
|
||||
"$ltl2tgba --lbtt --small --low %f > %T" \
|
||||
"$ltl2tgba --hoa --small --medium %f > %H" \
|
||||
"$ltl2tgba --lbtt --small --high %f > %T" \
|
||||
"$ltl2tgba --lbtt -x comp-susp --small %f >%T" \
|
||||
"$ltl2tgba --lbtt -x comp-susp,!skel-wdba --small %f >%T" \
|
||||
"$ltl2tgba --lbtt -x comp-susp,early-susp --small %f >%T" \
|
||||
"$ltl2tgba --lbtt -x comp-susp,!skel-wdba,!skel-simul --small %f >%T" \
|
||||
"$ltl2tgba --spin --ba -x degen-skip=0 %f >%N" \
|
||||
"$ltl2tgba --lbtt --ba --high %f > %T" \
|
||||
"$ltl2tgba --spin=6 --ba --medium %f > %N" \
|
||||
"$ltl2tgba --hoa -BDC %f > %H" \
|
||||
"$ltl2tgba --lbtt -BC %f > %T" \
|
||||
"$ltl2tgba --lbtt --unambiguous --low %f > %T" \
|
||||
"$ltl2tgba --lbtt --unambiguous --high %f > %T" \
|
||||
--json=output.json --csv=output.csv
|
||||
182
tests/ltlcross3.test
Executable file
182
tests/ltlcross3.test
Executable file
|
|
@ -0,0 +1,182 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
check_csv()
|
||||
{
|
||||
# Make sure all lines in $1 have the same number of comas
|
||||
sed 's/[^,]//g' < "$1" |
|
||||
( read first
|
||||
while read l; do
|
||||
test "x$first" = "x$l" || exit 1
|
||||
done)
|
||||
}
|
||||
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
|
||||
# Make sure ltlcross quotes formulas correctly
|
||||
cat >formula <<\EOF
|
||||
G"a'-'>'b"
|
||||
EOF
|
||||
run 0 ../../bin/ltlcross -F formula --csv=out.csv \
|
||||
"$ltl2tgba -s %f >%N" \
|
||||
"$ltl2tgba --lenient -s %s >%N"
|
||||
|
||||
run 2 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'foo bar' 2>stderr -f a
|
||||
grep 'ltlcross.*no input.*in.*foo bar' stderr
|
||||
|
||||
# Make sure non-zero exit codes are reported...
|
||||
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
|
||||
-f a --csv=out.csv 2>stderr
|
||||
grep '"exit_status"' out.csv
|
||||
grep '"exit_code"' out.csv
|
||||
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
|
||||
test `grep '"exit code",1' out.csv | wc -l` -eq 2
|
||||
check_csv out.csv
|
||||
|
||||
# ... unless --omit-missing is supplied.
|
||||
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
|
||||
-f a --csv=out.csv --omit-missing 2>stderr
|
||||
grep '"exit_status"' out.csv && exit 1
|
||||
grep '"exit_code"' out.csv && exit 1
|
||||
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
|
||||
test `grep '"exit code",1' out.csv | wc -l` -eq 0
|
||||
check_csv out.csv
|
||||
|
||||
# Likewise for timeouts
|
||||
echo foo >bug
|
||||
run 0 ../../bin/ltlcross 'sleep 5; false %f >%N' 'false %f >%N' \
|
||||
--timeout 2 -f a --csv=out.csv \
|
||||
--ignore-execution-failures \
|
||||
--save-bogus=bug 2>stderr
|
||||
grep '"exit_status"' out.csv
|
||||
grep '"exit_code"' out.csv
|
||||
test `grep 'warning:.*timeout' stderr | wc -l` -eq 2
|
||||
test `grep 'warning:.*exit code 1' stderr | wc -l` -eq 2
|
||||
test `grep '"timeout",-1' out.csv | wc -l` -eq 2
|
||||
test `grep '"exit code",1' out.csv | wc -l` -eq 2
|
||||
|
||||
grep 'No major problem detected' stderr
|
||||
grep '2 timeouts occurred' stderr
|
||||
grep '2 non-zero exit statuses were ignored' stderr
|
||||
check_csv out.csv
|
||||
# 'bug' should exist but be empty
|
||||
test -f bug
|
||||
test -s bug && exit 1
|
||||
|
||||
run 0 ../../bin/ltlcross 'sleep 5; false %f >%N' \
|
||||
--timeout 2 --omit-missing -f a --csv=out.csv 2>stderr
|
||||
grep '"exit_status"' out.csv && exit 1
|
||||
grep '"exit_code"' out.csv && exit 1
|
||||
test `grep 'warning:.*timeout' stderr | wc -l` -eq 2
|
||||
test `wc -l < out.csv` -eq 1
|
||||
check_csv out.csv
|
||||
|
||||
# Check with --products=5 --automata
|
||||
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
|
||||
-f a --csv=out.csv --products=5 --automata 2>stderr
|
||||
p=`sed 's/[^,]//g;q' out.csv | wc -c`
|
||||
grep '"exit_status"' out.csv
|
||||
grep '"exit_code"' out.csv
|
||||
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
|
||||
test `grep '"exit code",1' out.csv | wc -l` -eq 2
|
||||
test `grep '"HOA:.*--BODY--.*--END--"' out.csv | wc -l` -eq 2
|
||||
check_csv out.csv
|
||||
|
||||
# ... unless --omit-missing is supplied.
|
||||
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
|
||||
-f a --csv=out.csv --omit-missing --products=5 2>stderr
|
||||
grep '"exit_status"' out.csv && exit 1
|
||||
grep '"exit_code"' out.csv && exit 1
|
||||
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
|
||||
test `grep '"exit code",1' out.csv | wc -l` -eq 0
|
||||
check_csv out.csv
|
||||
|
||||
|
||||
# Check with --products=+5
|
||||
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
|
||||
-f a --csv=out.csv --products=+5 --automata 2>stderr
|
||||
q=`sed 's/[^,]//g;q' out.csv | wc -c`
|
||||
grep '"exit_status"' out.csv
|
||||
grep '"exit_code"' out.csv
|
||||
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
|
||||
test `grep '"exit code",1' out.csv | wc -l` -eq 2
|
||||
test `grep '"HOA:.*--BODY--.*--END--"' out.csv | wc -l` -eq 2
|
||||
check_csv out.csv
|
||||
|
||||
# ... unless --omit-missing is supplied.
|
||||
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
|
||||
-f a --csv=out.csv --omit-missing --products=+5 2>stderr
|
||||
grep '"exit_status"' out.csv && exit 1
|
||||
grep '"exit_code"' out.csv && exit 1
|
||||
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
|
||||
test `grep '"exit code",1' out.csv | wc -l` -eq 0
|
||||
check_csv out.csv
|
||||
|
||||
test $q -eq `expr $p + 12`
|
||||
|
||||
|
||||
# Check with Rabin/Streett output
|
||||
first="should not be erased"
|
||||
echo "$first" > bug.txt
|
||||
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%D' \
|
||||
-f 'X a' --csv=out.csv --save-bogus='>>bug.txt' 2>stderr
|
||||
q=`sed 's/[^,]//g;q' out.csv | wc -c`
|
||||
test $q -eq `expr $p - 1`
|
||||
grep '"exit_status"' out.csv
|
||||
grep '"exit_code"' out.csv
|
||||
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
|
||||
test `grep '"exit code",1' out.csv | wc -l` -eq 2
|
||||
check_csv out.csv
|
||||
grep 'X a' bug.txt
|
||||
test "`head -n 1 bug.txt`" = "$first"
|
||||
|
||||
|
||||
# Support for --ABORT-- in HOA.
|
||||
run 1 ../../bin/ltlcross 'echo HOA: --ABORT-- %f > %H' \
|
||||
-f a --csv=out.csv 2>stderr
|
||||
grep '"exit_status"' out.csv
|
||||
grep '"exit_code"' out.csv
|
||||
test `grep 'error:.*aborted' stderr | wc -l` -eq 2
|
||||
test `grep '"aborted",-1' out.csv | wc -l` -eq 2
|
||||
test 3 = `wc -l < out.csv`
|
||||
check_csv out.csv
|
||||
|
||||
# The header of CSV file is not output in append mode
|
||||
run 1 ../../bin/ltlcross 'echo HOA: --ABORT-- %f > %H' \
|
||||
-f a --csv='>>out.csv' 2>stderr
|
||||
grep '"exit_status"' out.csv
|
||||
grep '"exit_code"' out.csv
|
||||
test `grep 'error:.*aborted' stderr | wc -l` -eq 2
|
||||
test `grep '"aborted",-1' out.csv | wc -l` -eq 4
|
||||
test 5 = `wc -l < out.csv`
|
||||
check_csv out.csv
|
||||
|
||||
|
||||
# Diagnose empty automata, and make sure %% is correctly replaced by %
|
||||
run 1 ../../bin/ltlcross ': %f >%O; echo %%>foo' -f a 2>stderr
|
||||
test 2 = `grep -c ':.*empty input' stderr`
|
||||
cat foo
|
||||
cat >expected<<EOF
|
||||
%
|
||||
EOF
|
||||
diff foo expected
|
||||
88
tests/ltlcross4.test
Executable file
88
tests/ltlcross4.test
Executable file
|
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2013, 2014 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
test -z "$PYTHON" && exit 77
|
||||
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
|
||||
cat >formulas.txt <<EOF
|
||||
GFa & GFb
|
||||
GFa -> GFb
|
||||
EOF
|
||||
|
||||
../../bin/ltlcross -F formulas.txt \
|
||||
"{ltl2tgba any} $ltl2tgba --lbtt --any %f > %T" \
|
||||
"{ltl2tgba det} $ltl2tgba --lbtt --deterministic %f > %T" \
|
||||
"{ltl2tgba sma} $ltl2tgba --lbtt --small %f > %T" \
|
||||
--csv=output.csv
|
||||
|
||||
cat >test.py <<EOF
|
||||
import sys
|
||||
try:
|
||||
import pandas
|
||||
except ImportError:
|
||||
sys.exit(77)
|
||||
|
||||
x = pandas.read_csv("output.csv")
|
||||
print(x.filter(('formula', 'tool',
|
||||
'states', 'transitions')).groupby('tool').describe())
|
||||
EOF
|
||||
|
||||
# will exit 77 if panda is not installed
|
||||
$PYTHON test.py >out.1
|
||||
|
||||
# remove trailing whitespace from pandas' output,
|
||||
# and limit to 26 lines, because Pandas 0.13 adds
|
||||
# the size of the dataframe afterwards.
|
||||
sed 's/[ \t]*$//g;26q' <out.1 > py.out
|
||||
|
||||
cat >expected <<EOF
|
||||
states transitions
|
||||
tool
|
||||
ltl2tgba any count 4.000000 4.000000
|
||||
mean 2.250000 10.000000
|
||||
std 0.957427 5.163978
|
||||
min 1.000000 4.000000
|
||||
25% 1.750000 7.000000
|
||||
50% 2.500000 10.000000
|
||||
75% 3.000000 13.000000
|
||||
max 3.000000 16.000000
|
||||
ltl2tgba det count 4.000000 4.000000
|
||||
mean 2.250000 9.250000
|
||||
std 0.957427 4.573474
|
||||
min 1.000000 4.000000
|
||||
25% 1.750000 6.250000
|
||||
50% 2.500000 9.500000
|
||||
75% 3.000000 12.500000
|
||||
max 3.000000 14.000000
|
||||
ltl2tgba sma count 4.000000 4.000000
|
||||
mean 2.250000 9.250000
|
||||
std 0.957427 4.573474
|
||||
min 1.000000 4.000000
|
||||
25% 1.750000 6.250000
|
||||
50% 2.500000 9.500000
|
||||
75% 3.000000 12.500000
|
||||
max 3.000000 14.000000
|
||||
EOF
|
||||
|
||||
diff py.out expected
|
||||
96
tests/ltlcrossce.test
Executable file
96
tests/ltlcrossce.test
Executable file
|
|
@ -0,0 +1,96 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
|
||||
# The following "fake" script behaves as
|
||||
# version 1.5.9 of modella, when run as
|
||||
# 'modella -r12 -g -e %L %T' on
|
||||
# 'G(F(p0) & F(G(!p1))) | (F(G(!p0)) & G(F(p1)))'
|
||||
# or its negation. The translation is bogus
|
||||
# because the automata generated for this formula
|
||||
# and its negation both include the language of G(!p0).
|
||||
cat >fake <<\EOF
|
||||
#!/bin/sh
|
||||
case $1 in
|
||||
"| G & F p0 F G ! p1 & F G ! p0 G F p1")
|
||||
cat <<\END
|
||||
7 1 0 1 -1 1 t
|
||||
2 | & ! p0 ! p1 & ! p0 p1
|
||||
3 t
|
||||
4 | & ! p0 ! p1 & p0 ! p1
|
||||
-1 1 0 -1 1 t
|
||||
5 | & ! p0 ! p1 & ! p0 p1
|
||||
-1 2 0 -1 5 | & ! p0 ! p1 & ! p0 p1
|
||||
-1 3 0 1 -1 3 t
|
||||
-1 4 0 1 -1 4 | & ! p0 ! p1 & p0 ! p1
|
||||
-1 5 0 -1 5 & ! p0 ! p1
|
||||
6 & ! p0 p1
|
||||
-1 6 0 1 -1 2 | & ! p0 ! p1 & ! p0 p1
|
||||
-1
|
||||
END
|
||||
;;
|
||||
"! | G & F p0 F G ! p1 & F G ! p0 G F p1")
|
||||
cat <<\END
|
||||
12 1 0 1 -1 1 t
|
||||
2 | & ! p0 ! p1 & p0 ! p1
|
||||
3 t
|
||||
4 t
|
||||
5 | & ! p0 ! p1 & ! p0 p1
|
||||
6 & ! p0 ! p1
|
||||
-1 1 0 -1 1 t
|
||||
2 | & ! p0 ! p1 & p0 ! p1
|
||||
8 | & ! p0 ! p1 & ! p0 p1
|
||||
6 & ! p0 ! p1
|
||||
-1 2 0 -1 2 | & ! p0 ! p1 & p0 ! p1
|
||||
6 & ! p0 ! p1
|
||||
-1 3 0 -1 3 t
|
||||
7 t
|
||||
-1 4 0 -1 7 t
|
||||
-1 5 0 -1 8 | & ! p0 ! p1 & ! p0 p1
|
||||
6 & ! p0 ! p1
|
||||
-1 6 0 1 -1 6 & ! p0 ! p1
|
||||
-1 7 0 -1 7 | & ! p0 ! p1 & ! p0 p1
|
||||
9 | & p0 ! p1 & p0 p1
|
||||
-1 8 0 -1 10 | & ! p0 ! p1 & ! p0 p1
|
||||
6 & ! p0 ! p1
|
||||
-1 9 0 -1 11 t
|
||||
-1 10 0 -1 10 | & ! p0 ! p1 & ! p0 p1
|
||||
6 & ! p0 ! p1
|
||||
-1 11 0 1 -1 4 t
|
||||
-1
|
||||
END
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x fake
|
||||
|
||||
run 1 ../../bin/ltlcross -f 'G(F(p0) & F(G(!p1))) | (F(G(!p0)) & G(F(p1)))' \
|
||||
"$ltl2tgba --lbtt %f >%T" "./fake %l >%T" 2> errors
|
||||
cat errors
|
||||
grep 'error: P0\*N1 is nonempty' errors
|
||||
grep 'error: P1\*N0 is nonempty' errors
|
||||
grep 'error: P1\*N1 is nonempty' errors
|
||||
test `grep cycle errors | wc -l` = 3
|
||||
test `grep '^error:' errors | wc -l` = 4
|
||||
|
||||
72
tests/ltlcrossce2.test
Executable file
72
tests/ltlcrossce2.test
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
|
||||
cat >fake <<\EOF
|
||||
#!/bin/sh
|
||||
case $1 in
|
||||
"U G e p0 F p1 p2")
|
||||
|
||||
# echo 'U G e p0 F p1 p2' | ltl2dstar --output-format=hoa - - | fmt
|
||||
cat <<\END
|
||||
HOA: v1 States: 14 properties: implicit-labels trans-labels
|
||||
no-univ-branch deterministic complete acc-name: Rabin 3 Acceptance: 6
|
||||
(Fin(0)&Inf(1))|(Fin(2)&Inf(3))|(Fin(4)&Inf(5)) Start: 10 AP: 3 "p0"
|
||||
"p1" "p2" --BODY-- State: 0 {5} 0 3 5 5 0 3 5 5 State: 1 {3 4} 0 12 5
|
||||
1 0 12 5 1 State: 2 {3 4} 2 13 5 5 2 13 5 5 State: 3 {3 4} 13 13 5 5 13
|
||||
13 5 5 State: 4 {1 2 4} 4 4 4 4 4 4 4 4 State: 5 {0 2 4} 5 5 5 5 5 5 5
|
||||
5 State: 6 {2 4} 8 6 5 1 8 6 5 1 State: 7 {2 4} 7 8 5 5 2 8 5 5 State:
|
||||
8 {2 4} 8 8 5 5 8 8 5 5 State: 9 {2 4} 7 11 5 9 2 6 5 1 State: 10 {2 4}
|
||||
7 11 5 9 4 4 4 4 State: 11 {2 4} 8 11 5 9 8 6 5 1 State: 12 {4} 13 12
|
||||
5 1 13 12 5 1 State: 13 {4} 13 13 5 5 13 13 5 5 --END--
|
||||
END
|
||||
;;
|
||||
"! U G e p0 F p1 p2")
|
||||
# echo '! U G e p0 F p1 p2' | ltl2dstar --output-format=hoa - - | fmt |
|
||||
# sed '$s:8 13:13 8 /*<-bug*/:';
|
||||
cat <<\END
|
||||
HOA: v1 States: 14 properties: implicit-labels trans-labels
|
||||
no-univ-branch deterministic complete acc-name: Rabin 3 Acceptance: 6
|
||||
(Fin(0)&Inf(1))|(Fin(2)&Inf(3))|(Fin(4)&Inf(5)) Start: 11 AP: 3 "p0" "p1"
|
||||
"p2" --BODY-- State: 0 {5} 4 0 8 8 4 0 8 8 State: 1 {3 4} 1 1 8 8 1 1 8
|
||||
8 State: 2 {3 4} 1 2 8 13 1 2 8 13 State: 3 {3 4} 5 3 8 8 4 0 8 8 State:
|
||||
4 {1 2 4} 1 1 8 8 1 1 8 8 State: 5 {1 2 4} 5 3 8 8 1 1 8 8 State: 6 {1
|
||||
2 4} 6 3 8 8 12 1 8 8 State: 7 {1 2 4} 5 7 8 9 1 2 8 13 State: 8 {1 2 4}
|
||||
8 8 8 8 8 8 8 8 State: 9 {1 2 4} 6 7 8 9 12 2 8 13 State: 10 {0 2 4} 10
|
||||
10 10 10 10 10 10 10 State: 11 {2 4} 6 7 8 9 10 10 10 10 State: 12 {2 4}
|
||||
12 1 8 8 12 1 8 8 State: 13 {2 4} 12 2 13 8 /*<-bug*/ 12 2 8 13 --END--
|
||||
END
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x fake
|
||||
|
||||
run 1 ../../bin/ltlcross -f 'G(a <-> Fb) U c' \
|
||||
"$ltl2tgba --lbtt %f >%T" "./fake %l >%T" 2> errors
|
||||
cat errors
|
||||
grep 'error: P0\*N1 is nonempty' errors
|
||||
grep 'error: P1\*N1 is nonempty' errors
|
||||
grep 'error: Comp..1.\*Comp..1. is nonempty' errors
|
||||
test `grep cycle errors | wc -l` = 3
|
||||
test `grep '^error:' errors | wc -l` = 4
|
||||
36
tests/ltlcrossgrind.test
Executable file
36
tests/ltlcrossgrind.test
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014 Laboratoire de Recherche et Dévelopement to
|
||||
# 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
cat >fake <<EOF
|
||||
#!/bin/sh
|
||||
../../bin/ltl2tgba -s -f "\$1" | sed 's/p0/p1/g'
|
||||
EOF
|
||||
|
||||
chmod +x fake
|
||||
|
||||
run 1 ../../bin/ltlcross -f 'p0 U p1' "./fake %f >%N" \
|
||||
"../../bin/ltl2tgba -s -f %f >%N" --grind=bogus.grind
|
||||
|
||||
echo p0 >exp
|
||||
diff bogus.grind exp
|
||||
136
tests/ltldo.test
Executable file
136
tests/ltldo.test
Executable file
|
|
@ -0,0 +1,136 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
ltldo=../../bin/ltldo
|
||||
ltl2tgba=../../bin/ltl2tgba
|
||||
genltl=../../bin/genltl
|
||||
|
||||
run 0 $ltldo -f a -f 'a&b' -t 'echo %f,%s' >output
|
||||
cat >expected <<EOF
|
||||
a,a
|
||||
(a) & (b),(a) && (b)
|
||||
EOF
|
||||
diff output expected
|
||||
|
||||
# Renaming
|
||||
run 0 $ltldo -f a -f 'a&_b' -t 'echo %f,%s' >output
|
||||
cat >expected <<EOF
|
||||
a,a
|
||||
(p0) & (p1),(p0) && (p1)
|
||||
EOF
|
||||
diff output expected
|
||||
|
||||
|
||||
# Test timeouts. This test should take 2*2 seconds.
|
||||
$genltl --or-g=1..2 |
|
||||
run 0 $ltldo -F- -t 'sleep 10; echo %f' -T1 -t 'sleep 10; echo %f' \
|
||||
>output 2>stderr
|
||||
test -z "`cat output`"
|
||||
test 4 = `grep -c warning: stderr`
|
||||
|
||||
$genltl --and-gf=1..3 |
|
||||
run 0 $ltldo "{tgba}$ltl2tgba %f -H >%H" "{ba}$ltl2tgba >%N %f -s" \
|
||||
--stats="%T,%R,%f,%s,%t,%e" >output
|
||||
cat output
|
||||
cat >expected <<EOF
|
||||
tgba,1,GFp1,1,2,2
|
||||
ba,1,GFp1,2,4,4
|
||||
tgba,2,GFp1 & GFp2,1,4,4
|
||||
ba,2,GFp1 & GFp2,3,12,8
|
||||
tgba,3,GFp1 & GFp2 & GFp3,1,8,8
|
||||
ba,3,GFp1 & GFp2 & GFp3,4,32,13
|
||||
EOF
|
||||
diff output expected
|
||||
|
||||
# Renaming
|
||||
run 0 $ltldo "$ltl2tgba -H %s>%H" -f GF_foo_ -H >output
|
||||
cat output
|
||||
# The HOA output uses _foo_ as atomic proposition, but the name shows
|
||||
# that GFp0 was actually given to ltl2tgba.
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
name: "GFp0"
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 1 "_foo_"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete
|
||||
properties: deterministic stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 0 {0}
|
||||
[!0] 0
|
||||
--END--
|
||||
EOF
|
||||
diff output expected
|
||||
|
||||
# But we can force the name in the output:
|
||||
run 0 $ltldo "$ltl2tgba -H %s>%H" -f GF_foo_ -H --name=%f >output
|
||||
cat output
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
name: "GF_foo_"
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 1 "_foo_"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete
|
||||
properties: deterministic stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 0 {0}
|
||||
[!0] 0
|
||||
--END--
|
||||
EOF
|
||||
diff output expected
|
||||
|
||||
# Not trusting properties
|
||||
run 0 $ltldo "$ltl2tgba -H %s>%H" -f GF_foo_ -H --trust-hoa=no >output
|
||||
cat output
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
name: "GFp0"
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 1 "_foo_"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc complete
|
||||
properties: deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 0 {0}
|
||||
[!0] 0
|
||||
--END--
|
||||
EOF
|
||||
diff output expected
|
||||
|
||||
$ltldo ': %s; true>%O' -f GFa 2>stderr && exit 1
|
||||
test $? = 2
|
||||
grep ':.*empty input' stderr
|
||||
grep 'ltldo: aborting' stderr
|
||||
|
||||
$ltldo '{name} foo/bar/ltl2baextended' -f GFa 2>stderr && exit 1
|
||||
grep 'error:.*foo/bar/ltl2baextended -f .*>.*' stderr
|
||||
31
tests/ltldo2.test
Executable file
31
tests/ltldo2.test
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
ltldo=../../bin/ltldo
|
||||
genltl=../../bin/genltl
|
||||
|
||||
test -n "$LTL2BA" || exit 77
|
||||
|
||||
$genltl --or-g=1..2 |
|
||||
run 0 $ltldo "$LTL2BA -f %s>%H" '{foo}ltl2ba' >output
|
||||
test 4 = `grep -c digraph output`
|
||||
321
tests/ltlfilt.test
Executable file
321
tests/ltlfilt.test
Executable file
|
|
@ -0,0 +1,321 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Check several options of ltlfilt
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
|
||||
checkopt()
|
||||
{
|
||||
cat >exp
|
||||
run 0 $ltlfilt "$@" formulas > out
|
||||
diff exp out
|
||||
}
|
||||
|
||||
# The empty lines in the file are meant, we want to make sure that
|
||||
# they are ignored.
|
||||
cat >formulas <<EOF
|
||||
GFa | FGb /* comment to ignore */
|
||||
F(GFa | /* tricky /* comment */)*/ Gb)
|
||||
|
||||
F(b W GFa)
|
||||
GFa | Gb
|
||||
b W GFa
|
||||
!{a;b*;c}!
|
||||
!{a:b[*/*ignore me*/]:c/*ignore this comment*/}
|
||||
a U Fb
|
||||
G(a & Xb)
|
||||
Xa
|
||||
F(a & !Xa & Xb)
|
||||
{a & {b|c} }
|
||||
EOF
|
||||
|
||||
checkopt --eventual <<EOF
|
||||
GFa | FGb
|
||||
F(GFa | Gb)
|
||||
F(b W GFa)
|
||||
a U Fb
|
||||
F(a & !Xa & Xb)
|
||||
EOF
|
||||
|
||||
checkopt --universal <<EOF
|
||||
GFa | FGb
|
||||
F(GFa | Gb)
|
||||
GFa | Gb
|
||||
G(a & Xb)
|
||||
EOF
|
||||
|
||||
checkopt --eventual --universal <<EOF
|
||||
GFa | FGb
|
||||
F(GFa | Gb)
|
||||
EOF
|
||||
|
||||
checkopt --stutter-invariant <<EOF
|
||||
GFa | FGb
|
||||
F(GFa | Gb)
|
||||
F(b W GFa)
|
||||
GFa | Gb
|
||||
b W GFa
|
||||
!{a:b[*]:c}
|
||||
a U Fb
|
||||
F(a & !Xa & Xb)
|
||||
a & (b | c)
|
||||
EOF
|
||||
|
||||
checkopt -c --stutter-invariant <<EOF
|
||||
9
|
||||
EOF
|
||||
|
||||
checkopt --simplify <<EOF
|
||||
F(GFa | Gb)
|
||||
F(GFa | Gb)
|
||||
F(b W GFa)
|
||||
GFa | Gb
|
||||
b W GFa
|
||||
!a | X(!b R !c)
|
||||
!{a:b[*]:c}
|
||||
Fb
|
||||
G(a & Xb)
|
||||
Xa
|
||||
F(a & X(!a & b))
|
||||
a & (b | c)
|
||||
EOF
|
||||
|
||||
checkopt --simplify --eventual --unique <<EOF
|
||||
F(GFa | Gb)
|
||||
F(b W GFa)
|
||||
Fb
|
||||
F(a & X(!a & b))
|
||||
EOF
|
||||
|
||||
checkopt --safety <<EOF
|
||||
!({a;b[*];c}!)
|
||||
G(a & Xb)
|
||||
Xa
|
||||
a & (b | c)
|
||||
EOF
|
||||
|
||||
checkopt --obligation <<EOF
|
||||
!({a;b[*];c}!)
|
||||
!{a:b[*]:c}
|
||||
a U Fb
|
||||
G(a & Xb)
|
||||
Xa
|
||||
F(a & !Xa & Xb)
|
||||
a & (b | c)
|
||||
EOF
|
||||
|
||||
checkopt --guarantee <<EOF
|
||||
!{a:b[*]:c}
|
||||
a U Fb
|
||||
Xa
|
||||
F(a & !Xa & Xb)
|
||||
a & (b | c)
|
||||
EOF
|
||||
|
||||
checkopt -v --ltl <<EOF
|
||||
!({a;b[*];c}!)
|
||||
!{a:b[*]:c}
|
||||
EOF
|
||||
|
||||
checkopt -v --stutter-invariant <<EOF
|
||||
!({a;b[*];c}!)
|
||||
G(a & Xb)
|
||||
Xa
|
||||
EOF
|
||||
|
||||
checkopt --equivalent-to 'GFa | FGb' <<EOF
|
||||
GFa | FGb
|
||||
F(GFa | Gb)
|
||||
F(b W GFa)
|
||||
EOF
|
||||
|
||||
|
||||
cat >in <<EOF
|
||||
a & Xb & c
|
||||
a & b & GF(a | c) & FG(a | c)
|
||||
b & GF(a | c) & FG(a | c)
|
||||
G(d & e) | FG(Xf| !c) | h | i
|
||||
b & !Xc & e & (f | g)
|
||||
b & GF(a | c) & !GF!(a | c)
|
||||
F(a <-> b) -> (c xor d)
|
||||
EOF
|
||||
|
||||
cat >exp <<EOF
|
||||
p0 & Xp1
|
||||
p0 & p1 & GF(p0 | p2) & FG(p0 | p2)
|
||||
p0 & GFp1 & FGp1
|
||||
p0 | Gp1 | FG(p2 | Xp3)
|
||||
p0 | Gp1
|
||||
EOF
|
||||
|
||||
run 0 $ltlfilt -u --nnf --relabel-bool=pnn in >out
|
||||
diff exp out
|
||||
|
||||
cat >exp <<EOF
|
||||
#define p0 (a && c)
|
||||
#define p1 (b)
|
||||
p0 && Xp1
|
||||
#define p0 (a)
|
||||
#define p1 (b)
|
||||
#define p2 (c)
|
||||
p0 && p1 && []<>(p0 || p2) && <>[](p0 || p2)
|
||||
#define p0 (b)
|
||||
#define p1 (a || c)
|
||||
p0 && []<>p1 && <>[]p1
|
||||
#define p0 (h || i)
|
||||
#define p1 (d && e)
|
||||
#define p2 (!c)
|
||||
#define p3 (f)
|
||||
p0 || []p1 || <>[](p2 || Xp3)
|
||||
#define p0 ((c && !d) || (!c && d))
|
||||
#define p1 ((a && !b) || (!a && b))
|
||||
p0 || []p1
|
||||
EOF
|
||||
|
||||
run 0 $ltlfilt -s -u --nnf --relabel-bool=pnn --define in >out
|
||||
diff exp out
|
||||
|
||||
cat >exp <<EOF
|
||||
#define p0 (a)
|
||||
#define p1 (c)
|
||||
#define p2 (b)
|
||||
p0 && p1 && Xp2
|
||||
#define p0 (a)
|
||||
#define p1 (b)
|
||||
#define p2 (c)
|
||||
p0 && p1 && []<>(p0 || p2) && <>[](p0 || p2)
|
||||
#define p0 (b)
|
||||
#define p1 (a)
|
||||
#define p2 (c)
|
||||
p0 && []<>(p1 || p2) && <>[](p1 || p2)
|
||||
#define p0 (h)
|
||||
#define p1 (i)
|
||||
#define p2 (d)
|
||||
#define p3 (e)
|
||||
#define p4 (c)
|
||||
#define p5 (f)
|
||||
p0 || p1 || [](p2 && p3) || <>[](!p4 || Xp5)
|
||||
#define p0 (b)
|
||||
#define p1 (e)
|
||||
#define p2 (f)
|
||||
#define p3 (g)
|
||||
#define p4 (c)
|
||||
p0 && p1 && (p2 || p3) && !Xp4
|
||||
#define p0 (b)
|
||||
#define p1 (a)
|
||||
#define p2 (c)
|
||||
p0 && []<>(p1 || p2) && ![]<>!(p1 || p2)
|
||||
#define p0 (a)
|
||||
#define p1 (b)
|
||||
#define p2 (c)
|
||||
#define p3 (d)
|
||||
<>(p0 <-> p1) -> !(p2 <-> p3)
|
||||
EOF
|
||||
|
||||
run 0 $ltlfilt -s -u --relabel=pnn --define in >out
|
||||
diff exp out
|
||||
|
||||
toolong='((p2=0) * (p3=1))' # work around the 80-col check
|
||||
cat >exp <<EOF
|
||||
#define p0 (a=1)
|
||||
#define p1 (c=1)
|
||||
#define p2 (b=1)
|
||||
(p0=1) * (p1=1) * (X(p2=1))
|
||||
#define p0 (a=1)
|
||||
#define p1 (b=1)
|
||||
#define p2 (c=1)
|
||||
(p0=1) * (p1=1) * (G(F((p0=1) + (p2=1)))) * (F(G((p0=1) + (p2=1))))
|
||||
#define p0 (b=1)
|
||||
#define p1 (a=1)
|
||||
#define p2 (c=1)
|
||||
(p0=1) * (G(F((p1=1) + (p2=1)))) * (F(G((p1=1) + (p2=1))))
|
||||
#define p0 (h=1)
|
||||
#define p1 (i=1)
|
||||
#define p2 (d=1)
|
||||
#define p3 (e=1)
|
||||
#define p4 (c=1)
|
||||
#define p5 (f=1)
|
||||
(p0=1) + (p1=1) + (G((p2=1) * (p3=1))) + (F(G((p4=0) + (X(p5=1)))))
|
||||
#define p0 (b=1)
|
||||
#define p1 (e=1)
|
||||
#define p2 (f=1)
|
||||
#define p3 (g=1)
|
||||
#define p4 (c=1)
|
||||
(p0=1) * (p1=1) * ((p2=1) + (p3=1)) * (X(p4=0))
|
||||
#define p0 (c=1)
|
||||
#define p1 (d=1)
|
||||
#define p2 (a=1)
|
||||
#define p3 (b=1)
|
||||
((p0=1) * (p1=0)) + ((p0=0) * (p1=1)) + (G(((p2=1) * (p3=0)) + $toolong))
|
||||
EOF
|
||||
run 0 $ltlfilt -p --wring -u --nnf --relabel=pnn --define in >out
|
||||
diff exp out
|
||||
|
||||
run 0 $ltlfilt -0 in > out
|
||||
perl -i -pe 's/\0/@\n/g' out
|
||||
cat >exp <<EOF
|
||||
a & c & Xb@
|
||||
a & b & GF(a | c) & FG(a | c)@
|
||||
b & GF(a | c) & FG(a | c)@
|
||||
h | i | G(d & e) | FG(!c | Xf)@
|
||||
b & e & (f | g) & !Xc@
|
||||
b & GF(a | c) & !GF!(a | c)@
|
||||
F(a <-> b) -> (c xor d)@
|
||||
EOF
|
||||
diff exp out
|
||||
|
||||
SPOT_STUTTER_CHECK=0 \
|
||||
$ltlfilt --stutter-invariant -f '!{a:b*:c}' 2> stderr && exit 1
|
||||
test $? = 2
|
||||
grep 'non-LTL' stderr
|
||||
|
||||
SPOT_STUTTER_CHECK=555 \
|
||||
$ltlfilt --stutter-invariant -f '!{a:b*:c}' 2> stderr && exit 1
|
||||
test $? = 2
|
||||
grep 'invalid' stderr
|
||||
|
||||
SPOT_STUTTER_CHECK=5 \
|
||||
$ltlfilt --stutter-invariant -f '!{a:b*:c}'
|
||||
|
||||
# This one was incorrectly diagnosed as stutter invariant because of a
|
||||
# bug in the bitvectors.
|
||||
$ltlfilt --stutter-invariant -f 'F(a & XXXXXX!a)' && exit 1
|
||||
|
||||
|
||||
$ltlfilt -c -o 'foo' -f a 2>stderr && exit 1
|
||||
grep 'ltlfilt: options --output and --count are incompatible' stderr
|
||||
|
||||
out=`$ltlfilt -f 'G(a xor b) -> F(c <-> Xd)' --unabbreviate='^iF'`
|
||||
exp='(1 U (c <-> Xd)) | !G!(a <-> b)'
|
||||
test "$out" = "$exp"
|
||||
|
||||
$ltlfilt -f 'GF"a\"\\b"' > out
|
||||
test "`cat out`" = 'GF"a\"\\b"'
|
||||
|
||||
$ltlfilt --lbt-input -f 'G F "a\"\\b"' -l > out
|
||||
test "`cat out`" = 'G F "a\"\\b"'
|
||||
|
||||
true
|
||||
199
tests/ltlgrind.test
Executable file
199
tests/ltlgrind.test
Executable file
|
|
@ -0,0 +1,199 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014, 2015 Laboratoire de Recherche et Dévelopement to
|
||||
# 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
checkopt_noparse()
|
||||
{
|
||||
cat >exp
|
||||
run 0 ../../bin/ltlgrind --sort "$@" > out
|
||||
diff exp out
|
||||
}
|
||||
|
||||
checkopt()
|
||||
{
|
||||
checkopt_noparse "$@"
|
||||
# The result must be parsable
|
||||
../../bin/ltlfilt out
|
||||
}
|
||||
|
||||
checkopt -f 'Xp1 U (p4 | (p3 xor (p4 W p0)))' <<EOF
|
||||
1
|
||||
Xp1
|
||||
Xp1 U p4
|
||||
Xp1 U (p3 | p4)
|
||||
p4 | (p3 xor (p4 W p0))
|
||||
Xp1 U (!p3 | p4)
|
||||
Xp1 U (p3 xor (p4 W p0))
|
||||
Xp1 U (p4 | (p4 W p0))
|
||||
Xp1 U (p4 | (p3 xor p4))
|
||||
Xp1 U (p4 | (p0 xor p3))
|
||||
Xp1 U (p0 | (p0 xor p3))
|
||||
p1 U (p4 | (p3 xor (p4 W p0)))
|
||||
1 U (p4 | (p3 xor (p4 W p0)))
|
||||
Xp1 U (p4 | !(p4 W p0))
|
||||
Xp1 W (p4 | (p3 xor (p4 W p0)))
|
||||
Xp1 U (p4 | (p3 xor (p4 W 0)))
|
||||
Xp4 U (p4 | (p3 xor (p4 W p0)))
|
||||
Xp3 U (p4 | (p3 xor (p4 W p0)))
|
||||
Xp0 U (p4 | (p3 xor (p4 W p0)))
|
||||
Xp1 U (p1 | (p3 xor (p1 W p0)))
|
||||
Xp1 U (p3 | (p3 xor (p3 W p0)))
|
||||
Xp1 U (p4 | (p1 xor (p4 W p0)))
|
||||
Xp1 U (p4 | (p4 xor (p4 W p0)))
|
||||
Xp1 U (p4 | (p0 xor (p4 W p0)))
|
||||
Xp1 U (p4 | (p3 xor (p4 W p1)))
|
||||
Xp1 U (p4 | (p3 xor (p4 W p3)))
|
||||
Xp1 U (p4 | (p3 & !(p4 W p0)))
|
||||
Xp1 U (p4 | (!p3 & (p4 W p0)))
|
||||
EOF
|
||||
|
||||
checkopt -f '(Xp4 R p3) W !p0' <<EOF
|
||||
1
|
||||
!p0
|
||||
Xp4 R p3
|
||||
p3 W !p0
|
||||
Xp4 W !p0
|
||||
(p4 R p3) W !p0
|
||||
(0 R p3) W !p0
|
||||
(Xp4 R p3) W p0
|
||||
(Xp4 R p3) W 0
|
||||
(p3 W Xp4) W !p0
|
||||
(Xp3 R p3) W !p0
|
||||
(Xp0 R p3) W !p0
|
||||
(Xp4 R p4) W !p0
|
||||
(Xp4 R p0) W !p0
|
||||
(Xp4 R p3) W !p4
|
||||
(Xp4 R p3) W !p3
|
||||
EOF
|
||||
|
||||
checkopt -f 'F(!p2 & p3) | Fp0' -n 4 <<EOF
|
||||
Fp0
|
||||
F(!p2 & p3)
|
||||
Fp0 | Fp3
|
||||
(!p2 & p3) | Fp0
|
||||
EOF
|
||||
|
||||
checkopt -f '{(a | b)[*4] & ((a | b)*; c)} <>-> G(d <-> e) xor f' --split-ops \
|
||||
<<EOF
|
||||
{{a | b}[*4] & {{a | b}[*];c}}<>-> (f xor G(d -> e))
|
||||
{{a | b}[*4] & {{a | b}[*];c}}<>-> (f xor G(e -> d))
|
||||
{{a | b}[*4] & {{a | b}[*];c}}<>-> (f xor G(d & e))
|
||||
{{a | b}[*4] & {{a | b}[*];c}}<>-> (f & !G(d <-> e))
|
||||
{{a | b}[*4] & {{a | b}[*];c}}<>-> (!f & G(d <-> e))
|
||||
{{a | b}[*4] & {{a | b}[*];c}}<>-> (f xor G(!d & !e))
|
||||
{{{a | b}[*];c} && {{a | b}[*4];[*]}}<>-> (f xor G(d <-> e))
|
||||
{{a | b}[*4] && {{a | b}[*];c;[*]}}<>-> (f xor G(d <-> e))
|
||||
EOF
|
||||
|
||||
|
||||
checkopt -f '!(!XXp1 M X(p4 U p2))' --rewrite-ops <<EOF
|
||||
!(!XXp1 R X(p4 U p2))
|
||||
!(X(p4 U p2) U !XXp1)
|
||||
!(!XXp1 M X(p4 W p2))
|
||||
EOF
|
||||
|
||||
checkopt -f '!(p0 & !p2 & (p1 W 0))' --remove-multop-operands <<EOF
|
||||
!(p0 & !p2)
|
||||
!(p0 & (p1 W 0))
|
||||
!(!p2 & (p1 W 0))
|
||||
EOF
|
||||
|
||||
checkopt -f '{p1[*..2] | p2[*3..5] | p3[*6..]}[]-> 0' --simplify-bounds <<EOF
|
||||
{p2[*3..5] | p3[*6..] | p1[*0..1]}[]-> 0
|
||||
{p2[*3..5] | p3[*6..] | p1[*]}[]-> 0
|
||||
{p1[*0..2] | p3[*6..] | p2[*2..5]}[]-> 0
|
||||
{p1[*0..2] | p3[*6..] | p2[*0..5]}[]-> 0
|
||||
{p1[*0..2] | p3[*6..] | p2[*3..4]}[]-> 0
|
||||
{p1[*0..2] | p3[*6..] | p2[*3..]}[]-> 0
|
||||
{p1[*0..2] | p2[*3..5] | p3[*5..]}[]-> 0
|
||||
{p1[*0..2] | p2[*3..5] | p3[*]}[]-> 0
|
||||
EOF
|
||||
|
||||
checkopt -f '!F(!X(Xp1 R p2) -> p4)' --remove-one-ap <<EOF
|
||||
!F(!X(Xp2 R p2) -> p4)
|
||||
!F(!X(Xp4 R p2) -> p4)
|
||||
!F(!X(Xp1 R p1) -> p4)
|
||||
!F(!X(Xp1 R p4) -> p4)
|
||||
!F(!X(Xp1 R p2) -> p1)
|
||||
!F(!X(Xp1 R p2) -> p2)
|
||||
EOF
|
||||
|
||||
checkopt -f '!p4 & (p2 | {{!p1}[*]})' --ap-to-const <<EOF
|
||||
0
|
||||
!p4
|
||||
p2 & !p4
|
||||
p2 | {{!p1}[*]}
|
||||
!p4 & {{!p1}[*]}
|
||||
!p4 & (p2 | {[*]})
|
||||
EOF
|
||||
|
||||
|
||||
checkopt -f 'F(XXp0 | (p4 & Gp0))' --remove-ops <<EOF
|
||||
XXp0 | (p4 & Gp0)
|
||||
F(Xp0 | (p4 & Gp0))
|
||||
F((p0 & p4) | XXp0)
|
||||
EOF
|
||||
|
||||
checkopt -f '1 U (p3 <-> p4)' -m 2 <<EOF
|
||||
0
|
||||
1
|
||||
p3
|
||||
p4
|
||||
!p4
|
||||
!p3
|
||||
p3 -> p4
|
||||
p4 -> p3
|
||||
p3 & p4
|
||||
1 U p3
|
||||
1 U p4
|
||||
1 U !p3
|
||||
1 U !p4
|
||||
!p3 & !p4
|
||||
1 U (p3 & !p4)
|
||||
1 U (!p3 & p4)
|
||||
EOF
|
||||
|
||||
checkopt -f 'F({{p2;p0}[:*]}[]-> Xp0)' <<EOF
|
||||
1
|
||||
FXp0
|
||||
F!{{p2;p0}[:*]}
|
||||
{{p2;p0}[:*]}[]-> Xp0
|
||||
F({p2;p0}[]-> Xp0)
|
||||
F({{p2;p0}[:*]}[]-> p0)
|
||||
F({{p2;p0}[:*]}[]-> 0)
|
||||
F({p0[*2][:*]}[]-> Xp0)
|
||||
F({p2[*2][:*]}[]-> Xp2)
|
||||
F({{1;p0}[:*]}[]-> Xp0)
|
||||
F({{p2;1}[:*]}[]-> Xp0)
|
||||
EOF
|
||||
|
||||
echo '1,a,3' > input
|
||||
checkopt_noparse input/2 <<EOF
|
||||
1,0,3
|
||||
1,1,3
|
||||
EOF
|
||||
|
||||
checkopt_noparse -F input/2 --format '%<,%f,%>,%F,%L' <<EOF
|
||||
1,0,3,input,1
|
||||
1,1,3,input,1
|
||||
EOF
|
||||
70
tests/ltlprod.cc
Normal file
70
tests/ltlprod.cc
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2008, 2009, 2012, 2014, 2015 Laboratoire de Recherche
|
||||
// et Développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2003, 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/twaalgos/product.hh>
|
||||
#include <spot/twaalgos/ltl2tgba_fm.hh>
|
||||
#include <spot/twaalgos/dot.hh>
|
||||
|
||||
static void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << prog << " formula1 formula2" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
int exit_code = 0;
|
||||
|
||||
if (argc != 3)
|
||||
syntax(argv[0]);
|
||||
|
||||
{
|
||||
spot::environment& env(spot::default_environment::instance());
|
||||
|
||||
spot::parse_error_list pel1;
|
||||
auto f1 = spot::parse_infix_psl(argv[1], pel1, env);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, argv[1], pel1))
|
||||
return 2;
|
||||
|
||||
spot::parse_error_list pel2;
|
||||
auto f2 = spot::parse_infix_psl(argv[2], pel2, env);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, argv[2], pel2))
|
||||
return 2;
|
||||
|
||||
auto dict = spot::make_bdd_dict();
|
||||
{
|
||||
auto a1 = spot::ltl_to_tgba_fm(f1, dict);
|
||||
auto a2 = spot::ltl_to_tgba_fm(f2, dict);
|
||||
spot::print_dot(std::cout, product(a1, a2));
|
||||
}
|
||||
}
|
||||
assert(spot::fnode::instances_check());
|
||||
return exit_code;
|
||||
}
|
||||
39
tests/ltlprod.test
Executable file
39
tests/ltlprod.test
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2015 Laboratoire de Recherche et Développement
|
||||
# de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# We don't check the output, but just running these might be enough to
|
||||
# trigger assertions.
|
||||
|
||||
run 0 ../ltlprod a b
|
||||
run 0 ../ltlprod a a
|
||||
run 0 ../ltlprod 'a U b' 'X f'
|
||||
run 0 ../ltlprod 'X a' 'X a'
|
||||
run 0 ../ltlprod 'X a' 'a U b'
|
||||
run 0 ../ltlprod 'a & b & c' 'b & d & c'
|
||||
run 0 ../ltlprod 'a | b | (c U (d & (g U (h ^ i))))' 'h ^ i'
|
||||
run 0 ../ltlprod 'Xa & (b U !a) & (b U !a)' '(b U !a) & f'
|
||||
66
tests/ltlrel.cc
Normal file
66
tests/ltlrel.cc
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et Developement
|
||||
// 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/tl/relabel.hh>
|
||||
#include <spot/tl/print.hh>
|
||||
|
||||
static void
|
||||
syntax(char *prog)
|
||||
{
|
||||
std::cerr << prog << " formula" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
syntax(argv[0]);
|
||||
|
||||
{
|
||||
spot::parse_error_list p1;
|
||||
auto f1 = spot::parse_infix_psl(argv[1], p1);
|
||||
|
||||
if (spot::format_parse_errors(std::cerr, argv[1], p1))
|
||||
return 2;
|
||||
|
||||
spot::relabeling_map* m = new spot::relabeling_map;
|
||||
auto f2 = spot::relabel_bse(f1, spot::Pnn, m);
|
||||
spot::print_psl(std::cout, f2) << '\n';
|
||||
|
||||
|
||||
typedef std::map<std::string, std::string> map_t;
|
||||
map_t sorted_map;
|
||||
for (spot::relabeling_map::const_iterator i = m->begin();
|
||||
i != m->end(); ++i)
|
||||
sorted_map[spot::str_psl(i->first)] =
|
||||
spot::str_psl(i->second);
|
||||
for (map_t::const_iterator i = sorted_map.begin();
|
||||
i != sorted_map.end(); ++i)
|
||||
std::cout << " " << i->first << " -> "
|
||||
<< i->second << '\n';
|
||||
delete m;
|
||||
}
|
||||
assert(spot::fnode::instances_check());
|
||||
return 0;
|
||||
}
|
||||
79
tests/ltlrel.test
Executable file
79
tests/ltlrel.test
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013 Laboratoire de Recherche et Dévelopement to
|
||||
# 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Check for the constant_term visitor
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
t()
|
||||
{
|
||||
cat > tmp.$$
|
||||
run 0 ../ltlrel "`head -n 1 tmp.$$`" > out.$$
|
||||
sed 1d tmp.$$ > exp.$$
|
||||
diff out.$$ exp.$$
|
||||
}
|
||||
|
||||
t <<EOF
|
||||
a & Xb & c
|
||||
p0 & Xp1
|
||||
p0 -> a & c
|
||||
p1 -> b
|
||||
EOF
|
||||
|
||||
t <<EOF
|
||||
a & b & GF(a | c) & FG(a | c)
|
||||
p0 & p1 & GF(p0 | p2) & FG(p0 | p2)
|
||||
p0 -> a
|
||||
p1 -> b
|
||||
p2 -> c
|
||||
EOF
|
||||
|
||||
t <<EOF
|
||||
b & GF(a | c) & FG(a | c)
|
||||
p0 & GFp1 & FGp1
|
||||
p0 -> b
|
||||
p1 -> a | c
|
||||
EOF
|
||||
|
||||
t <<EOF
|
||||
G(d & e) | FG(Xf| !c) | h | i
|
||||
p0 | Gp1 | FG(p2 | Xp3)
|
||||
p0 -> h | i
|
||||
p1 -> d & e
|
||||
p2 -> !c
|
||||
p3 -> f
|
||||
EOF
|
||||
|
||||
t <<EOF
|
||||
a <-> b
|
||||
p0
|
||||
p0 -> a <-> b
|
||||
EOF
|
||||
|
||||
t <<EOF
|
||||
(a <-> b) & X(b -> c)
|
||||
(p0 <-> p1) & X(p1 -> p2)
|
||||
p0 -> a
|
||||
p1 -> b
|
||||
p2 -> c
|
||||
EOF
|
||||
54
tests/lunabbrev.test
Executable file
54
tests/lunabbrev.test
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
|
||||
# de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Check for the unabbreviate_logic visitor
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
cat >lunabbrev.txt<<EOF
|
||||
# A few things that do not change
|
||||
a, a
|
||||
1, 1
|
||||
0, 0
|
||||
G a , G a
|
||||
a U b, a U b
|
||||
a & b, a & b
|
||||
a & b, b & a
|
||||
a & b & c, c & a & b
|
||||
a & b & c, b & c & a
|
||||
a & b & a, b & a & b
|
||||
a & b, b & a & b
|
||||
a & b, b & a & a
|
||||
a & b & (c |(f U g)| e), b & a & a & (c | e |(f U g)| e | c) & b
|
||||
# other formulae that do change
|
||||
a ^ b, (a & !b) | (!a & b)
|
||||
a ^ Xb, (!Xb & a) | (!a & Xb) | (Xb & !a)
|
||||
GF a => F G(b), !GFa | F Gb
|
||||
!a <-> Xb, (Xb & !a) | (!!a & !Xb)
|
||||
(a ^ b) | (b ^ c), (c & !b) | (!c & b) | (a & !b) | (!a & b)
|
||||
EOF
|
||||
|
||||
run 0 ../lunabbrev lunabbrev.txt
|
||||
161
tests/maskacc.test
Executable file
161
tests/maskacc.test
Executable file
|
|
@ -0,0 +1,161 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
Acceptance: 2 Fin(0)&Fin(1)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1 {0}
|
||||
[1] 2 {1}
|
||||
State: 1
|
||||
[0] 2
|
||||
[0] 3 {1}
|
||||
State: 2
|
||||
[1] 1
|
||||
[1] 3 {0}
|
||||
State: 3
|
||||
[0] 3 {0 1}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expect1 <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: co-Buchi
|
||||
Acceptance: 1 Fin(0)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[1] 1 {0}
|
||||
State: 1
|
||||
[1] 2
|
||||
State: 2
|
||||
[0] 1
|
||||
[0] 3 {0}
|
||||
State: 3
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt --mask-acc=0 input1 -H >output
|
||||
diff output expect1
|
||||
|
||||
cat >expect2 <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: co-Buchi
|
||||
Acceptance: 1 Fin(0)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1 {0}
|
||||
State: 1
|
||||
[0] 2
|
||||
State: 2
|
||||
[1] 1
|
||||
[1] 3 {0}
|
||||
State: 3
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt --mask-acc=1 input1 -H >output
|
||||
diff output expect2
|
||||
|
||||
cat >expect3 <<EOF
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt --mask-acc=0,1,2 input1 -H >output
|
||||
diff output expect3
|
||||
|
||||
run 0 ../../bin/autfilt --mask-acc=0 --mask-acc=1 input1 -H >output
|
||||
diff output expect3
|
||||
|
||||
cat >input4 <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 3 Inf(1)|Fin(0)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1 {1}
|
||||
[1] 2 {0}
|
||||
State: 1
|
||||
[0] 2
|
||||
[0] 3 {0}
|
||||
State: 2
|
||||
[1] 1
|
||||
[1] 3 {1}
|
||||
State: 3
|
||||
[0] 3 {0 1}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expect4 <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
Acceptance: 2 Fin(0)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[1] 1 {0}
|
||||
State: 1
|
||||
[1] 2
|
||||
State: 2
|
||||
[0] 1
|
||||
[0] 3 {0}
|
||||
State: 3
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt --mask-acc=1 input4 -H >output
|
||||
diff output expect4
|
||||
|
||||
# Errors
|
||||
run 2 ../../bin/autfilt --mask-acc=a3 input1
|
||||
run 2 ../../bin/autfilt --mask-acc=3-2 input1
|
||||
run 2 ../../bin/autfilt --mask-acc=0,9999,1 input1
|
||||
113
tests/maskkeep.test
Executable file
113
tests/maskkeep.test
Executable file
|
|
@ -0,0 +1,113 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1 {0}
|
||||
[1] 2 {1}
|
||||
State: 1
|
||||
[0] 2
|
||||
[0] 3 {1}
|
||||
State: 2
|
||||
[1] 1
|
||||
[1] 3 {0}
|
||||
State: 3
|
||||
[0] 3 {0 1}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expect1 <<EOF
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt --keep-states=0 input1 -H >output
|
||||
diff output expect1
|
||||
|
||||
run 0 ../../bin/autfilt --keep-states=1 input1 -H >output
|
||||
diff output expect1
|
||||
|
||||
cat >expect3 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1 {0}
|
||||
[1] 2 {1}
|
||||
State: 1
|
||||
[0] 2
|
||||
State: 2
|
||||
[1] 1
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expect4 <<EOF
|
||||
HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1
|
||||
State: 1
|
||||
[1] 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt --keep-states=0,1,2 input1 -H >output
|
||||
diff output expect3
|
||||
run 0 ../../bin/autfilt --keep-states=0,9999,1,2 input1 -H >output
|
||||
diff output expect3
|
||||
|
||||
run 0 ../../bin/autfilt --keep-states=1,2,0 input1 -H >output
|
||||
diff output expect4
|
||||
|
||||
# Errors
|
||||
run 2 ../../bin/autfilt --keep-states=a3 input1
|
||||
run 2 ../../bin/autfilt --keep-states=3-2 input1
|
||||
79
tests/monitor.test
Executable file
79
tests/monitor.test
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
expect()
|
||||
{
|
||||
cat >output.exp
|
||||
run 0 "$@" > output.out
|
||||
cat output.out
|
||||
diff output.out output.exp
|
||||
}
|
||||
|
||||
expect ../../bin/ltl2tgba --monitor a <<EOF
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 1
|
||||
0 [label="0"]
|
||||
0 -> 0 [label="1"]
|
||||
1 [label="1"]
|
||||
1 -> 0 [label="a"]
|
||||
}
|
||||
EOF
|
||||
|
||||
expect ../../bin/ltl2tgba --monitor a --hoa<<EOF
|
||||
HOA: v1
|
||||
name: "a"
|
||||
States: 2
|
||||
Start: 1
|
||||
AP: 1 "a"
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
properties: stutter-invariant terminal
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
State: 1
|
||||
[0] 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
expect ../../bin/ltl2tgba --monitor GFa --hoa<<EOF
|
||||
HOA: v1
|
||||
name: "GFa"
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
properties: deterministic stutter-invariant
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
--END--
|
||||
EOF
|
||||
73
tests/nenoform.test
Executable file
73
tests/nenoform.test
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2011, 2014 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Check for the negative_normal_form visitor
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
cat >nenoform.txt<<EOF
|
||||
# A few things that do not change
|
||||
a, a
|
||||
1, 1
|
||||
0, 0
|
||||
!a, !a
|
||||
a U b, a U b
|
||||
a & b, a & b
|
||||
a & b, b & a
|
||||
a & !b & c, c & a & !b
|
||||
a & b & c, b & c & a
|
||||
Xa & b & Xa, b & Xa & b
|
||||
a & b, b & a & b
|
||||
a & !b, !b & a & a
|
||||
a & b & (Xc |(f U !g)| e), b & a & a & (Xc | e |(f U !g)| e | Xc) & b
|
||||
GFa => FGb, FG!a || FGb
|
||||
|
||||
# Basic rewritings
|
||||
!!a, a
|
||||
!!!!!a, !a
|
||||
!Xa, X!a
|
||||
!Fa, G!a
|
||||
!Ga, F!a
|
||||
!(a ^ b), !a&!b | a&b
|
||||
!(a <=> b), (!a&b) | a&!b
|
||||
!(a => b), a&!b
|
||||
!(!a => !b), !a&b
|
||||
!(a U b), !a R !b
|
||||
!(a R b), !a U !b
|
||||
!(!a R !b), a U b
|
||||
!(a & b & c & d & b), !a | !b | !c | !d
|
||||
!(a | b | c | d), !a & !b & !c & !d
|
||||
|
||||
# Nested rewritings
|
||||
!(a U (!b U ((a & b & c) R d))), !a R (b R ((!a | !b | !c) U !d))
|
||||
!(GF a => FG b), GFa & GF!b
|
||||
|
||||
# Rational operators
|
||||
!X{a;b}<>->Fx, X{a;b}[]->G!x
|
||||
!F({a*}<>->{b*}<>->c), G({a*}[]->{b*}[]->!c)
|
||||
EOF
|
||||
|
||||
run 0 ../nenoform nenoform.txt
|
||||
402
tests/neverclaimread.test
Executable file
402
tests/neverclaimread.test
Executable file
|
|
@ -0,0 +1,402 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >input <<EOF
|
||||
never {
|
||||
T2_init:
|
||||
if
|
||||
:: (1) -> goto T2_init
|
||||
:: (p1 && p0) -> goto T1
|
||||
fi;
|
||||
T1:
|
||||
T1b: /* alias */
|
||||
if
|
||||
:: (p1 && (! p0)) -> goto alias2
|
||||
:: !(p1) -> goto T1b
|
||||
:: ! (p1) -> goto T2_init
|
||||
fi;
|
||||
alias1:
|
||||
accept_all:
|
||||
alias2:
|
||||
skip
|
||||
}
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -XN -H input > stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "p0" "p1"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
[0&1] 1
|
||||
State: 1
|
||||
[!1] 0
|
||||
[!1] 1
|
||||
[!0&1] 2
|
||||
State: 2 {0}
|
||||
[t] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt -F stdout --isomorph expected
|
||||
|
||||
rm input stdout expected
|
||||
|
||||
|
||||
# Same test, but with the newer syntax output since Spin 6.24
|
||||
cat >input <<EOF
|
||||
never {
|
||||
T2_init:
|
||||
do
|
||||
:: (1) -> goto T2_init
|
||||
:: (p1 && p0) -> goto T1
|
||||
od;
|
||||
T1:
|
||||
do
|
||||
:: atomic { (p1 && (! p0)) -> assert(!(p1 && (! p0))) }
|
||||
:: !(p1) -> goto T1
|
||||
:: ! (p1) -> goto T2_init
|
||||
od;
|
||||
}
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -XN -H input > stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 2 "p0" "p1"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels state-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[t] 0
|
||||
[0&1] 1
|
||||
State: 1
|
||||
[!1] 0
|
||||
[!1] 1
|
||||
[!0&1] 2
|
||||
State: 2 {0}
|
||||
[t] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt -F stdout --isomorph expected
|
||||
|
||||
rm input stdout expected
|
||||
|
||||
|
||||
# Unparenthesed disjunction
|
||||
cat >input <<EOF
|
||||
never { /* p0 || p1 */
|
||||
accept_init:
|
||||
if
|
||||
:: (p1) && (p0) -> goto accept_all
|
||||
:: (p1) && !(p0) -> goto accept_all
|
||||
fi;
|
||||
accept_all:
|
||||
skip
|
||||
}
|
||||
EOF
|
||||
run 0 ../ikwiad -XN input > stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 0
|
||||
0 [label="0", peripheries=2]
|
||||
0 -> 1 [label="p1"]
|
||||
1 [label="1", peripheries=2]
|
||||
1 -> 1 [label="1"]
|
||||
}
|
||||
EOF
|
||||
|
||||
diff stdout expected
|
||||
|
||||
rm input stdout expected
|
||||
|
||||
# Test broken guards in input
|
||||
cat >input <<EOF
|
||||
never {
|
||||
T2_init:
|
||||
if
|
||||
:: (1) -> goto T2_init
|
||||
:: (p1 && ) -> goto T1
|
||||
fi;
|
||||
T1:
|
||||
if
|
||||
:: (p1 && ! p0)) -> goto accept_all
|
||||
:: (p1) -> goto T1
|
||||
fi;
|
||||
accept_all:
|
||||
skip
|
||||
}
|
||||
EOF
|
||||
|
||||
# We used to catch the following error:
|
||||
# input:5.11: syntax error, unexpected closing parenthesis
|
||||
# input:5.8-9: missing right operand for "and operator"
|
||||
# but since the guard parser is more lenient, we just assume
|
||||
# that "p1 && " is an atomic property.
|
||||
|
||||
run 2 ../ikwiad -XN input > stdout 2>stderr
|
||||
cat >expected <<\EOF
|
||||
input:9.16: syntax error, unexpected ')', expecting fi or ':'
|
||||
EOF
|
||||
grep input: stderr > stderrfilt
|
||||
diff stderrfilt expected
|
||||
|
||||
|
||||
# This output from MoDeLLa was not property parsed by Spot because of
|
||||
# the missing parentheses around p0. Report from František Blahoudek.
|
||||
cat >input <<EOF
|
||||
never{
|
||||
T0_init:
|
||||
if
|
||||
:: true -> goto T1
|
||||
:: p0 -> goto T2
|
||||
fi;
|
||||
T1:
|
||||
if
|
||||
:: true -> goto T1
|
||||
:: p0 -> goto accept_T3
|
||||
fi;
|
||||
T2:
|
||||
if
|
||||
:: p0 -> goto accept_T3
|
||||
fi;
|
||||
accept_T3:
|
||||
if
|
||||
:: p0 -> goto T2
|
||||
fi;
|
||||
}
|
||||
EOF
|
||||
cat >expected<<EOF
|
||||
edges: 6
|
||||
states: 4
|
||||
EOF
|
||||
|
||||
run 0 ../ikwiad -ks -XN input > output
|
||||
diff output expected
|
||||
|
||||
|
||||
# Test duplicated labels. The following neverclaim was produced by
|
||||
# ltl2ba 1.1 for '[](<>[]p1 U X[]<>Xp0)', but is rejected by Spin
|
||||
# because of a duplicate label (accept_S10). We should
|
||||
# complain as well. This was reported by Joachim Klein.
|
||||
|
||||
cat >input <<\EOF
|
||||
never { /* [](<>[]p1 U X[]<>Xp0) */
|
||||
T0_init:
|
||||
if
|
||||
:: (1) -> goto accept_S2
|
||||
:: (1) -> goto T1_S3
|
||||
:: (p1) -> goto T2_S4
|
||||
fi;
|
||||
accept_S2:
|
||||
if
|
||||
:: (1) -> goto accept_S39
|
||||
:: (1) -> goto T1_S24
|
||||
:: (p1) -> goto accept_S10
|
||||
fi;
|
||||
accept_S39:
|
||||
if
|
||||
:: (p0) -> goto accept_S39
|
||||
:: (1) -> goto T0_S39
|
||||
:: (1) -> goto T0_S24
|
||||
:: (p1) -> goto T0_S10
|
||||
fi;
|
||||
T0_S39:
|
||||
if
|
||||
:: (p0) -> goto accept_S39
|
||||
:: (1) -> goto T0_S39
|
||||
:: (1) -> goto T0_S24
|
||||
:: (p1) -> goto T0_S10
|
||||
fi;
|
||||
T0_S24:
|
||||
if
|
||||
:: (1) -> goto T0_S24
|
||||
:: (p1) -> goto T0_S10
|
||||
fi;
|
||||
T0_S10:
|
||||
if
|
||||
:: (p0 && p1) -> goto accept_S10
|
||||
:: (p1) -> goto T0_S10
|
||||
fi;
|
||||
accept_S10:
|
||||
if
|
||||
:: (p0 && p1) -> goto accept_S10
|
||||
:: (p1) -> goto T0_S10
|
||||
fi;
|
||||
T1_S24:
|
||||
if
|
||||
:: (1) -> goto T1_S24
|
||||
:: (p1) -> goto accept_S10
|
||||
fi;
|
||||
accept_S10:
|
||||
if
|
||||
:: (p1) -> goto accept_S10
|
||||
fi;
|
||||
T1_S3:
|
||||
if
|
||||
:: (1) -> goto T1_S3
|
||||
:: (1) -> goto T1_S24
|
||||
:: (p1) -> goto T2_S4
|
||||
:: (p1) -> goto accept_S10
|
||||
fi;
|
||||
T2_S4:
|
||||
if
|
||||
:: (p1) -> goto T2_S4
|
||||
:: (p1) -> goto accept_S10
|
||||
fi;
|
||||
}
|
||||
EOF
|
||||
|
||||
run 2 ../ikwiad -ks -XN input > stdout 2>stderr
|
||||
cat stderr
|
||||
cat >expected-err <<\EOF
|
||||
input:48.1-10: redefinition of accept_S10...
|
||||
input:38.1-10: ... accept_S10 previously defined here
|
||||
EOF
|
||||
grep input: stderr > stderrfilt
|
||||
diff stderrfilt expected-err
|
||||
|
||||
# DOS-style new lines should have the same output.
|
||||
perl -pi -e 's/$/\r/' input
|
||||
run 2 ../ikwiad -ks -XN input > stdout 2>stderr
|
||||
cat stderr
|
||||
grep input: stderr > stderrfilt
|
||||
diff stderrfilt expected-err
|
||||
|
||||
|
||||
# Empty guards should be diagnosed at the correct location
|
||||
cat >input <<EOF
|
||||
never { /* a U b */
|
||||
T0_init:
|
||||
if
|
||||
:: ((b)) -> goto accept_all
|
||||
:: ( ) -> goto T0_init
|
||||
fi;
|
||||
accept_all:
|
||||
skip
|
||||
}
|
||||
never { /* a U b */
|
||||
T0_init:
|
||||
if
|
||||
:: ((b)) -> goto accept_all
|
||||
:: ((b) -> goto T0_init
|
||||
fi;
|
||||
accept_all:
|
||||
skip
|
||||
}
|
||||
EOF
|
||||
../../bin/autfilt --name=%F --dot=nsc <input >stdout 2>stderr && exit 1
|
||||
cat >expected <<EOF
|
||||
digraph G {
|
||||
rankdir=LR
|
||||
label="-"
|
||||
labelloc="t"
|
||||
node [shape="circle"]
|
||||
I [label="", style=invis, width=0]
|
||||
I -> 0
|
||||
subgraph cluster_0 {
|
||||
color=green
|
||||
label=""
|
||||
1 [label="1", peripheries=2]
|
||||
}
|
||||
subgraph cluster_1 {
|
||||
color=red
|
||||
label=""
|
||||
0 [label="0"]
|
||||
}
|
||||
0 -> 1 [label="b"]
|
||||
0 -> 0 [label="0"]
|
||||
1 -> 1 [label="1"]
|
||||
}
|
||||
EOF
|
||||
diff stdout expected
|
||||
# FIXME: the "ignoring trailing garbage" is unwanted
|
||||
cat >expected.err <<EOF
|
||||
5.6-8: unexpected empty block
|
||||
5.6-8: ignoring trailing garbage
|
||||
14.6-19.1: missing closing parenthese
|
||||
19.1: syntax error, unexpected end of file, expecting fi or ':'
|
||||
autfilt: failed to read automaton from -
|
||||
EOF
|
||||
diff stderr expected.err
|
||||
|
||||
|
||||
cat >formulae<<EOF
|
||||
a
|
||||
FG a
|
||||
X false
|
||||
(G a) U X b
|
||||
(a U b) U (c U d)
|
||||
true
|
||||
(Ga && XXXX!a)
|
||||
"a > b" U "process@foo"
|
||||
GF("(a + b) == 42" U "process@foo")
|
||||
EOF
|
||||
while read f
|
||||
do
|
||||
run 0 ../../bin/ltl2tgba -H "!($f)" > f.hoa
|
||||
run 0 ../../bin/ltl2tgba -s -f "$f" > f.spot
|
||||
# Make sure there is no `!x' occurring in the
|
||||
# output. Because `x' is usually #define'd, we
|
||||
# should use `!(x)' in guards.
|
||||
grep '![^(].*->' f.spot && exit 1
|
||||
# In case we cannot run spin or ltl2ba, use the spot output
|
||||
cp f.spot f.spin
|
||||
cp f.spot f.ltl2ba
|
||||
|
||||
sf=`../../bin/ltlfilt -sf "$f"`
|
||||
|
||||
if test -n "$SPIN"; then
|
||||
# Old spin versions cannot parse formulas such as ((a + b) == 42).
|
||||
$SPIN -f "$sf" > f.spin.tmp && mv f.spin.tmp f.spin
|
||||
fi
|
||||
case $f in
|
||||
*\"*);;
|
||||
*)
|
||||
if test -n "$LTL2BA"; then
|
||||
$LTL2BA -f "$sf" > f.ltl2ba
|
||||
fi
|
||||
esac
|
||||
|
||||
run 0 ../../bin/autfilt --count -v --intersect=f.hoa \
|
||||
f.spot f.spin f.ltl2ba >out
|
||||
test 3 = `cat out`
|
||||
done <formulae
|
||||
435
tests/ngraph.cc
Normal file
435
tests/ngraph.cc
Normal file
|
|
@ -0,0 +1,435 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement
|
||||
// de l'Epita.
|
||||
//
|
||||
// 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <spot/graph/ngraph.hh>
|
||||
#include <spot/twa/twa.hh>
|
||||
|
||||
template <typename SL, typename TL>
|
||||
void
|
||||
dot_state(std::ostream& out, const spot::digraph<SL, TL>& g, unsigned n)
|
||||
{
|
||||
out << " [label=\"" << g.state_data(n) << "\"]\n";
|
||||
}
|
||||
|
||||
template <typename TL>
|
||||
void
|
||||
dot_state(std::ostream& out, const spot::digraph<void, TL>&, unsigned)
|
||||
{
|
||||
out << '\n';
|
||||
}
|
||||
|
||||
template <typename SL, typename TL>
|
||||
void
|
||||
dot_state(std::ostream& out, const spot::digraph<SL, TL>& g, unsigned n,
|
||||
std::string name)
|
||||
{
|
||||
out << " [label=\"" << name << "\\n" << g.state_data(n) << "\"]\n";
|
||||
}
|
||||
|
||||
template <typename TL>
|
||||
void
|
||||
dot_state(std::ostream& out, const spot::digraph<void, TL>&, unsigned,
|
||||
std::string name)
|
||||
{
|
||||
out << " [label=\"" << name << "\"]\n";
|
||||
}
|
||||
|
||||
|
||||
template <typename SL, typename TL, typename TR>
|
||||
void
|
||||
dot_trans(std::ostream& out, const spot::digraph<SL, TL>&, TR& tr)
|
||||
{
|
||||
out << " [label=\"" << tr.data() << "\"]\n";
|
||||
}
|
||||
|
||||
template <typename SL, typename TR>
|
||||
void
|
||||
dot_trans(std::ostream& out, const spot::digraph<SL, void>&, TR&)
|
||||
{
|
||||
out << '\n';
|
||||
}
|
||||
|
||||
|
||||
template <typename SL, typename TL>
|
||||
void
|
||||
dot(std::ostream& out, const spot::digraph<SL, TL>& g)
|
||||
{
|
||||
out << "digraph {\n";
|
||||
unsigned c = g.num_states();
|
||||
for (unsigned s = 0; s < c; ++s)
|
||||
{
|
||||
out << ' ' << s;
|
||||
dot_state(out, g, s);
|
||||
for (auto& t: g.out(s))
|
||||
{
|
||||
out << ' ' << s << " -> " << t.dst;
|
||||
dot_trans(out, g, t);
|
||||
}
|
||||
}
|
||||
out << "}\n";
|
||||
}
|
||||
|
||||
template <typename G1, typename G2, typename G3, typename G4>
|
||||
void
|
||||
dot(std::ostream& out, const spot::named_graph<G1, G2, G3, G4>& g)
|
||||
{
|
||||
out << "digraph {\n";
|
||||
auto& gg = g.graph();
|
||||
unsigned c = gg.num_states();
|
||||
for (unsigned s = 0; s < c; ++s)
|
||||
{
|
||||
out << ' ' << s;
|
||||
dot_state(out, gg, s, g.get_name(s));
|
||||
for (auto& t: gg.out(s))
|
||||
{
|
||||
out << ' ' << s << " -> " << t.dst;
|
||||
dot_trans(out, gg, t);
|
||||
}
|
||||
}
|
||||
out << "}\n";
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
g1(const spot::digraph<void, void>& g, unsigned s, int e)
|
||||
{
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s))
|
||||
{
|
||||
(void) t;
|
||||
++f;
|
||||
}
|
||||
return f == e;
|
||||
}
|
||||
|
||||
static bool f1()
|
||||
{
|
||||
spot::digraph<void, void> g(3);
|
||||
spot::named_graph<spot::digraph<void, void>, std::string> gg(g);
|
||||
|
||||
auto s1 = gg.new_state("s1");
|
||||
auto s2 = gg.new_state("s2");
|
||||
auto s3 = gg.new_state("s3");
|
||||
gg.new_edge("s1", "s2");
|
||||
gg.new_edge("s1", "s3");
|
||||
gg.new_edge("s2", "s3");
|
||||
gg.new_edge("s3", "s1");
|
||||
gg.new_edge("s3", "s2");
|
||||
gg.new_edge("s3", "s3");
|
||||
|
||||
dot(std::cout, gg);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
(void) t;
|
||||
++f;
|
||||
}
|
||||
return f == 2
|
||||
&& g1(g, s3, 3)
|
||||
&& g1(g, s2, 1)
|
||||
&& g1(g, s1, 2);
|
||||
}
|
||||
|
||||
|
||||
static bool f2()
|
||||
{
|
||||
spot::digraph<int, void> g(3);
|
||||
spot::named_graph<spot::digraph<int, void>, std::string> gg(g);
|
||||
|
||||
auto s1 = gg.new_state("s1", 1);
|
||||
gg.new_state("s2", 2);
|
||||
gg.new_state("s3", 3);
|
||||
gg.new_edge("s1", "s2");
|
||||
gg.new_edge("s1", "s3");
|
||||
gg.new_edge("s2", "s3");
|
||||
gg.new_edge("s3", "s2");
|
||||
|
||||
dot(std::cout, gg);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += g.state_data(t.dst);
|
||||
}
|
||||
return f == 5;
|
||||
}
|
||||
|
||||
static bool f3()
|
||||
{
|
||||
spot::digraph<void, int> g(3);
|
||||
spot::named_graph<spot::digraph<void, int>, std::string> gg(g);
|
||||
|
||||
auto s1 = gg.new_state("s1");
|
||||
gg.new_state("s2");
|
||||
gg.new_state("s3");
|
||||
gg.new_edge("s1", "s2", 1);
|
||||
gg.new_edge("s1", "s3", 2);
|
||||
gg.new_edge("s2", "s3", 3);
|
||||
gg.new_edge("s3", "s2", 4);
|
||||
|
||||
dot(std::cout, gg);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += t.label;
|
||||
}
|
||||
return f == 3 && g.states().size() == 3;
|
||||
}
|
||||
|
||||
static bool f4()
|
||||
{
|
||||
spot::digraph<int, int> g(3);
|
||||
spot::named_graph<spot::digraph<int, int>, std::string> gg(g);
|
||||
|
||||
auto s1 = gg.new_state("s1", 2);
|
||||
gg.new_state("s2", 3);
|
||||
gg.new_state("s3", 4);
|
||||
gg.new_edge("s1", "s2", 1);
|
||||
gg.new_edge("s1", "s3", 2);
|
||||
gg.new_edge("s2", "s3", 3);
|
||||
gg.new_edge("s3", "s2", 4);
|
||||
|
||||
dot(std::cout, gg);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += t.label * g.state_data(t.dst);
|
||||
}
|
||||
return f == 11;
|
||||
}
|
||||
|
||||
static bool f5()
|
||||
{
|
||||
typedef spot::digraph<void, std::pair<int, float>> graph_t;
|
||||
graph_t g(3);
|
||||
spot::named_graph<graph_t, std::string> gg(g);
|
||||
|
||||
auto s1 = gg.new_state("s1");
|
||||
gg.new_state("s2");
|
||||
gg.new_state("s3");
|
||||
gg.new_edge("s1", "s2", std::make_pair(1, 1.2f));
|
||||
gg.new_edge("s1", "s3", std::make_pair(2, 1.3f));
|
||||
gg.new_edge("s2", "s3", std::make_pair(3, 1.4f));
|
||||
gg.new_edge("s3", "s2", std::make_pair(4, 1.5f));
|
||||
|
||||
int f = 0;
|
||||
float h = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += std::get<0>(t);
|
||||
h += std::get<1>(t);
|
||||
}
|
||||
return f == 3 && (h > 2.49 && h < 2.51);
|
||||
}
|
||||
|
||||
static bool f6()
|
||||
{
|
||||
typedef spot::digraph<void, std::pair<int, float>> graph_t;
|
||||
graph_t g(3);
|
||||
spot::named_graph<graph_t, std::string> gg(g);
|
||||
|
||||
auto s1 = gg.new_state("s1");
|
||||
gg.new_state("s2");
|
||||
gg.new_state("s3");
|
||||
gg.new_edge("s1", "s2", 1, 1.2f);
|
||||
gg.new_edge("s1", "s3", 2, 1.3f);
|
||||
gg.new_edge("s2", "s3", 3, 1.4f);
|
||||
gg.new_edge("s3", "s2", 4, 1.5f);
|
||||
|
||||
int f = 0;
|
||||
float h = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += t.first;
|
||||
h += t.second;
|
||||
}
|
||||
return f == 3 && (h > 2.49 && h < 2.51);
|
||||
}
|
||||
|
||||
static bool f7()
|
||||
{
|
||||
typedef spot::digraph<int, int, true> graph_t;
|
||||
graph_t g(3);
|
||||
spot::named_graph<graph_t, std::string> gg(g);
|
||||
|
||||
auto s1 = gg.new_state("s1", 2);
|
||||
gg.new_state("s2", 3);
|
||||
gg.new_state("s3", 4);
|
||||
gg.new_edge("s1", {"s2", "s3"}, 1);
|
||||
gg.new_edge("s1", {"s3"}, 2);
|
||||
gg.new_edge("s2", {"s3"}, 3);
|
||||
gg.new_edge("s3", {"s2"}, 4);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
for (auto& tt: t.dst)
|
||||
{
|
||||
f += t.label * g.state_data(tt);
|
||||
}
|
||||
}
|
||||
return f == 15;
|
||||
}
|
||||
|
||||
|
||||
struct int_pair
|
||||
{
|
||||
int one;
|
||||
int two;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, int_pair p)
|
||||
{
|
||||
os << '(' << p.one << ',' << p.two << ')';
|
||||
return os;
|
||||
}
|
||||
|
||||
#if __GNUC__ <= 4 && __GNUC_MINOR__ <= 6
|
||||
int_pair(int one, int two)
|
||||
: one(one), two(two)
|
||||
{
|
||||
}
|
||||
|
||||
int_pair()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static bool f8()
|
||||
{
|
||||
typedef spot::digraph<int_pair, int_pair> graph_t;
|
||||
graph_t g(3);
|
||||
spot::named_graph<graph_t, std::string> gg(g);
|
||||
auto s1 = gg.new_state("s1", 2, 4);
|
||||
gg.new_state("s2", 3, 6);
|
||||
gg.new_state("s3", 4, 8);
|
||||
gg.new_edge("s1", "s2", 1, 3);
|
||||
gg.new_edge("s1", "s3", 2, 5);
|
||||
gg.new_edge("s2", "s3", 3, 7);
|
||||
gg.new_edge("s3", "s2", 4, 9);
|
||||
|
||||
dot(std::cout, gg);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += t.one * g.state_data(t.dst).one;
|
||||
f += t.two * g.state_data(t.dst).two;
|
||||
}
|
||||
return f == 69;
|
||||
}
|
||||
|
||||
struct my_state: public spot::state
|
||||
{
|
||||
public:
|
||||
virtual ~my_state() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
virtual int compare(const spot::state* other) const
|
||||
{
|
||||
auto o = down_cast<const my_state*>(other);
|
||||
assert(o);
|
||||
|
||||
// Do not simply return "other - this", it might not fit in an int.
|
||||
if (o < this)
|
||||
return -1;
|
||||
if (o > this)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual size_t hash() const
|
||||
{
|
||||
return
|
||||
reinterpret_cast<const char*>(this) - static_cast<const char*>(nullptr);
|
||||
}
|
||||
|
||||
virtual my_state*
|
||||
clone() const
|
||||
{
|
||||
return const_cast<my_state*>(this);
|
||||
}
|
||||
|
||||
virtual void destroy() const
|
||||
{
|
||||
}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const my_state&)
|
||||
{
|
||||
return os;
|
||||
}
|
||||
};
|
||||
|
||||
static bool f9()
|
||||
{
|
||||
typedef spot::digraph<my_state, int_pair> graph_t;
|
||||
graph_t g(3);
|
||||
spot::named_graph<graph_t, std::string> gg(g);
|
||||
auto s1 = gg.new_state("s1");
|
||||
gg.new_state("s2");
|
||||
auto s3 = gg.new_state("s3");
|
||||
gg.alias_state(s3, "s3b");
|
||||
|
||||
gg.new_edge("s1", "s2", 1, 3);
|
||||
gg.new_edge("s1", "s3", 2, 5);
|
||||
gg.new_edge("s2", "s3b", 3, 7);
|
||||
gg.new_edge("s3", "s2", 4, 9);
|
||||
|
||||
dot(std::cout, gg);
|
||||
|
||||
int f = 0;
|
||||
for (auto& t: g.out(s1))
|
||||
{
|
||||
f += t.one + t.two;
|
||||
}
|
||||
|
||||
|
||||
return (f == 11) &&
|
||||
g.state_data(s1).compare(&g.state_data(gg.get_state("s1"))) == 0 &&
|
||||
g.state_data(s1).compare(&g.state_data(gg.get_state("s2"))) != 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
bool a1 = f1();
|
||||
bool a2 = f2();
|
||||
bool a3 = f3();
|
||||
bool a4 = f4();
|
||||
bool a5 = f5();
|
||||
bool a6 = f6();
|
||||
bool a7 = f7();
|
||||
bool a8 = f8();
|
||||
bool a9 = f9();
|
||||
std::cout << a1 << ' '
|
||||
<< a2 << ' '
|
||||
<< a3 << ' '
|
||||
<< a4 << ' '
|
||||
<< a5 << ' '
|
||||
<< a6 << ' '
|
||||
<< a7 << ' '
|
||||
<< a8 << ' '
|
||||
<< a9 << '\n';
|
||||
return !(a1 && a2 && a3 && a4 && a5 && a6 && a7 && a8 && a9);
|
||||
}
|
||||
96
tests/ngraph.test
Executable file
96
tests/ngraph.test
Executable file
|
|
@ -0,0 +1,96 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# While running some benchmark, Tomáš Babiak found that Spot took too
|
||||
# much time (i.e. >1h) to translate those six formulae. It turns out
|
||||
# that the WDBA minimization was performed after the degeneralization
|
||||
# algorithm, while this is not necessary (WDBA will produce a BA, so
|
||||
# we may as well skip degeneralization). Translating these formulae
|
||||
# in the test-suite ensure that they don't take too much time (the
|
||||
# buildfarm will timeout if it does).
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
run 0 ../ngraph > stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
digraph {
|
||||
0 [label="s1"]
|
||||
0 -> 1
|
||||
0 -> 2
|
||||
1 [label="s2"]
|
||||
1 -> 2
|
||||
2 [label="s3"]
|
||||
2 -> 0
|
||||
2 -> 1
|
||||
2 -> 2
|
||||
}
|
||||
digraph {
|
||||
0 [label="s1\n1"]
|
||||
0 -> 1
|
||||
0 -> 2
|
||||
1 [label="s2\n2"]
|
||||
1 -> 2
|
||||
2 [label="s3\n3"]
|
||||
2 -> 1
|
||||
}
|
||||
digraph {
|
||||
0 [label="s1"]
|
||||
0 -> 1 [label="1"]
|
||||
0 -> 2 [label="2"]
|
||||
1 [label="s2"]
|
||||
1 -> 2 [label="3"]
|
||||
2 [label="s3"]
|
||||
2 -> 1 [label="4"]
|
||||
}
|
||||
digraph {
|
||||
0 [label="s1\n2"]
|
||||
0 -> 1 [label="1"]
|
||||
0 -> 2 [label="2"]
|
||||
1 [label="s2\n3"]
|
||||
1 -> 2 [label="3"]
|
||||
2 [label="s3\n4"]
|
||||
2 -> 1 [label="4"]
|
||||
}
|
||||
digraph {
|
||||
0 [label="s1\n(2,4)"]
|
||||
0 -> 1 [label="(1,3)"]
|
||||
0 -> 2 [label="(2,5)"]
|
||||
1 [label="s2\n(3,6)"]
|
||||
1 -> 2 [label="(3,7)"]
|
||||
2 [label="s3\n(4,8)"]
|
||||
2 -> 1 [label="(4,9)"]
|
||||
}
|
||||
digraph {
|
||||
0 [label="s1\n"]
|
||||
0 -> 1 [label="(1,3)"]
|
||||
0 -> 2 [label="(2,5)"]
|
||||
1 [label="s2\n"]
|
||||
1 -> 2 [label="(3,7)"]
|
||||
2 [label="s3\n"]
|
||||
2 -> 1 [label="(4,9)"]
|
||||
}
|
||||
1 1 1 1 1 1 1 1 1
|
||||
EOF
|
||||
|
||||
diff stdout expected
|
||||
|
||||
75
tests/nondet.test
Executable file
75
tests/nondet.test
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012, 2013 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
set -e
|
||||
|
||||
cat >expected.1<<EOF
|
||||
FGa, 0 0
|
||||
GFa, 1 1
|
||||
a U b, 1 0
|
||||
G(!r | Fa) | Fx, 0 1
|
||||
EOF
|
||||
|
||||
# also test the filename/COL syntax
|
||||
run 0 ../../bin/ltl2tgba -F expected.1/1 --stats='%f, %d %p' >out.1
|
||||
diff out.1 expected.1
|
||||
|
||||
cat >expected.2<<EOF
|
||||
FGa, 0 1
|
||||
GFa, 1 1
|
||||
a U b, 1 1
|
||||
G(!r | Fa) | Fx, 0 1
|
||||
EOF
|
||||
|
||||
# filename/COL should also work when filename=-
|
||||
run 0 ../../bin/ltl2tgba -C -F-/1 --stats='%f, %d %p' <expected.2 >out.2
|
||||
diff out.2 expected.2
|
||||
|
||||
# Test multi-line CSV fields.
|
||||
cat >in.2b<<EOF
|
||||
FGa, 0 1
|
||||
GFa, 1 1
|
||||
a U b, 1 1
|
||||
"G(!r | Fa)
|
||||
|
|
||||
Fx", 0 1
|
||||
EOF
|
||||
run 0 ../../bin/ltl2tgba -C -Fin.2b/1 --stats='%f, %d %p' >out.2b
|
||||
diff out.2b expected.2
|
||||
|
||||
|
||||
run 0 ../../bin/ltl2tgba FGa GFa --stats='%f %d %n %s %p' >out.3
|
||||
cat >expected.3<<EOF
|
||||
FGa 0 1 2 0
|
||||
GFa 1 0 1 1
|
||||
EOF
|
||||
|
||||
diff out.3 expected.3
|
||||
|
||||
|
||||
run 0 ../../bin/ltl2tgba -DC FGa GFa --stats='%f %d %n %s %p' >out.4
|
||||
cat >expected.4<<EOF
|
||||
FGa 0 1 3 1
|
||||
GFa 1 0 1 1
|
||||
EOF
|
||||
|
||||
diff out.4 expected.4
|
||||
|
||||
120
tests/obligation.test
Executable file
120
tests/obligation.test
Executable file
|
|
@ -0,0 +1,120 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2010, 2011, 2014, 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./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)))))
|
||||
GS p
|
||||
GS q&Xp
|
||||
GS G(Ga&F!a)
|
||||
EOF
|
||||
|
||||
grok()
|
||||
{
|
||||
case $1 in
|
||||
"this is a safety property"*) echo SA;;
|
||||
"this is a guarantee property"*) echo GU;;
|
||||
"this is a guarantee and a safety"*) echo GS;;
|
||||
"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=`../ikwiad -O "$f"`
|
||||
y=`../ikwiad -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);;
|
||||
GS,GS);;
|
||||
OB,OB);;
|
||||
NO,NO);;
|
||||
*) echo "Incompatible results: $resx,$resy"; exit 1;;
|
||||
esac
|
||||
done < formulas.txt
|
||||
|
||||
exit 0
|
||||
163
tests/optba.test
Executable file
163
tests/optba.test
Executable file
|
|
@ -0,0 +1,163 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
# This is a case where autfilt is used to optimize BA, but used to
|
||||
# produce a larger one. See issue #79.
|
||||
|
||||
autfilt=../../bin/autfilt
|
||||
|
||||
# ltldo -s -f '!(((p1 W c1) U Gp2) || (GXc2 <-> F!F!c1))' 'ltl3ba -M0'
|
||||
cat >input <<EOF
|
||||
never {
|
||||
T0_init:
|
||||
if
|
||||
:: ((!(c1)) && (!(p1)) && (!(p2))) -> goto accept_S1
|
||||
:: ((!(c1)) && (!(p1))) -> goto T0_S2
|
||||
:: ((!(c1)) && (!(p2))) -> goto T0_S3
|
||||
:: ((true)) -> goto T0_S4
|
||||
:: ((!(c1)) && (!(p1)) && (!(p2))) -> goto T0_S5
|
||||
:: ((!(c1)) && (!(p1))) -> goto T0_S6
|
||||
:: ((!(c1)) && (!(p2))) -> goto T0_S7
|
||||
:: ((true)) -> goto T0_S8
|
||||
fi;
|
||||
accept_S1:
|
||||
if
|
||||
:: ((!(c1)) && (c2)) -> goto accept_S1
|
||||
:: ((c2)) -> goto T0_S9
|
||||
fi;
|
||||
T0_S2:
|
||||
if
|
||||
:: ((c2) && (!(p2))) -> goto T0_S9
|
||||
:: ((c2)) -> goto T0_S2
|
||||
fi;
|
||||
T0_S3:
|
||||
if
|
||||
:: ((!(c1)) && (c2) && (!(p1))) -> goto accept_S1
|
||||
:: ((!(c1)) && (c2)) -> goto T0_S3
|
||||
fi;
|
||||
T0_S4:
|
||||
if
|
||||
:: ((!(c1)) && (c2) && (!(p1)) && (!(p2))) -> goto accept_S1
|
||||
:: ((!(c1)) && (c2) && (!(p1))) -> goto T0_S2
|
||||
:: ((!(c1)) && (c2) && (!(p2))) -> goto T0_S3
|
||||
:: ((c2) && (!(p2))) -> goto T0_S10
|
||||
:: ((!(c1)) && (c2) && (!(p2))) -> goto accept_S11
|
||||
:: ((c2)) -> goto T0_S4
|
||||
fi;
|
||||
T0_S5:
|
||||
if
|
||||
:: ((true)) -> goto T0_S5
|
||||
:: ((!(c2))) -> goto T0_S12
|
||||
fi;
|
||||
T0_S6:
|
||||
if
|
||||
:: ((!(p2))) -> goto T0_S5
|
||||
:: ((true)) -> goto T0_S6
|
||||
:: ((!(c2)) && (!(p2))) -> goto T0_S12
|
||||
:: ((!(c2))) -> goto T0_S13
|
||||
fi;
|
||||
T0_S7:
|
||||
if
|
||||
:: ((!(c1)) && (!(p1))) -> goto T0_S5
|
||||
:: ((!(c1))) -> goto T0_S7
|
||||
:: ((!(c1)) && (!(c2)) && (!(p1))) -> goto T0_S12
|
||||
:: ((!(c1)) && (!(c2))) -> goto T0_S14
|
||||
fi;
|
||||
T0_S8:
|
||||
if
|
||||
:: ((!(c1)) && (!(p1)) && (!(p2))) -> goto T0_S5
|
||||
:: ((!(c1)) && (!(p1))) -> goto T0_S6
|
||||
:: ((!(c1)) && (!(p2))) -> goto T0_S7
|
||||
:: ((!(c1)) && (!(c2)) && (!(p1)) && (!(p2))) -> goto T0_S12
|
||||
:: ((!(c1)) && (!(c2)) && (!(p1))) -> goto T0_S13
|
||||
:: ((!(c1)) && (!(c2)) && (!(p2))) -> goto T0_S14
|
||||
:: ((!(c2))) -> goto T0_S18
|
||||
:: ((true)) -> goto T0_S8
|
||||
fi;
|
||||
T0_S9:
|
||||
if
|
||||
:: ((!(c1)) && (c2)) -> goto accept_S1
|
||||
:: ((c2)) -> goto T0_S9
|
||||
fi;
|
||||
T0_S10:
|
||||
if
|
||||
:: ((!(c1)) && (c2) && (!(p1)) && (!(p2))) -> goto accept_S1
|
||||
:: ((!(c1)) && (c2) && (!(p1))) -> goto T0_S2
|
||||
:: ((!(c1)) && (c2) && (!(p2))) -> goto T0_S3
|
||||
:: ((c2)) -> goto T0_S10
|
||||
:: ((!(c1)) && (c2)) -> goto accept_S11
|
||||
fi;
|
||||
accept_S11:
|
||||
if
|
||||
:: ((!(c1)) && (c2) && (!(p1)) && (!(p2))) -> goto accept_S1
|
||||
:: ((!(c1)) && (c2) && (!(p1))) -> goto T0_S2
|
||||
:: ((!(c1)) && (c2) && (!(p2))) -> goto T0_S3
|
||||
:: ((c2) && (!(p2))) -> goto T0_S10
|
||||
:: ((!(c1)) && (c2) && (!(p2))) -> goto accept_S11
|
||||
:: ((c2)) -> goto T0_S4
|
||||
fi;
|
||||
T0_S12:
|
||||
if
|
||||
:: ((true)) -> goto T0_S12
|
||||
:: ((c1)) -> goto accept_S15
|
||||
fi;
|
||||
T0_S13:
|
||||
if
|
||||
:: ((!(p2))) -> goto T0_S12
|
||||
:: ((c1) && (!(p2))) -> goto accept_S15
|
||||
:: ((true)) -> goto T0_S13
|
||||
fi;
|
||||
T0_S14:
|
||||
if
|
||||
:: ((!(c1)) && (!(p1))) -> goto T0_S12
|
||||
:: ((!(c1))) -> goto T0_S14
|
||||
fi;
|
||||
accept_S15:
|
||||
if
|
||||
:: ((c1)) -> goto accept_S15
|
||||
fi;
|
||||
accept_S16:
|
||||
if
|
||||
:: ((c1) && (!(p2))) -> goto accept_S16
|
||||
:: ((c1)) -> goto T0_S17
|
||||
fi;
|
||||
T0_S17:
|
||||
if
|
||||
:: ((c1) && (!(p2))) -> goto accept_S16
|
||||
:: ((c1)) -> goto T0_S17
|
||||
fi;
|
||||
T0_S18:
|
||||
if
|
||||
:: ((!(c1)) && (!(p1)) && (!(p2))) -> goto T0_S12
|
||||
:: ((!(c1)) && (!(p1))) -> goto T0_S13
|
||||
:: ((!(c1)) && (!(p2))) -> goto T0_S14
|
||||
:: ((c1)) -> goto T0_S17
|
||||
:: ((true)) -> goto T0_S18
|
||||
fi;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 18 states is fine for transition-based acceptance
|
||||
test `$autfilt --exclusive-ap=c1,c2 --high --small --stats=%s input` = 18
|
||||
|
||||
# But we should have 19 with Büchi acceptance, not 20.
|
||||
test `$autfilt --exclusive-ap=c1,c2 --high --small -B --stats=%s input` = 19
|
||||
4
tests/origin
Normal file
4
tests/origin
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
state1, "!b", state2;
|
||||
state2, "a&b", state3;
|
||||
state3, "a", state4 state1;
|
||||
state4, "b", state1;
|
||||
106
tests/parse.test
Executable file
106
tests/parse.test
Executable file
|
|
@ -0,0 +1,106 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2011, 2012, 2013 Laboratoire de Recherche
|
||||
# et Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Check that spot::parse succeed on valid input, and that
|
||||
# dump and dotty will work with the resulting trees. Note that
|
||||
# this doesn't check that the tree is correct w.r.t. the formula.
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
for f in \
|
||||
'0' \
|
||||
'1' \
|
||||
'true' \
|
||||
'false' \
|
||||
'a' \
|
||||
'p11011' \
|
||||
'(p11011)' \
|
||||
'a & b' \
|
||||
'a * _b12' \
|
||||
'a && .b.' \
|
||||
'a + b' \
|
||||
'a3214 | b' \
|
||||
'a /\ b' \
|
||||
'a || b' \
|
||||
'a \/ b' \
|
||||
'a | b' \
|
||||
'_a_ U b' \
|
||||
'a R b' \
|
||||
'a <=> b' \
|
||||
'a <-> b' \
|
||||
'a ^ b' \
|
||||
'a xor b' \
|
||||
'a => b' \
|
||||
'a -> b' \
|
||||
'F b' \
|
||||
'Gb' \
|
||||
'G(b)' \
|
||||
'!G(!b)' \
|
||||
'!b' \
|
||||
'[]b' \
|
||||
'<>b' \
|
||||
'X b' \
|
||||
'()b' \
|
||||
'X"X"' \
|
||||
'X"F"' \
|
||||
'X"G"' \
|
||||
'X"U"' \
|
||||
'X"W"' \
|
||||
'X"R"' \
|
||||
'X"M"' \
|
||||
'long_atomic_proposition_1 U long_atomic_proposition_2' \
|
||||
' ab & ac | ad ^ af' \
|
||||
'((b & a) + a) & d' \
|
||||
'(ab & ac | ad ) <=> af ' \
|
||||
'a U b U c U d U e U f U g U h U i U j U k U l U m' \
|
||||
'(ab & !Xad + ad U ab) & FG p12 /\ GF p13' \
|
||||
'((([]<>()p12)) )' \
|
||||
'a R ome V anille' \
|
||||
'p=0Uq=1' \
|
||||
'((p=1Rq=1)+p=0)UXq=0' \
|
||||
'((p=1Rq=1)*p=0)UXq=0' \
|
||||
'(Gq=1*Fp=0)UXq=0' \
|
||||
'((p=1Mq=1)Wx+p=0)RXq=0' \
|
||||
'((p=1Vq=1)Rx+p=0)WXq=0' \
|
||||
'((X(p2=0))U(X(p2=0)))+((Xp1=0)UFALSE)'
|
||||
|
||||
do
|
||||
if ../ltl2text "$f"; then
|
||||
:
|
||||
else
|
||||
echo "ltl2text failed to parse '$f'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -n "$DOT"; then
|
||||
run 0 ../ltl2dot "$f" > parse.dot
|
||||
if $DOT -o /dev/null parse.dot; then
|
||||
rm -f parse.dot
|
||||
else
|
||||
rm -f parse.dot
|
||||
echo "dot failed to parse ltl2dot output for '$f'"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
50
tests/parse_print_test.cc
Normal file
50
tests/parse_print_test.cc
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2014, 2015 Laboratoire de Recherche et
|
||||
// Developpement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <spot/parseaut/public.hh>
|
||||
#include <spot/twaalgos/hoa.hh>
|
||||
|
||||
using namespace spot;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void) argc;
|
||||
assert(argc == 2);
|
||||
int return_value = 0;
|
||||
|
||||
spot::automaton_parser_options opts;
|
||||
opts.want_kripke = true;
|
||||
spot::automaton_stream_parser parser(argv[1], opts);
|
||||
|
||||
while (auto paut = parser.parse(make_bdd_dict(),
|
||||
default_environment::instance()))
|
||||
{
|
||||
if (paut->format_errors(std::cerr))
|
||||
{
|
||||
return_value = 1;
|
||||
if (paut->ks)
|
||||
continue;
|
||||
}
|
||||
if (!paut->ks)
|
||||
break;
|
||||
print_hoa(std::cout, paut->ks, "k");
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
2390
tests/parseaut.test
Executable file
2390
tests/parseaut.test
Executable file
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue