Remove ltl2tgba_lacim and all supporting classes.

This translator algorithm is seldom used in practice because we work
with explicit automata everywhere, and this is only useful to build
symbolic automata.  Furthermore, the symbolic automata produced by this
algorithm are larger (when looked at explicitly) than those produced by
ltl2tgba_fm or other explicit translators.

The nice side effect of this removal is that we can also remove a lot of
supporting classes, that were relying a lot on BDDs.

* src/tgba/public.hh, src/tgba/statebdd.cc, src/tgba/statebdd.hh,
src/tgba/succiterconcrete.cc, src/tgba/succiterconcrete.hh,
src/tgba/tgbabddconcrete.cc, src/tgba/tgbabddconcrete.hh,
src/tgba/tgbabddconcretefactory.cc, src/tgba/tgbabddconcretefactory.hh,
src/tgba/tgbabddconcreteproduct.cc, src/tgba/tgbabddconcreteproduct.hh,
src/tgba/tgbabddcoredata.cc, src/tgba/tgbabddcoredata.hh,
src/tgba/tgbabddfactory.hh, src/tgbaalgos/ltl2tgba_lacim.cc,
src/tgbaalgos/ltl2tgba_lacim.hh, src/tgbatest/bddprod.test,
src/tgbatest/mixprod.cc, src/tgbatest/mixprod.test: Delete all these
files.
* bench/ltlcounter/Makefile.am, bench/ltlcounter/README,
bench/ltlcounter/plot.gnu, bench/ltlcounter/run, src/tgba/Makefile.am,
src/tgbaalgos/Makefile.am, src/tgbatest/Makefile.am,
src/tgbatest/cycles.test, src/tgbatest/dupexp.test,
src/tgbatest/emptchk.test, src/tgbatest/ltl2tgba.cc,
src/tgbatest/ltl2tgba.test, src/tgbatest/ltlcross.test,
src/tgbatest/ltlprod.cc, src/tgbatest/spotlbtt.test,
src/tgbatest/wdba.test, src/tgbatest/wdba2.test,
src/tgba/tgbaexplicit.hh, wrap/python/ajax/ltl2tgba.html,
wrap/python/ajax/spot.in, wrap/python/spot.i,
wrap/python/tests/interdep.py, wrap/python/tests/ltl2tgba.py,
wrap/python/tests/ltl2tgba.test: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2014-07-08 16:22:43 +02:00
parent 26b932828b
commit 116fe8654f
43 changed files with 111 additions and 2291 deletions

View file

@ -1,5 +1,5 @@
# Copyright (C) 2009 Laboratoire de Recherche et Développement de # Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
# l'EPITA (LRDE) # de l'EPITA (LRDE)
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
# #
@ -18,4 +18,4 @@
EXTRA_DIST = run plot.gnu EXTRA_DIST = run plot.gnu
CLEANFILES = results.fm results.lacim results.fm.eps results.lacim.eps CLEANFILES = results.fm results.taa results.fm.eps results.taa.eps

View file

@ -20,5 +20,5 @@ This benchmark used this familly of formulae to plot the performance
of the ltl2tgba_fm algorithm. Studying the behaviour of ltl2tgba_fm of the ltl2tgba_fm algorithm. Studying the behaviour of ltl2tgba_fm
on this class of formulae helped us to improve the translation. on this class of formulae helped us to improve the translation.
Execute "./run" to compute the raw numbers, then execture Execute "./run" to compute the raw numbers, then execute
"gnuplot plot.gnu" to plot the figures. "gnuplot plot.gnu" to plot the figures.

View file

@ -15,11 +15,11 @@ plot 'results.fm' using 1:($4+$5) '%lf,%lf,%lf,%lf,%*lf,%*lf,%lf,%*lf,%*lf' \
with lines title "States" with lines title "States"
set output 'results.lacim.eps' set output 'results.taa.eps'
plot 'results.lacim' using 1:($4+$5) '%lf,%lf,%lf,%lf,%*lf,%*lf,%lf,%*lf,%*lf' \ plot 'results.taa' using 1:($4+$5) '%lf,%lf,%lf,%lf,%*lf,%*lf,%lf,%*lf,%*lf' \
with filledcurve x1 title "Total Time" axes x1y2, \ with filledcurve x1 title "Total Time" axes x1y2, \
'results.lacim' using 1:4 '%lf,%lf,%lf,%lf,%*lf,%*lf,%lf,%*lf,%*lf' \ 'results.taa' using 1:4 '%lf,%lf,%lf,%lf,%*lf,%*lf,%lf,%*lf,%*lf' \
with filledcurve x1 title "Translation Time" axes x1y2, \ with filledcurve x1 title "Translation Time" axes x1y2, \
'results.lacim' using 1:2 '%lf,%lf,%lf,%lf,%*lf,%*lf,%lf,%*lf,%*lf' \ 'results.taa' using 1:2 '%lf,%lf,%lf,%lf,%*lf,%*lf,%lf,%*lf,%*lf' \
with lines title "States" with lines title "States"

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011, 2012, 2013 Laboratoire de Recherche # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire de
# et Développement de l'EPITA (LRDE) # Recherche et Développement de l'EPITA (LRDE)
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
# #
@ -35,18 +35,18 @@ for n in 1 2 3 4 5 6 7 8 9 10 11 12 13; do
echo $n,$states,$transitions,$time,$time2 echo $n,$states,$transitions,$time,$time2
done | tee results.fm done | tee results.fm
echo "# Benching ltl2tgba_lacim..." echo "# Benching ltl2taa..."
echo "# the following values are also saved to file 'results.lacim'" echo "# the following values are also saved to file 'results.taa'"
echo "# time1 = translation time" echo "# time1 = translation time"
echo "# time2 = exploration time" echo "# time2 = exploration time"
echo "# n, states, transitions, user time1, system time1, wall time1, user time1, system time2, wall time2" echo "# n, states, transitions, user time1, system time1, wall time1, user time1, system time2, wall time2"
for n in 1 2 3 4 5 6 7; do for n in 1 2 3 4 5 6 7; do
$LTL2TGBA -T -ks -l "`$gen --rv-counter-linear $n`" >out 2>&1 $LTL2TGBA -T -ks -taa "`$gen --rv-counter-linear $n`" >out 2>&1
states=`sed -n 's/^states: \([0-9]*\)$/\1/p' out` states=`sed -n 's/^states: \([0-9]*\)$/\1/p' out`
transitions=`sed -n 's/^transitions: \([0-9]*\)$/\1/p' out` transitions=`sed -n 's/^transitions: \([0-9]*\)$/\1/p' out`
time=`sed -n 's/ *translating formula *| *\([0-9]*\) .*| *\([0-9]*\) .*| *\([0-9]*\) .*|.*/\1,\2,\3/p' out` time=`sed -n 's/ *translating formula *| *\([0-9]*\) .*| *\([0-9]*\) .*| *\([0-9]*\) .*|.*/\1,\2,\3/p' out`
time2=`sed -n 's/ *producing output *| *\([0-9]*\) .*| *\([0-9]*\) .*| *\([0-9]*\) .*|.*/\1,\2,\3/p' out` time2=`sed -n 's/ *producing output *| *\([0-9]*\) .*| *\([0-9]*\) .*| *\([0-9]*\) .*|.*/\1,\2,\3/p' out`
echo $n,$states,$transitions,$time,$time2 echo $n,$states,$transitions,$time,$time2
done | tee results.lacim done | tee results.taa
echo "# now run 'gnuplot plot.gnu'" echo "# now run 'gnuplot plot.gnu'"

View file

@ -30,19 +30,11 @@ tgba_HEADERS = \
bddprint.hh \ bddprint.hh \
formula2bdd.hh \ formula2bdd.hh \
futurecondcol.hh \ futurecondcol.hh \
public.hh \
sba.hh \ sba.hh \
state.hh \ state.hh \
statebdd.hh \
succiter.hh \ succiter.hh \
succiterconcrete.hh \
taatgba.hh \ taatgba.hh \
tgba.hh \ tgba.hh \
tgbabddconcrete.hh \
tgbabddconcretefactory.hh \
tgbabddconcreteproduct.hh \
tgbabddcoredata.hh \
tgbabddfactory.hh \
tgbaexplicit.hh \ tgbaexplicit.hh \
tgbagraph.hh \ tgbagraph.hh \
tgbakvcomplement.hh \ tgbakvcomplement.hh \
@ -62,14 +54,8 @@ libtgba_la_SOURCES = \
bddprint.cc \ bddprint.cc \
formula2bdd.cc \ formula2bdd.cc \
futurecondcol.cc \ futurecondcol.cc \
succiterconcrete.cc \
statebdd.cc \
taatgba.cc \ taatgba.cc \
tgba.cc \ tgba.cc \
tgbabddconcrete.cc \
tgbabddconcretefactory.cc \
tgbabddconcreteproduct.cc \
tgbabddcoredata.cc \
tgbaexplicit.cc \ tgbaexplicit.cc \
tgbakvcomplement.cc \ tgbakvcomplement.cc \
tgbaproduct.cc \ tgbaproduct.cc \

View file

@ -1,38 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#ifndef SPOT_TGBA_PUBLIC_HH
# define SPOT_TGBA_PUBLIC_HH
// This file should not exist.
#if __GNUC__
#ifndef SKIP_DEPRECATED_WARNING
#warning This file is deprecated. Include tgba.hh or what you need.
#endif
#endif
# include "tgba.hh"
# include "tgbabddconcrete.hh"
# include "tgbabddconcreteproduct.hh"
# include "bddprint.hh"
#endif // SPOT_TGBA_PUBLIC_HH

View file

@ -1,53 +0,0 @@
// Copyright (C) 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#include "statebdd.hh"
#include <bdd.h>
#include <cassert>
namespace spot
{
int
state_bdd::compare(const state* other) const
{
// This method should not be called to compare states from different
// automata, and all states from the same automaton will use the same
// state class.
const state_bdd* o = down_cast<const state_bdd*>(other);
assert(o);
return o->as_bdd().id() - state_.id();
}
size_t
state_bdd::hash() const
{
return state_.id();
}
/// Duplicate a state.
state_bdd*
state_bdd::clone() const
{
return new state_bdd(*this);
}
}

View file

@ -1,57 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement de
// l'Epita.
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#ifndef SPOT_TGBA_STATEBDD_HH
# define SPOT_TGBA_STATEBDD_HH
#include <bdd.h>
#include "state.hh"
namespace spot
{
/// A state whose representation is a BDD.
/// \ingroup tgba_representation
class SPOT_API state_bdd: public state
{
public:
state_bdd(bdd s)
: state_(s)
{
}
/// Return the BDD part of the state.
virtual bdd
as_bdd() const
{
return state_;
}
virtual int compare(const state* other) const;
virtual size_t hash() const;
virtual state_bdd* clone() const;
protected:
bdd state_; ///< BDD representation of the state.
};
}
#endif // SPOT_TGBA_STATEBDD_HH

View file

