det.test 3.37 KB
Newer Older
1
2
#!/bin/sh
# -*- coding: utf-8 -*-
3
4
# Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# 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

24
ltl2tgba=ltl2tgba
25
26

cat >formulas <<'EOF'
27
1,13,X((a M F((!b & !c) | (b & c))) W (G!c U b))
28
1,5,X(((a & b) R (!a U !c)) R b)
29
1,9,XXG(Fa U Xb)
30
31
1,5,(!a M !b) W F!c
1,3,(b & Fa & GFc) R a
32
33
1,2,(a R (b W a)) W G(!a M (b | c))
1,11,(Fa W b) R (!a | Fc)
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
52
1,3,G(a U (b | X((!a & !c) | (a & c))))
53
54
55
56
57
58
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

59
$ltl2tgba -x tba-det --det --stats '%d,%s,%f' -F formulas/3 > out
60
61
diff formulas out

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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--
81
82
EOF

83
84
cat >ex.hoa <<'EOF'
HOA: v1
85
States: 5
86
87
88
89
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
90
properties: trans-labels explicit-labels state-acc inherently-weak
91
92
93
94
--BODY--
State: 0
[!0] 0
[0] 1
95
[!0] 3
96
97
State: 1
[!0] 0
98
99
100
[0] 2
[!0] 3
State: 2
101
[!0] 0
102
103
[0] 2
[!0] 3
104
[0] 4
105
106
State: 3 {0}
[!0] 3
107
State: 4 {0}
108
[!0] 3
109
[0] 4
110
--END--
111
112
EOF

113
run 0 ../ikwiad -H -DC -XH in.hoa > out.hoa
114
115
run 1 autfilt -q --are-isomorph in.hoa out.hoa
run 0 autfilt -q --are-isomorph ex.hoa out.hoa
116

117
run 0 ../ikwiad -x -DC 'GFa & XGFb' > out.tgba
118
119
cat >ex.tgba <<EOF
digraph G {
120
  rankdir=LR
121
  node [shape="circle"]
122
123
124
125
126
127
  I [label="", style=invis, width=0]
  I -> 0
  0 [label="0"]
  0 -> 1 [label="1"]
  1 [label="1"]
  1 -> 1 [label="1"]
128
129
  1 -> 2 [label="!a"]
  1 -> 3 [label="!b"]
130
  2 [label="2", peripheries=2]
131
  2 -> 2 [label="!a"]
132
  3 [label="3", peripheries=2]
133
  3 -> 3 [label="!b"]
134
135
136
}
EOF
diff out.tgba ex.tgba
137
138
139
140


# 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.
141
run 0 ltl2tgba -H '(0 R Xa) R (a xor Fa)' > out.hoa
142
143
grep deterministic out.hoa && exit 1

144
145
146
147
148
149
150
151
152
153
154
155
156

# 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
157
run 0 ltl2tgba -D -F input/1 --stats='%f,%s' > output
158
159
160
cat output
diff input output

161
true