spot/tests/core/parity2.test
Alexandre Duret-Lutz 7a65bdf6bc specialized translation for GF(guarantee) and FG(safety)
This is adapted from a proposition in a paper by J. Esparza,
J. Křentínský, and S. Sickert, submitted to LICS'18.  We should add
proper references to the code and documentation once that paper is
accepted.

* spot/twaalgos/gfguarantee.cc, spot/twaalgos/gfguarantee.hh:
New files.
* spot/twaalgos/Makefile.am, python/spot/impl.i: Add them.
* spot/twa/fwd.hh: Add a forward declaration of bdd_dict_ptr.
* spot/twaalgos/postproc.cc, spot/twaalgos/postproc.hh: Make it
possible to call finalize() from the translator subclass.  Constify
all the do_* functions while we are there.
* spot/twaalgos/translate.cc, spot/twaalgos/translate.hh: Add
a "gf-guarantee" option to decide whether to use the new translation.
* bin/spot-x.cc: Document it.
* tests/core/dca2.test, tests/core/genltl.test,
tests/core/ltl2tgba2.test, tests/core/parity2.test,
tests/core/satmin.test, tests/python/automata.ipynb,
tests/python/sbacc.py: Adjust test cases.
* tests/python/except.py: Add a couple more tests.
2018-03-28 18:20:46 +02:00

850 lines
15 KiB
Bash
Executable file

#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2018 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
rm -rf res res2
for x in P 'Pmin odd' 'Pmax even' p 'pmin odd' 'pmax even'; do
ltl2tgba "-$x" FGa 'GFa & GFb' >>res
ltl2tgba FGa 'GFa & GFb' | autfilt --name=%M --high "-$x" >>res2
ltl2tgba -D "-$x" FGa 'GFa & GFb' >>res3
ltl2tgba FGa 'GFa & GFb' | autfilt -D --name=%M --high "-$x" >>res4
done
cat >expected<<EOF
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: co-Buchi
Acceptance: 1 Fin(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0] 0
[!0] 0 {0}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {0}
[!1] 0
[!0&1] 1
State: 1
[0] 0 {0}
[!0] 1
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: co-Buchi
Acceptance: 1 Fin(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0] 0
[!0] 0 {0}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {1}
[!1] 0
[!0&1] 1
State: 1
[0] 0 {1}
[!0] 1
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: parity max even 2
Acceptance: 2 Fin(1) & Inf(0)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0] 0 {0}
[!0] 0 {1}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {0}
[!1] 0
[!0&1] 1
State: 1
[0] 0 {0}
[!0] 1
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: parity max even 2
Acceptance: 2 Fin(1) & Inf(0)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0] 0 {0}
[!0] 0 {1}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Streett 1
Acceptance: 2 Fin(0) | Inf(1)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {1}
[!1] 0 {0}
[!0&1] 1 {0}
State: 1
[0] 0 {1}
[!0] 1 {0}
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0] 0 {1}
[!0] 0 {0}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: parity min odd 3
Acceptance: 3 Fin(0) & (Inf(1) | Fin(2))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {1}
[!1] 0 {2}
[!0&1] 1 {2}
State: 1
[0] 0 {1}
[!0] 1 {2}
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: parity max even 2
Acceptance: 2 Fin(1) & Inf(0)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0] 0 {0}
[!0] 0 {1}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: parity max even 3
Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {2}
[!1] 0 {1}
[!0&1] 1 {1}
State: 1
[0] 0 {2}
[!0] 1 {1}
--END--
EOF
diff expected res
cat >expected2<<EOF
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc stutter-invariant
properties: inherently-weak
--BODY--
State: 0
[t] 0
[0] 1
State: 1 {0}
[0] 1
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {0}
[!1] 0
[!0&1] 1
State: 1
[0] 0 {0}
[!0] 1
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels state-acc stutter-invariant
properties: inherently-weak
--BODY--
State: 0
[t] 0
[0] 1
State: 1 {1}
[0] 1
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {1}
[!1] 0
[!0&1] 1
State: 1
[0] 0 {1}
[!0] 1
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc stutter-invariant
properties: inherently-weak
--BODY--
State: 0
[t] 0
[0] 1
State: 1 {0}
[0] 1
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {0}
[!1] 0
[!0&1] 1
State: 1
[0] 0 {0}
[!0] 1
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: Streett 1
Acceptance: 2 Fin(0) | Inf(1)
properties: trans-labels explicit-labels state-acc colored
properties: stutter-invariant inherently-weak
--BODY--
State: 0 {0}
[t] 0
[0] 1
State: 1 {1}
[0] 1
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Streett 1
Acceptance: 2 Fin(0) | Inf(1)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {1}
[!1] 0 {0}
[!0&1] 1 {0}
State: 1
[0] 0 {1}
[!0] 1 {0}
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: parity min odd 3
Acceptance: 3 Fin(0) & (Inf(1) | Fin(2))
properties: trans-labels explicit-labels state-acc colored
properties: stutter-invariant inherently-weak
--BODY--
State: 0 {2}
[t] 0
[0] 1
State: 1 {1}
[0] 1
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: parity min odd 3
Acceptance: 3 Fin(0) & (Inf(1) | Fin(2))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {1}
[!1] 0 {2}
[!0&1] 1 {2}
State: 1
[0] 0 {1}
[!0] 1 {2}
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: parity max even 3
Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))
properties: trans-labels explicit-labels state-acc colored
properties: stutter-invariant inherently-weak
--BODY--
State: 0 {1}
[t] 0
[0] 1
State: 1 {2}
[0] 1
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: parity max even 3
Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {2}
[!1] 0 {1}
[!0&1] 1 {1}
State: 1
[0] 0 {2}
[!0] 1 {1}
--END--
EOF
diff expected2 res2
cat >expected3<<EOF
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: co-Buchi
Acceptance: 1 Fin(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0 {0}
[0] 0
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 1
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!1] 0
[1] 1 {0}
State: 1
[0&!1] 0
[!0] 1
[0&1] 1 {0}
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: co-Buchi
Acceptance: 1 Fin(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0 {0}
[0] 0
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 1
AP: 2 "a" "b"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!1] 0
[1] 1 {1}
State: 1
[0&!1] 0
[!0] 1
[0&1] 1 {1}
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: parity max even 2
Acceptance: 2 Fin(1) & Inf(0)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0 {1}
[0] 0 {0}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 1
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!1] 0
[1] 1 {0}
State: 1
[0&!1] 0
[!0] 1
[0&1] 1 {0}
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: parity max even 2
Acceptance: 2 Fin(1) & Inf(0)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0 {1}
[0] 0 {0}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 1
AP: 2 "a" "b"
acc-name: Streett 1
Acceptance: 2 Fin(0) | Inf(1)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!1] 0 {0}
[1] 1 {1}
State: 1
[0&!1] 0 {0}
[!0] 1 {0}
[0&1] 1 {1}
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0 {0}
[0] 0 {1}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 1
AP: 2 "a" "b"
acc-name: parity min odd 3
Acceptance: 3 Fin(0) & (Inf(1) | Fin(2))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!1] 0 {2}
[1] 1 {1}
State: 1
[0&!1] 0 {2}
[!0] 1 {2}
[0&1] 1 {1}
--END--
HOA: v1
name: "FGa"
States: 1
Start: 0
AP: 1 "a"
acc-name: parity max even 2
Acceptance: 2 Fin(1) & Inf(0)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0 {1}
[0] 0 {0}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 1
AP: 2 "a" "b"
acc-name: parity max even 3
Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!1] 0 {1}
[1] 1 {2}
State: 1
[0&!1] 0 {1}
[!0] 1 {1}
[0&1] 1 {2}
--END--
EOF
diff expected3 res3
cat >expected4<<EOF
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0
[0] 1 {1}
State: 1
[!0] 0 {0}
[0] 1 {1}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {0}
[!1] 0
[!0&1] 1
State: 1
[0] 0 {0}
[!0] 1
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0
[0] 1 {1}
State: 1
[!0] 0 {0}
[0] 1 {1}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {1}
[!1] 0
[!0&1] 1
State: 1
[0] 0 {1}
[!0] 1
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: parity max even 2
Acceptance: 2 Fin(1) & Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0
[0] 1 {0}
State: 1
[!0] 0 {1}
[0] 1 {0}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {0}
[!1] 0
[!0&1] 1
State: 1
[0] 0 {0}
[!0] 1
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: parity min odd 3
Acceptance: 3 Fin(0) & (Inf(1) | Fin(2))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0 {2}
[0] 1 {1}
State: 1
[!0] 0 {0}
[0] 1 {1}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Streett 1
Acceptance: 2 Fin(0) | Inf(1)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {1}
[!1] 0 {0}
[!0&1] 1 {0}
State: 1
[0] 0 {1}
[!0] 1 {0}
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: parity min odd 3
Acceptance: 3 Fin(0) & (Inf(1) | Fin(2))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0 {2}
[0] 1 {1}
State: 1
[!0] 0 {0}
[0] 1 {1}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: parity min odd 3
Acceptance: 3 Fin(0) & (Inf(1) | Fin(2))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {1}
[!1] 0 {2}
[!0&1] 1 {2}
State: 1
[0] 0 {1}
[!0] 1 {2}
--END--
HOA: v1
name: "FGa"
States: 2
Start: 0
AP: 1 "a"
acc-name: parity max even 4
Acceptance: 4 Fin(3) & (Inf(2) | (Fin(1) & Inf(0)))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0] 0 {1}
[0] 1 {2}
State: 1
[!0] 0 {3}
[0] 1 {2}
--END--
HOA: v1
name: "G(Fa & Fb)"
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: parity max even 3
Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&1] 0 {2}
[!1] 0 {1}
[!0&1] 1 {1}
State: 1
[0] 0 {2}
[!0] 1 {1}
--END--
EOF
diff expected4 res4
ltlcross 'ltl2tgba -P' 'ltl2tgba -P"odd max"' 'ltl2tgba -P"even min"' \
'ltl2tgba -p' 'ltl2tgba -p"odd max"' 'ltl2tgba -p"even min"' \
-f FGa -f 'GFa&GFb' -f 'GF(a <-> XXXb)'