@ -1,193 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#include "succiterconcrete.hh"
#include <cassert>
namespace spot
{
tgba_succ_iterator_concrete::~tgba_succ_iterator_concrete()
{
}
bool
tgba_succ_iterator_concrete::first()
{
succ_set_left_ = succ_set_;
current_ = bddfalse;
if (!done())
return next();
else
return false;
}
bool
tgba_succ_iterator_concrete::next()
{
assert(!done());
// succ_set_ is the set of successors we have to explore. it
// contains Now/Next variables and atomic propositions. Each
// satisfaction of succ_set_ represents a transition, and we want
// to compute as few transitions as possible. However one
// important constraint is that all Next variables must appear in
// the satisfaction.
//
// The full satisfactions of succ_set_ maybe something
// like this (ignoring Now variables):
// a & b & Next[a] & Next[b]
// !a & b & Next[a] & Next[b]
// a & !b & Next[a] & Next[b]
// a & b & Next[a] & !Next[b]
// This denotes four transitions, three of which going to
// the same node. Obviously (a&b | !a&b | a&!b)
// == (a | b), so it's tempting to replace these four
// transitions by
// (a + b) & Next[a] & Next[b]
// a & b & Next[a] & !Next[b]
// Is this always correct? No! It depends on the
// acceptance conditions associated to each transition.
// We cannot merge transitions which have different
// acceptance conditions.
// Let's label transitions with hypothetic acceptance sets:
// a & b & Next[a] & Next[b] ; Acc[1]
// !a & b & Next[a] & Next[b] ; Acc[1]
// a & !b & Next[a] & Next[b] ; Acc[2]
// a & b & Next[a] & !Next[b] ; Acc[1]
// Now it's pretty clear only the first two transitions
// may be merged:
// b & Next[a] & Next[b] ; Acc[1]
// a & !b & Next[a] & Next[b] ; Acc[2]
// a & b & Next[a] & !Next[b] ; Acc[1]
do
{
// FIXME: Iterating on the successors this way (calling
// bdd_satone{,set} and NANDing out (-=) the result from a
// set) requires several descents of the BDD. Maybe it would
// be faster to compute all satisfying formulae in one
// operation.
succ_set_left_ -= current_;
if (succ_set_left_ == bddfalse) // No more successors?
return false;
// Pick one transition, and extract its destination.
bdd trans = bdd_satoneset(succ_set_left_, data_.next_set,
bddfalse);
bdd dest = bdd_exist(trans, data_.notnext_set);
// Gather all transitions going to this destination...
current_ = succ_set_left_ & dest;
// ... and compute their acceptance sets.
bdd as = data_.acceptance_conditions & current_;
// AS is false when no satisfaction of the current transition
// belongs to an acceptance set: current_ can be used as-is.
if (as != bddfalse)
{
// Otherwise, we have acceptance sets, and we should
// restrict current_ to a subset sharing the same
// acceptance conditions.
// same acceptance set.
as = bdd_exist(as, data_.nownext_set);
// as = (a | (!a)&b) & (Acc[a] | Acc[b]) + (!a & Acc[b])
bdd cube = bdd_satone(as);
// cube = (!ab & Acc[a])
bdd prop = bdd_exist(cube, data_.acc_set);
// prop = (!a)&b
current_acc_ = bdd_forall(bdd_restrict(as, prop), data_.var_set);
// current_acc_ = (Acc[a] | Acc[b])
assert(current_acc_ != bddfalse);
// Find other transitions included exactly in each of these
// acceptance sets and are not included in other sets.
// Consider
// !p.!Acc[g].Acc[f] + p.!Acc[g].Acc[f] + p.Acc[g].!Acc[f]
// if current_acc_ = !Acc[g].Acc[f] we
// want to compute !p, not (!p + p), because p really
// belongs to !Acc[g].Acc[f] + Acc[g].!Acc[f], not
// only !Acc[g].Acc[f].
// So, first, filter out all transitions like p, which
// are also in other acceptance sets.
bdd fout = bdd_relprod(as, !current_acc_, data_.acc_set);
bdd as_fout = as - fout;
// Then, pick the remaining term that are exactly in all
// required acceptance sets.
bdd all = bddtrue;
bdd acc = current_acc_;
do
{
bdd one_acc = bdd_satone(acc);
acc -= one_acc;
all &= bdd_relprod(as_fout, one_acc, data_.acc_set);
}
while (acc != bddfalse);
// all = (a | (!a)&b) & (Acc[a] | Acc[b])
current_ = all & dest;
// current_ = (a | (!a)&b) & (Next...)
}
else
{
current_acc_ = bddfalse;
}
assert(current_ != bddfalse);
// The destination state, computed here, should be compatible
// with the transition relation. Otherwise it won't have any
// successor (a dead node) and we can skip it. We need to
// compute current_state_ anyway, so this test costs us nothing.
assert(dest == bdd_exist(current_, data_.notnext_set));
current_state_ = bdd_replace(dest, data_.dict->next_to_now);
}
while ((current_state_ & data_.relation) == bddfalse);
return succ_set_left_ != bddfalse;
}
bool
tgba_succ_iterator_concrete::done() const
{
return succ_set_left_ == bddfalse;
}
state_bdd*
tgba_succ_iterator_concrete::current_state() const
{
assert(!done());
return new state_bdd(current_state_);
}
bdd
tgba_succ_iterator_concrete::current_condition() const
{
assert(!done());
return bdd_exist(current_, data_.notvar_set);
}
bdd
tgba_succ_iterator_concrete::current_acceptance_conditions() const
{
assert(!done());
return current_acc_;
}
}

View file

@ -1,86 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#ifndef SPOT_TGBA_SUCCITERCONCRETE_HH
# define SPOT_TGBA_SUCCITERCONCRETE_HH
#include "statebdd.hh"
#include "succiter.hh"
#include "tgbabddcoredata.hh"
namespace spot
{
/// A concrete iterator over successors of a TGBA state.
/// \ingroup tgba_representation
class SPOT_API tgba_succ_iterator_concrete:
public tgba_succ_iterator
{
public:
/// \brief Build a spot::tgba_succ_iterator_concrete.
///
/// \param successors The set of successors with ingoing
/// conditions and acceptance conditions, represented as a BDD.
/// The job of this iterator will be to enumerate the
/// satisfactions of that BDD and split them into destination
/// states and conditions, and compute acceptance conditions.
/// \param d The core data of the automata.
/// These contains sets of variables useful to split a BDD, and
/// compute acceptance conditions.
tgba_succ_iterator_concrete(const tgba_bdd_core_data& d, bdd successors)
: data_(d)
{
recycle(successors);
}
void recycle(bdd successors)
{
succ_set_ = successors;
succ_set_left_ = successors;
current_ = bddfalse;
}
virtual ~tgba_succ_iterator_concrete();
// iteration
bool first();
bool next();
bool done() const;
// inspection
state_bdd* current_state() const;
bdd current_condition() const;
bdd current_acceptance_conditions() const;
private:
const tgba_bdd_core_data& data_; ///< Core data of the automaton.
bdd succ_set_; ///< The set of successors.
bdd succ_set_left_; ///< Unexplored successors (including current_).
bdd current_; ///< \brief Current successor, as a conjunction of
/// atomic proposition and Next variables.
bdd current_state_; ///< \brief Current successor, as a
/// conjunction of Now variables.
bdd current_acc_; ///< \brief Acceptance conditions for the current
/// transition.
};
}
#endif // SPOT_TGBA_SUCCITERCONCRETE_HH

View file

@ -1,160 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#include "tgbabddconcrete.hh"
#include "bddprint.hh"
#include <cassert>
namespace spot
{
tgba_bdd_concrete::tgba_bdd_concrete(const tgba_bdd_factory& fact)
: data_(fact.get_core_data())
{
get_dict()->register_all_variables_of(&fact, this);
}
tgba_bdd_concrete::tgba_bdd_concrete(const tgba_bdd_factory& fact, bdd init)
: data_(fact.get_core_data())
{
get_dict()->register_all_variables_of(&fact, this);
set_init_state(init);
}
tgba_bdd_concrete::~tgba_bdd_concrete()
{
get_dict()->unregister_all_my_variables(this);
}
void
tgba_bdd_concrete::set_init_state(bdd s)
{
// Usually, the ltl2tgba translator will return an
// initial state which does not include all true Now variables,
// even though the truth of some Now variables is garanteed.
//
// For instance, when building the automata for the formula GFa,
// the translator will define the following two equivalences
// Now[Fa] <=> a | (Prom[a] & Next[Fa])
// Now[GFa] <=> Now[Fa] & Next[GFa]
// and return Now[GFa] as initial state.
//
// Starting for state Now[GFa], we could then build
// the following automaton:
// In state Now[GFa]:
// if `a', go to state Now[GFa] & Now[Fa]
// if `!a', go to state Now[GFa] & Now[Fa] with Prom[a]
// In state Now[GFa] & Now[Fa]:
// if `a', go to state Now[GFa] & Now[Fa]
// if `!a', go to state Now[GFa] & Now[Fa] with Prom[a]
//
// As we can see, states Now[GFa] and Now[GFa] & Now[Fa] share
// the same actions. This is no surprise, because
// Now[GFa] <=> Now[GFa] & Now[Fa] according to the equivalences
// defined by the translator.
//
// This happens because we haven't completed the initial
// state with the value of other Now variables. We can
// complete this state with the other equivalant Now variables
// here, but we can't do anything about the remaining unknown
// variables.
s &= bdd_relprod(s, data_.relation, data_.notnow_set);
init_ = s;
}
state_bdd*
tgba_bdd_concrete::get_init_state() const
{
return new state_bdd(init_);
}
bdd
tgba_bdd_concrete::get_init_bdd() const
{
return init_;
}
tgba_succ_iterator_concrete*
tgba_bdd_concrete::succ_iter(const state* state) const
{
const state_bdd* s = down_cast<const state_bdd*>(state);
assert(s);
bdd succ_set = data_.relation & s->as_bdd();
// Do not allocate an iterator if we can reuse one.
if (iter_cache_)
{
tgba_succ_iterator_concrete* res =
down_cast<tgba_succ_iterator_concrete*>(iter_cache_);
iter_cache_ = nullptr;
res->recycle(succ_set);
return res;
}
return new tgba_succ_iterator_concrete(data_, succ_set);
}
bdd
tgba_bdd_concrete::compute_support_conditions(const state* st) const
{
const state_bdd* s = down_cast<const state_bdd*>(st);
assert(s);
return bdd_relprod(s->as_bdd(), data_.relation, data_.notvar_set);
}
std::string
tgba_bdd_concrete::format_state(const state* state) const
{
const state_bdd* s = down_cast<const state_bdd*>(state);
assert(s);
return bdd_format_set(get_dict(), s->as_bdd());
}
bdd_dict*
tgba_bdd_concrete::get_dict() const
{
return data_.dict;
}
bdd
tgba_bdd_concrete::all_acceptance_conditions() const
{
return data_.all_acceptance_conditions;
}
bdd
tgba_bdd_concrete::neg_acceptance_conditions() const
{
return data_.negacc_set;
}
const tgba_bdd_core_data&
tgba_bdd_concrete::get_core_data() const
{
return data_;
}
void
tgba_bdd_concrete::delete_unaccepting_scc()
{
data_.delete_unaccepting_scc(init_);
set_init_state(init_);
}
}

View file

@ -1,97 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// 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/>.
#ifndef SPOT_TGBA_TGBABDDCONCRETE_HH
# define SPOT_TGBA_TGBABDDCONCRETE_HH
#include "tgba.hh"
#include "statebdd.hh"
#include "tgbabddfactory.hh"
#include "succiterconcrete.hh"
namespace spot
{
/// \ingroup tgba_representation
/// \brief A concrete spot::tgba implemented using BDDs.
class SPOT_API tgba_bdd_concrete: public tgba
{
public:
/// \brief Construct a tgba_bdd_concrete with unknown initial state.
///
/// set_init_state() should be called later.
tgba_bdd_concrete(const tgba_bdd_factory& fact);
/// \brief Construct a tgba_bdd_concrete with known initial state.
tgba_bdd_concrete(const tgba_bdd_factory& fact, bdd init);
virtual ~tgba_bdd_concrete();
/// \brief Set the initial state.
virtual void set_init_state(bdd s);
virtual state_bdd* get_init_state() const;
/// \brief Get the initial state directly as a BDD.
///
/// The sole point of this method is to prevent writing
/// horrors such as
/// \code
/// state_bdd* s = automata.get_init_state();
/// some_class some_instance(s->as_bdd());
/// s->destroy();
/// \endcode
bdd get_init_bdd() const;
virtual tgba_succ_iterator_concrete*
succ_iter(const state* local_state) const;
virtual std::string format_state(const state* state) const;
virtual bdd_dict* get_dict() const;
/// \brief Get the core data associated to this automaton.
///
/// These data includes the various BDD used to represent
/// the relation, encode variable sets, Next-to-Now rewrite
/// rules, etc.
const tgba_bdd_core_data& get_core_data() const;
virtual bdd all_acceptance_conditions() const;
virtual bdd neg_acceptance_conditions() const;
/// \brief Delete SCCs (Strongly Connected Components) from the
/// TGBA which cannot be accepting.
void delete_unaccepting_scc();
protected:
virtual bdd compute_support_conditions(const state* state) const;
tgba_bdd_core_data data_; ///< Core data associated to the automaton.
bdd init_; ///< Initial state.
private:
// Disallow copy.
tgba_bdd_concrete(const tgba_bdd_concrete&) SPOT_DELETED;
tgba_bdd_concrete& operator=(const tgba_bdd_concrete&) SPOT_DELETED;
};
}
#endif // SPOT_TGBA_TGBABDDCONCRETE_HH

View file

