autfilt: add a --track-formula option

Fixes #591.

* spot/twaalgos/matchstates.cc,
spot/twaalgos/matchstates.hh (match_states_decorate): New function.
* bin/autfilt.cc: Add a --track-formula option.
* tests/core/trackf.test: New file.
* tests/Makefile.am: Test it.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2024-08-30 11:38:26 +02:00
parent 3d3e87948c
commit c5d991e55c
6 changed files with 171 additions and 5 deletions

View file

@ -316,6 +316,7 @@ TESTS_twa = \
core/sbacc.test \
core/stutter-tgba.test \
core/strength.test \
core/trackf.test \
core/emptchk.test \
core/emptchke.test \
core/dfs.test \

123
tests/core/trackf.test Executable file
View file

@ -0,0 +1,123 @@
#!/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 <http://www.gnu.org/licenses/>.
. ./defs
set -e
ltl2tgba -D 'Ga | Gb | Gc' |
autfilt --track-formula='Ga | Gb | Gc' > out
cat >exp <<EOF
HOA: v1
name: "Ga | Gb | Gc"
States: 7
Start: 6
AP: 3 "a" "b" "c"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
properties: stutter-invariant very-weak
--BODY--
State: 0 "Gc"
[2] 0
State: 1 "Gb | Gc"
[!1&2] 0
[1&2] 1
[1&!2] 2
State: 2 "Gb"
[1] 2
State: 3 "Ga"
[0] 3
State: 4 "Ga | Gc"
[!0&2] 0
[0&!2] 3
[0&2] 4
State: 5 "Ga | Gb"
[!0&1] 2
[0&!1] 3
[0&1] 5
State: 6 "Ga | Gb | Gc"
[!0&!1&2] 0
[!0&1&2] 1
[!0&1&!2] 2
[0&!1&!2] 3
[0&!1&2] 4
[0&1&!2] 5
[0&1&2] 6
--END--
EOF
diff out exp
ltl2tgba 'Ga | Gb | Gc' | autfilt --track-formula='Ga | Gb | Gc' > out
cat >exp <<EOF
HOA: v1
name: "Ga | Gb | Gc"
States: 4
Start: 0
AP: 3 "a" "b" "c"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc stutter-invariant
properties: very-weak
--BODY--
State: 0 "Ga | Gb | Gc"
[0] 1
[1] 2
[2] 3
State: 1 "Ga | Gb | Gc"
[0] 1
State: 2 "Ga | Gb | Gc"
[1] 2
State: 3 "Ga | Gb | Gc"
[2] 3
--END--
EOF
diff out exp
ltl2tgba --low -U 'a U b U c' | autfilt --track-formula='a U b U c' > out
cat >exp <<EOF
HOA: v1
name: "a U (b U c)"
States: 4
Start: 0
AP: 3 "a" "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc unambiguous
properties: stutter-invariant
--BODY--
State: 0 "a U (b U c)"
[0&!1&!2] 0
[2] 1 {0}
[1&!2] 2
[0&1&!2] 3
State: 1 "1"
[t] 1 {0}
State: 2 "a U (b U c)"
[2] 1 {0}
[1&!2] 2
State: 3 "a U (b U c)"
[0&!1&!2] 0
[0&1&!2] 3
--END--
EOF
diff out exp