spot/tests/core/ltlf.test
Alexandre Duret-Lutz a117fe1a22 to_finit: fix issue #526
* spot/twaalgos/remprop.cc: Use bdd_restrict instead of bdd_exists.
* tests/core/ltlf.test: Add test case.
* NEWS: Mention the bug.
2023-02-07 14:40:20 +01:00

224 lines
3.8 KiB
Bash
Executable file

#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2022, 2023 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
# ltlfilt --from-ltlf is also tested in ltlfilt.test
ltlfilt --from-ltlf=A -f 'a & Xa' -f 'a & X[!]a' \
-f '(a U b) & (F(c) | F(d & X(0)))' >out
cat >expected<<EOF
A & a & X(!A | a) & (A U G!A)
A & a & X(A & a) & (A U G!A)
A & (a U (A & b)) & (F(A & c) | F(A & d & X!A)) & (A U G!A)
EOF
diff expected out
ltl2tgba -B -F out > out2
cat >expected2<<EOF
HOA: v1
name: "A & a & X(!A | a) & (A U G!A)"
States: 4
Start: 1
AP: 2 "A" "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
properties: very-weak
--BODY--
State: 0 {0}
[!0] 0
State: 1
[0&1] 2
State: 2
[!0] 0
[0&1] 3
State: 3
[!0] 0
[0] 3
--END--
HOA: v1
name: "a & X(A & a) & (A U G!A)"
States: 4
Start: 3
AP: 2 "A" "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
properties: very-weak
--BODY--
State: 0 {0}
[!0] 0
State: 1
[!0] 0
[0] 1
State: 2
[0&1] 1
State: 3
[0&1] 2
--END--
HOA: v1
name: "(a U (A & b)) & (A U G!A) & F((A & c) | (A & d & X!A))"
States: 5
Start: 0
AP: 5 "A" "b" "a" "c" "d"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc very-weak
--BODY--
State: 0
[0&!1&2&!3] 0
[0&1&3] 1
[0&1&!3] 2
[0&!1&2&3] 3
[0&1&!3&4] 4
State: 1
[0] 1
[!0] 4
State: 2
[0&3] 1
[0&!3] 2
[0&!3&4] 4
State: 3
[0&1] 1
[0&!1&2] 3
State: 4 {0}
[!0] 4
--END--
EOF
diff expected2 out2
autfilt --to-finite=A out2 >out3
cat >expected3 <<EOF
HOA: v1
States: 3
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[0] 1
State: 1 {0}
[0] 2
State: 2 {0}
[t] 2
--END--
HOA: v1
States: 3
Start: 2
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0 {0}
[t] 0
State: 1
[0] 0
State: 2
[0] 1
--END--
HOA: v1
States: 5
Start: 0
AP: 4 "b" "a" "c" "d"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[!0&1&!2] 0
[0&2] 1
[0&!2] 2
[!0&1&2] 3
[0&!2&3] 4
State: 1 {0}
[t] 1
State: 2
[2] 1
[!2] 2
[!2&3] 4
State: 3
[0] 1
[!0&1] 3
State: 4 {0}
[f] 4
--END--
EOF
diff expected3 out3
autfilt out3 > out4
diff out3 out4
# Removing the [f] lines should not change anything for autfilt
grep -v '\[f\]' out4 > out3
cmp out3 out4 && exit 1 # make sure we did remove something
autfilt out3 > out4
diff out4 expected3
# Issue #526
ltlfilt -f '(i->XXo)|G(i<->Xo2)' --from-ltlf | ltl2tgba -D |\
autfilt -C --to-finite > out
cat >exp <<EOF
HOA: v1
States: 9
Start: 0
AP: 3 "o" "o2" "i"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0 {0}
[2] 6
[!2] 7
State: 1
[!1&!2] 1
[!1&2] 5
[1] 8
State: 2 {0}
[0] 7
[!0] 8
State: 3 {0}
[!0&!1&!2] 1
[!0&!1&2] 5
[0] 7
[!0&1] 8
State: 4 {0}
[!0&1&!2] 1
[!0&1&2] 5
[0] 7
[!0&!1] 8
State: 5 {0}
[1&!2] 1
[1&2] 5
[!1] 8
State: 6 {0}
[!1] 2
[1&!2] 3
[1&2] 4
State: 7 {0}
[t] 7
State: 8
[t] 8
--END--
EOF
diff out exp