improve support for LTLf semantics

* spot/twaalgos/remprop.cc, spot/twaalgos/remprop.hh (to_finite): New
function.
* bin/autfilt.cc (--to-finite): Add it.
* doc/org/tut12.org: Update to use it.
* spot/twa/twagraph.cc (purge_dead_states): Also remove false edges.
* spot/parseaut/parseaut.yy: Do not ignore false self-loops, and
add false self-loop on accepting states without successors.
* NEWS: List the above changes.
* tests/core/ltlf.test: New file.
* tests/Makefile.am: Add it.
* tests/core/complete.test: Adjust expected output.
This commit is contained in:
Alexandre Duret-Lutz 2022-02-07 14:44:04 +01:00
parent 9b0a20412b
commit a3753e608b
10 changed files with 416 additions and 83 deletions

View file

@ -272,6 +272,7 @@ TESTS_twa = \
core/degenscc.test \
core/randomize.test \
core/lbttparse.test \
core/ltlf.test \
core/scc.test \
core/sccdot.test \
core/sccif.test \

View file

@ -1,6 +1,6 @@
#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2017 Laboratoire de Recherche et Développement
# Copyright (C) 2015-2017, 2022 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
#
# This file is part of Spot, a model checking library.
@ -236,6 +236,7 @@ properties: deterministic univ-branch
State: 0 {0}
[t] 0
State: 1 {0}
[f] 1
[t] 0
--END--
EOF
@ -272,7 +273,8 @@ properties: trans-labels explicit-labels state-acc deterministic
properties: univ-branch
--BODY--
State: 0
State: 1
State: 1 {0}
[f] 1
--END--
EOF
diff out expected

175
tests/core/ltlf.test Executable file
View file

@ -0,0 +1,175 @@
#! /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
# 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: 2
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] 3
State: 3
[0&1] 1
--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: 1
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] 2
State: 2
[0] 0
--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