Add a remove_fin() algorithm

* src/bin/autfilt.cc: Add remove_fin().
* src/tgba/acc.cc, src/tgba/acc.hh: Add is_dnf() and simplify eval().
* src/tgbaalgos/remfin.cc, src/tgbaalgos/remfin.hh: New files.
* src/tgbaalgos/Makefile.am: Add them.
* src/tgbatest/remfin.test: New file.
* src/tgbatest/Makefile.am: Add it.
This commit is contained in:
Alexandre Duret-Lutz 2015-02-24 09:10:20 +01:00
parent 1441c4fe34
commit 85508a0ea6
8 changed files with 667 additions and 24 deletions

View file

@ -72,6 +72,7 @@ TESTS = \
det.test \
neverclaimread.test \
hoaparse.test \
remfin.test \
dstar.test \
readsave.test \
ltldo.test \

266
src/tgbatest/remfin.test Executable file
View file

@ -0,0 +1,266 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2015 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
autfilt=../../bin/autfilt
cat >test1 <<EOF
/*
** This was a TGBA for GFa & GFb, but
** the acceptance has been changed to Fin(0)|Fin(1)
** so this is now the complement automaton.
**/
HOA: v1
States: 1
Start: 0
AP: 2 "a" "b"
Acceptance: 2 Fin(0)|Fin(1)
--BODY--
State: 0
[0&1] 0 {0 1}
[!0&!1] 0
[!0&1] 0 {1}
[0&!1] 0 {0}
--END--
/*
** This one has a mix of Inf and Fin acceptance, but no interference
** between the Fin sets
**/
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
Acceptance: 5 Inf(0)&Fin(1)&Fin(3) | Inf(2)&Inf(3) | Inf(4)
--BODY--
State: 0
[t] 0
[0] 1 {1}
[!0] 2 {0}
State: 1
[1] 0
[0&1] 1 {0}
[!0&1] 2 {2}
State: 2
[!1] 0
[0&!1] 1 {0}
[!0&!1] 2 {0}
--END--
/*
** This one is similar, but Inf(0) is ised in two terms, so
** we to introduce extra sets in the output.
**/
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 4 Inf(0)&Fin(1)&Fin(3) | Inf(2)&Inf(3) | Inf(0)
--BODY--
State: 0
[t] 0
[0] 1 {1}
[!0] 2 {0}
State: 1
[1] 0
[0&1] 1 {0}
[!0&1] 2 {2}
State: 2
[!1] 0
[0&!1] 1 {0}
[!0&!1] 2 {0}
--END--
/*
** The t and f acceptance.
*/
HOA: v1
States: 1
Start: 0
Acceptance: 0 f
--BODY--
State: 0
--END--
HOA: v1
States: 1
Start: 0
Acceptance: 0 t
--BODY--
State: 0
[t] 0
--END--
/* An example from ltl2dstar.
** No new state should be added.
*/
HOA: v1
States: 2
acc-name: Rabin 1
Acceptance: 2 (Fin(0)&Inf(1))
Start: 0
AP: 1 "p0"
--BODY--
State: 0 {}
0
1
State: 1 {1}
1
1
--END--
EOF
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
Acceptance: 3 Inf(2)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[0&1] 0
[!0&!1] 0
[!0&1] 0
[0&!1] 0
[!0&!1] 1
[!0&1] 1
[!0&!1] 2
[0&!1] 2
State: 1 {2}
[!0&!1] 1
[!0&1] 1
State: 2 {2}
[!0&!1] 2
[0&!1] 2
--END--
HOA: v1
States: 6
Start: 0
AP: 2 "a" "b"
Acceptance: 5 Inf(0) | Inf(4) | (Inf(2)&Inf(3))
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[t] 0
[0] 1
[!0] 2
[t] 3
State: 1
[1] 0
[0&1] 1
[!0&1] 2 {2}
[1] 3
[0&1] 4
State: 2
[!1] 0
[0&!1] 1
[!0&!1] 2
[!1] 3
[0&!1] 4
[!0&!1] 5
State: 3
[t] 3
[!0] 5 {0}
State: 4
[1] 3
[0&1] 4 {0}
[!0&1] 5
State: 5
[!1] 3
[0&!1] 4 {0}
[!0&!1] 5 {0}
--END--
HOA: v1
States: 6
Start: 0
AP: 2 "a" "b"
Acceptance: 6 (Inf(0)&Inf(5)) | ((Inf(0) | (Inf(2)&Inf(3))) & Inf(4))
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[t] 0 {4}
[0] 1 {4}
[!0] 2 {0 4}
[t] 3 {4}
State: 1
[1] 0 {4}
[0&1] 1 {0 4}
[!0&1] 2 {2 4}
[1] 3 {4}
[0&1] 4 {0 4}
State: 2
[!1] 0 {4}
[0&!1] 1 {0 4}
[!0&!1] 2 {0 4}
[!1] 3 {4}
[0&!1] 4 {0 4}
[!0&!1] 5 {0 4}
State: 3
[t] 3 {5}
[!0] 5 {0 5}
State: 4
[1] 3 {5}
[0&1] 4 {0 5}
[!0&1] 5 {5}
State: 5
[!1] 3 {5}
[0&!1] 4 {0 5}
[!0&!1] 5 {0 5}
--END--
HOA: v1
States: 1
Start: 0
AP: 0
Acceptance: 0 f
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
--END--
HOA: v1
States: 1
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete deterministic
--BODY--
State: 0
[t] 0
--END--
HOA: v1
States: 2
Start: 0
AP: 1 "p0"
Acceptance: 2 Inf(1)
properties: trans-labels explicit-labels state-acc complete deterministic
--BODY--
State: 0
[!0] 0
[0] 1
State: 1 {1}
[!0] 1
[0] 1
--END--
EOF
run 0 $autfilt -H --remove-fin test1 > output
cat output
diff -u output expected