degenid.test 3.29 KB
Newer Older
1
#!/bin/sh
2
# Copyright (C) 2011, 2013 Laboratoire de Recherche et Développement
3
4
5
6
7
8
# 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
9
# the Free Software Foundation; either version 3 of the License, or
10
11
12
13
14
15
16
17
# (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
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

. ./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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67


# 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105


# 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`"
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193


# 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 6-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 6 = "`cat out.stat`"