@ -1,149 +0,0 @@
// Copyright (C) 2009, 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#include "tgbabddconcretefactory.hh"
namespace spot
{
tgba_bdd_concrete_factory::tgba_bdd_concrete_factory(bdd_dict* dict)
: data_(dict)
{
}
tgba_bdd_concrete_factory::~tgba_bdd_concrete_factory()
{
acc_map_::iterator ai;
for (ai = acc_.begin(); ai != acc_.end(); ++ai)
ai->first->destroy();
get_dict()->unregister_all_my_variables(this);
}
int
tgba_bdd_concrete_factory::create_state(const ltl::formula* f)
{
int num = get_dict()->register_state(f, this);
// Keep track of all "Now" variables for easy
// existential quantification.
data_.declare_now_next (bdd_ithvar(num), bdd_ithvar(num + 1));
return num;
}
int
tgba_bdd_concrete_factory::create_anonymous_state()
{
int num = get_dict()->register_anonymous_variables(2, this);
bdd_setpair(get_dict()->next_to_now, num + 1, num);
bdd_setpair(get_dict()->now_to_next, num, num + 1);
// Keep track of all "Now" variables for easy
// existential quantification.
data_.declare_now_next (bdd_ithvar(num), bdd_ithvar(num + 1));
return num;
}
int
tgba_bdd_concrete_factory::create_atomic_prop(const ltl::formula* f)
{
int num = get_dict()->register_proposition(f, this);
// Keep track of all atomic proposition for easy
// existential quantification.
data_.declare_atomic_prop(bdd_ithvar(num));
return num;
}
void
tgba_bdd_concrete_factory::declare_acceptance_condition(bdd b,
const ltl::formula* a)
{
// Maintain a conjunction of BDDs associated to A. We will latter
// (in tgba_bdd_concrete_factory::finish()) associate this
// conjunction to A.
acc_map_::iterator ai = acc_.find(a);
if (ai == acc_.end())
{
a = a->clone();
acc_[a] = b;
}
else
{
ai->second &= b;
}
}
void
tgba_bdd_concrete_factory::finish()
{
acc_map_::iterator ai;
for (ai = acc_.begin(); ai != acc_.end(); ++ai)
{
// Register a BDD variable for this acceptance condition.
int num = get_dict()->register_acceptance_variable(ai->first, this);
// Keep track of all acceptance conditions for easy
// existential quantification.
data_.declare_acceptance_condition(bdd_ithvar(num));
}
for (ai = acc_.begin(); ai != acc_.end(); ++ai)
{
bdd acc = bdd_ithvar(get_dict()->acc_map[ai->first]);
// Complete acc with all the other acceptance conditions negated.
acc &= bdd_exist(data_.negacc_set, acc);
// Any state matching the BDD formulae registered is part
// of this acceptance set.
data_.acceptance_conditions |= ai->second & acc;
// Keep track of all acceptance conditions, so that we can
// easily check whether a transition satisfies all acceptance
// conditions.
data_.all_acceptance_conditions |= acc;
}
data_.acceptance_conditions_support =
bdd_support(data_.acceptance_conditions);
// Any constraint between Now variables also exist between Next
// variables. Doing this limits the quantity of useless
// successors we will have to explore. (By "useless successors"
// I mean a combination of Next variables that represent a cul de sac
// state: the combination exists but won't allow further exploration
// because it fails the constraints.)
data_.relation &= bdd_replace(bdd_exist(data_.relation, data_.notnow_set),
get_dict()->now_to_next);
}
const tgba_bdd_core_data&
tgba_bdd_concrete_factory::get_core_data() const
{
return data_;
}
bdd_dict*
tgba_bdd_concrete_factory::get_dict() const
{
return data_.dict;
}
void
tgba_bdd_concrete_factory::constrain_relation(bdd new_rel)
{
data_.relation &= new_rel;
}
}

View file

@ -1,102 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2013 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#ifndef SPOT_TGBA_TGBABDDCONCRETEFACTORY_HH
# define SPOT_TGBA_TGBABDDCONCRETEFACTORY_HH
#include "misc/hash.hh"
#include "ltlast/formula.hh"
#include "tgbabddfactory.hh"
namespace spot
{
/// Helper class to build a spot::tgba_bdd_concrete object.
class SPOT_API tgba_bdd_concrete_factory: public tgba_bdd_factory
{
public:
tgba_bdd_concrete_factory(bdd_dict* dict);
virtual ~tgba_bdd_concrete_factory();
/// Create a Now/Next variables for formula \a f.
///
/// \param f The formula to create a state for.
/// \return The BDD variable number v for the Now state. The
/// Next BDD corresponds to v+1.
///
/// The state variables are not created if they already exist.
/// Instead their existing variable numbers are returned.
/// Variable numbers can be turned into BDD using ithvar().
int create_state(const ltl::formula* f);
/// Create a anonymous Now/Next variables.
///
/// \return The BDD variable number v for the Now state. The
/// Next BDD corresponds to v+1.
int create_anonymous_state();
/// Create an atomic proposition variable for formula \a f.
///
/// \param f The formula to create an aotmic proposition for.
/// \return The variable number for this state.
///
/// The atomic proposition is not created if it already exists.
/// Instead its existing variable number is returned. Variable numbers
/// can be turned into BDD using ithvar().
int create_atomic_prop(const ltl::formula* f);
/// Declare an acceptance condition.
///
/// Formula such as 'f U g' or 'F g' make the promise
/// that 'g' will be fulfilled eventually. So once
/// one of this formula has been translated into a BDD,
/// we use declare_acceptance_condition() to associate
/// all other states to the acceptance set of 'g'.
///
/// \param b a BDD indicating which variables are in the
/// acceptance set
/// \param a the formula associated
void declare_acceptance_condition(bdd b, const ltl::formula* a);
const tgba_bdd_core_data& get_core_data() const;
bdd_dict* get_dict() const;
/// Add a new constraint to the relation.
void constrain_relation(bdd new_rel);
/// \brief Perfom final computations before the relation can be used.
///
/// This function should be called after all propositions, state,
/// acceptance conditions, and constraints have been declared, and
/// before calling get_code_data() or get_dict().
void finish();
private:
tgba_bdd_core_data data_; ///< Core data for the new automata.
typedef std::unordered_map<const ltl::formula*, bdd,
ltl::formula_ptr_hash> acc_map_;
acc_map_ acc_; ///< BDD associated to each acceptance condition
};
}
#endif // SPOT_TGBA_TGBABDDCONCRETEFACTORY_HH

View file

@ -1,78 +0,0 @@
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#include <cassert>
#include "tgbabddconcreteproduct.hh"
namespace spot
{
namespace
{
/// \brief Helper class for product().
///
/// As both automata are encoded using BDD, we just have
/// to homogenize the variable numbers before ANDing the
/// relations and initial states.
class tgba_bdd_product_factory: public tgba_bdd_factory
{
public:
tgba_bdd_product_factory(const tgba_bdd_concrete* left,
const tgba_bdd_concrete* right)
: dict_(left->get_dict()),
left_(left),
right_(right),
data_(left_->get_core_data(), right_->get_core_data()),
init_(left_->get_init_bdd() & right_->get_init_bdd())
{
assert(dict_ == right->get_dict());
}
virtual
~tgba_bdd_product_factory()
{
}
const tgba_bdd_core_data&
get_core_data() const
{
return data_;
}
bdd
get_init_state() const
{
return init_;
}
private:
bdd_dict* dict_;
const tgba_bdd_concrete* left_;
const tgba_bdd_concrete* right_;
tgba_bdd_core_data data_;
bdd init_;
};
}
tgba_bdd_concrete*
product(const tgba_bdd_concrete* left, const tgba_bdd_concrete* right)
{
tgba_bdd_product_factory p(left, right);
return new tgba_bdd_concrete(p, p.get_init_state());
}
}

View file

@ -1,36 +0,0 @@
// Copyright (C) 2003, 2004, 2013 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#ifndef SPOT_TGBA_TGBABDDCONCRETEPRODUCT_HH
# define SPOT_TGBA_TGBABDDCONCRETEPRODUCT_HH
#include "tgbabddconcrete.hh"
namespace spot
{
/// \ingroup tgba_algorithms
/// \brief Multiplies two spot::tgba_bdd_concrete automata.
///
/// This function builds the resulting product as another
/// spot::tgba_bdd_concrete automaton.
SPOT_API tgba_bdd_concrete*
product(const tgba_bdd_concrete* left, const tgba_bdd_concrete* right);
}
#endif // SPOT_TGBA_TGBABDDCONCRETEPRODUCT_HH

View file

@ -1,200 +0,0 @@
// Copyright (C) 2009, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#include <cassert>
#include "tgbabddcoredata.hh"
namespace spot
{
tgba_bdd_core_data::tgba_bdd_core_data(bdd_dict* dict)
: relation(bddtrue),
acceptance_conditions(bddfalse),
acceptance_conditions_support(bddtrue),
all_acceptance_conditions(bddfalse),
now_set(bddtrue),
next_set(bddtrue),
nownext_set(bddtrue),
notnow_set(bddtrue),
notnext_set(bddtrue),
var_set(bddtrue),
notvar_set(bddtrue),
varandnext_set(bddtrue),
acc_set(bddtrue),
notacc_set(bddtrue),
negacc_set(bddtrue),
dict(dict)
{
}
tgba_bdd_core_data::tgba_bdd_core_data(const tgba_bdd_core_data& copy)
: relation(copy.relation),
acceptance_conditions(copy.acceptance_conditions),
acceptance_conditions_support(copy.acceptance_conditions_support),
all_acceptance_conditions(copy.all_acceptance_conditions),
now_set(copy.now_set),
next_set(copy.next_set),
nownext_set(copy.nownext_set),
notnow_set(copy.notnow_set),
notnext_set(copy.notnext_set),
var_set(copy.var_set),
notvar_set(copy.notvar_set),
varandnext_set(copy.varandnext_set),
acc_set(copy.acc_set),
notacc_set(copy.notacc_set),
negacc_set(copy.negacc_set),
dict(copy.dict)
{
}
// Merge two core_data.
tgba_bdd_core_data::tgba_bdd_core_data(const tgba_bdd_core_data& left,
const tgba_bdd_core_data& right)
: relation(left.relation & right.relation),
acceptance_conditions(left.acceptance_conditions
| right.acceptance_conditions),
acceptance_conditions_support(left.acceptance_conditions_support
& right.acceptance_conditions_support),
all_acceptance_conditions(left.all_acceptance_conditions
| right.all_acceptance_conditions),
now_set(left.now_set & right.now_set),
next_set(left.next_set & right.next_set),
nownext_set(left.nownext_set & right.nownext_set),
notnow_set(left.notnow_set & right.notnow_set),
notnext_set(left.notnext_set & right.notnext_set),
var_set(left.var_set & right.var_set),
notvar_set(left.notvar_set & right.notvar_set),
varandnext_set(left.varandnext_set & right.varandnext_set),
acc_set(left.acc_set & right.acc_set),
notacc_set(left.notacc_set & right.notacc_set),
negacc_set(left.negacc_set & right.negacc_set),
dict(left.dict)
{
assert(dict == right.dict);
}
tgba_bdd_core_data&
tgba_bdd_core_data::operator=(const tgba_bdd_core_data& copy)
{
if (this != &copy)
{
this->~tgba_bdd_core_data();
new (this) tgba_bdd_core_data(copy);
}
return *this;
}
void
tgba_bdd_core_data::declare_now_next(bdd now, bdd next)
{
now_set &= now;
next_set &= next;
notnext_set &= now;
notnow_set &= next;
bdd both = now & next;
nownext_set &= both;
notvar_set &= both;
notacc_set &= both;
varandnext_set &= next;
}
void
tgba_bdd_core_data::declare_atomic_prop(bdd var)
{
notnow_set &= var;
notnext_set &= var;
notacc_set &= var;
var_set &= var;
varandnext_set &= var;
}
void
tgba_bdd_core_data::declare_acceptance_condition(bdd acc)
{
notnow_set &= acc;
notnext_set &= acc;
notvar_set &= acc;
acc_set &= acc;
negacc_set &= !acc;
}
void
tgba_bdd_core_data::delete_unaccepting_scc(bdd init)
{
bdd er = bdd_exist(relation, var_set); /// existsRelation
bdd s0 = bddfalse;
bdd s1 = bdd_exist(bdd_exist(init & relation, var_set), now_set);
s1 = bdd_replace(s1, dict->next_to_now);
/// Find all reachable states
while (s0 != s1)
{
s0 = s1;
/// Compute s1 = succ(s0) | s
s1 = bdd_replace(bdd_exist(s0 & er, now_set), dict->next_to_now) | s0;
}
/// Find states which can be visited infinitely often while seeing
/// all acceptance conditions
s0 = bddfalse;
while (s0 != s1)
{
s0 = s1;
bdd all = all_acceptance_conditions;
while (all != bddfalse)
{
bdd next = bdd_satone(all);
all -= next;
s1 = infinitely_often(s1, next, er);
}
}
relation = (relation & bdd_replace(s0, dict->now_to_next));
}
bdd
tgba_bdd_core_data::infinitely_often(bdd s, bdd acc, bdd er)
{
bdd ar = acc & (relation & acceptance_conditions); /// accRelation
bdd s0 = bddfalse;
bdd s1 = s;
while (s0 != s1)
{
s0 = s1;
bdd as = bdd_replace(s0, dict->now_to_next) & ar;
as = bdd_exist(bdd_exist(as, next_set), var_set) & s0;
/// Do predStar
bdd s0_ = bddfalse;
bdd s1_ = bdd_exist(as, acc_set);
while (s0_ != s1_)
{
s0_ = s1_;
/// Compute s1_ = pred(s0_) | s0_
s1_ = bdd_exist(er & bdd_replace(s0_, dict->now_to_next), next_set);
s1_ = (s1_ & s0) | s0_;
}
s1 = s0_;
}
return s0;
}
}

