ltlgrind.test 3.75 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
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
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
#! /bin/sh
# Copyright (C) 2013 Laboratoire de Recherche et Developement 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()
{
    cat >exp
    run 0 ../../bin/ltlgrind "$@" > out
    diff exp out
}

checkopt -f 'Xp1 U (p4 | (p3 xor (p4 W p0)))' <<EOF
1
Xp1
p4 | (p3 xor (p4 W p0))
Xp1 W (p4 | (p3 xor (p4 W p0)))
Xp1 U (p3 xor (p4 W p0))
Xp1 U p4
Xp1 U (p3 | p4)
Xp1 U (p4 | (p4 W p0))
Xp1 U (p4 | (p3 & !(p4 W p0)))
Xp1 U (p4 | (!p3 & (p4 W p0)))
Xp1 U (p4 | (p3 xor p4))
Xp1 U (p4 | (p0 xor p3))
Xp1 U (!p3 | p4)
Xp1 U (p4 | (p3 xor (p4 W 0)))
Xp1 U (p4 | !(p4 W p0))
p1 U (p4 | (p3 xor (p4 W p0)))
1 U (p4 | (p3 xor (p4 W p0)))
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 (p0 | (p0 xor p3))
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)))
EOF

checkopt -f '(Xp4 R p3) W !p0' --sort <<EOF
1
!p0
Xp4 R p3
p3 W !p0
Xp4 W !p0
(Xp4 R p3) W p0
(Xp4 R p3) W 0
(p4 R p3) W !p0
(0 R p3) W !p0
(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
F(!p2 & p3)
Fp0
(!p2 & p3) | Fp0
Fp0 | Fp3
EOF

checkopt -f '{(a | b)[*4] & ((a | b)*; c)} <>-> G(d <-> e) xor f' --split-ops \
<<EOF
{{{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}}[*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 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
!(!p2 & (p1 W 0))
!(p0 & (p1 W 0))
!(p0 & !p2)
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 | {{!p1}[*]}
!p4 & {{!p1}[*]}
p2 & !p4
!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
1
0
p3
p4
p3 -> p4
p4 -> p3
p3 & p4
!p4
!p3
!p3 & !p4
1 U p3
1 U p4
1 U !p3
1 U !p4
1 U (p3 & !p4)
1 U (!p3 & p4)
EOF