spot/src/ta/taproduct.hh
Alexandre Duret-Lutz dc5ad78b3e Make bdd_dict a shared pointer.
* src/tgba/bdddict.hh (bdd_dict_ptr): New type.
(make_bdd_dict): New function.
* iface/dve2/dve2.cc, iface/dve2/dve2.hh, iface/dve2/dve2check.cc,
src/bin/dstar2tgba.cc, src/bin/ltlcross.cc,
src/dstarparse/dstarparse.yy, src/dstarparse/public.hh,
src/graphtest/tgbagraph.cc, src/kripke/kripkeexplicit.cc,
src/kripke/kripkeexplicit.hh, src/kripke/kripkeprint.cc,
src/kripkeparse/kripkeparse.yy, src/kripkeparse/public.hh,
src/kripketest/parse_print_test.cc, src/ltlvisit/apcollect.cc,
src/ltlvisit/contain.cc, src/ltlvisit/contain.hh,
src/ltlvisit/simplify.cc, src/ltlvisit/simplify.hh,
src/neverparse/neverclaimparse.yy, src/neverparse/public.hh,
src/priv/accmap.hh, src/saba/saba.hh, src/saba/sabacomplementtgba.cc,
src/saba/sabacomplementtgba.hh, src/sabatest/sabacomplementtgba.cc,
src/ta/ta.hh, src/ta/taexplicit.cc, src/ta/taexplicit.hh,
src/ta/taproduct.cc, src/ta/taproduct.hh, src/ta/tgtaexplicit.cc,
src/ta/tgtaexplicit.hh, src/taalgos/dotty.cc, src/tgba/bddprint.cc,
src/tgba/bddprint.hh, src/tgba/formula2bdd.cc, src/tgba/formula2bdd.hh,
src/tgba/taatgba.cc, src/tgba/taatgba.hh, src/tgba/tgba.hh,
src/tgba/tgbagraph.hh, src/tgba/tgbakvcomplement.cc,
src/tgba/tgbakvcomplement.hh, src/tgba/tgbaproduct.cc,
src/tgba/tgbaproduct.hh, src/tgba/tgbaproxy.cc, src/tgba/tgbaproxy.hh,
src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh,
src/tgba/tgbascc.cc, src/tgba/tgbascc.hh, src/tgba/tgbasgba.cc,
src/tgba/tgbasgba.hh, src/tgba/tgbaunion.cc, src/tgba/tgbaunion.hh,
src/tgba/wdbacomp.cc, src/tgbaalgos/compsusp.cc,
src/tgbaalgos/compsusp.hh, src/tgbaalgos/degen.cc,
src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc,
src/tgbaalgos/emptiness.cc, src/tgbaalgos/lbtt.cc,
src/tgbaalgos/lbtt.hh, src/tgbaalgos/ltl2taa.cc,
src/tgbaalgos/ltl2taa.hh, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/randomgraph.cc,
src/tgbaalgos/randomgraph.hh, src/tgbaalgos/save.cc,
src/tgbaalgos/translate.cc, src/tgbaalgos/translate.hh,
src/tgbaalgos/word.cc, src/tgbaalgos/word.hh, src/tgbaparse/public.hh,
src/tgbaparse/tgbaparse.yy, src/tgbatest/complementation.cc,
src/tgbatest/explprod.cc, src/tgbatest/ltl2tgba.cc,
src/tgbatest/ltlprod.cc, src/tgbatest/maskacc.cc,
src/tgbatest/powerset.cc, src/tgbatest/randtgba.cc,
src/tgbatest/taatgba.cc, src/tgbatest/tgbaread.cc,
src/tgbatest/tripprod.cc, wrap/python/ajax/spot.in,
wrap/python/tests/alarm.py, wrap/python/tests/ltl2tgba.py,
wrap/python/tests/parsetgba.py: Update to use bdd_dict_ptr and
make_bdd_dict().
2014-08-13 20:23:09 +02:00

219 lines
5.4 KiB
C++

// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SPOT_TA_TAPRODUCT_HH
# define SPOT_TA_TAPRODUCT_HH
#include "ta.hh"
#include "kripke/kripke.hh"
namespace spot
{
/// \ingroup ta_emptiness_check
/// \brief A state for spot::ta_product.
///
/// This state is in fact a pair of state: the state from the TA
/// automaton and that of Kripke structure.
class SPOT_API state_ta_product : public state
{
public:
/// \brief Constructor
/// \param ta_state The state from the ta automaton.
/// \param kripke_state The state from Kripke structure.
state_ta_product(state* ta_state, state* kripke_state) :
ta_state_(ta_state), kripke_state_(kripke_state)
{
}
/// Copy constructor
state_ta_product(const state_ta_product& o);
virtual
~state_ta_product();
state*
get_ta_state() const
{
return ta_state_;
}
state*
get_kripke_state() const
{
return kripke_state_;
}
virtual int
compare(const state* other) const;
virtual size_t
hash() const;
virtual state_ta_product*
clone() const;
private:
state* ta_state_; ///< State from the ta automaton.
state* kripke_state_; ///< State from the kripke structure.
};
/// \brief Iterate over the successors of a product computed on the fly.
class SPOT_API ta_succ_iterator_product : public ta_succ_iterator
{
public:
ta_succ_iterator_product(const state_ta_product* s, const ta* t,
const kripke* k);
virtual
~ta_succ_iterator_product();
// iteration
bool first();
bool next();
bool done() const;
// inspection
state_ta_product*
current_state() const;
bdd
current_condition() const;
bdd
current_acceptance_conditions() const;
/// \brief Return true if the changeset of the current transition is empty
bool
is_stuttering_transition() const;
protected:
//@{
/// Internal routines to advance to the next successor.
void step_();
bool next_non_stuttering_();
/// \brief Move to the next successor in the kripke structure
void
next_kripke_dest();
//@}
protected:
const state_ta_product* source_;
const ta* ta_;
const kripke* kripke_;
ta_succ_iterator* ta_succ_it_;
tgba_succ_iterator* kripke_succ_it_;
state_ta_product* current_state_;
bdd current_condition_;
bdd current_acceptance_conditions_;
bool is_stuttering_transition_;
bdd kripke_source_condition;
state * kripke_current_dest_state;
};
/// \ingroup ta_emptiness_check
/// \brief A lazy product between a Testing automaton and a Kripke structure.
/// (States are computed on the fly.)
class SPOT_API ta_product: public ta
{
public:
/// \brief Constructor.
/// \param testing_automaton The TA component in the product.
/// \param kripke_structure The Kripke component in the product.
ta_product(const ta* testing_automaton, const kripke* kripke_structure);
virtual
~ta_product();
virtual const std::set<state*, state_ptr_less_than>
get_initial_states_set() const;
virtual ta_succ_iterator_product*
succ_iter(const spot::state* s) const;
virtual ta_succ_iterator_product*
succ_iter(const spot::state* s, bdd changeset) const;
virtual bdd_dict_ptr
get_dict() const;
virtual std::string
format_state(const spot::state* s) const;
virtual bool
is_accepting_state(const spot::state* s) const;
virtual bool
is_livelock_accepting_state(const spot::state* s) const;
virtual bool
is_initial_state(const spot::state* s) const;
/// \brief Return true if the state \a s has no succeseurs
/// in the TA automaton (the TA component of the product automaton)
virtual bool
is_hole_state_in_ta_component(const spot::state* s) const;
virtual bdd
get_state_condition(const spot::state* s) const;
virtual bdd
all_acceptance_conditions() const;
virtual void
free_state(const spot::state* s) const;
const ta*
get_ta() const
{
return ta_;
}
const kripke*
get_kripke() const
{
return kripke_;
}
private:
bdd_dict_ptr dict_;
const ta* ta_;
const kripke* kripke_;
// Disallow copy.
ta_product(const ta_product&) SPOT_DELETED;
ta_product& operator=(const ta_product&) SPOT_DELETED;
};
class SPOT_API ta_succ_iterator_product_by_changeset :
public ta_succ_iterator_product
{
public:
ta_succ_iterator_product_by_changeset(const state_ta_product* s,
const ta* t, const kripke* k,
bdd changeset);
/// \brief Move to the next successor in the Kripke structure
void next_kripke_dest();
};
}
#endif // SPOT_TA_TAPRODUCT_HH