View file

@ -1,159 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2011, 2012, 2013 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#ifndef SPOT_TGBA_TGBABDDCOREDATA_HH
# define SPOT_TGBA_TGBABDDCOREDATA_HH
#include <bdd.h>
#include "bdddict.hh"
namespace spot
{
/// Core data for a TGBA encoded using BDDs.
struct SPOT_API tgba_bdd_core_data
{
/// \brief encodes the transition relation of the TGBA.
///
/// \c relation uses three kinds of variables:
/// \li "Now" variables, that encode the current state
/// \li "Next" variables, that encode the destination state
/// \li atomic propositions, which are things to verify before going on
/// to the next state
bdd relation;
/// \brief encodes the acceptance conditions
///
/// <tt>a U b</tt>, or <tt>F b</tt>, both imply that \c b should
/// be verified eventually. We encode this with generalized Büchi
/// acceptating conditions. An acceptance set, called
/// <tt>Acc[b]</tt>, hold all the state that do not promise to
/// verify \c b eventually. (I.e., all the states that contain \c
/// b, or do not contain <tt>a U b</tt>, or <tt>F b</tt>.)
///
/// The spot::succ_iter::current_acceptance_conditions() method
/// will return the \c Acc[x] variables of the acceptance sets
/// in which a transition is. Actually we never return \c Acc[x]
/// alone, but \c Acc[x] and all other acceptance variables negated.
///
/// So if there is three acceptance set \c a, \c b, and \c c, and a
/// transition is in set \c a, we'll return <tt>
/// Acc[a]&!Acc[b]&!Acc[c]</tt>. If the transition is in both \c
/// a and \c b, we'll return <tt>(Acc[a]\&!Acc[b]\&!Acc[c]) \c | \c
/// (!Acc[a]\&Acc[b]\&!Acc[c])</tt>.
///
/// Acceptance conditions are attributed to transitions and are
/// only concerned by atomic propositions (which label the
/// transitions) and Next variables (the destination). Typically,
/// a transition should bear the variable \c Acc[b] if it doesn't
/// check for `b' and have a destination of the form <tt>a U b</tt>,
/// or <tt>F b</tt>.
///
/// To summarize, \c acceptance_conditions contains three kinds of
/// variables:
/// \li "Next" variables, that encode the destination state,
/// \li atomic propositions, which are things to verify before going on
/// to the next state,
/// \li "Acc" variables.
bdd acceptance_conditions;
/// The value of \c bdd_support(acceptance_conditions)
bdd acceptance_conditions_support;
/// \brief The set of all acceptance conditions used by the Automaton.
///
/// The goal of the emptiness check is to ensure that
/// a strongly connected component walks through each
/// of these acceptiong conditions. I.e., the union
/// of the acceptiong conditions of all transition in
/// the SCC should be equal to the result of this function.
bdd all_acceptance_conditions;
/// The conjunction of all Now variables, in their positive form.
bdd now_set;
/// The conjunction of all Next variables, in their positive form.
bdd next_set;
/// The conjunction of all Now and Next variables, in their positive form.
bdd nownext_set;
/// \brief The (positive) conjunction of all variables which are
/// not Now variables.
bdd notnow_set;
/// \brief The (positive) conjunction of all variables which are
/// not Next variables.
bdd notnext_set;
/// \brief The (positive) conjunction of all variables which are
/// atomic propositions.
bdd var_set;
/// \brief The (positive) conjunction of all variables which are
/// not atomic propositions.
bdd notvar_set;
/// \brief The (positive) conjunction of all Next variables
/// and atomic propositions.
bdd varandnext_set;
/// \brief The (positive) conjunction of all variables which are
/// acceptance conditions.
bdd acc_set;
/// \brief The (positive) conjunction of all variables which are not
/// acceptance conditions.
bdd notacc_set;
/// \brief The negative conjunction of all variables which are acceptance
/// conditions.
bdd negacc_set;
/// The dictionary used by the automata.
bdd_dict* dict;
/// \brief Default constructor.
///
/// Initially all variable set are empty and the \c relation is true.
tgba_bdd_core_data(bdd_dict* dict);
/// Copy constructor.
tgba_bdd_core_data(const tgba_bdd_core_data& copy);
/// \brief Merge two tgba_bdd_core_data.
///
/// This is used when building a product of two automata.
tgba_bdd_core_data(const tgba_bdd_core_data& left,
const tgba_bdd_core_data& right);
tgba_bdd_core_data& operator=(const tgba_bdd_core_data& copy);
/// \brief Update the variable sets to take a new pair of variables into
/// account.
void declare_now_next(bdd now, bdd next);
/// \brief Update the variable sets to take a new automic proposition into
/// account.
void declare_atomic_prop(bdd var);
/// \brief Update the variable sets to take a new acceptance condition
/// into account.
void declare_acceptance_condition(bdd prom);
/// \brief Delete SCCs (Strongly Connected Components) from the
/// relation which cannot be accepting.
void delete_unaccepting_scc(bdd init);
private:
bdd infinitely_often(bdd s, bdd acc, bdd er);
};
}
#endif // SPOT_TGBA_TGBABDDCOREDATA_HH

View file

@ -1,43 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#ifndef SPOT_TGBA_TGBABDDFACTORY_HH
# define SPOT_TGBA_TGBABDDFACTORY_HH
#include "tgbabddcoredata.hh"
namespace spot
{
/// \brief Abstract class for spot::tgba_bdd_concrete factories.
///
/// A spot::tgba_bdd_concrete can be constructed from anything that
/// supplies core data and their associated dictionary.
class SPOT_API tgba_bdd_factory
{
public:
virtual ~tgba_bdd_factory() {}
/// Get the core data for the new automata.
virtual const tgba_bdd_core_data& get_core_data() const = 0;
};
}
#endif // SPOT_TGBA_TGBABDDFACTORY_HH

View file

