simulation: Fix co-simulation and iterated simulations of BA automata

* src/tgbaalgos/simulation.hh, src/tgbaalgos/simulation.cc
(simulation_sba, cosimulation_sba, iterated_simulations_sba): New
function.  Also speedup the existing functions by avoiding
add_acceptince_conditions() and add_conditions().  Finally, use
scc_filter_states() when dealing with degeneralized automata.
* src/tgbaalgos/postproc.cc, src/tgbaalgos/postproc.hh (do_ba_simul):
New method.  Use it after degeneralization.
* src/tgba/tgbaexplicit.hh (get_transition, get_state): New methods.
* src/tgbatest/basimul.test: New file.
* src/tgbatest/Makefile.am (TESTS): Add it.
* NEWS: Introduce the new function and summarize the bug.
This commit is contained in:
Alexandre Duret-Lutz 2013-05-12 17:49:20 +02:00
parent 372790a489
commit 0c7c933805
8 changed files with 303 additions and 110 deletions

76
src/tgbatest/basimul.test Executable file
View file

@ -0,0 +1,76 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013 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
ltl2tgba=../../bin/ltl2tgba
# This bug was found while working on the state-based acceptance
# output for the LBTT format. Using ba-simul=2 causes reverse
# simulation to be applied to the BA automaton obtained after
# degeneralization. Unfortunately in Spot 1.1, reverse simulation is
# only implemented on TGBA, and when applied to a TGBA that is a BA,
# it may merge one state that is accepting with one state that is not
# accepting, just because they have the same incoming transitions.
# (Applying direct simulation on a TGBA that is a BA is not a problem,
# since an accepting state will never have the same outgoing
# transitions as a BA.)
# In previous tests, we did not notice the bug because the --lbtt
# output was always using transition-based acceptance (the equivalent
# of --lbtt=t today), so the result of the reverse-simulation on the
# BA was output as a TGBA with a single acceptance set, and some state
# had both accepting and non-accepting transitions because of the
# merge. Unfortunately, this is not a Büchi automaton. Using the
# --spin output, or the new (state-based) --lbtt output highlights the
# bug.
# In the cases below, the following configurations used to fail
# cross-comparison with the other "sane" configurations, at least
# with the first formula. (The other three formulas were added because
# they also triggered related issues while debugging the first one.)
# --lbtt -x ba-simul=2
# --lbtt -x ba-simul=3
# --spin -x ba-simul=2
# --spin -x ba-simul=3
for seed in 1 2 3; do
../../bin/ltlcross --seed=$seed --density=0.$seed \
-f 'X((F(Xa | b) W c) U (Xc W (a & d)))' \
-f '((<> p5 V ((p0 U p1) <-> (p5 \/ p1))) -> ((<> p4 V p2) M p2))' \
-f '!p2 & (Fp5 R (((p0 U p1) & (p5 | p1)) | (!p5 & (!p0 R !p1))))' \
-f '! ((p0 /\ p4) <-> ! ((! p0 U (p0 W p4)) /\ (X p5 -> ([] p3 /\ p5))))' \
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=0 %f >%T" \
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=1 %f >%T" \
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=2 %f >%T" \
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=3 %f >%T" \
"$ltl2tgba --ba --high --lbtt -x ba-simul=0 %f >%T" \
"$ltl2tgba --ba --high --lbtt -x ba-simul=1 %f >%T" \
"$ltl2tgba --ba --high --lbtt -x ba-simul=2 %f >%T" \
"$ltl2tgba --ba --high --lbtt -x ba-simul=3 %f >%T" \
"$ltl2tgba --ba --high --spin -x ba-simul=0 %f >%N" \
"$ltl2tgba --ba --high --spin -x ba-simul=1 %f >%N" \
"$ltl2tgba --ba --high --spin -x ba-simul=2 %f >%N" \
"$ltl2tgba --ba --high --spin -x ba-simul=3 %f >%N"
done