Stable version of TGTA approach implementation (automaton + product)
* src/ta/tgta.hh, src/ta/tgta.cc, src/ta/tgtaexplicit.hh, src/ta/tgtaexplicit.hh, src/ta/tgtaproduct.hh, src/ta/tgtaproduct.cc, src/taalgos/minimize.cc, src/taalgos/minimize.hh, src/taalgos/emptinessta.hh, src/taalgos/emptinessta.hh, src/taalgos/emptinessta.cc, src/taalgos/tgba2ta.hh, src/taalgos/tgba2ta.cc: rename tgbta to tgta in this source files. * src/ta/tgbtaexplicit.hh, src/ta/tgbtaproduct.hh, src/ta/tgbta.cc, src/ta/tgbtaproduct.cc, src/ta/tgbta.hh, src/ta/tgbtaexplicit.cc: Rename as... * src/ta/taexplicit.cc, src/ta/taexplicit.hh, src/ta/taproduct.cc, src/ta/taproduct.hh, src/ta/tgtaexplicit.cc: ... these. * src/taalgos/sba2ta.hh, src/taalgos/sba2ta.cc: deleted because the implementation of all the transformations beteween TGBA and the different forms of TA are new implemented in src/taalgos/tgba2ta.hh and src/taalgos/tgba2ta.cc. * src/tgbatest/ltl2tgba.cc: rename the options of commands that build the different forms of TA. * src/ta/ta.hh: BUG Fix * src/ta/Makefile.am, src/tgbatest/ltl2ta.test: impacts of this renaming
This commit is contained in:
parent
c76e651bad
commit
5a706300b0
24 changed files with 1308 additions and 1580 deletions
|
|
@ -27,16 +27,16 @@ ta_HEADERS = \
|
|||
ta.hh \
|
||||
taexplicit.hh \
|
||||
taproduct.hh \
|
||||
tgbta.hh \
|
||||
tgbtaexplicit.hh \
|
||||
tgbtaproduct.hh
|
||||
tgta.hh \
|
||||
tgtaexplicit.hh \
|
||||
tgtaproduct.hh
|
||||
|
||||
|
||||
noinst_LTLIBRARIES = libta.la
|
||||
libta_la_SOURCES = \
|
||||
ta.cc \
|
||||
taproduct.cc \
|
||||
tgbta.cc \
|
||||
tgbtaexplicit.cc \
|
||||
tgta.cc \
|
||||
tgtaexplicit.cc \
|
||||
taexplicit.cc \
|
||||
tgbtaproduct.cc
|
||||
tgtaproduct.cc
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace spot
|
|||
///
|
||||
/// The Testing Automata (TA) were introduced by
|
||||
/// Henri Hansen, Wojciech Penczek and Antti Valmari
|
||||
/// in "Stuttering-insensitive automata for on-the-fly de- tection of livelock
|
||||
/// in "Stuttering-insensitive automata for on-the-fly detection of livelock
|
||||
/// properties" In Proc. of FMICSÕ02, vol. 66(2) of Electronic Notes in
|
||||
/// Theoretical Computer Science.Elsevier.
|
||||
///
|
||||
|
|
@ -69,7 +69,7 @@ namespace spot
|
|||
/// Browsing such automaton can be achieved using two functions:
|
||||
/// \c get_initial_states_set or \c get_artificial_initial_state, and \c
|
||||
/// succ_iter. The former returns the initial state(s) while the latter lists
|
||||
/// the successor states of any state (filtred by transition "changeset").
|
||||
/// the successor states of any state (filtred by "changeset").
|
||||
///
|
||||
/// Note that although this is a transition-based automata,
|
||||
/// we never represent transitions! Transition informations are
|
||||
|
|
@ -98,7 +98,7 @@ namespace spot
|
|||
/// artificial initial state have one transition to each real initial state,
|
||||
/// and this transition is labeled by the corresponding initial condition.
|
||||
/// (For more details, see the paper cited above)
|
||||
spot::state*
|
||||
virtual spot::state*
|
||||
get_artificial_initial_state() const
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -114,7 +114,7 @@ namespace spot
|
|||
succ_iter(const spot::state* state) const = 0;
|
||||
|
||||
/// \brief Get an iterator over the successors of \a state
|
||||
/// filtred by the changeset labeling the transitions
|
||||
/// filtred by the changeset on transitions
|
||||
///
|
||||
/// The iterator has been allocated with \c new. It is the
|
||||
/// responsability of the caller to \c delete it when no
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ namespace spot
|
|||
return (*i_)->acceptance_conditions;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
// state_ta_explicit
|
||||
|
||||
|
|
@ -141,19 +140,19 @@ namespace spot
|
|||
if (transitions_ == 0)
|
||||
transitions_ = new transitions;
|
||||
|
||||
transitions* transitions_condition = get_transitions(t->condition);
|
||||
transitions* trans_by_condition = get_transitions(t->condition);
|
||||
|
||||
if (transitions_condition == 0)
|
||||
if (trans_by_condition == 0)
|
||||
{
|
||||
transitions_condition = new transitions;
|
||||
transitions_by_condition[(t->condition).id()] = transitions_condition;
|
||||
trans_by_condition = new transitions;
|
||||
transitions_by_condition[(t->condition).id()] = trans_by_condition;
|
||||
}
|
||||
|
||||
state_ta_explicit::transitions::iterator it_trans;
|
||||
bool transition_found = false;
|
||||
|
||||
for (it_trans = transitions_condition->begin(); (it_trans
|
||||
!= transitions_condition->end() && !transition_found); it_trans++)
|
||||
for (it_trans = trans_by_condition->begin(); (it_trans
|
||||
!= trans_by_condition->end() && !transition_found); it_trans++)
|
||||
{
|
||||
transition_found = ((*it_trans)->dest == t->dest);
|
||||
if (transition_found)
|
||||
|
|
@ -166,12 +165,12 @@ namespace spot
|
|||
{
|
||||
if (add_at_beginning)
|
||||
{
|
||||
transitions_condition->push_front(t);
|
||||
trans_by_condition->push_front(t);
|
||||
transitions_->push_front(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
transitions_condition->push_back(t);
|
||||
trans_by_condition->push_back(t);
|
||||
transitions_->push_back(t);
|
||||
}
|
||||
|
||||
|
|
@ -290,11 +289,16 @@ namespace spot
|
|||
== (dest)->get_tgba_condition());
|
||||
bool dest_is_livelock_accepting = dest->is_livelock_accepting_state();
|
||||
|
||||
//Before deleting stuttering transitions, propaged back livelock and initial state's properties
|
||||
//Before deleting stuttering transitions, propaged back livelock
|
||||
//and initial state's properties
|
||||
if (is_stuttering_transition)
|
||||
{
|
||||
if (dest_is_livelock_accepting)
|
||||
set_livelock_accepting_state(true);
|
||||
if (!is_livelock_accepting_state() && dest_is_livelock_accepting)
|
||||
{
|
||||
set_livelock_accepting_state(true);
|
||||
stuttering_reachable_livelock
|
||||
= dest->stuttering_reachable_livelock;
|
||||
}
|
||||
if (dest->is_initial_state())
|
||||
set_initial_state(true);
|
||||
}
|
||||
|
|
@ -321,7 +325,7 @@ namespace spot
|
|||
void
|
||||
state_ta_explicit::free_transitions()
|
||||
{
|
||||
state_ta_explicit::transitions* trans = get_transitions();
|
||||
state_ta_explicit::transitions* trans = transitions_;
|
||||
state_ta_explicit::transitions::iterator it_trans;
|
||||
// We don't destroy the transitions in the state's destructor because
|
||||
// they are not cloned.
|
||||
|
|
@ -340,6 +344,7 @@ namespace spot
|
|||
++i;
|
||||
}
|
||||
|
||||
transitions_ = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -227,6 +227,7 @@ namespace spot
|
|||
void
|
||||
free_transitions();
|
||||
|
||||
state_ta_explicit* stuttering_reachable_livelock;
|
||||
private:
|
||||
const state* tgba_state_;
|
||||
const bdd tgba_condition_;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ namespace spot
|
|||
|
||||
ta_succ_iterator_product::~ta_succ_iterator_product()
|
||||
{
|
||||
// ta_->free_state(current_state_);
|
||||
delete current_state_;
|
||||
current_state_ = 0;
|
||||
delete ta_succ_it_;
|
||||
|
|
@ -315,6 +314,17 @@ namespace spot
|
|||
return new ta_succ_iterator_product(stp, ta_, kripke_);
|
||||
}
|
||||
|
||||
|
||||
ta_succ_iterator_product*
|
||||
ta_product::succ_iter(const spot::state* s, bdd changeset) const
|
||||
{
|
||||
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
||||
assert(s);
|
||||
return new ta_succ_iterator_product_by_changeset(stp, ta_, kripke_,
|
||||
changeset);
|
||||
|
||||
}
|
||||
|
||||
bdd_dict*
|
||||
ta_product::get_dict() const
|
||||
{
|
||||
|
|
@ -349,6 +359,7 @@ namespace spot
|
|||
}
|
||||
|
||||
|
||||
|
||||
bool
|
||||
ta_product::is_initial_state(const spot::state* s) const
|
||||
{
|
||||
|
|
@ -400,4 +411,62 @@ namespace spot
|
|||
|
||||
}
|
||||
|
||||
|
||||
ta_succ_iterator_product_by_changeset::ta_succ_iterator_product_by_changeset(
|
||||
const state_ta_product* s, const ta* t, const kripke* k, bdd changeset) :
|
||||
ta_succ_iterator_product(s, t, k)
|
||||
{
|
||||
current_condition_ = changeset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
ta_succ_iterator_product_by_changeset::next_kripke_dest()
|
||||
{
|
||||
if (!kripke_succ_it_)
|
||||
return;
|
||||
|
||||
if (kripke_current_dest_state == 0)
|
||||
{
|
||||
kripke_succ_it_->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
kripke_current_dest_state->destroy();
|
||||
kripke_current_dest_state = 0;
|
||||
kripke_succ_it_->next();
|
||||
}
|
||||
|
||||
// If one of the two successor sets is empty initially, we reset
|
||||
// kripke_succ_it_, so that done() can detect this situation easily. (We
|
||||
// choose to reset kripke_succ_it_ because this variable is already used by
|
||||
// done().)
|
||||
if (kripke_succ_it_->done())
|
||||
{
|
||||
delete kripke_succ_it_;
|
||||
kripke_succ_it_ = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
kripke_current_dest_state = kripke_succ_it_->current_state();
|
||||
bdd kripke_current_dest_condition = kripke_->state_condition(
|
||||
kripke_current_dest_state);
|
||||
|
||||
if (current_condition_ != bdd_setxor(kripke_source_condition,
|
||||
kripke_current_dest_condition))
|
||||
next_kripke_dest();
|
||||
is_stuttering_transition_ = (kripke_source_condition
|
||||
== kripke_current_dest_condition);
|
||||
if (!is_stuttering_transition_)
|
||||
{
|
||||
ta_succ_it_ = ta_->succ_iter(source_->get_ta_state(),
|
||||
current_condition_);
|
||||
ta_succ_it_->first();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace spot
|
|||
{
|
||||
|
||||
/// \brief A state for spot::ta_product.
|
||||
/// \ingroup emptiness_check
|
||||
/// \ingroup ta_emptiness_check
|
||||
///
|
||||
/// This state is in fact a pair of state: the state from the TA
|
||||
/// automaton and that of Kripke structure.
|
||||
|
|
@ -104,7 +104,7 @@ namespace spot
|
|||
bool
|
||||
is_stuttering_transition() const;
|
||||
|
||||
private:
|
||||
protected:
|
||||
//@{
|
||||
/// Internal routines to advance to the next successor.
|
||||
void
|
||||
|
|
@ -135,7 +135,7 @@ namespace spot
|
|||
|
||||
/// \brief A lazy product between a Testing automaton and a Kripke structure.
|
||||
/// (States are computed on the fly.)
|
||||
/// \ingroup emptiness_check
|
||||
/// \ingroup ta_emptiness_check
|
||||
class ta_product : public ta
|
||||
{
|
||||
public:
|
||||
|
|
@ -153,6 +153,9 @@ namespace spot
|
|||
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*
|
||||
get_dict() const;
|
||||
|
||||
|
|
@ -169,7 +172,7 @@ namespace spot
|
|||
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)
|
||||
/// in the TA automaton (the TA component of the product automaton)
|
||||
virtual bool
|
||||
is_hole_state_in_ta_component(const spot::state* s) const;
|
||||
|
||||
|
|
@ -205,6 +208,23 @@ namespace spot
|
|||
operator=(const ta_product&);
|
||||
};
|
||||
|
||||
|
||||
class 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
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright (C) 2010, 2011 Laboratoire de Recherche et Developpement
|
||||
// de l Epita_explicit (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 2 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 MERCHANta_explicitBILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more deta_explicitils.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_TA_TGBTA_HH
|
||||
# define SPOT_TA_TGBTA_HH
|
||||
|
||||
#include "tgba/tgba.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class tgbta : public tgba
|
||||
{
|
||||
|
||||
protected:
|
||||
tgbta();
|
||||
public:
|
||||
|
||||
virtual
|
||||
~tgbta();
|
||||
virtual tgba_succ_iterator*
|
||||
succ_iter_by_changeset(const spot::state* s, bdd change_set) const =0;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SPOT_TA_TGBTA_HH
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
// Copyright (C) 2010, 2011 Laboratoire de Recherche et Developpement
|
||||
// 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "ltlast/atomic_prop.hh"
|
||||
#include "ltlast/constant.hh"
|
||||
#include "tgbtaexplicit.hh"
|
||||
#include "tgba/formula2bdd.hh"
|
||||
#include "misc/bddop.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
|
||||
#include "tgba/bddprint.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
|
||||
tgbta_explicit::tgbta_explicit(const tgba* tgba, bdd all_acceptance_conditions,
|
||||
state_ta_explicit* artificial_initial_state) :
|
||||
ta_explicit(tgba, all_acceptance_conditions, artificial_initial_state)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
state*
|
||||
tgbta_explicit::get_init_state() const
|
||||
{
|
||||
return ta_explicit::get_artificial_initial_state();
|
||||
}
|
||||
|
||||
tgba_succ_iterator*
|
||||
tgbta_explicit::succ_iter(const spot::state* state,
|
||||
const spot::state*,
|
||||
const tgba*) const
|
||||
{
|
||||
return ta_explicit::succ_iter(state);
|
||||
}
|
||||
|
||||
bdd
|
||||
tgbta_explicit::compute_support_conditions(const spot::state* in) const
|
||||
{
|
||||
return get_tgba()->support_conditions(((const state_ta_explicit*) in)->get_tgba_state());
|
||||
}
|
||||
|
||||
bdd
|
||||
tgbta_explicit::compute_support_variables(const spot::state* in) const
|
||||
{
|
||||
return get_tgba()->support_variables(((const state_ta_explicit*) in)->get_tgba_state());
|
||||
}
|
||||
|
||||
bdd_dict*
|
||||
tgbta_explicit::get_dict() const
|
||||
{
|
||||
return ta_explicit::get_dict();
|
||||
}
|
||||
|
||||
bdd
|
||||
tgbta_explicit::all_acceptance_conditions() const
|
||||
{
|
||||
|
||||
return ta_explicit::all_acceptance_conditions();
|
||||
}
|
||||
|
||||
bdd
|
||||
tgbta_explicit::neg_acceptance_conditions() const
|
||||
{
|
||||
return get_tgba()->neg_acceptance_conditions();
|
||||
}
|
||||
|
||||
std::string
|
||||
tgbta_explicit::format_state(const spot::state* s) const
|
||||
{
|
||||
return ta_explicit::format_state(s);
|
||||
}
|
||||
|
||||
|
||||
spot::tgba_succ_iterator* tgbta_explicit::succ_iter_by_changeset(const spot::state* s, bdd change_set) const
|
||||
{
|
||||
return ta_explicit::succ_iter(s,change_set);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,15 +18,15 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "tgbta.hh"
|
||||
#include "tgta.hh"
|
||||
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
tgbta::tgbta()
|
||||
tgta::tgta()
|
||||
{};
|
||||
tgbta::~tgbta()
|
||||
tgta::~tgta()
|
||||
{};
|
||||
|
||||
|
||||
85
src/ta/tgta.hh
Normal file
85
src/ta/tgta.hh
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
// Copyright (C) 2010, 2011 Laboratoire de Recherche et Developpement
|
||||
// de l Epita_explicit (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 2 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 MERCHANta_explicitBILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more deta_explicitils.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_TA_TGBTA_HH
|
||||
# define SPOT_TA_TGBTA_HH
|
||||
|
||||
#include "tgba/tgba.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
/// \brief A Transition-based Generalized Testing Automaton (TGTA).
|
||||
/// \ingroup ta_essentials
|
||||
///
|
||||
/// Transition-based Generalized Testing Automaton (TGTA) is a new kind of
|
||||
/// automaton that combines features from both TA and TGBA.
|
||||
/// From TA, we take the idea of labeling transitions with changesets,
|
||||
/// however we remove the use of livelock-acceptance (because it may require
|
||||
/// a two-pass emptiness check), and the implicit stuttering. From TGBA, we
|
||||
/// inherit the use of transition-based generalized acceptance conditions.
|
||||
/// The resulting Chimera, which we call \emph{Transition-based
|
||||
/// Generalized Testing Automaton} (TGTA), accepts only
|
||||
/// stuttering-insensitive languages like TA, and inherits advantages from
|
||||
/// both TA and TGBA: it has a simple one-pass emptiness-check procedure
|
||||
/// (the same as algorithm the one for TGBA), and can benefit from reductions
|
||||
/// based on the stuttering of the properties pretty much like a TA.
|
||||
/// Livelock acceptance states, which are no longer supported are emulated
|
||||
///using states with a Büchi accepting self-loop labeled by empty changeset.
|
||||
///
|
||||
/// Browsing such automaton can be achieved using two functions:
|
||||
/// \c get_initial_state and \c
|
||||
/// succ_iter. The former returns the initial state(s) while the latter lists
|
||||
/// the successor states of any state. A second implementation of \c succ_iter
|
||||
/// returns only the successors reached through a changeset passed as
|
||||
/// a parameter.
|
||||
///
|
||||
/// Note that although this is a transition-based automata,
|
||||
/// we never represent transitions! Transition informations are
|
||||
/// obtained by querying the iterator over the successors of
|
||||
/// a state.
|
||||
|
||||
|
||||
class tgta : public tgba
|
||||
{
|
||||
|
||||
protected:
|
||||
tgta();
|
||||
public:
|
||||
|
||||
virtual
|
||||
~tgta();
|
||||
|
||||
/// \brief Get an iterator over the successors of \a state
|
||||
/// filtred by the value of the changeset on transitions between the
|
||||
/// \a state and his successors
|
||||
///
|
||||
/// The iterator has been allocated with \c new. It is the
|
||||
/// responsability of the caller to \c delete it when no
|
||||
/// longer needed.
|
||||
///
|
||||
virtual tgba_succ_iterator*
|
||||
succ_iter_by_changeset(const spot::state* s, bdd change_set) const =0;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SPOT_TA_TGBTA_HH
|
||||
97
src/ta/tgtaexplicit.cc
Normal file
97
src/ta/tgtaexplicit.cc
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
// Copyright (C) 2010, 2011 Laboratoire de Recherche et Developpement
|
||||
// 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "ltlast/atomic_prop.hh"
|
||||
#include "ltlast/constant.hh"
|
||||
#include "tgtaexplicit.hh"
|
||||
#include "tgba/formula2bdd.hh"
|
||||
#include "misc/bddop.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
|
||||
#include "tgba/bddprint.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
tgta_explicit::tgta_explicit(const tgba* tgba, bdd all_acceptance_conditions,
|
||||
state_ta_explicit* artificial_initial_state) :
|
||||
ta_explicit(tgba, all_acceptance_conditions, artificial_initial_state)
|
||||
{
|
||||
}
|
||||
|
||||
state*
|
||||
tgta_explicit::get_init_state() const
|
||||
{
|
||||
return ta_explicit::get_artificial_initial_state();
|
||||
}
|
||||
|
||||
tgba_succ_iterator*
|
||||
tgta_explicit::succ_iter(const spot::state* state, const spot::state*,
|
||||
const tgba*) const
|
||||
{
|
||||
return ta_explicit::succ_iter(state);
|
||||
}
|
||||
|
||||
bdd
|
||||
tgta_explicit::compute_support_conditions(const spot::state* in) const
|
||||
{
|
||||
return get_tgba()->support_conditions(
|
||||
((const state_ta_explicit*) in)->get_tgba_state());
|
||||
}
|
||||
|
||||
bdd
|
||||
tgta_explicit::compute_support_variables(const spot::state* in) const
|
||||
{
|
||||
return get_tgba()->support_variables(
|
||||
((const state_ta_explicit*) in)->get_tgba_state());
|
||||
}
|
||||
|
||||
bdd_dict*
|
||||
tgta_explicit::get_dict() const
|
||||
{
|
||||
return ta_explicit::get_dict();
|
||||
}
|
||||
|
||||
bdd
|
||||
tgta_explicit::all_acceptance_conditions() const
|
||||
{
|
||||
|
||||
return ta_explicit::all_acceptance_conditions();
|
||||
}
|
||||
|
||||
bdd
|
||||
tgta_explicit::neg_acceptance_conditions() const
|
||||
{
|
||||
return get_tgba()->neg_acceptance_conditions();
|
||||
}
|
||||
|
||||
std::string
|
||||
tgta_explicit::format_state(const spot::state* s) const
|
||||
{
|
||||
return ta_explicit::format_state(s);
|
||||
}
|
||||
|
||||
spot::tgba_succ_iterator*
|
||||
tgta_explicit::succ_iter_by_changeset(const spot::state* s, bdd chngset) const
|
||||
{
|
||||
return ta_explicit::succ_iter(s, chngset);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,8 +18,8 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_TA_TGBTAEXPLICIT_HH
|
||||
# define SPOT_TA_TGBTAEXPLICIT_HH
|
||||
#ifndef SPOT_TA_TGTAEXPLICIT_HH
|
||||
# define SPOT_TA_TGTAEXPLICIT_HH
|
||||
|
||||
#include "misc/hash.hh"
|
||||
#include <list>
|
||||
|
|
@ -29,38 +29,46 @@
|
|||
#include <cassert>
|
||||
#include "misc/bddlt.hh"
|
||||
#include "taexplicit.hh"
|
||||
#include "tgbta.hh"
|
||||
#include "tgta.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class tgbta_explicit : public tgbta, public ta_explicit
|
||||
|
||||
/// Explicit representation of a spot::tgta.
|
||||
/// \ingroup ta_representation
|
||||
class tgta_explicit : public tgta, public ta_explicit
|
||||
{
|
||||
public:
|
||||
tgbta_explicit(const tgba* tgba, bdd all_acceptance_conditions,
|
||||
state_ta_explicit* artificial_initial_state) ;
|
||||
tgta_explicit(const tgba* tgba, bdd all_acceptance_conditions,
|
||||
state_ta_explicit* artificial_initial_state);
|
||||
|
||||
// tgba interface
|
||||
virtual spot::state* get_init_state() const;
|
||||
virtual tgba_succ_iterator*
|
||||
succ_iter(const spot::state* local_state,
|
||||
const spot::state* global_state = 0,
|
||||
const tgba* global_automaton = 0) const;
|
||||
virtual bdd_dict* get_dict() const;
|
||||
// tgba interface
|
||||
virtual spot::state*
|
||||
get_init_state() const;
|
||||
virtual tgba_succ_iterator*
|
||||
succ_iter(const spot::state* local_state, const spot::state* global_state =
|
||||
0, const tgba* global_automaton = 0) const;
|
||||
virtual bdd_dict*
|
||||
get_dict() const;
|
||||
|
||||
virtual bdd all_acceptance_conditions() const;
|
||||
virtual bdd neg_acceptance_conditions() const;
|
||||
virtual bdd
|
||||
all_acceptance_conditions() const;
|
||||
virtual bdd
|
||||
neg_acceptance_conditions() const;
|
||||
|
||||
virtual std::string format_state(const spot::state* s) const;
|
||||
virtual std::string
|
||||
format_state(const spot::state* s) const;
|
||||
|
||||
virtual tgba_succ_iterator* succ_iter_by_changeset(const spot::state* s, bdd change_set) const;
|
||||
protected:
|
||||
virtual bdd compute_support_conditions(const spot::state* state) const;
|
||||
virtual bdd compute_support_variables(const spot::state* state) const;
|
||||
virtual tgba_succ_iterator*
|
||||
succ_iter_by_changeset(const spot::state* s, bdd change_set) const;
|
||||
protected:
|
||||
virtual bdd
|
||||
compute_support_conditions(const spot::state* state) const;
|
||||
virtual bdd
|
||||
compute_support_variables(const spot::state* state) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // SPOT_TA_TGBTAEXPLICIT_HH
|
||||
#endif // SPOT_TA_TGTAEXPLICIT_HH
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
#define trace while (0) std::clog
|
||||
#endif
|
||||
|
||||
#include "tgbtaproduct.hh"
|
||||
#include "tgtaproduct.hh"
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include "misc/hashfunc.hh"
|
||||
|
|
@ -38,19 +38,19 @@ namespace spot
|
|||
{
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// tgbta_succ_iterator_product
|
||||
// tgta_succ_iterator_product
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// tgbta_product
|
||||
// tgta_product
|
||||
|
||||
tgbta_product::tgbta_product(const kripke* left, const tgbta* right) :
|
||||
tgta_product::tgta_product(const kripke* left, const tgta* right) :
|
||||
tgba_product(left, right)
|
||||
{
|
||||
}
|
||||
|
||||
state*
|
||||
tgbta_product::get_init_state() const
|
||||
tgta_product::get_init_state() const
|
||||
{
|
||||
fixed_size_pool* p = const_cast<fixed_size_pool*> (&pool_);
|
||||
return new (p->allocate()) state_product(left_->get_init_state(),
|
||||
|
|
@ -58,7 +58,7 @@ namespace spot
|
|||
}
|
||||
|
||||
tgba_succ_iterator*
|
||||
tgbta_product::succ_iter(const state* local_state, const state*,
|
||||
tgta_product::succ_iter(const state* local_state, const state*,
|
||||
const tgba*) const
|
||||
{
|
||||
const state_product* s = down_cast<const state_product*> (local_state);
|
||||
|
|
@ -66,20 +66,20 @@ namespace spot
|
|||
|
||||
fixed_size_pool* p = const_cast<fixed_size_pool*> (&pool_);
|
||||
|
||||
return new tgbta_succ_iterator_product(s, (const kripke*) left_,
|
||||
(const tgbta *) right_, p);
|
||||
return new tgta_succ_iterator_product(s, (const kripke*) left_,
|
||||
(const tgta *) right_, p);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// tgbtgbta_succ_iterator_product
|
||||
tgbta_succ_iterator_product::tgbta_succ_iterator_product(
|
||||
const state_product* s, const kripke* k, const tgbta* t,
|
||||
// tgbtgta_succ_iterator_product
|
||||
tgta_succ_iterator_product::tgta_succ_iterator_product(
|
||||
const state_product* s, const kripke* k, const tgta* t,
|
||||
fixed_size_pool* pool) :
|
||||
source_(s), tgbta_(t), kripke_(k), pool_(pool)
|
||||
source_(s), tgta_(t), kripke_(k), pool_(pool)
|
||||
{
|
||||
|
||||
state * tgbta_init_state = tgbta_->get_init_state();
|
||||
if ((s->right())->compare(tgbta_init_state) == 0)
|
||||
state * tgta_init_state = tgta_->get_init_state();
|
||||
if ((s->right())->compare(tgta_init_state) == 0)
|
||||
source_ = 0;
|
||||
|
||||
if (source_ == 0)
|
||||
|
|
@ -88,11 +88,11 @@ namespace spot
|
|||
kripke_current_dest_state = kripke_->get_init_state();
|
||||
current_condition_
|
||||
= kripke_->state_condition(kripke_current_dest_state);
|
||||
tgbta_succ_it_ = tgbta_->succ_iter_by_changeset(
|
||||
tgbta_init_state, current_condition_);
|
||||
tgbta_succ_it_->first();
|
||||
tgta_succ_it_ = tgta_->succ_iter_by_changeset(
|
||||
tgta_init_state, current_condition_);
|
||||
tgta_succ_it_->first();
|
||||
trace
|
||||
<< "*** tgbta_succ_it_->done() = ***" << tgbta_succ_it_->done()
|
||||
<< "*** tgta_succ_it_->done() = ***" << tgta_succ_it_->done()
|
||||
<< std::endl;
|
||||
|
||||
}
|
||||
|
|
@ -101,40 +101,40 @@ namespace spot
|
|||
kripke_source_condition = kripke_->state_condition(s->left());
|
||||
kripke_succ_it_ = kripke_->succ_iter(s->left());
|
||||
kripke_current_dest_state = 0;
|
||||
tgbta_succ_it_ = 0;
|
||||
tgta_succ_it_ = 0;
|
||||
}
|
||||
|
||||
tgbta_init_state->destroy();
|
||||
tgta_init_state->destroy();
|
||||
current_state_ = 0;
|
||||
}
|
||||
|
||||
tgbta_succ_iterator_product::~tgbta_succ_iterator_product()
|
||||
tgta_succ_iterator_product::~tgta_succ_iterator_product()
|
||||
{
|
||||
// ta_->free_state(current_state_);
|
||||
if (current_state_ != 0)
|
||||
current_state_->destroy();
|
||||
current_state_ = 0;
|
||||
delete tgbta_succ_it_;
|
||||
delete tgta_succ_it_;
|
||||
delete kripke_succ_it_;
|
||||
if (kripke_current_dest_state != 0)
|
||||
kripke_current_dest_state->destroy();
|
||||
}
|
||||
|
||||
void
|
||||
tgbta_succ_iterator_product::step_()
|
||||
tgta_succ_iterator_product::step_()
|
||||
{
|
||||
if (!tgbta_succ_it_->done())
|
||||
tgbta_succ_it_->next();
|
||||
if (tgbta_succ_it_->done())
|
||||
if (!tgta_succ_it_->done())
|
||||
tgta_succ_it_->next();
|
||||
if (tgta_succ_it_->done())
|
||||
{
|
||||
delete tgbta_succ_it_;
|
||||
tgbta_succ_it_ = 0;
|
||||
delete tgta_succ_it_;
|
||||
tgta_succ_it_ = 0;
|
||||
next_kripke_dest();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tgbta_succ_iterator_product::next_kripke_dest()
|
||||
tgta_succ_iterator_product::next_kripke_dest()
|
||||
{
|
||||
if (!kripke_succ_it_)
|
||||
return;
|
||||
|
|
@ -167,14 +167,14 @@ namespace spot
|
|||
|
||||
current_condition_ = bdd_setxor(kripke_source_condition,
|
||||
kripke_current_dest_condition);
|
||||
tgbta_succ_it_ = tgbta_->succ_iter_by_changeset(source_->right(),
|
||||
tgta_succ_it_ = tgta_->succ_iter_by_changeset(source_->right(),
|
||||
current_condition_);
|
||||
tgbta_succ_it_->first();
|
||||
tgta_succ_it_->first();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
tgbta_succ_iterator_product::first()
|
||||
tgta_succ_iterator_product::first()
|
||||
{
|
||||
|
||||
next_kripke_dest();
|
||||
|
|
@ -186,7 +186,7 @@ namespace spot
|
|||
}
|
||||
|
||||
void
|
||||
tgbta_succ_iterator_product::next()
|
||||
tgta_succ_iterator_product::next()
|
||||
{
|
||||
current_state_->destroy();
|
||||
current_state_ = 0;
|
||||
|
|
@ -202,18 +202,18 @@ namespace spot
|
|||
}
|
||||
|
||||
void
|
||||
tgbta_succ_iterator_product::find_next_succ_()
|
||||
tgta_succ_iterator_product::find_next_succ_()
|
||||
{
|
||||
|
||||
while (!done())
|
||||
{
|
||||
if (!tgbta_succ_it_->done())
|
||||
if (!tgta_succ_it_->done())
|
||||
{
|
||||
current_state_ = new (pool_->allocate()) state_product(
|
||||
kripke_current_dest_state->clone(),
|
||||
tgbta_succ_it_->current_state(), pool_);
|
||||
tgta_succ_it_->current_state(), pool_);
|
||||
current_acceptance_conditions_
|
||||
= tgbta_succ_it_->current_acceptance_conditions();
|
||||
= tgta_succ_it_->current_acceptance_conditions();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -222,11 +222,11 @@ namespace spot
|
|||
}
|
||||
|
||||
bool
|
||||
tgbta_succ_iterator_product::done() const
|
||||
tgta_succ_iterator_product::done() const
|
||||
{
|
||||
if (source_ == 0)
|
||||
{
|
||||
return !tgbta_succ_it_ || tgbta_succ_it_->done();
|
||||
return !tgta_succ_it_ || tgta_succ_it_->done();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -236,7 +236,7 @@ namespace spot
|
|||
}
|
||||
|
||||
state_product*
|
||||
tgbta_succ_iterator_product::current_state() const
|
||||
tgta_succ_iterator_product::current_state() const
|
||||
{
|
||||
trace
|
||||
<< "*** current_state() .... if(done()) = ***" << done() << std::endl;
|
||||
|
|
@ -244,13 +244,13 @@ namespace spot
|
|||
}
|
||||
|
||||
bdd
|
||||
tgbta_succ_iterator_product::current_condition() const
|
||||
tgta_succ_iterator_product::current_condition() const
|
||||
{
|
||||
return current_condition_;
|
||||
}
|
||||
|
||||
bdd
|
||||
tgbta_succ_iterator_product::current_acceptance_conditions() const
|
||||
tgta_succ_iterator_product::current_acceptance_conditions() const
|
||||
{
|
||||
return current_acceptance_conditions_;
|
||||
}
|
||||
|
|
@ -21,24 +21,24 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_TGBTA_TGBAPRODUCT_HH
|
||||
# define SPOT_TGBTA_TGBAPRODUCT_HH
|
||||
#ifndef SPOT_tgta_TGBAPRODUCT_HH
|
||||
# define SPOT_tgta_TGBAPRODUCT_HH
|
||||
|
||||
#include "tgba/tgba.hh"
|
||||
#include "tgba/tgbaproduct.hh"
|
||||
#include "misc/fixpool.hh"
|
||||
#include "kripke/kripke.hh"
|
||||
#include "tgbta.hh"
|
||||
#include "tgta.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
/// \brief A lazy product. (States are computed on the fly.)
|
||||
class tgbta_product : public tgba_product
|
||||
class tgta_product : public tgba_product
|
||||
{
|
||||
public:
|
||||
|
||||
tgbta_product(const kripke* left, const tgbta* right);
|
||||
tgta_product(const kripke* left, const tgta* right);
|
||||
|
||||
virtual state*
|
||||
get_init_state() const;
|
||||
|
|
@ -51,13 +51,13 @@ namespace spot
|
|||
};
|
||||
|
||||
/// \brief Iterate over the successors of a product computed on the fly.
|
||||
class tgbta_succ_iterator_product : public tgba_succ_iterator
|
||||
class tgta_succ_iterator_product : public tgba_succ_iterator
|
||||
{
|
||||
public:
|
||||
tgbta_succ_iterator_product(const state_product* s, const kripke* k, const tgbta* tgbta, fixed_size_pool* pool);
|
||||
tgta_succ_iterator_product(const state_product* s, const kripke* k, const tgta* tgta, fixed_size_pool* pool);
|
||||
|
||||
virtual
|
||||
~tgbta_succ_iterator_product();
|
||||
~tgta_succ_iterator_product();
|
||||
|
||||
// iteration
|
||||
void
|
||||
|
|
@ -91,10 +91,10 @@ namespace spot
|
|||
|
||||
protected:
|
||||
const state_product* source_;
|
||||
const tgbta* tgbta_;
|
||||
const tgta* tgta_;
|
||||
const kripke* kripke_;
|
||||
fixed_size_pool* pool_;
|
||||
tgba_succ_iterator* tgbta_succ_it_;
|
||||
tgba_succ_iterator* tgta_succ_it_;
|
||||
tgba_succ_iterator* kripke_succ_it_;
|
||||
state_product* current_state_;
|
||||
bdd current_condition_;
|
||||
|
|
@ -107,4 +107,4 @@ namespace spot
|
|||
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBTA_TGBAPRODUCT_HH
|
||||
#endif // SPOT_tgta_TGBAPRODUCT_HH
|
||||
Loading…
Add table
Add a link
Reference in a new issue