@ -172,7 +172,11 @@ namespace spot
/// States labeled by a formula /// States labeled by a formula
/// \ingroup tgba_representation /// \ingroup tgba_representation
class SPOT_API state_explicit_formula: class SPOT_API state_explicit_formula:
#ifndef SWIG
public state_explicit<const ltl::formula*, ltl::formula_ptr_hash> public state_explicit<const ltl::formula*, ltl::formula_ptr_hash>
#else
public state
#endif
{ {
public: public:
state_explicit_formula(): state_explicit_formula():

View file

@ -48,7 +48,6 @@ tgbaalgos_HEADERS = \
lbtt.hh \ lbtt.hh \
ltl2taa.hh \ ltl2taa.hh \
ltl2tgba_fm.hh \ ltl2tgba_fm.hh \
ltl2tgba_lacim.hh \
magic.hh \ magic.hh \
minimize.hh \ minimize.hh \
neverclaim.hh \ neverclaim.hh \
@ -96,7 +95,6 @@ libtgbaalgos_la_SOURCES = \
lbtt.cc \ lbtt.cc \
ltl2taa.cc \ ltl2taa.cc \
ltl2tgba_fm.cc \ ltl2tgba_fm.cc \
ltl2tgba_lacim.cc \
magic.cc \ magic.cc \
minimize.cc \ minimize.cc \
ndfs_result.hxx \ ndfs_result.hxx \

View file

@ -1,307 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2012, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// 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/>.
#include "ltlast/visitor.hh"
#include "ltlast/allnodes.hh"
#include "ltlvisit/lunabbrev.hh"
#include "ltlvisit/nenoform.hh"
#include "tgba/tgbabddconcretefactory.hh"
#include <cassert>
#include "ltl2tgba_lacim.hh"
namespace spot
{
namespace
{
using namespace ltl;
/// \brief Recursively translate a formula into a BDD.
///
/// The algorithm used here is adapted from Jean-Michel Couvreur's
/// Probataf tool.
class ltl_trad_visitor: public visitor
{
public:
ltl_trad_visitor(tgba_bdd_concrete_factory& fact, bool root = false)
: fact_(fact), root_(root)
{
}
virtual
~ltl_trad_visitor()
{
}
bdd
result()
{
return res_;
}
void
visit(const atomic_prop* node)
{
res_ = bdd_ithvar(fact_.create_atomic_prop(node));
}
void
visit(const constant* node)
{
switch (node->val())
{
case constant::True:
res_ = bddtrue;
return;
case constant::False:
res_ = bddfalse;
return;
case constant::EmptyWord:
SPOT_UNIMPLEMENTED();
}
SPOT_UNREACHABLE();
}
void
visit(const unop* node)
{
switch (node->op())
{
case unop::F:
{
/*
Fx <=> x | XFx
In other words:
now <=> x | next
*/
int v = fact_.create_state(node);
bdd now = bdd_ithvar(v);
bdd next = bdd_ithvar(v + 1);
bdd x = recurse(node->child());
fact_.constrain_relation(bdd_apply(now, x | next, bddop_biimp));
/*
`x | next', doesn't actually encode the fact that x
should be fulfilled eventually. We ensure this by
creating a new generalized Büchi acceptance set, Acc[x],
and leave out of this set any transition going off NOW
without checking X. Such acceptance conditions are
checked for during the emptiness check.
*/
fact_.declare_acceptance_condition(x | !now, node->child());
res_ = now;
return;
}
case unop::G:
{
bdd child = recurse(node->child());
// If G occurs at the top of the formula we don't
// need Now/Next variables. We just constrain
// the relation so that the child always happens.
// This saves 2 BDD variables.
if (root_)
{
fact_.constrain_relation(child);
res_ = child;
return;
}
// Gx <=> x && XGx
int v = fact_.create_state(node);
bdd now = bdd_ithvar(v);
bdd next = bdd_ithvar(v + 1);
fact_.constrain_relation(bdd_apply(now, child & next,
bddop_biimp));
res_ = now;
return;
}
case unop::Not:
{
res_ = bdd_not(recurse(node->child()));
return;
}
case unop::X:
{
int v = fact_.create_state(node->child());
bdd now = bdd_ithvar(v);
bdd next = bdd_ithvar(v + 1);
fact_.constrain_relation(bdd_apply(now, recurse(node->child()),
bddop_biimp));
res_ = next;
return;
}
case unop::Finish:
case unop::Closure:
case unop::NegClosure:
case unop::NegClosureMarked:
SPOT_UNIMPLEMENTED();
}
SPOT_UNREACHABLE();
}
void
visit(const bunop*)
{
SPOT_UNIMPLEMENTED();
}
void
visit(const binop* node)
{
bdd f1 = recurse(node->first());
bdd f2 = recurse(node->second());
binop::type op = node->op();
switch (op)
{
case binop::Xor:
res_ = bdd_apply(f1, f2, bddop_xor);
return;
case binop::Implies:
res_ = bdd_apply(f1, f2, bddop_imp);
return;
case binop::Equiv:
res_ = bdd_apply(f1, f2, bddop_biimp);
return;
case binop::U:
case binop::W:
{
// f1 U f2 <=> f2 | (f1 & X(f1 U f2))
// In other words:
// now <=> f2 | (f1 & next)
int v = fact_.create_state(node);
bdd now = bdd_ithvar(v);
bdd next = bdd_ithvar(v + 1);
fact_.constrain_relation(bdd_apply(now, f2 | (f1 & next),
bddop_biimp));
if (op == binop::U)
{
// The rightmost conjunction, f1 & next, doesn't
// actually encode the fact that f2 should be
// fulfilled eventually. We declare an acceptance
// condition for this purpose (see the comment in
// the unop::F case).
fact_.declare_acceptance_condition(f2 | !now, node->second());
}
res_ = now;
return;
}
case binop::R:
case binop::M:
{
// f1 R f2 <=> f2 & (f1 | X(f1 R f2))
// In other words:
// now <=> f2 & (f1 | next)
int v = fact_.create_state(node);
bdd now = bdd_ithvar(v);
bdd next = bdd_ithvar(v + 1);
fact_.constrain_relation(bdd_apply(now, f2 & (f1 | next),
bddop_biimp));
if (op == binop::M)
{
// f2 & next, doesn't actually encode the fact that
// f1 should be fulfilled eventually. We declare an
// acceptance condition for this purpose (see the
// comment in the unop::F case).
fact_.declare_acceptance_condition(f1 | !now, node->second());
}
res_ = now;
return;
}
case binop::UConcat:
case binop::EConcat:
case binop::EConcatMarked:
SPOT_UNIMPLEMENTED();
}
SPOT_UNREACHABLE();
}
void
visit(const multop* node)
{
int op = -1;
bool root = false;
switch (node->op())
{
case multop::And:
op = bddop_and;
res_ = bddtrue;
// When the root formula is a conjunction it's ok to
// consider all children as root formulae. This allows the
// root-G trick to save many more variable. (See the
// translation of G.)
root = root_;
break;
case multop::Or:
op = bddop_or;
res_ = bddfalse;
break;
case multop::Concat:
case multop::Fusion:
case multop::AndNLM:
case multop::AndRat:
case multop::OrRat:
SPOT_UNIMPLEMENTED();
}
assert(op != -1);
unsigned s = node->size();
for (unsigned n = 0; n < s; ++n)
{
res_ = bdd_apply(res_, recurse(node->nth(n), root), op);
}
}
bdd
recurse(const formula* f, bool root = false)
{
ltl_trad_visitor v(fact_, root);
f->accept(v);
return v.result();
}
private:
bdd res_;
tgba_bdd_concrete_factory& fact_;
bool root_;
};
} // anonymous
tgba_bdd_concrete*
ltl_to_tgba_lacim(const ltl::formula* f, bdd_dict* dict)
{
// Normalize the formula. We want all the negations on
// the atomic propositions. We also suppress logic
// abbreviations such as <=>, =>, or XOR, since they
// would involve negations at the BDD level.
const ltl::formula* f1 = ltl::unabbreviate_logic(f);
const ltl::formula* f2 = ltl::negative_normal_form(f1);
f1->destroy();
// Traverse the formula and draft the automaton in a factory.
tgba_bdd_concrete_factory fact(dict);
ltl_trad_visitor v(fact, true);
f2->accept(v);
f2->destroy();
fact.finish();
// Finally setup the resulting automaton.
return new tgba_bdd_concrete(fact, v.result());
}
}

View file

@ -1,57 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// 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/>.
#ifndef SPOT_TGBAALGOS_LTL2TGBA_LACIM_HH
# define SPOT_TGBAALGOS_LTL2TGBA_LACIM_HH
#include "ltlast/formula.hh"
#include "tgba/tgbabddconcrete.hh"
namespace spot
{
/// \ingroup tgba_ltl
/// \brief Build a spot::tgba_bdd_concrete from an LTL formula.
///
/// This is based on the following paper.
/** \verbatim
@InProceedings{ couvreur.00.lacim,
author = {Jean-Michel Couvreur},
title = {Un point de vue symbolique sur la logique temporelle
lin{\'e}aire},
booktitle = {Actes du Colloque LaCIM 2000},
month = {August},
year = {2000},
pages = {131--140},
volume = {27},
series = {Publications du LaCIM},
publisher = {Universit{\'e} du Qu{\'e}bec {\`a} Montr{\'e}al},
editor = {Pierre Leroux}
}
\endverbatim */
/// \param f The formula to translate into an automaton.
/// \param dict The spot::bdd_dict the constructed automata should use.
/// \return A spot::tgba_bdd_concrete that recognizes the language of \a f.
SPOT_API tgba_bdd_concrete*
ltl_to_tgba_lacim(const ltl::formula* f, bdd_dict* dict);
}
#endif // SPOT_TGBAALGOS_LTL2TGBA_LACIM_HH

View file

@ -31,7 +31,6 @@ noinst_PROGRAMS = ltl2tgba randtgba
check_SCRIPTS = defs check_SCRIPTS = defs
# Keep this sorted alphabetically. # Keep this sorted alphabetically.
check_PROGRAMS = \ check_PROGRAMS = \
bddprod \
bitvect \ bitvect \
complement \ complement \
explicit \ explicit \
@ -43,7 +42,6 @@ check_PROGRAMS = \
intvcmp2 \ intvcmp2 \
ltlprod \ ltlprod \
maskacc \ maskacc \
mixprod \
powerset \ powerset \
readsat \ readsat \
taatgba \ taatgba \
@ -51,8 +49,6 @@ check_PROGRAMS = \
tripprod tripprod
# Keep this sorted alphabetically. # Keep this sorted alphabetically.
bddprod_SOURCES = ltlprod.cc
bddprod_CXXFLAGS = -DBDD_CONCRETE_PRODUCT
bitvect_SOURCES = bitvect.cc bitvect_SOURCES = bitvect.cc
complement_SOURCES = complementation.cc complement_SOURCES = complementation.cc
explicit_SOURCES = explicit.cc explicit_SOURCES = explicit.cc
@ -66,7 +62,6 @@ intvcmp2_SOURCES = intvcmp2.cc
ltl2tgba_SOURCES = ltl2tgba.cc ltl2tgba_SOURCES = ltl2tgba.cc
ltlprod_SOURCES = ltlprod.cc ltlprod_SOURCES = ltlprod.cc
maskacc_SOURCES = maskacc.cc maskacc_SOURCES = maskacc.cc
mixprod_SOURCES = mixprod.cc
powerset_SOURCES = powerset.cc powerset_SOURCES = powerset.cc
randtgba_SOURCES = randtgba.cc randtgba_SOURCES = randtgba.cc
readsat_SOURCES = readsat.cc readsat_SOURCES = readsat.cc
@ -100,13 +95,11 @@ TESTS = \
ltl2ta.test \ ltl2ta.test \
ltl2ta2.test \ ltl2ta2.test \
ltlprod.test \ ltlprod.test \
bddprod.test \
explprod.test \ explprod.test \
explpro2.test \ explpro2.test \
explpro3.test \ explpro3.test \
explpro4.test \ explpro4.test \
tripprod.test \ tripprod.test \
mixprod.test \
dupexp.test \ dupexp.test \
degendet.test \ degendet.test \
degenid.test \ degenid.test \

View file

@ -1,38 +0,0 @@
#!/bin/sh
# Copyright (C) 2009 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# 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
# We don't check the output, but just running these might be enough to
# trigger assertions.
run 0 ../bddprod a b
run 0 ../bddprod a a
run 0 ../bddprod 'a U b' 'X f'
run 0 ../bddprod 'X a' 'X a'
run 0 ../bddprod 'X a' 'a U b'
run 0 ../bddprod 'a & b & c' 'b & d & c'
run 0 ../bddprod 'a | b | (c U (d & (g U (h ^ i))))' 'h ^ i'
run 0 ../bddprod 'Xa & (b U !a) & (b U !a)' '(b U !a) & f'

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2012 Laboratoire de Recherche et Développement # Copyright (C) 2012, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE). # de l'Epita (LRDE).
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
@ -82,7 +82,3 @@ test `wc -l < out` -eq 10
run 0 ../ltl2tgba -KW '(Ga -> Gb) W c' > out run 0 ../ltl2tgba -KW '(Ga -> Gb) W c' > out
test `grep 'is weak' out | wc -l` -eq 4 test `grep 'is weak' out | wc -l` -eq 4
test `grep 'is not weak' out | wc -l` -eq 1 test `grep 'is not weak' out | wc -l` -eq 1
run 0 ../ltl2tgba -l -KW 'F(Fa R (Gb & !a))' > out
test `grep 'is weak' out | wc -l` -eq 7
test `grep 'is not weak' out | wc -l` -eq 1

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2009 Laboratoire de Recherche et Développement # Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE). # de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), # Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre # département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -30,10 +30,6 @@ dorun()
run 0 ../ltl2tgba -f -s "$1" >output1 run 0 ../ltl2tgba -f -s "$1" >output1
run 0 ../ltl2tgba -f -S "$1" >output2 run 0 ../ltl2tgba -f -S "$1" >output2
test `wc -l <output1` = `wc -l <output2` test `wc -l <output1` = `wc -l <output2`
run 0 ../ltl2tgba -l -s "$1" >output1
run 0 ../ltl2tgba -l -S "$1" >output2
test `wc -l <output1` = `wc -l <output2`
} }
dorun 'a' dorun 'a'

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2008, 2009, 2010 Laboratoire de Recherche et # Copyright (C) 2008, 2009, 2010, 2014 Laboratoire de Recherche et
# Développement de l'Epita (LRDE). # Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de # Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de
# Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), # Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
@ -33,54 +33,54 @@ expect_ce_do()
expect_ce() expect_ce()
{ {
expect_ce_do -CR -e -l "$1" expect_ce_do -CR -e -taa "$1"
expect_ce_do -CR -e -l -D "$1" expect_ce_do -CR -e -taa -D "$1"
expect_ce_do -CR -e -f "$1" expect_ce_do -CR -e -f "$1"
expect_ce_do -CR -e -f -D "$1" expect_ce_do -CR -e -f -D "$1"
expect_ce_do -CR -e'Cou99(shy)' -l "$1" expect_ce_do -CR -e'Cou99(shy)' -taa "$1"
expect_ce_do -CR -e'Cou99(shy)' -l -D "$1" expect_ce_do -CR -e'Cou99(shy)' -taa -D "$1"
expect_ce_do -CR -e'Cou99(shy)' -f "$1" expect_ce_do -CR -e'Cou99(shy)' -f "$1"
expect_ce_do -CR -e'Cou99(shy)' -f -D "$1" expect_ce_do -CR -e'Cou99(shy)' -f -D "$1"
expect_ce_do -CR -eCVWY90 -l "$1" expect_ce_do -CR -eCVWY90 -taa "$1"
expect_ce_do -CR -eCVWY90 -f "$1" expect_ce_do -CR -eCVWY90 -f "$1"
run 0 ../ltl2tgba -CR -e'CVWY90(bsh=10M)' -l "$1" run 0 ../ltl2tgba -CR -e'CVWY90(bsh=10M)' -taa "$1"
run 0 ../ltl2tgba -CR -e'CVWY90(bsh=10M)' -f "$1" run 0 ../ltl2tgba -CR -e'CVWY90(bsh=10M)' -f "$1"
run 0 ../ltl2tgba -CR -eSE05 -l "$1" run 0 ../ltl2tgba -CR -eSE05 -taa "$1"
run 0 ../ltl2tgba -CR -eSE05 -f "$1" run 0 ../ltl2tgba -CR -eSE05 -f "$1"
run 0 ../ltl2tgba -CR -e'SE05(bsh=10M)' -l "$1" run 0 ../ltl2tgba -CR -e'SE05(bsh=10M)' -taa "$1"
run 0 ../ltl2tgba -CR -e'SE05(bsh=10M)' -f "$1" run 0 ../ltl2tgba -CR -e'SE05(bsh=10M)' -f "$1"
run 0 ../ltl2tgba -CR -eTau03_opt -f "$1" run 0 ../ltl2tgba -CR -eTau03_opt -f "$1"
run 0 ../ltl2tgba -CR -eGV04 -f "$1" run 0 ../ltl2tgba -CR -eGV04 -f "$1"
# Expect multiple accepting runs # Expect multiple accepting runs
test `../ltl2tgba -C -e'CVWY90(repeated)' -l "$1" | test `../ltl2tgba -C -e'CVWY90(repeated)' -taa "$1" |
grep Prefix: | wc -l` -ge $2 grep Prefix: | wc -l` -ge $2
test `../ltl2tgba -C -e'SE05(repeated)' -l "$1" | test `../ltl2tgba -C -e'SE05(repeated)' -taa "$1" |
grep Prefix: | wc -l` -ge $2 grep Prefix: | wc -l` -ge $2
} }
expect_no() expect_no()
{ {
run 0 ../ltl2tgba -CR -E -l "$1" run 0 ../ltl2tgba -CR -E -taa "$1"
run 0 ../ltl2tgba -CR -E -l -D "$1" run 0 ../ltl2tgba -CR -E -taa -D "$1"
run 0 ../ltl2tgba -CR -E -f "$1" run 0 ../ltl2tgba -CR -E -f "$1"
run 0 ../ltl2tgba -CR -E -f -D "$1" run 0 ../ltl2tgba -CR -E -f -D "$1"
run 0 ../ltl2tgba -CR -E'Cou99(shy)' -l "$1" run 0 ../ltl2tgba -CR -E'Cou99(shy)' -taa "$1"
run 0 ../ltl2tgba -CR -E'Cou99(shy)' -l -D "$1" run 0 ../ltl2tgba -CR -E'Cou99(shy)' -taa -D "$1"
run 0 ../ltl2tgba -CR -E'Cou99(shy)' -f "$1" run 0 ../ltl2tgba -CR -E'Cou99(shy)' -f "$1"
run 0 ../ltl2tgba -CR -E'Cou99(shy)' -f -D "$1" run 0 ../ltl2tgba -CR -E'Cou99(shy)' -f -D "$1"
run 0 ../ltl2tgba -CR -ECVWY90 -l "$1" run 0 ../ltl2tgba -CR -ECVWY90 -taa "$1"
run 0 ../ltl2tgba -CR -ECVWY90 -f "$1" run 0 ../ltl2tgba -CR -ECVWY90 -f "$1"
run 0 ../ltl2tgba -CR -E'CVWY90(bsh=10M)' -l "$1" run 0 ../ltl2tgba -CR -E'CVWY90(bsh=10M)' -taa "$1"
run 0 ../ltl2tgba -CR -E'CVWY90(bsh=10M)' -f "$1" run 0 ../ltl2tgba -CR -E'CVWY90(bsh=10M)' -f "$1"
run 0 ../ltl2tgba -CR -ESE05 -l "$1" run 0 ../ltl2tgba -CR -ESE05 -taa "$1"
run 0 ../ltl2tgba -CR -ESE05 -f "$1" run 0 ../ltl2tgba -CR -ESE05 -f "$1"
run 0 ../ltl2tgba -CR -E'SE05(bsh=10M)' -l "$1" run 0 ../ltl2tgba -CR -E'SE05(bsh=10M)' -taa "$1"
run 0 ../ltl2tgba -CR -E'SE05(bsh=10M)' -f "$1" run 0 ../ltl2tgba -CR -E'SE05(bsh=10M)' -f "$1"
run 0 ../ltl2tgba -CR -ETau03_opt -f "$1" run 0 ../ltl2tgba -CR -ETau03_opt -f "$1"
run 0 ../ltl2tgba -CR -EGV04 -f "$1" run 0 ../ltl2tgba -CR -EGV04 -f "$1"
test `../ltl2tgba -C -e'CVWY90(repeated)' -l "!($1)" | test `../ltl2tgba -C -e'CVWY90(repeated)' -taa "!($1)" |
grep Prefix: | wc -l` -ge $2 grep Prefix: | wc -l` -ge $2
test `../ltl2tgba -C -e'SE05(repeated)' -l "!($1)" | test `../ltl2tgba -C -e'SE05(repeated)' -taa "!($1)" |
grep Prefix: | wc -l` -ge $2 grep Prefix: | wc -l` -ge $2
} }
@ -94,5 +94,5 @@ expect_ce 'Fa & Xb & GFc & Gd' 1
expect_ce 'Fa & Xa & GFc & Gc' 2 expect_ce 'Fa & Xa & GFc & Gc' 2
expect_ce 'Fc & X(a | Xb) & GF(a | Xb) & Gc' 1 expect_ce 'Fc & X(a | Xb) & GF(a | Xb) & Gc' 1
expect_ce '!((FF a) <=> (F x))' 3 expect_ce '!((FF a) <=> (F x))' 3
expect_no 'Xa && (!a U b) && !b && X!b' 4 expect_no 'Xa && (!a U b) && !b && X!b' 2
expect_no '(a U !b) && Gb' 3 expect_no '(a U !b) && Gb' 2

