* spot/parseaut/parseaut.yy, spot/parseaut/scanaut.ll: Add rules for PGSolver's format. * spot/parseaut/public.hh: PGAME is a new type of output. * tests/core/pgsolver.test: New file. * tests/Makefile.am: Add it. * tests/python/games.ipynb: More exemples. * NEWS: Mention the new feature.
265 lines
4.2 KiB
Bash
Executable file
265 lines
4.2 KiB
Bash
Executable file
#!/bin/sh
|
|
# -*- coding: utf-8 -*-
|
|
# Copyright (C) 2022 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
|
|
|
|
# This is example 6 is the manual of pgsolver 4.1
|
|
cat >example1.pg <<EOF
|
|
parity 4;
|
|
0 6 1 4,2 "Africa";
|
|
4 5 1 0 "Antarctica";
|
|
1 8 1 2,4,3 "America";
|
|
3 6 0 4,2 "Australia";
|
|
2 7 0 3,1,0,4 "Asia";
|
|
EOF
|
|
autfilt example1.pg >out
|
|
|
|
rest='(Fin(6) & (Inf(5) | (Fin(4) & (Inf(3) | (Fin(2) & (Inf(1) | Fin(0)))))))'
|
|
cat >example1.hoa <<EOF
|
|
HOA: v1
|
|
States: 5
|
|
Start: 0
|
|
AP: 0
|
|
acc-name: parity max odd 9
|
|
Acceptance: 9 Fin(8) & (Inf(7) | $rest)
|
|
properties: trans-labels explicit-labels state-acc colored complete
|
|
spot-state-player: 1 1 0 0 1
|
|
--BODY--
|
|
State: 0 "Africa" {6}
|
|
[t] 4
|
|
[t] 2
|
|
State: 1 "America" {8}
|
|
[t] 2
|
|
[t] 4
|
|
[t] 3
|
|
State: 2 "Asia" {7}
|
|
[t] 3
|
|
[t] 1
|
|
[t] 0
|
|
[t] 4
|
|
State: 3 "Australia" {6}
|
|
[t] 4
|
|
[t] 2
|
|
State: 4 "Antarctica" {5}
|
|
[t] 0
|
|
--END--
|
|
EOF
|
|
|
|
diff out example1.hoa
|
|
|
|
# The first line should be optional
|
|
sed 1d example1.pg | autfilt example1.pg >out
|
|
diff out example1.hoa
|
|
|
|
|
|
# Test streaming.
|
|
cat >example2.pg <<EOF
|
|
parity 10;
|
|
0 0 1 4,9;
|
|
1 2 1 5,2;
|
|
2 4 0 6,1;
|
|
3 5 0 0,2;
|
|
4 6 0 6,3;
|
|
5 8 1 7,8;
|
|
6 10 1 0,8;
|
|
7 11 1 5,1;
|
|
8 13 0 1,3;
|
|
9 14 1 5,6;
|
|
parity 20;
|
|
0 0 0 6,5;
|
|
1 2 1 13,0;
|
|
2 4 0 7,18;
|
|
3 5 0 8,4;
|
|
4 6 0 0,19;
|
|
5 8 0 12,18;
|
|
6 9 0 16,17;
|
|
7 11 1 14,2;
|
|
8 13 1 15,1;
|
|
9 15 0 11,10;
|
|
10 16 1 14,9;
|
|
11 17 1 16,14;
|
|
12 19 1 9,1;
|
|
13 21 0 11,17;
|
|
14 22 1 12,8;
|
|
15 24 1 5,1;
|
|
16 26 1 13,7;
|
|
17 28 1 10,1;
|
|
18 29 1 12,6;
|
|
19 30 1 13,10;
|
|
never { /* false */
|
|
accept_init:
|
|
T0_init:
|
|
do
|
|
:: atomic { (false) -> assert(!(false)) }
|
|
od;
|
|
accept_all:
|
|
skip
|
|
}
|
|
EOF
|
|
autfilt example2.pg >out
|
|
parity15=`randaut -A'parity max odd 15' -Q1 0 | grep Acceptance`
|
|
parity31=`randaut -A'parity max odd 31' -Q1 0 | grep Acceptance`
|
|
cat > example2.hoa <<EOF
|
|
HOA: v1
|
|
States: 10
|
|
Start: 0
|
|
AP: 0
|
|
acc-name: parity max odd 15
|
|
$parity15
|
|
properties: trans-labels explicit-labels state-acc colored complete
|
|
spot-state-player: 1 1 0 0 0 1 1 1 0 1
|
|
--BODY--
|
|
State: 0 {0}
|
|
[t] 4
|
|
[t] 9
|
|
State: 1 {2}
|
|
[t] 5
|
|
[t] 2
|
|
State: 2 {4}
|
|
[t] 6
|
|
[t] 1
|
|
State: 3 {5}
|
|
[t] 0
|
|
[t] 2
|
|
State: 4 {6}
|
|
[t] 6
|
|
[t] 3
|
|
State: 5 {8}
|
|
[t] 7
|
|
[t] 8
|
|
State: 6 {10}
|
|
[t] 0
|
|
[t] 8
|
|
State: 7 {11}
|
|
[t] 5
|
|
[t] 1
|
|
State: 8 {13}
|
|
[t] 1
|
|
[t] 3
|
|
State: 9 {14}
|
|
[t] 5
|
|
[t] 6
|
|
--END--
|
|
HOA: v1
|
|
States: 20
|
|
Start: 0
|
|
AP: 0
|
|
acc-name: parity max odd 31
|
|
$parity31
|
|
properties: trans-labels explicit-labels state-acc colored complete
|
|
spot-state-player: 0 1 0 0 0 0 0 1 1 0 1 1 1 0 1 1 1 1 1 1
|
|
--BODY--
|
|
State: 0 {0}
|
|
[t] 6
|
|
[t] 5
|
|
State: 1 {2}
|
|
[t] 13
|
|
[t] 0
|
|
State: 2 {4}
|
|
[t] 7
|
|
[t] 18
|
|
State: 3 {5}
|
|
[t] 8
|
|
[t] 4
|
|
State: 4 {6}
|
|
[t] 0
|
|
[t] 19
|
|
State: 5 {8}
|
|
[t] 12
|
|
[t] 18
|
|
State: 6 {9}
|
|
[t] 16
|
|
[t] 17
|
|
State: 7 {11}
|
|
[t] 14
|
|
[t] 2
|
|
State: 8 {13}
|
|
[t] 15
|
|
[t] 1
|
|
State: 9 {15}
|
|
[t] 11
|
|
[t] 10
|
|
State: 10 {16}
|
|
[t] 14
|
|
[t] 9
|
|
State: 11 {17}
|
|
[t] 16
|
|
[t] 14
|
|
State: 12 {19}
|
|
[t] 9
|
|
[t] 1
|
|
State: 13 {21}
|
|
[t] 11
|
|
[t] 17
|
|
State: 14 {22}
|
|
[t] 12
|
|
[t] 8
|
|
State: 15 {24}
|
|
[t] 5
|
|
[t] 1
|
|
State: 16 {26}
|
|
[t] 13
|
|
[t] 7
|
|
State: 17 {28}
|
|
[t] 10
|
|
[t] 1
|
|
State: 18 {29}
|
|
[t] 12
|
|
[t] 6
|
|
State: 19 {30}
|
|
[t] 13
|
|
[t] 10
|
|
--END--
|
|
HOA: v1
|
|
States: 2
|
|
Start: 0
|
|
AP: 0
|
|
acc-name: Buchi
|
|
Acceptance: 1 Inf(0)
|
|
properties: trans-labels explicit-labels state-acc colored
|
|
properties: deterministic
|
|
--BODY--
|
|
State: 0 {0}
|
|
[f] 1
|
|
State: 1 {0}
|
|
[t] 1
|
|
--END--
|
|
EOF
|
|
diff out example2.hoa
|
|
|
|
|
|
cat >example3.pg <<EOF
|
|
parity 4;
|
|
0 6 1 4,2;
|
|
4 5 1 0;
|
|
1 8 1 2,4,3;
|
|
3 6 20 4,2;
|
|
2 7 3 3,1,0,4;
|
|
EOF
|
|
autfilt example3.pg >stdout 2>stderr && exit 1
|
|
cat >expected.err<<EOF
|
|
example3.pg:5.5-6: node owner should be 0 or 1
|
|
example3.pg:6.5: node owner should be 0 or 1
|
|
EOF
|
|
diff stderr expected.err
|
|
sed 's/ ".*"//g' example1.hoa > example3.hoa
|
|
diff stdout example3.hoa
|