#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) by the Spot authors, see the AUTHORS file for details.
#
# 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 .
. ./defs
set -e
cat >alt.hoa <alt.dot
aho='arrowhead=onormal'
b='style=bold,'
tE='tooltip="\\E'
cat >expect.dot < -11 [$aho]
subgraph cluster_0 {
color=green
id="SCC0"
label=""
2 [label="G(a)"]
}
subgraph cluster_1 {
color=red
id="SCC1"
label=""
1 [label="FG(a)\n⓿"]
}
subgraph cluster_2 {
color=green
id="SCC2"
label=""
6 [label="t"]
}
subgraph cluster_3 {
color=red
id="SCC3"
label=""
4 [label="F(b)\n⓿"]
}
subgraph cluster_4 {
color=green
id="SCC4"
label=""
3 [label="GF(b)"]
-8 [label=<>,shape=point,width=0.05,height=0.05]
}
subgraph cluster_5 {
color=red
id="SCC5"
label=""
5 [label="((a) U (b))\n⓿"]
}
subgraph cluster_6 {
color=black
id="SCC6"
label=""
0 [label="((((a) U (b)) && GF(b)) && FG(a))"]
}
-11 [label=<>,shape=point,width=0.05,height=0.05]
-11 -> 0 [id="E-11E0"]
-11 -> 2 [id="E-11E2"]
0 -> -1 [label="b", id="E1", $tE\n#1", $aho]
-1 [label=<>,shape=point,width=0.05,height=0.05]
-1 -> 1 [id="E-1E1"]
-1 -> 3 [id="E-1E3"]
0 -> -4 [label="a & !b", id="E2", $tE\n#2", $b color="#E31A1C", $aho]
-4 [label=<>,shape=point,width=0.05,height=0.05]
-4 -> 1 [$b color="#E31A1C",id="E-4E1"]
-4 -> 3 [$b color="#E31A1C",id="E-4E3"]
-4 -> 5 [$b color="#E31A1C",id="E-4E5"]
1 -> 2 [label="a", id="E3", $tE\n#3"]
1 -> 1 [label="1", id="E4", $tE\n#4"]
2 -> 2 [label="a", id="E5", $tE\n#5"]
3 -> 3 [label="b", id="E6", $tE\n#6"]
3 -> -8 [label="!b", id="E7", $tE\n#7", $b color="#FF7F00", $aho]
-8 -> 3 [$b color="#FF7F00",id="E-8E3"]
-8 -> 4 [$b color="#FF7F00",id="E-8E4"]
4 -> 6 [label="b", id="E8", $tE\n#8"]
4 -> 4 [label="!b", id="E9", $tE\n#9"]
5 -> 6 [label="b", id="E10", $tE\n#10"]
5 -> 5 [label="a & !b", id="E11", $tE\n#11"]
6 -> 6 [label="1", id="E12", $tE\n#12"]
}
EOF
diff expect.dot alt.dot
autfilt --trust=no --check=strength alt.hoa | grep properties: >output
cat >expected <out.hoa <res
cat >expected <res
cat >expected <ex1<ex2<ex3<ex4<expect4<expect4d< out4
diff expect4 out4
run 0 autfilt --remove-dead-states ex4 > out4
diff expect4d out4
cat >ex5< out5
cat >expect <ex6< ex6.dot
cat >expect6.dot<⓿)
[co-Büchi]>
labelloc="t"
node [shape="box",style="rounded",width="0.5"]
fontname="Lato"
node [fontname="Lato"]
edge [fontname="Lato"]
I [label="", style=invis, width=0]
I -> -1 [$aho]
-1 [label=<>,shape=point,width=0.05,height=0.05]
-1 -> 0
-1 -> 1
0 [label=<0>]
0 -> 0 [label=]
0 -> -1.1 [label=, $b color="#FF4DA0", $aho]
-1.1 [label=<>,shape=point,width=0.05,height=0.05]
-1.1 -> 0 [$b color="#FF4DA0"]
-1.1 -> 1 [$b color="#FF4DA0"]
0 -> -1.2 [label=, $b color="#FF7F00", $aho]
-1.2 [label=<>,shape=point,width=0.05,height=0.05]
-1.2 -> 0 [$b color="#FF7F00"]
-1.2 -> 1 [$b color="#FF7F00"]
1 [label=<1>]
1 -> 1 [label=]
}
EOF
diff ex6.dot expect6.dot
cat >ex7< ex7.dot
color='⓿'
color1='❶'
cat >expect7.dot<[Streett-like 2]>
labelloc="t"
node [shape="box",style="rounded",width="0.5"]
fontname="Lato"
node [fontname="Lato"]
edge [fontname="Lato"]
I [label="", style=invis, width=0]
I -> 0
subgraph cluster_0 {
color=green
label=""
4 [label=]
}
subgraph cluster_1 {
color=green
label=""
1 [label=]
}
subgraph cluster_2 {
color=red
label=""
2 [label=]
}
subgraph cluster_3 {
color=red
label=""
3 [label=]
}
subgraph cluster_4 {
color=green
label=""
0 [label=]
-1 [label=<>,shape=point,width=0.05,height=0.05]
-4 [label=<>,shape=point,width=0.05,height=0.05]
-7 [label=<>,shape=point,width=0.05,height=0.05]
-10 [label=<>,shape=point,width=0.05,height=0.05]
}
0 -> 4 [label=]
0 -> 0 [label=]
0 -> -1 [label=, $aho]
-1 -> 0
-1 -> 1
0 -> -4 [label=, $aho]
-4 -> 0
-4 -> 2
0 -> -7 [label=, $aho]
-7 -> 0
-7 -> 3
0 -> -10 [label=, $aho]
-10 -> 0
-10 -> 2
-10 -> 3
1 -> 1 [label=]
2 -> 4 [label=]
2 -> 2 [label=❶>]
3 -> 4 [label=]
3 -> 3 [label=⓿>]
4 -> 4 [label=<1>]
}
EOF
diff ex7.dot expect7.dot
cat >ex8< ex8.dot
cat >expect8.dot<[Streett-like 2]>
labelloc="t"
node [shape="box",style="rounded",width="0.5"]
fontname="Lato"
node [fontname="Lato"]
edge [fontname="Lato"]
I [label="", style=invis, width=0]
I -> 0
subgraph cluster_0 {
color=green
label=""
4 [label=]
}
subgraph cluster_1 {
color=red
label=""
2 [label=]
}
subgraph cluster_2 {
color=red
label=""
3 [label=]
}
subgraph cluster_3 {
color=green
label=""
0 [label=]
-1 [label=<>,shape=point,width=0.05,height=0.05]
-4 [label=<>,shape=point,width=0.05,height=0.05]
-7 [label=<>,shape=point,width=0.05,height=0.05]
1 [label=]
-10 [label=<>,shape=point,width=0.05,height=0.05]
}
0 -> 4 [label=]
0 -> 0 [label=]
0 -> -1 [label=, $aho]
-1 -> 0
-1 -> 1
0 -> -4 [label=, $aho]
-4 -> 0
-4 -> 2
0 -> -7 [label=, $aho]
-7 -> 0
-7 -> 3
1 -> 1 [label=]
1 -> -10 [label=, $aho]
-10 -> 0
-10 -> 2
-10 -> 3
2 -> 4 [label=]
2 -> 2 [label=❶>]
3 -> 4 [label=]
3 -> 3 [label=⓿>]
4 -> 4 [label=<1>]
}
EOF
diff ex8.dot expect8.dot
cat >ex9 < ex9.dot
cat >expect9.dot <⓿)
[co-Büchi]>
labelloc="t"
node [shape="box",style="rounded",width="0.5"]
fontname="Lato"
node [fontname="Lato"]
edge [fontname="Lato"]
I [label="", style=invis, width=0]
I -> 0
0 [label=<0>]
0 -> -1.1 [label=, $b color="#FF4DA0", $aho]
-1.1 [label=<>,shape=point,width=0.05,height=0.05]
-1.1 -> 1 [$b color="#FF4DA0"]
-1.1 -> 2 [$b color="#FF4DA0"]
1 [label=<1>]
1 -> -1.1 [label=, $b color="#FF4DA0", $aho]
2 [label=<2>]
2 -> -1.2 [label=, $b color="#FF7F00", $aho]
-1.2 [label=<>,shape=point,width=0.05,height=0.05]
-1.2 -> 1 [$b color="#FF7F00"]
-1.2 -> 2 [$b color="#FF7F00"]
}
EOF
diff ex9.dot expect9.dot
cat >ex10 < ex10.dot
cat >expect10.dot <⓿)
[co-Büchi]>
labelloc="t"
node [shape="box",style="rounded",width="0.5"]
fontname="Lato"
node [fontname="Lato"]
edge [fontname="Lato"]
I [label="", style=invis, width=0]
I -> 0
0 [label=<0>]
0 -> -1.1 [label=, $b color="#FF4DA0", $aho]
-1.1 [label=<>,shape=point,width=0.05,height=0.05]
-1.1 -> 1 [$b color="#FF4DA0"]
-1.1 -> 2 [$b color="#FF4DA0"]
1 [label=<1>]
1 -> -1.3 [label=, $b color="#6A3D9A", $aho]
-1.3 [label=<>,shape=point,width=0.05,height=0.05]
-1.3 -> 1 [$b color="#6A3D9A"]
-1.3 -> 2 [$b color="#6A3D9A"]
2 [label=<2>]
2 -> -1.2 [label=, $b color="#FF7F00", $aho]
-1.2 [label=<>,shape=point,width=0.05,height=0.05]
-1.2 -> 1 [$b color="#FF7F00"]
-1.2 -> 2 [$b color="#FF7F00"]
}
EOF
diff ex10.dot expect10.dot
cat >ex11 < ex11.dot
cat >expect11.dot <⓿)
[co-Büchi]>
labelloc="t"
node [shape="box",style="rounded",width="0.5"]
fontname="Lato"
node [fontname="Lato"]
edge [fontname="Lato"]
I [label="", style=invis, width=0]
I -> 0
subgraph cluster_0 {
color=green
label=""
3 [label=]
}
subgraph cluster_1 {
color=green
label=""
1 [label=]
}
subgraph cluster_2 {
color=green
label=""
2 [label=]
}
subgraph cluster_3 {
color=green
label=""
0 [label=]
-1 [label=<>,shape=point,width=0.05,height=0.05]
-4 [label=<>,shape=point,width=0.05,height=0.05]
}
0 -> 0 [label=]
0 -> -1 [label=, $aho]
-1 -> 0
-1 -> 1
0 -> -4 [label=, $aho]
-4 -> 0
-4 -> 2
1 -> 3 [label=]
1 -> 1 [label=]
2 -> 2 [label=]
3 -> 3 [label=<1>]
}
EOF
diff ex11.dot expect11.dot
# Detect cases where alternation-removal cannot work.
cat >in <out && exit 1
grep 'autfilt.*weak.*alternating' out
test '0 2 2 1' = "`autfilt --stats='%[Wiw]c %[w]c %[iw]c %[W]c' in`"
cat >in <out && exit 1
grep 'autfilt.*weak.*alternating' out
test '2 0 2 2' = "`autfilt --stats='%[Wiw]c %[w]c %[iw]c %[W]c' in`"
cat >in <in <in <stderr && exit2
grep '%\[x\]U' stderr
cat >in <out.dot
# T0T-1 is not a valid name for GraphViz, it has to be quoted.
cat >exp.dot < 1
1 [label="1"]
1 -> -1 [label="1\n{0}", arrowhead=onormal]
-1 [label=<>,shape=point,width=0.05,height=0.05]
"T0T-1" [label="", style=invis, width=0]
-1 -> "T0T-1"
-1 -> 1
T0T1 [label="", style=invis, width=0]
1 -> T0T1 [label="a"]
}
EOF
diff out.dot exp.dot