View file

@ -30,7 +30,6 @@
#include "ltlvisit/apcollect.hh" #include "ltlvisit/apcollect.hh"
#include "ltlast/allnodes.hh" #include "ltlast/allnodes.hh"
#include "ltlparse/public.hh" #include "ltlparse/public.hh"
#include "tgbaalgos/ltl2tgba_lacim.hh"
#include "tgbaalgos/ltl2tgba_fm.hh" #include "tgbaalgos/ltl2tgba_fm.hh"
#include "tgbaalgos/ltl2taa.hh" #include "tgbaalgos/ltl2taa.hh"
#include "tgba/bddprint.hh" #include "tgba/bddprint.hh"
@ -142,8 +141,6 @@ syntax(char* prog)
<< "Translation algorithm:" << std::endl << "Translation algorithm:" << std::endl
<< " -f use Couvreur's FM algorithm for LTL" << " -f use Couvreur's FM algorithm for LTL"
<< " (default)" << std::endl << " (default)" << std::endl
<< " -l use Couvreur's LaCIM algorithm for LTL "
<< std::endl
<< " -taa use Tauriainen's TAA-based algorithm for LTL" << " -taa use Tauriainen's TAA-based algorithm for LTL"
<< std::endl << std::endl
<< " -u use Compositional translation" << " -u use Compositional translation"
@ -165,19 +162,6 @@ syntax(char* prog)
<< "(implies -f)" << std::endl << "(implies -f)" << std::endl
<< std::endl << std::endl
<< "Options for Couvreur's LaCIM algorithm (-l):"
<< std::endl
<< " -a display the acceptance_conditions BDD, not the "
<< "reachability graph"
<< std::endl
<< " -A same as -a, but as a set" << std::endl
<< " -r display the relation BDD, not the reachability graph"
<< std::endl
<< " -R same as -r, but as a set" << std::endl
<< " -R3b symbolically prune unaccepting SCC from BDD relation"
<< std::endl
<< std::endl
<< "Options for Tauriainen's TAA-based algorithm (-taa):" << "Options for Tauriainen's TAA-based algorithm (-taa):"
<< std::endl << std::endl
<< " -c enable language containment checks (implies -taa)" << " -c enable language containment checks (implies -taa)"
@ -351,7 +335,7 @@ main(int argc, char** argv)
bool utf8_opt = false; bool utf8_opt = false;
enum { NoDegen, DegenTBA, DegenSBA } degeneralize_opt = NoDegen; enum { NoDegen, DegenTBA, DegenSBA } degeneralize_opt = NoDegen;
enum { TransitionLabeled, StateLabeled } labeling_opt = TransitionLabeled; enum { TransitionLabeled, StateLabeled } labeling_opt = TransitionLabeled;
enum { TransFM, TransLaCIM, TransTAA, TransCompo } translation = TransFM; enum { TransFM, TransTAA, TransCompo } translation = TransFM;
bool fm_red = false; bool fm_red = false;
bool fm_exprop_opt = false; bool fm_exprop_opt = false;
bool fm_symb_merge_opt = true; bool fm_symb_merge_opt = true;
@ -377,7 +361,6 @@ main(int argc, char** argv)
false, false, false); false, false, false);
bool simpcache_stats = false; bool simpcache_stats = false;
bool scc_filter_all = false; bool scc_filter_all = false;
bool symbolic_scc_pruning = false;
bool display_reduced_form = false; bool display_reduced_form = false;
bool post_branching = false; bool post_branching = false;
bool fair_loop_approx = false; bool fair_loop_approx = false;
@ -443,14 +426,7 @@ main(int argc, char** argv)
utf8_opt = true; utf8_opt = true;
spot::enable_utf8(); spot::enable_utf8();
} }
else if (!strcmp(argv[formula_index], "-a"))
{
output = 2;
}
else if (!strcmp(argv[formula_index], "-A"))
{
output = 4;
}
else if (!strcmp(argv[formula_index], "-b")) else if (!strcmp(argv[formula_index], "-b"))
{ {
output = 7; output = 7;
@ -613,10 +589,6 @@ main(int argc, char** argv)
{ {
output = 16; output = 16;
} }
else if (!strcmp(argv[formula_index], "-l"))
{
translation = TransLaCIM;
}
else if (!strcmp(argv[formula_index], "-L")) else if (!strcmp(argv[formula_index], "-L"))
{ {
fair_loop_approx = true; fair_loop_approx = true;
@ -668,10 +640,6 @@ main(int argc, char** argv)
tm.stop("reading -P's argument"); tm.stop("reading -P's argument");
system_aut = s; system_aut = s;
} }
else if (!strcmp(argv[formula_index], "-r"))
{
output = 1;
}
else if (!strcmp(argv[formula_index], "-r1")) else if (!strcmp(argv[formula_index], "-r1"))
{ {
simpltl = true; simpltl = true;
@ -714,10 +682,6 @@ main(int argc, char** argv)
redopt.containment_checks = true; redopt.containment_checks = true;
redopt.containment_checks_stronger = true; redopt.containment_checks_stronger = true;
} }
else if (!strcmp(argv[formula_index], "-R"))
{
output = 3;
}
else if (!strcmp(argv[formula_index], "-R1q") else if (!strcmp(argv[formula_index], "-R1q")
|| !strcmp(argv[formula_index], "-R1t") || !strcmp(argv[formula_index], "-R1t")
|| !strcmp(argv[formula_index], "-R2q") || !strcmp(argv[formula_index], "-R2q")
@ -740,10 +704,6 @@ main(int argc, char** argv)
scc_filter = true; scc_filter = true;
scc_filter_all = true; scc_filter_all = true;
} }
else if (!strcmp(argv[formula_index], "-R3b"))
{
symbolic_scc_pruning = true;
}
else if (!strcmp(argv[formula_index], "-rd")) else if (!strcmp(argv[formula_index], "-rd"))
{ {
display_reduced_form = true; display_reduced_form = true;
@ -1021,7 +981,6 @@ main(int argc, char** argv)
switch (translation) switch (translation)
{ {
case TransFM: case TransFM:
case TransLaCIM:
case TransTAA: case TransTAA:
case TransCompo: case TransCompo:
{ {
@ -1037,7 +996,6 @@ main(int argc, char** argv)
if (f || from_file) if (f || from_file)
{ {
spot::tgba_bdd_concrete* concrete = 0;
const spot::tgba* to_free = 0; const spot::tgba* to_free = 0;
const spot::tgba* to_free2 = 0; const spot::tgba* to_free2 = 0;
spot::tgba* a = 0; spot::tgba* a = 0;
@ -1212,9 +1170,6 @@ main(int argc, char** argv)
case TransTAA: case TransTAA:
a = spot::ltl_to_taa(f, dict, containment); a = spot::ltl_to_taa(f, dict, containment);
break; break;
case TransLaCIM:
a = concrete = spot::ltl_to_tgba_lacim(f, dict);
break;
} }
tm.stop("translating formula"); tm.stop("translating formula");
to_free = a; to_free = a;
@ -1240,35 +1195,7 @@ main(int argc, char** argv)
} }
if (opt_monitor && !scc_filter) if (opt_monitor && !scc_filter)
{
if (dynamic_cast<const spot::tgba_bdd_concrete*>(a))
symbolic_scc_pruning = true;
else
scc_filter = true; scc_filter = true;
}
if (symbolic_scc_pruning)
{
const spot::tgba_bdd_concrete* bc =
dynamic_cast<const spot::tgba_bdd_concrete*>(a);
if (!bc)
{
std::cerr << ("Error: Automaton is not symbolic: cannot "
"prune SCCs symbolically.\n"
" Try -R3 instead of -R3b, or use "
"another translation.")
<< std::endl;
exit(2);
}
else
{
tm.start("reducing A_f w/ symbolic SCC pruning");
if (bc)
const_cast<spot::tgba_bdd_concrete*>(bc)
->delete_unaccepting_scc();
tm.stop("reducing A_f w/ symbolic SCC pruning");
}
}
// Remove dead SCCs and useless acceptance conditions before // Remove dead SCCs and useless acceptance conditions before
// degeneralization. // degeneralization.
@ -1701,28 +1628,6 @@ main(int argc, char** argv)
case 0: case 0:
spot::dotty_reachable(std::cout, a, assume_sba); spot::dotty_reachable(std::cout, a, assume_sba);
break; break;
case 1:
if (concrete)
spot::bdd_print_dot(std::cout, concrete->get_dict(),
concrete->get_core_data().relation);
break;
case 2:
if (concrete)
spot::bdd_print_dot(std::cout, concrete->get_dict(),
concrete->
get_core_data().acceptance_conditions);
break;
case 3:
if (concrete)
spot::bdd_print_set(std::cout, concrete->get_dict(),
concrete->get_core_data().relation);
break;
case 4:
if (concrete)
spot::bdd_print_set(std::cout, concrete->get_dict(),
concrete->
get_core_data().acceptance_conditions);
break;
case 5: case 5:
a->get_dict()->dump(std::cout); a->get_dict()->dump(std::cout);
break; break;

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011, 2012, 2013 Laboratoire de Recherche et # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire de Recherche et
# Développement de l'Epita (LRDE). # Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), # Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre # département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -41,9 +41,9 @@ check_psl ()
check_ltl () check_ltl ()
{ {
check_psl "$@" check_psl "$@"
# Make cross products with LaCIM # Make cross products with TAA
run 0 ../ltl2tgba -l -R3b -b "$1" > out.tgba run 0 ../ltl2tgba -taa -R3 -b "$1" > out.tgba
run 0 ../ltl2tgba -l -R3b -Pout.tgba -E "!($1)" run 0 ../ltl2tgba -taa -R3 -Pout.tgba -E "!($1)"
} }
check_ltl a check_ltl a

View file

@ -25,15 +25,12 @@ ltl2tgba=../ltl2tgba
../../bin/randltl -n 100 p1 p2 p3 p4 p5 p6 --tree-size 5..15 | ../../bin/randltl -n 100 p1 p2 p3 p4 p5 p6 --tree-size 5..15 |
../../bin/ltlcross --products=2 \ ../../bin/ltlcross --products=2 \
"$ltl2tgba -t -l %f > %T" \
"$ltl2tgba -t -l -R3b -r4 %f > %T" \
"$ltl2tgba -t -f %f > %T" \ "$ltl2tgba -t -f %f > %T" \
"$ltl2tgba -t -f -y %f > %T" \ "$ltl2tgba -t -f -y %f > %T" \
"$ltl2tgba -t -f -r4 %f > %T" \ "$ltl2tgba -t -f -r4 %f > %T" \
"$ltl2tgba -t -f -R3 %f > %T" \ "$ltl2tgba -t -f -R3 %f > %T" \
"$ltl2tgba -t -f -R3 -Rm %f > %T" \ "$ltl2tgba -t -f -R3 -Rm %f > %T" \
"$ltl2tgba -t -f -R3 -RM %f > %T" \ "$ltl2tgba -t -f -R3 -RM %f > %T" \
"$ltl2tgba -t -l -R3b -Rm %f > %T" \
"$ltl2tgba -t -f -D %f > %T" \ "$ltl2tgba -t -f -D %f > %T" \
"$ltl2tgba -t -f -D %f > %T" \ "$ltl2tgba -t -f -D %f > %T" \
"$ltl2tgba -t -f -r4 -R3 -RDS %f > %T" \ "$ltl2tgba -t -f -r4 -R3 -RDS %f > %T" \

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2012 Laboratoire de Recherche et // Copyright (C) 2008, 2009, 2012, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de // Copyright (C) 2003, 2004 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), // Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
@ -25,9 +25,8 @@
#include <cstdlib> #include <cstdlib>
#include "ltlast/allnodes.hh" #include "ltlast/allnodes.hh"
#include "ltlparse/public.hh" #include "ltlparse/public.hh"
#include "tgbaalgos/ltl2tgba_lacim.hh"
#include "tgba/tgbaproduct.hh" #include "tgba/tgbaproduct.hh"
#include "tgba/tgbabddconcreteproduct.hh" #include "tgbaalgos/ltl2tgba_fm.hh"
#include "tgbaalgos/dotty.hh" #include "tgbaalgos/dotty.hh"
void void
@ -61,16 +60,11 @@ main(int argc, char** argv)
spot::bdd_dict* dict = new spot::bdd_dict(); spot::bdd_dict* dict = new spot::bdd_dict();
{ {
spot::tgba_bdd_concrete* a1 = spot::ltl_to_tgba_lacim(f1, dict); auto a1 = spot::ltl_to_tgba_fm(f1, dict);
spot::tgba_bdd_concrete* a2 = spot::ltl_to_tgba_lacim(f2, dict); auto a2 = spot::ltl_to_tgba_fm(f2, dict);
f1->destroy(); f1->destroy();
f2->destroy(); f2->destroy();
auto p = new spot::tgba_product(a1, a2);
#ifdef BDD_CONCRETE_PRODUCT
spot::tgba_bdd_concrete* p = spot::product(a1, a2);
#else
spot::tgba_product* p = new spot::tgba_product(a1, a2);
#endif
spot::dotty_reachable(std::cout, p); spot::dotty_reachable(std::cout, p);
delete p; delete p;
delete a1; delete a1;

View file

@ -1,78 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2012, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// 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/>.
#include <iostream>
#include <cassert>
#include <cstdlib>
#include "ltlast/allnodes.hh"
#include "ltlparse/public.hh"
#include "tgbaalgos/ltl2tgba_lacim.hh"
#include "tgba/tgbaproduct.hh"
#include "tgba/tgbabddconcreteproduct.hh"
#include "tgbaparse/public.hh"
#include "tgbaalgos/save.hh"
void
syntax(char* prog)
{
std::cerr << prog << " formula file" << std::endl;
exit(2);
}
int
main(int argc, char** argv)
{
int exit_code = 0;
if (argc != 3)
syntax(argv[0]);
spot::bdd_dict* dict = new spot::bdd_dict();
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::ltl::parse_error_list pel1;
const spot::ltl::formula* f1 = spot::ltl::parse(argv[1], pel1, env);
if (spot::ltl::format_parse_errors(std::cerr, argv[1], pel1))
return 2;
spot::tgba_parse_error_list pel2;
spot::tgba* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
return 2;
{
spot::tgba_bdd_concrete* a1 = spot::ltl_to_tgba_lacim(f1, dict);
f1->destroy();
spot::tgba_product p(a1, a2);
spot::tgba_save_reachable(std::cout, &p);
delete a1;
}
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
delete a2;
assert(spot::ltl::atomic_prop::instance_count() == 0);
delete dict;
return exit_code;
}

View file

@ -1,46 +0,0 @@
#!/bin/sh
# Copyright (C) 2009 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# 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
# We don't check the output, but just running this might be enough to
# trigger assertions or I/O errors.
cat >input1 <<EOF
acc = p1;
s1, s3, "a",;
s1, s2, "b", p1;
s2, s1, "!a",;
s2, s3, "c",;
EOF
run 0 ../mixprod 'F(a U b) & Xa' input1 >stdout
cat stdout
# Make sure we can read the produced output
run 0 ../mixprod 'G!a' stdout
rm input1 stdout

View file

@ -32,30 +32,6 @@ need_lbtt
set -e set -e
cat > config <<EOF cat > config <<EOF
Algorithm
{
Name = "Spot (Couvreur -- LaCIM)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -l -F -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- LaCIM), reduction of formula"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -l -F -t -r4'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- LaCIM), degeneralized"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -l -F -t -D'"
Enabled = no
}
Algorithm Algorithm
{ {
Name = "Spot (Couvreur -- LaCIM), fake" Name = "Spot (Couvreur -- LaCIM), fake"
@ -136,14 +112,6 @@ Algorithm
Enabled = yes Enabled = yes
} }
Algorithm
{
Name = "Spot (Couvreur -- LaCIM), +pre +WDBA"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -r4 -R3b -Rm -F -l -t'"
Enabled = yes
}
Algorithm Algorithm
{ {
Name = "Spot (Couvreur -- FM), without symb_merge" Name = "Spot (Couvreur -- FM), without symb_merge"
@ -201,15 +169,6 @@ Algorithm
Enabled = yes Enabled = yes
} }
Algorithm
{
Name = "Spot (Couvreur -- LaCim), simulated"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -l -t -RDS -r4 -R3'"
Enabled = yes
}
Algorithm Algorithm
{ {
Name = "Spot (Couvreur -- TAA), simulated" Name = "Spot (Couvreur -- TAA), simulated"

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2010 Laboratoire de Recherche et Développement # Copyright (C) 2010, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE). # de l'Epita (LRDE).
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
@ -114,7 +114,7 @@ while read f; do
# to detect any crash. Do that only for the first few formula, because # to detect any crash. Do that only for the first few formula, because
# it takes a long time. # it takes a long time.
if test $i -lt 5; then if test $i -lt 5; then
run 0 ../ltl2tgba -l -R3b -DS -Rm "!($f)" >/dev/null run 0 ../ltl2tgba -taa -DS -Rm "!($f)" >/dev/null
i=`expr $i + 1` i=`expr $i + 1`
fi fi

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2012 Laboratoire de Recherche et Développement # Copyright (C) 2012, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE). # de l'Epita (LRDE).
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
@ -37,11 +37,3 @@ run 0 ../ltl2tgba -Rm -kt 'Fa | XGd' > out2
cmp out expected cmp out expected
cmp out2 expected cmp out2 expected
# This non-obligation formula used to be minimized by mistake when
# translated with lacim.
x=`../ltl2tgba -l -Rm 'F(Fa R (Gb & !a))' |
grep -v -- '->' |
sed -n 's/.*label="\(..*\)".*/\1/p' |
tr -d '0-9\n'`
test -n "$x"

View file

@ -565,7 +565,6 @@ an identifier: <span class="formula">aUb</span> is an atomic proposition, unlike
<ul class="head"> <ul class="head">
<li>Translator Algorithm:</li> <li>Translator Algorithm:</li>
<li><a href="#tabs-tfm" class="btip" title="A tableau construction that uses BDDs to symbolically represent each state of the automaton. This is the best algorithm of the three, and the only one that has been extended to support PSL operators.">Couvreur/FM</a></li> <li><a href="#tabs-tfm" class="btip" title="A tableau construction that uses BDDs to symbolically represent each state of the automaton. This is the best algorithm of the three, and the only one that has been extended to support PSL operators.">Couvreur/FM</a></li>
<li><a href="#tabs-tla" class="btip" title="Builds a purely symbolic automaton, using BDDs to encode the transition relation. The translation itself is fast (it uses a number of BDD operations that is linear in the size of the formula), but the resulting symbolic encoding is better used symbolically. If you develop it explicitly (e.g. to draw it, as on this page) the result can easily have an exponential number of states.">Couvreur/LaCIM</a></li>
<li><a href="#tabs-tta" class="btip" title="An implementation of Heikki Tauriainen's Ph.D. thesis algorithm to translate LTL formulas via very weak alternating automata with transition-based generalized acceptance conditions.">Tauriainen/TAA</a></li> <li><a href="#tabs-tta" class="btip" title="An implementation of Heikki Tauriainen's Ph.D. thesis algorithm to translate LTL formulas via very weak alternating automata with transition-based generalized acceptance conditions.">Tauriainen/TAA</a></li>
<li><a href="#tabs-tl3" class="btip" title="An improved version of LTL2BA, overhauled by Tomáš Babiak during his Ph.D., and described at TACAS'12.<br>LTL3BA is not part of Spot. Options in this tab correspond to options offered by LTL3BA, and have some overlap with the options offered by Spot upstream and downstream.">LTL3BA</a></li> <li><a href="#tabs-tl3" class="btip" title="An improved version of LTL2BA, overhauled by Tomáš Babiak during his Ph.D., and described at TACAS'12.<br>LTL3BA is not part of Spot. Options in this tab correspond to options offered by LTL3BA, and have some overlap with the options offered by Spot upstream and downstream.">LTL3BA</a></li>
<li><a href="#tabs-tcs" class="btip" title="Compositionnal suspension.<br>To be presented at Spin'13. Suspendable formulas are formulas such as <span class='formula'>GFa</span> or <span class='formula'>FGb</span> whose verification can always be postponed by a finite number of step. In this approach, we extract all suspendable subformulas, translate them separately from the main, skeleton automaton, only to merge them back in the accepting SCC.">Comp.Susp.</a></li> <li><a href="#tabs-tcs" class="btip" title="Compositionnal suspension.<br>To be presented at Spin'13. Suspendable formulas are formulas such as <span class='formula'>GFa</span> or <span class='formula'>FGb</span> whose verification can always be postponed by a finite number of step. In this approach, we extract all suspendable subformulas, translate them separately from the main, skeleton automaton, only to merge them back in the accepting SCC.">Comp.Susp.</a></li>
@ -591,12 +590,6 @@ an identifier: <span class="formula">aUb</span> is an atomic proposition, unlike
fair-loop approximations fair-loop approximations
</label><br> </label><br>
</div> </div>
<div id="tabs-tla">
<label class="rtip" title="The automaton built by Couvreur/LaCIM is represented symbolically using BDDs. Useless SCCs can be removed using a series of fix-point operations. You may want to disable the <b>prune unaccepting SCCs</b> automaton simplification.">
<INPUT type="checkbox" name="la" value="sp" checked>
symbolically prune unaccepting SCCs
</label><br>
</div>
<div id="tabs-tta"> <div id="tabs-tta">
<label class="rtip" title="Enable a refined set of translation rules, based on language inclusion between subformulas. Because language inclusion between formula is tested using automata operations on translations for subformulas, this option can be slow."> <label class="rtip" title="Enable a refined set of translation rules, based on language inclusion between subformulas. Because language inclusion between formula is tested using automata operations on translations for subformulas, this option can be slow.">
<INPUT type="checkbox" name="ta" value="lc" checked> <INPUT type="checkbox" name="ta" value="lc" checked>

View file

@ -1,6 +1,6 @@
#!@PYTHON@ #!@PYTHON@
# -*- mode: python; coding: utf-8 -*- # -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2011, 2012, 2013 Laboratoire de Recherche et # Copyright (C) 2011, 2012, 2013, 2014 Laboratoire de Recherche et
# Développement de l'Epita (LRDE). # Développement de l'Epita (LRDE).
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
@ -518,10 +518,6 @@ if translator == 'fm':
automaton = spot.ltl_to_tgba_fm(f, dict, automaton = spot.ltl_to_tgba_fm(f, dict,
exprop, symb_merge, exprop, symb_merge,
branching_postponement, fair_loop_approx) branching_postponement, fair_loop_approx)
elif translator == 'la':
automaton = spot.ltl_to_tgba_lacim(f, dict)
if form.getfirst('la', '') == 'sp':
automaton.delete_unaccepting_scc()
elif translator == 'ta': elif translator == 'ta':
refined_rules = False refined_rules = False
if form.getfirst('ta', '') == 'lc': if form.getfirst('ta', '') == 'lc':
@ -594,6 +590,9 @@ elif translator == 'cs':
automaton = spot.compsusp(f, dict, cs_nowdba, cs_nosimul, automaton = spot.compsusp(f, dict, cs_nowdba, cs_nosimul,
cs_early_start, donot_inject) cs_early_start, donot_inject)
else:
unbufprint('''<div class="error">unsupported translator</div>''')
finish()
# Monitor output # Monitor output
if output_type == 'm': if output_type == 'm':

View file

@ -62,6 +62,8 @@ namespace std {
#include "ltlparse/public.hh" #include "ltlparse/public.hh"
#include "tgba/bdddict.hh"
#include "ltlvisit/dotty.hh" #include "ltlvisit/dotty.hh"
#include "ltlvisit/dump.hh" #include "ltlvisit/dump.hh"
#include "ltlvisit/lunabbrev.hh" #include "ltlvisit/lunabbrev.hh"
@ -71,17 +73,12 @@ namespace std {
#include "ltlvisit/tunabbrev.hh" #include "ltlvisit/tunabbrev.hh"
#include "ltlvisit/apcollect.hh" #include "ltlvisit/apcollect.hh"
#include "tgba/bdddict.hh"
#include "tgba/bddprint.hh" #include "tgba/bddprint.hh"
#include "tgba/state.hh" #include "tgba/state.hh"
#include "tgba/succiter.hh" #include "tgba/succiter.hh"
#include "tgba/tgba.hh" #include "tgba/tgba.hh"
#include "tgba/sba.hh" #include "tgba/sba.hh"
#include "tgba/statebdd.hh"
#include "tgba/taatgba.hh" #include "tgba/taatgba.hh"
#include "tgba/tgbabddcoredata.hh"
#include "tgba/succiterconcrete.hh"
#include "tgba/tgbabddconcrete.hh"
#include "tgba/tgbaexplicit.hh" #include "tgba/tgbaexplicit.hh"
#include "tgba/tgbaproduct.hh" #include "tgba/tgbaproduct.hh"
#include "tgba/tgbatba.hh" #include "tgba/tgbatba.hh"
@ -95,7 +92,6 @@ namespace std {
#include "tgbaalgos/lbtt.hh" #include "tgbaalgos/lbtt.hh"
#include "tgbaalgos/ltl2taa.hh" #include "tgbaalgos/ltl2taa.hh"
#include "tgbaalgos/ltl2tgba_fm.hh" #include "tgbaalgos/ltl2tgba_fm.hh"
#include "tgbaalgos/ltl2tgba_lacim.hh"
#include "tgbaalgos/compsusp.hh" #include "tgbaalgos/compsusp.hh"
#include "tgbaalgos/magic.hh" #include "tgbaalgos/magic.hh"
#include "tgbaalgos/minimize.hh" #include "tgbaalgos/minimize.hh"
@ -175,6 +171,8 @@ using namespace spot;
%include "ltlparse/public.hh" %include "ltlparse/public.hh"
%include "tgba/bdddict.hh"
%include "ltlvisit/dotty.hh" %include "ltlvisit/dotty.hh"
%include "ltlvisit/dump.hh" %include "ltlvisit/dump.hh"
%include "ltlvisit/lunabbrev.hh" %include "ltlvisit/lunabbrev.hh"
@ -192,7 +190,6 @@ using namespace spot;
%feature("new") spot::explicit_se05_search; %feature("new") spot::explicit_se05_search;
%feature("new") spot::ltl_to_taa; %feature("new") spot::ltl_to_taa;
%feature("new") spot::ltl_to_tgba_fm; %feature("new") spot::ltl_to_tgba_fm;
%feature("new") spot::ltl_to_tgba_lacim;
%feature("new") spot::compsusp; %feature("new") spot::compsusp;
%feature("new") spot::minimize_wdba; %feature("new") spot::minimize_wdba;
%feature("new") spot::minimize_monitor; %feature("new") spot::minimize_monitor;
@ -218,17 +215,12 @@ using namespace spot;
// Help SWIG with namespace lookups. // Help SWIG with namespace lookups.
#define ltl spot::ltl #define ltl spot::ltl
%include "tgba/bdddict.hh"
%include "tgba/bddprint.hh" %include "tgba/bddprint.hh"
%include "tgba/state.hh" %include "tgba/state.hh"
%include "tgba/succiter.hh" %include "tgba/succiter.hh"
%include "tgba/tgba.hh" %include "tgba/tgba.hh"
%include "tgba/sba.hh" %include "tgba/sba.hh"
%include "tgba/statebdd.hh"
%include "tgba/taatgba.hh" %include "tgba/taatgba.hh"
%include "tgba/tgbabddcoredata.hh"
%include "tgba/succiterconcrete.hh"
%include "tgba/tgbabddconcrete.hh"
%include "tgba/tgbaexplicit.hh" %include "tgba/tgbaexplicit.hh"
%include "tgba/tgbaproduct.hh" %include "tgba/tgbaproduct.hh"
%include "tgba/tgbatba.hh" %include "tgba/tgbatba.hh"
@ -241,6 +233,13 @@ namespace spot {
}; };
} }
%template(tgba_explicit_succ_iterator__string)
spot::tgba_explicit_succ_iterator<state_explicit_string>;
%template(tgba_explicit_succ_iterator__number)
spot::tgba_explicit_succ_iterator<state_explicit_number>;
%template(tgba_explicit_succ_iterator__formula)
spot::tgba_explicit_succ_iterator<state_explicit_formula>;
%template(explicit_graph__string_tgba) %template(explicit_graph__string_tgba)
spot::explicit_graph<state_explicit_string, tgba>; spot::explicit_graph<state_explicit_string, tgba>;
%template(explicit_graph__number_tgba) %template(explicit_graph__number_tgba)
@ -298,7 +297,6 @@ namespace spot {
%include "tgbaalgos/lbtt.hh" %include "tgbaalgos/lbtt.hh"
%include "tgbaalgos/ltl2taa.hh" %include "tgbaalgos/ltl2taa.hh"
%include "tgbaalgos/ltl2tgba_fm.hh" %include "tgbaalgos/ltl2tgba_fm.hh"
%include "tgbaalgos/ltl2tgba_lacim.hh"
%include "tgbaalgos/compsusp.hh" %include "tgbaalgos/compsusp.hh"
%include "tgbaalgos/magic.hh" %include "tgbaalgos/magic.hh"
%include "tgbaalgos/minimize.hh" %include "tgbaalgos/minimize.hh"

View file

@ -25,24 +25,33 @@
import buddy import buddy
import spot import spot
import sys import sys
simp = spot.ltl_simplifier()
e = spot.default_environment.instance() e = spot.default_environment.instance()
p = spot.empty_parse_error_list() p = spot.empty_parse_error_list()
f = spot.parse('GFa', p, e) f = spot.parse('GFa', p, e)
dict = spot.bdd_dict() d = simp.get_dict()
a = spot.ltl_to_tgba_lacim(f, dict) a = spot.ltl_to_tgba_fm(f, d)
g = spot.parse('b&c', p, e)
b = simp.as_bdd(g)
buddy.bdd_printset(b); spot.nl_cout()
del g
s0 = a.get_init_state() s0 = a.get_init_state()
b = s0.as_bdd() it = a.succ_iter(s0)
sys.stdout.write("%s\n" % b) it.first()
iter = a.succ_iter(s0) while not it.done():
iter.first() c = it.current_condition()
while not iter.done():
c = iter.current_condition()
sys.stdout.write("%s\n" % c) sys.stdout.write("%s\n" % c)
b &= c # `&=' is defined only in buddy. So if this statement works b &= c # `&=' is defined only in buddy. So if this statement works
# it means buddy can grok spot's objects. # it means buddy can grok spot's objects.
iter.next() buddy.bdd_printset(c); spot.nl_cout()
it.next()
buddy.bdd_printset(b); spot.nl_cout()
sys.stdout.write("%s\n" % b) sys.stdout.write("%s\n" % b)
del b del b
del c del c
del f del f
del a del a
del simp

View file

@ -31,14 +31,11 @@ def usage(prog):
sys.stderr.write("""Usage: %s [OPTIONS...] formula sys.stderr.write("""Usage: %s [OPTIONS...] formula
Options: Options:
-a display the acceptance_conditions BDD, not the reachability graph
-A same as -a, but as a set
-d turn on traces during parsing -d turn on traces during parsing
-D degeneralize the automaton -D degeneralize the automaton
-f use Couvreur's FM algorithm for translation -f use Couvreur's FM algorithm for translation
-r display the relation BDD, not the reachability graph
-R same as -r, but as a set
-t display reachable states in LBTT's format -t display reachable states in LBTT's format
-T use ltl2taa for translation
-v display the BDD variables used by the automaton -v display the BDD variables used by the automaton
""" % prog) """ % prog)
sys.exit(2) sys.exit(2)
@ -46,7 +43,7 @@ Options:
prog = sys.argv[0] prog = sys.argv[0]
try: try:
opts, args = getopt.getopt(sys.argv[1:], 'aAdDfrRtv') opts, args = getopt.getopt(sys.argv[1:], 'dDftTv')
except getopt.GetoptError: except getopt.GetoptError:
usage(prog) usage(prog)
@ -55,24 +52,19 @@ debug_opt = False
degeneralize_opt = None degeneralize_opt = None
output = 0 output = 0
fm_opt = 0 fm_opt = 0
taa_opt = 0
for o, a in opts: for o, a in opts:
if o == '-a': if o == '-d':
output = 2
elif o == '-A':
output = 4
elif o == '-d':
debug_opt = True debug_opt = True
elif o == '-D': elif o == '-D':
degeneralize_opt = 1 degeneralize_opt = 1
elif o == '-f': elif o == '-f':
fm_opt = 1 fm_opt = 1
elif o == '-r':
output = 1
elif o == '-R':
output = 3
elif o == '-t': elif o == '-t':
output = 6 output = 6
elif o == '-T':
taa_opt = 1
elif o == '-v': elif o == '-v':
output = 5 output = 5
else: else:
@ -98,8 +90,10 @@ if f:
if fm_opt: if fm_opt:
a = spot.ltl_to_tgba_fm(f, dict) a = spot.ltl_to_tgba_fm(f, dict)
concrete = 0 concrete = 0
elif taa_opt:
a = concrete = spot.ltl_to_taa(f, dict)
else: else:
a = concrete = spot.ltl_to_tgba_lacim(f, dict) assert "unspecified translator"
f.destroy() f.destroy()
del f del f
@ -109,24 +103,6 @@ if f:
if output == 0: if output == 0:
spot.dotty_reachable(cout, a) spot.dotty_reachable(cout, a)
elif output == 1:
if concrete:
spot.bdd_print_dot(cout, concrete.get_dict(),
concrete.get_core_data().relation)
elif output == 2:
if concrete:
spot.bdd_print_dot(cout, concrete.get_dict(),
concrete.get_core_data().acceptance_conditions)
elif output == 3:
if concrete:
spot.bdd_print_set(cout, concrete.get_dict(),
concrete.get_core_data().relation)
spot.nl_cout()
elif output == 4:
if concrete:
spot.bdd_print_set(cout, concrete.get_dict(),
concrete.get_core_data().acceptance_conditions)
spot.nl_cout()
elif output == 5: elif output == 5:
a.get_dict().dump(cout) a.get_dict().dump(cout)
elif output == 6: elif output == 6:

View file

@ -1,4 +1,6 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2014 Laboratoire de Recherche et
# Développement de l'EPITA.
# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), # Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre # département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie. # et Marie Curie.
@ -24,15 +26,15 @@ set -e
# We don't check the output, but just running these might be enough to # We don't check the output, but just running these might be enough to
# trigger assertions. # trigger assertions.
./run $srcdir/ltl2tgba.py a ./run $srcdir/ltl2tgba.py -T a
./run $srcdir/ltl2tgba.py 'a U b' ./run $srcdir/ltl2tgba.py -T 'a U b'
./run $srcdir/ltl2tgba.py 'X a' ./run $srcdir/ltl2tgba.py -T 'X a'
./run $srcdir/ltl2tgba.py 'a & b & c' ./run $srcdir/ltl2tgba.py -T 'a & b & c'
./run $srcdir/ltl2tgba.py 'a | b | (c U (d & (g U (h ^ i))))' ./run $srcdir/ltl2tgba.py -T 'a | b | (c U (d & (g U (h ^ i))))'
./run $srcdir/ltl2tgba.py 'Xa & (b U !a) & (b U !a)' ./run $srcdir/ltl2tgba.py -T 'Xa & (b U !a) & (b U !a)'
./run $srcdir/ltl2tgba.py 'Fa & Xb & GFc & Gd' ./run $srcdir/ltl2tgba.py -T 'Fa & Xb & GFc & Gd'
./run $srcdir/ltl2tgba.py 'Fa & Xa & GFc & Gc' ./run $srcdir/ltl2tgba.py -T 'Fa & Xa & GFc & Gc'
./run $srcdir/ltl2tgba.py 'Fc & X(a | Xb) & GF(a | Xb) & Gc' ./run $srcdir/ltl2tgba.py -T 'Fc & X(a | Xb) & GF(a | Xb) & Gc'
./run $srcdir/ltl2tgba.py -f a ./run $srcdir/ltl2tgba.py -f a
./run $srcdir/ltl2tgba.py -f 'a U b' ./run $srcdir/ltl2tgba.py -f 'a U b'