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:
parent
26b932828b
commit
116fe8654f
43 changed files with 111 additions and 2291 deletions
|
|
@ -30,19 +30,11 @@ tgba_HEADERS = \
|
|||
bddprint.hh \
|
||||
formula2bdd.hh \
|
||||
futurecondcol.hh \
|
||||
public.hh \
|
||||
sba.hh \
|
||||
state.hh \
|
||||
statebdd.hh \
|
||||
succiter.hh \
|
||||
succiterconcrete.hh \
|
||||
taatgba.hh \
|
||||
tgba.hh \
|
||||
tgbabddconcrete.hh \
|
||||
tgbabddconcretefactory.hh \
|
||||
tgbabddconcreteproduct.hh \
|
||||
tgbabddcoredata.hh \
|
||||
tgbabddfactory.hh \
|
||||
tgbaexplicit.hh \
|
||||
tgbagraph.hh \
|
||||
tgbakvcomplement.hh \
|
||||
|
|
@ -62,14 +54,8 @@ libtgba_la_SOURCES = \
|
|||
bddprint.cc \
|
||||
formula2bdd.cc \
|
||||
futurecondcol.cc \
|
||||
succiterconcrete.cc \
|
||||
statebdd.cc \
|
||||
taatgba.cc \
|
||||
tgba.cc \
|
||||
tgbabddconcrete.cc \
|
||||
tgbabddconcretefactory.cc \
|
||||
tgbabddconcreteproduct.cc \
|
||||
tgbabddcoredata.cc \
|
||||
tgbaexplicit.cc \
|
||||
tgbakvcomplement.cc \
|
||||
tgbaproduct.cc \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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_;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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_);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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 != ©)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -172,7 +172,11 @@ namespace spot
|
|||
/// States labeled by a formula
|
||||
/// \ingroup tgba_representation
|
||||
class SPOT_API state_explicit_formula:
|
||||
#ifndef SWIG
|
||||
public state_explicit<const ltl::formula*, ltl::formula_ptr_hash>
|
||||
#else
|
||||
public state
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
state_explicit_formula():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue