spot/src/tgbatest/degenid.test
Alexandre Duret-Lutz ba5bddec78 degen: use the initial state heuristic when entering SCCs
* src/tgbaalgos/degen.cc: Implement it.
* src/tgbatest/degenid.test: New test cases.
2013-09-16 08:31:43 +02:00

105 lines
2.6 KiB
Bash
Executable file

#!/bin/sh
# Copyright (C) 2011, 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
# Make sure degeneralization is idempotent
for f in 'FGa|GFb' 'GFa & GFb & GFc' 'GF(a->FGb)&GF(c->FGd)'; do
for opt in -DS -D; do
../ltl2tgba $opt -b "$f" > autX.spot
../ltl2tgba -X -kt autX.spot > base.size
cat base.size
for x in X XX XXX; do
../ltl2tgba -X $opt -b aut$x.spot > autX$x.spot
../ltl2tgba -X -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
acc = "1";
"1", "2", "!b | !a", "1";
"1", "5", "a & b", "1";
"2", "2", "b & !a", "1";
"2", "3", "!b & !a", "1";
"2", "4", "a", "1";
"5", "1", "a & !b",;
"5", "2", "!b & !a",;
"5", "5", "a & b",;
"5", "6", "b & !a",;
"3", "1", "a & b",;
"3", "2", "b & !a",;
"3", "3", "!b & !a",;
"3", "4", "a & !b",;
"4", "1", "b",;
"4", "5", "a & !b",;
"4", "6", "!b & !a",;
"6", "1", "!b",;
"6", "3", "b & !a",;
"6", "4", "a & b",;
EOF
run 0 ../ltl2tgba -ks -X -DS bug > out
grep 'states: 6' out
# This 8-state degeneralized automaton used
# to be "degeneralized" to a 9-state BA...
cat > bug2 <<EOF
acc = "1";
"1", "2", "1",;
"2", "3", "1", "1";
"3", "3", "a & !b",;
"3", "4", "a & b",;
"3", "5", "!a & !b",;
"3", "6", "b & !a",;
"4", "3", "a", "1";
"4", "5", "!a", "1";
"5", "3", "a & !b",;
"5", "4", "a & b",;
"5", "6", "b & !a",;
"5", "7", "!a & !b",;
"6", "3", "a & !b", "1";
"6", "4", "a & b", "1";
"6", "6", "b & !a", "1";
"6", "7", "!a & !b", "1";
"7", "3", "a & !b",;
"7", "4", "a & b",;
"7", "8", "b & !a",;
"7", "7", "!a & !b",;
"8", "4", "a",;
"8", "8", "!a",;
EOF
run 0 ../ltl2tgba -ks -X -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`"