Revamp tgbaexplicit.hh
* src/tgba/tgbaexplicit.hh, src/tgba/tgbaexplicit.cc: Factor most of the code in an explicit_graph<State, Type> that inherits from type. The tgba_explicit type<State> now inherits from explicit_graph<State,tgba>. * src/ltlvisit/contain.cc, src/neverparse/neverclaimparse.yy src/tgba/tgbareduc.cc, src/tgba/tgbareduc.hh, src/tgbaalgos/cutscc.cc, src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh, src/tgbaalgos/emptiness.cc, src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/minimize.cc, src/tgbaalgos/powerset.cc, src/tgbaalgos/randomgraph.cc, src/tgbaalgos/sccfilter.cc, src/tgbaparse/tgbaparse.yy, src/tgbatest/complementation.cc, src/tgbatest/explicit.cc, src/tgbatest/explprod.cc, src/tgbatest/ltl2tgba.cc, src/tgbatest/mixprod.cc, src/tgbatest/powerset.cc, src/tgbatest/tgbaread.cc, src/tgbatest/tripprod.cc: Replace tgba_explicit* by the actual type used. * src/tgbatest/explicit2.cc: New file. * src/tgbatest/Makefile.am: Add it.
This commit is contained in:
parent
9e2b932fe6
commit
a15aac2845
27 changed files with 810 additions and 708 deletions
|
|
@ -132,9 +132,11 @@ namespace spot
|
||||||
if (i != translated_.end())
|
if (i != translated_.end())
|
||||||
return &i->second;
|
return &i->second;
|
||||||
|
|
||||||
const tgba_explicit* e = ltl_to_tgba_fm(f, dict_, exprop_, symb_merge_,
|
const tgba_explicit_formula* e =
|
||||||
branching_postponement_,
|
ltl_to_tgba_fm(f, dict_, exprop_, symb_merge_,
|
||||||
fair_loop_approx_);
|
branching_postponement_,
|
||||||
|
fair_loop_approx_);
|
||||||
|
|
||||||
record_& r = translated_[f->clone()];
|
record_& r = translated_[f->clone()];
|
||||||
r.translation = e;
|
r.translation = e;
|
||||||
return &r;
|
return &r;
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ ident_list:
|
||||||
state:
|
state:
|
||||||
ident_list "skip"
|
ident_list "skip"
|
||||||
{
|
{
|
||||||
spot::tgba_explicit::transition* t = result->create_transition(*$1, *$1);
|
spot::state_explicit_string::transition* t = result->create_transition(*$1, *$1);
|
||||||
bool acc = !strncmp("accept", $1->c_str(), 6);
|
bool acc = !strncmp("accept", $1->c_str(), 6);
|
||||||
if (acc)
|
if (acc)
|
||||||
result->add_acceptance_condition(t,
|
result->add_acceptance_condition(t,
|
||||||
|
|
@ -135,7 +135,7 @@ state:
|
||||||
bool acc = !strncmp("accept", $1->c_str(), 6);
|
bool acc = !strncmp("accept", $1->c_str(), 6);
|
||||||
for (it = $3->begin(); it != $3->end(); ++it)
|
for (it = $3->begin(); it != $3->end(); ++it)
|
||||||
{
|
{
|
||||||
spot::tgba_explicit::transition* t =
|
spot::state_explicit_string::transition* t =
|
||||||
result->create_transition(*$1,*it->second);
|
result->create_transition(*$1,*it->second);
|
||||||
|
|
||||||
result->add_condition(t, it->first);
|
result->add_condition(t, it->first);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et Développement
|
// Copyright (C) 2012 Laboratoire de Recherche et Développement
|
||||||
// de l'Epita (LRDE).
|
// de l'Epita (LRDE).
|
||||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
|
||||||
// et Marie Curie.
|
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -21,348 +18,13 @@
|
||||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
// 02111-1307, USA.
|
// 02111-1307, USA.
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include "ltlast/atomic_prop.hh"
|
|
||||||
#include "ltlast/constant.hh"
|
|
||||||
#include "tgbaexplicit.hh"
|
#include "tgbaexplicit.hh"
|
||||||
#include "tgba/formula2bdd.hh"
|
#include "ltlast/constant.hh"
|
||||||
#include "misc/bddop.hh"
|
|
||||||
#include <cassert>
|
|
||||||
#include "ltlvisit/tostring.hh"
|
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
const std::string state_explicit_string::default_val("empty");
|
||||||
////////////////////////////////////////
|
const int state_explicit_number::default_val(0);
|
||||||
// tgba_explicit_succ_iterator
|
const ltl::formula*
|
||||||
|
state_explicit_formula::default_val(ltl::constant::true_instance());
|
||||||
tgba_explicit_succ_iterator::tgba_explicit_succ_iterator
|
|
||||||
(const state_explicit::transitions_t* s, bdd all_acc)
|
|
||||||
: s_(s), all_acceptance_conditions_(all_acc)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
tgba_explicit_succ_iterator::first()
|
|
||||||
{
|
|
||||||
i_ = s_->begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
tgba_explicit_succ_iterator::next()
|
|
||||||
{
|
|
||||||
++i_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
tgba_explicit_succ_iterator::done() const
|
|
||||||
{
|
|
||||||
return i_ == s_->end();
|
|
||||||
}
|
|
||||||
|
|
||||||
state_explicit*
|
|
||||||
tgba_explicit_succ_iterator::current_state() const
|
|
||||||
{
|
|
||||||
assert(!done());
|
|
||||||
return const_cast<state_explicit*>(i_->dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd
|
|
||||||
tgba_explicit_succ_iterator::current_condition() const
|
|
||||||
{
|
|
||||||
assert(!done());
|
|
||||||
return i_->condition;
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd
|
|
||||||
tgba_explicit_succ_iterator::current_acceptance_conditions() const
|
|
||||||
{
|
|
||||||
assert(!done());
|
|
||||||
return i_->acceptance_conditions & all_acceptance_conditions_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////
|
|
||||||
// state_explicit
|
|
||||||
|
|
||||||
int
|
|
||||||
state_explicit::compare(const spot::state* other) const
|
|
||||||
{
|
|
||||||
const state_explicit* o = down_cast<const state_explicit*>(other);
|
|
||||||
assert(o);
|
|
||||||
// Do not simply return "o - this", it might not fit in an int.
|
|
||||||
if (o < this)
|
|
||||||
return -1;
|
|
||||||
if (o > this)
|
|
||||||
return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t
|
|
||||||
state_explicit::hash() const
|
|
||||||
{
|
|
||||||
return
|
|
||||||
reinterpret_cast<const char*>(this) - static_cast<const char*>(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////
|
|
||||||
// tgba_explicit
|
|
||||||
|
|
||||||
|
|
||||||
tgba_explicit::tgba_explicit(bdd_dict* dict)
|
|
||||||
: dict_(dict), init_(0), all_acceptance_conditions_(bddfalse),
|
|
||||||
neg_acceptance_conditions_(bddtrue),
|
|
||||||
all_acceptance_conditions_computed_(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba_explicit::~tgba_explicit()
|
|
||||||
{
|
|
||||||
dict_->unregister_all_my_variables(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba_explicit::transition*
|
|
||||||
tgba_explicit::create_transition(state* source, const state* dest)
|
|
||||||
{
|
|
||||||
transition t;
|
|
||||||
t.dest = dest;
|
|
||||||
t.condition = bddtrue;
|
|
||||||
t.acceptance_conditions = bddfalse;
|
|
||||||
state_explicit::transitions_t::iterator i =
|
|
||||||
source->successors.insert(source->successors.end(), t);
|
|
||||||
return &*i;
|
|
||||||
}
|
|
||||||
void
|
|
||||||
tgba_explicit::add_condition(transition* t, const ltl::formula* f)
|
|
||||||
{
|
|
||||||
t->condition &= formula_to_bdd(f, dict_, this);
|
|
||||||
f->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
tgba_explicit::add_conditions(transition* t, bdd f)
|
|
||||||
{
|
|
||||||
dict_->register_propositions(f, this);
|
|
||||||
t->condition &= f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
tgba_explicit::copy_acceptance_conditions_of(const tgba *a)
|
|
||||||
{
|
|
||||||
assert(neg_acceptance_conditions_ == bddtrue);
|
|
||||||
assert(all_acceptance_conditions_computed_ == false);
|
|
||||||
bdd f = a->neg_acceptance_conditions();
|
|
||||||
dict_->register_acceptance_variables(f, this);
|
|
||||||
neg_acceptance_conditions_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
tgba_explicit::set_acceptance_conditions(bdd acc)
|
|
||||||
{
|
|
||||||
assert(neg_acceptance_conditions_ == bddtrue);
|
|
||||||
assert(all_acceptance_conditions_computed_ == false);
|
|
||||||
dict_->register_acceptance_variables(bdd_support(acc), this);
|
|
||||||
neg_acceptance_conditions_ = compute_neg_acceptance_conditions(acc);
|
|
||||||
all_acceptance_conditions_computed_ = true;
|
|
||||||
all_acceptance_conditions_ = acc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
tgba_explicit::has_acceptance_condition(const ltl::formula* f) const
|
|
||||||
{
|
|
||||||
return dict_->is_registered_acceptance_variable(f, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd
|
|
||||||
tgba_explicit::get_acceptance_condition(const ltl::formula* f)
|
|
||||||
{
|
|
||||||
bdd_dict::fv_map::iterator i = dict_->acc_map.find(f);
|
|
||||||
assert(has_acceptance_condition(f));
|
|
||||||
/* If this second assert fails and the first doesn't,
|
|
||||||
things are badly broken. This has already happened. */
|
|
||||||
assert(i != dict_->acc_map.end());
|
|
||||||
f->destroy();
|
|
||||||
bdd v = bdd_ithvar(i->second);
|
|
||||||
v &= bdd_exist(neg_acceptance_conditions_, v);
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
tgba_explicit::add_acceptance_condition(transition* t, const ltl::formula* f)
|
|
||||||
{
|
|
||||||
bdd c = get_acceptance_condition(f);
|
|
||||||
t->acceptance_conditions |= c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
tgba_explicit::add_acceptance_conditions(transition* t, bdd f)
|
|
||||||
{
|
|
||||||
bdd sup = bdd_support(f);
|
|
||||||
dict_->register_acceptance_variables(sup, this);
|
|
||||||
while (sup != bddtrue)
|
|
||||||
{
|
|
||||||
neg_acceptance_conditions_ &= bdd_nithvar(bdd_var(sup));
|
|
||||||
sup = bdd_high(sup);
|
|
||||||
}
|
|
||||||
t->acceptance_conditions |= f;
|
|
||||||
}
|
|
||||||
|
|
||||||
state*
|
|
||||||
tgba_explicit::get_init_state() const
|
|
||||||
{
|
|
||||||
// Fix empty automata by adding a lone initial state.
|
|
||||||
if (!init_)
|
|
||||||
const_cast<tgba_explicit*>(this)->add_default_init();
|
|
||||||
return init_;
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba_succ_iterator*
|
|
||||||
tgba_explicit::succ_iter(const spot::state* state,
|
|
||||||
const spot::state* global_state,
|
|
||||||
const tgba* global_automaton) const
|
|
||||||
{
|
|
||||||
const state_explicit* s = down_cast<const state_explicit*>(state);
|
|
||||||
assert(s);
|
|
||||||
(void) global_state;
|
|
||||||
(void) global_automaton;
|
|
||||||
return new tgba_explicit_succ_iterator(&s->successors,
|
|
||||||
all_acceptance_conditions());
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd
|
|
||||||
tgba_explicit::compute_support_conditions(const spot::state* in) const
|
|
||||||
{
|
|
||||||
const state_explicit* s = down_cast<const state_explicit*>(in);
|
|
||||||
assert(s);
|
|
||||||
const state_explicit::transitions_t& st = s->successors;
|
|
||||||
|
|
||||||
bdd res = bddfalse;
|
|
||||||
state_explicit::transitions_t::const_iterator i;
|
|
||||||
for (i = st.begin(); i != st.end(); ++i)
|
|
||||||
res |= i->condition;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd
|
|
||||||
tgba_explicit::compute_support_variables(const spot::state* in) const
|
|
||||||
{
|
|
||||||
const state_explicit* s = down_cast<const state_explicit*>(in);
|
|
||||||
assert(s);
|
|
||||||
const state_explicit::transitions_t& st = s->successors;
|
|
||||||
|
|
||||||
bdd res = bddtrue;
|
|
||||||
state_explicit::transitions_t::const_iterator i;
|
|
||||||
for (i = st.begin(); i != st.end(); ++i)
|
|
||||||
res &= bdd_support(i->condition);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd_dict*
|
|
||||||
tgba_explicit::get_dict() const
|
|
||||||
{
|
|
||||||
return dict_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd
|
|
||||||
tgba_explicit::all_acceptance_conditions() const
|
|
||||||
{
|
|
||||||
if (!all_acceptance_conditions_computed_)
|
|
||||||
{
|
|
||||||
all_acceptance_conditions_ =
|
|
||||||
compute_all_acceptance_conditions(neg_acceptance_conditions_);
|
|
||||||
all_acceptance_conditions_computed_ = true;
|
|
||||||
}
|
|
||||||
return all_acceptance_conditions_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd
|
|
||||||
tgba_explicit::neg_acceptance_conditions() const
|
|
||||||
{
|
|
||||||
return neg_acceptance_conditions_;
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba_explicit_string::~tgba_explicit_string()
|
|
||||||
{
|
|
||||||
ns_map::iterator i;
|
|
||||||
for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i)
|
|
||||||
{
|
|
||||||
// Do not erase the same state twice. (Because of possible aliases.)
|
|
||||||
if (state_name_map_.erase(i->second))
|
|
||||||
{
|
|
||||||
delete i->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba_explicit::state*
|
|
||||||
tgba_explicit_string::add_default_init()
|
|
||||||
{
|
|
||||||
return add_state("empty");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
tgba_explicit_string::format_state(const spot::state* s) const
|
|
||||||
{
|
|
||||||
const state_explicit* se = down_cast<const state_explicit*>(s);
|
|
||||||
assert(se);
|
|
||||||
sn_map::const_iterator i = state_name_map_.find(se);
|
|
||||||
assert(i != state_name_map_.end());
|
|
||||||
return i->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba_explicit_formula::~tgba_explicit_formula()
|
|
||||||
{
|
|
||||||
ns_map::iterator i = name_state_map_.begin();
|
|
||||||
while (i != name_state_map_.end())
|
|
||||||
{
|
|
||||||
// Advance the iterator before deleting the formula.
|
|
||||||
const ltl::formula* s = i->first;
|
|
||||||
delete i->second;
|
|
||||||
++i;
|
|
||||||
s->destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba_explicit::state* tgba_explicit_formula::add_default_init()
|
|
||||||
{
|
|
||||||
return add_state(ltl::constant::true_instance());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
tgba_explicit_formula::format_state(const spot::state* s) const
|
|
||||||
{
|
|
||||||
const state_explicit* se = down_cast<const state_explicit*>(s);
|
|
||||||
assert(se);
|
|
||||||
sn_map::const_iterator i = state_name_map_.find(se);
|
|
||||||
assert(i != state_name_map_.end());
|
|
||||||
return ltl::to_string(i->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba_explicit_number::~tgba_explicit_number()
|
|
||||||
{
|
|
||||||
ns_map::iterator i = name_state_map_.begin();
|
|
||||||
while (i != name_state_map_.end())
|
|
||||||
{
|
|
||||||
delete i->second;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba_explicit::state* tgba_explicit_number::add_default_init()
|
|
||||||
{
|
|
||||||
return add_state(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
tgba_explicit_number::format_state(const spot::state* s) const
|
|
||||||
{
|
|
||||||
const state_explicit* se = down_cast<const state_explicit*>(s);
|
|
||||||
assert(se);
|
|
||||||
sn_map::const_iterator i = state_name_map_.find(se);
|
|
||||||
assert(i != state_name_map_.end());
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << i->second;
|
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et Développement
|
// -*- encoding: utf-8 -*-
|
||||||
// de l'Epita (LRDE).
|
// Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
|
||||||
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de
|
// Développement de l'Epita.
|
||||||
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris
|
||||||
// Université Pierre et Marie Curie.
|
// 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.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -24,21 +25,48 @@
|
||||||
#ifndef SPOT_TGBA_TGBAEXPLICIT_HH
|
#ifndef SPOT_TGBA_TGBAEXPLICIT_HH
|
||||||
# define SPOT_TGBA_TGBAEXPLICIT_HH
|
# define SPOT_TGBA_TGBAEXPLICIT_HH
|
||||||
|
|
||||||
#include "misc/hash.hh"
|
#include <sstream>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "tgba.hh"
|
#include "tgba.hh"
|
||||||
|
#include "tgba/formula2bdd.hh"
|
||||||
|
#include "misc/hash.hh"
|
||||||
|
#include "misc/bddop.hh"
|
||||||
#include "ltlast/formula.hh"
|
#include "ltlast/formula.hh"
|
||||||
#include <cassert>
|
#include "ltlvisit/tostring.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
// Forward declarations. See below.
|
///misc
|
||||||
class state_explicit;
|
template<typename T>
|
||||||
class tgba_explicit_succ_iterator;
|
struct destroy_key
|
||||||
class tgba_explicit;
|
{
|
||||||
|
void destroy(T t)
|
||||||
|
{
|
||||||
|
(void) t;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// States used by spot::tgba_explicit.
|
template<>
|
||||||
|
struct destroy_key<const ltl::formula*>
|
||||||
|
{
|
||||||
|
void destroy(const ltl::formula* t)
|
||||||
|
{
|
||||||
|
t->destroy();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class tba: public tgba
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/// A State in a TBA (Transition based Buchi Automaton) is accepting
|
||||||
|
/// iff all outgoing transitions are accepting.
|
||||||
|
virtual bool is_accepting(const spot::state* s) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// States used by spot::explicit_graph implementation
|
||||||
/// \ingroup tgba_representation
|
/// \ingroup tgba_representation
|
||||||
|
template<typename Label, typename label_hash>
|
||||||
class state_explicit: public spot::state
|
class state_explicit: public spot::state
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -46,12 +74,35 @@ namespace spot
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int compare(const spot::state* other) const;
|
state_explicit(const Label& l):
|
||||||
virtual size_t hash() const;
|
label_(l)
|
||||||
|
|
||||||
virtual state_explicit* clone() const
|
|
||||||
{
|
{
|
||||||
return const_cast<state_explicit*>(this);
|
}
|
||||||
|
|
||||||
|
virtual ~state_explicit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void destroy() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef Label Label_t;
|
||||||
|
typedef label_hash label_hash_t;
|
||||||
|
|
||||||
|
struct transition
|
||||||
|
{
|
||||||
|
bdd condition;
|
||||||
|
bdd acceptance_conditions;
|
||||||
|
const state_explicit<Label, label_hash>* dest;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::list<transition> transitions_t;
|
||||||
|
transitions_t successors;
|
||||||
|
|
||||||
|
const Label& label() const
|
||||||
|
{
|
||||||
|
return label_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool empty() const
|
bool empty() const
|
||||||
|
|
@ -59,347 +110,600 @@ namespace spot
|
||||||
return successors.empty();
|
return successors.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
virtual int compare(const state* other) const
|
||||||
void destroy() const
|
|
||||||
{
|
{
|
||||||
|
const state_explicit<Label, label_hash>* s =
|
||||||
|
down_cast<const state_explicit<Label, label_hash>*>(other);
|
||||||
|
assert (s);
|
||||||
|
|
||||||
|
// Do not simply return "o - this", it might not fit in an int.
|
||||||
|
if (s < this)
|
||||||
|
return -1;
|
||||||
|
if (s > this)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Explicit transitions.
|
virtual size_t hash() const
|
||||||
struct transition
|
|
||||||
{
|
|
||||||
bdd condition;
|
|
||||||
bdd acceptance_conditions;
|
|
||||||
const state_explicit* dest;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::list<transition> transitions_t;
|
|
||||||
transitions_t successors;
|
|
||||||
private:
|
|
||||||
state_explicit(const state_explicit& other);
|
|
||||||
state_explicit& operator=(const state_explicit& other);
|
|
||||||
|
|
||||||
virtual ~state_explicit()
|
|
||||||
{
|
{
|
||||||
|
return
|
||||||
|
reinterpret_cast<const char*>(this) - static_cast<const char*>(0);
|
||||||
}
|
}
|
||||||
friend class tgba_explicit_string;
|
|
||||||
friend class tgba_explicit_formula;
|
|
||||||
friend class tgba_explicit_number;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
virtual state_explicit<Label, label_hash>*
|
||||||
/// Explicit representation of a spot::tgba.
|
clone() const
|
||||||
/// \ingroup tgba_representation
|
{
|
||||||
class tgba_explicit: public tgba
|
return const_cast<state_explicit<Label, label_hash>*>(this);
|
||||||
{
|
}
|
||||||
public:
|
|
||||||
typedef state_explicit state;
|
|
||||||
typedef state_explicit::transition transition;
|
|
||||||
|
|
||||||
tgba_explicit(bdd_dict* dict);
|
|
||||||
|
|
||||||
/// Add a default initial state.
|
|
||||||
virtual state* add_default_init() = 0;
|
|
||||||
|
|
||||||
transition*
|
|
||||||
create_transition(state* source, const state* dest);
|
|
||||||
|
|
||||||
void add_condition(transition* t, const ltl::formula* f);
|
|
||||||
/// This assumes that all variables in \a f are known from dict.
|
|
||||||
void add_conditions(transition* t, bdd f);
|
|
||||||
|
|
||||||
/// \brief Copy the acceptance conditions of a tgba.
|
|
||||||
///
|
|
||||||
/// If used, this function should be called before creating any
|
|
||||||
/// transition.
|
|
||||||
void copy_acceptance_conditions_of(const tgba *a);
|
|
||||||
|
|
||||||
/// The the acceptance conditions.
|
|
||||||
void set_acceptance_conditions(bdd acc);
|
|
||||||
|
|
||||||
bool has_acceptance_condition(const ltl::formula* f) const;
|
|
||||||
void add_acceptance_condition(transition* t, const ltl::formula* f);
|
|
||||||
/// This assumes that all acceptance conditions in \a f are known from dict.
|
|
||||||
void add_acceptance_conditions(transition* t, bdd f);
|
|
||||||
|
|
||||||
// tgba interface
|
|
||||||
virtual ~tgba_explicit();
|
|
||||||
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 std::string format_state(const spot::state* s) const = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bdd compute_support_conditions(const spot::state* state) const;
|
Label label_;
|
||||||
virtual bdd compute_support_variables(const spot::state* state) const;
|
|
||||||
|
|
||||||
bdd get_acceptance_condition(const ltl::formula* f);
|
|
||||||
|
|
||||||
bdd_dict* dict_;
|
|
||||||
state_explicit* init_;
|
|
||||||
mutable bdd all_acceptance_conditions_;
|
|
||||||
bdd neg_acceptance_conditions_;
|
|
||||||
mutable bool all_acceptance_conditions_computed_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// Disallow copy.
|
|
||||||
tgba_explicit(const tgba_explicit& other);
|
|
||||||
tgba_explicit& operator=(const tgba_explicit& other);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///states labeled by an int
|
||||||
|
/// \ingroup tgba_representation
|
||||||
|
class state_explicit_number:
|
||||||
|
public state_explicit<int, identity_hash<int> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
state_explicit_number()
|
||||||
|
: state_explicit<int, identity_hash<int> >()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
state_explicit_number(int label)
|
||||||
|
: state_explicit<int, identity_hash<int> >(label)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void destroy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int default_val;
|
||||||
|
static std::string to_string(int l)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << l;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// States labeled by a string
|
||||||
|
/// \ingroup tgba_representation
|
||||||
|
class state_explicit_string:
|
||||||
|
public state_explicit<std::string, string_hash>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
state_explicit_string():
|
||||||
|
state_explicit<std::string, string_hash>()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
state_explicit_string(const std::string& label)
|
||||||
|
: state_explicit<std::string, string_hash>(label)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void destroy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static const std::string default_val;
|
||||||
|
static std::string to_string(const std::string& l)
|
||||||
|
{
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// States labeled by a formula
|
||||||
|
/// \ingroup tgba_representation
|
||||||
|
class state_explicit_formula:
|
||||||
|
public state_explicit<const ltl::formula*, ltl::formula_ptr_hash>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
state_explicit_formula():
|
||||||
|
state_explicit<const ltl::formula*, ltl::formula_ptr_hash>()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
state_explicit_formula(const ltl::formula* label)
|
||||||
|
: state_explicit<const ltl::formula*, ltl::formula_ptr_hash>(label)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void destroy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static const ltl::formula* default_val;
|
||||||
|
static std::string to_string(const ltl::formula* l)
|
||||||
|
{
|
||||||
|
return ltl::to_string(l);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// Successor iterators used by spot::tgba_explicit.
|
/// Successor iterators used by spot::tgba_explicit.
|
||||||
/// \ingroup tgba_representation
|
/// \ingroup tgba_representation
|
||||||
|
template<typename State>
|
||||||
class tgba_explicit_succ_iterator: public tgba_succ_iterator
|
class tgba_explicit_succ_iterator: public tgba_succ_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tgba_explicit_succ_iterator(const state_explicit::transitions_t* s,
|
tgba_explicit_succ_iterator(const State* start,
|
||||||
bdd all_acc);
|
bdd all_acc)
|
||||||
|
: start_(start),
|
||||||
|
all_acceptance_conditions_(all_acc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual void first();
|
virtual void first()
|
||||||
virtual void next();
|
{
|
||||||
virtual bool done() const;
|
it_ = start_->successors.begin();
|
||||||
|
}
|
||||||
|
|
||||||
virtual state_explicit* current_state() const;
|
virtual void next()
|
||||||
virtual bdd current_condition() const;
|
{
|
||||||
virtual bdd current_acceptance_conditions() const;
|
++it_;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool done() const
|
||||||
|
{
|
||||||
|
return it_ == start_->successors.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual State* current_state() const
|
||||||
|
{
|
||||||
|
assert(!done());
|
||||||
|
|
||||||
|
//ugly but I can't see any other wayout
|
||||||
|
const State* res = down_cast<const State*>(it_->dest);
|
||||||
|
assert(res);
|
||||||
|
|
||||||
|
return
|
||||||
|
const_cast<State*>(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bdd current_condition() const
|
||||||
|
{
|
||||||
|
assert(!done());
|
||||||
|
return it_->condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bdd current_acceptance_conditions() const
|
||||||
|
{
|
||||||
|
assert(!done());
|
||||||
|
return it_->acceptance_conditions & all_acceptance_conditions_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const state_explicit::transitions_t* s_;
|
const State* start_;
|
||||||
state_explicit::transitions_t::const_iterator i_;
|
typename State::transitions_t::const_iterator it_;
|
||||||
bdd all_acceptance_conditions_;
|
bdd all_acceptance_conditions_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A tgba_explicit instance with states labeled by a given type.
|
/// Graph implementation for automata representation
|
||||||
template<typename label, typename label_hash>
|
/// \ingroup tgba_representation
|
||||||
class tgba_explicit_labelled: public tgba_explicit
|
template<typename State, typename Type>
|
||||||
|
class explicit_graph: public Type
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
typedef label label_t;
|
typedef Sgi::hash_map<typename State::Label_t, State,
|
||||||
typedef Sgi::hash_map<label, state_explicit*,
|
typename State::label_hash_t> ls_map;
|
||||||
label_hash> ns_map;
|
typedef Sgi::hash_map<const State*, typename State::Label_t,
|
||||||
typedef Sgi::hash_map<const state_explicit*, label,
|
ptr_hash<State> > sl_map;
|
||||||
ptr_hash<state_explicit> > sn_map;
|
typedef typename State::transition transition;
|
||||||
ns_map name_state_map_;
|
|
||||||
sn_map state_name_map_;
|
|
||||||
public:
|
public:
|
||||||
tgba_explicit_labelled(bdd_dict* dict) : tgba_explicit(dict) {};
|
explicit_graph(bdd_dict* dict)
|
||||||
|
: ls_(),
|
||||||
bool has_state(const label& name)
|
sl_(),
|
||||||
|
init_(0),
|
||||||
|
dict_(dict)
|
||||||
{
|
{
|
||||||
return name_state_map_.find(name) != name_state_map_.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const label& get_label(const state_explicit* s) const
|
State* add_default_init()
|
||||||
{
|
{
|
||||||
typename sn_map::const_iterator i = state_name_map_.find(s);
|
return add_state(State::default_val);
|
||||||
assert(i != state_name_map_.end());
|
|
||||||
return i->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label& get_label(const spot::state* s) const
|
|
||||||
{
|
|
||||||
const state_explicit* se = down_cast<const state_explicit*>(s);
|
|
||||||
assert(se);
|
|
||||||
return get_label(se);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return the state_explicit for \a name, creating the state if
|
|
||||||
/// it does not exist.
|
|
||||||
state* add_state(const label& name)
|
|
||||||
{
|
|
||||||
typename ns_map::iterator i = name_state_map_.find(name);
|
|
||||||
if (i == name_state_map_.end())
|
|
||||||
{
|
|
||||||
state_explicit* s = new state_explicit;
|
|
||||||
name_state_map_[name] = s;
|
|
||||||
state_name_map_[s] = name;
|
|
||||||
|
|
||||||
// The first state we add is the inititial state.
|
|
||||||
// It can also be overridden with set_init_state().
|
|
||||||
if (!init_)
|
|
||||||
init_ = s;
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
return i->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
state*
|
|
||||||
set_init_state(const label& state)
|
|
||||||
{
|
|
||||||
state_explicit* s = add_state(state);
|
|
||||||
init_ = s;
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
transition*
|
|
||||||
create_transition(state* source, const state* dest)
|
|
||||||
{
|
|
||||||
return tgba_explicit::create_transition(source, dest);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transition*
|
transition*
|
||||||
create_transition(const label& source, const label& dest)
|
create_transition(State* source, const State* dest)
|
||||||
|
{
|
||||||
|
transition t;
|
||||||
|
|
||||||
|
t.dest = dest;
|
||||||
|
t.condition = bddtrue;
|
||||||
|
t.acceptance_conditions = bddfalse;
|
||||||
|
|
||||||
|
typename State::transitions_t::iterator i =
|
||||||
|
source->successors.insert(source->successors.end(), t);
|
||||||
|
|
||||||
|
return &*i;
|
||||||
|
}
|
||||||
|
|
||||||
|
transition*
|
||||||
|
create_transition(const typename State::Label_t& source,
|
||||||
|
const typename State::Label_t& dest)
|
||||||
{
|
{
|
||||||
// It's important that the source be created before the
|
// It's important that the source be created before the
|
||||||
// destination, so the first source encountered becomes the
|
// destination, so the first source encountered becomes the
|
||||||
// default initial state.
|
// default initial state.
|
||||||
state* s = add_state(source);
|
State* s = add_state(source);
|
||||||
return tgba_explicit::create_transition(s, add_state(dest));
|
return create_transition(s, add_state(dest));
|
||||||
|
}
|
||||||
|
|
||||||
|
transition*
|
||||||
|
get_transition(const tgba_explicit_succ_iterator<State>* si)
|
||||||
|
{
|
||||||
|
return const_cast<transition*>(&(*(si->i_)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void add_condition(transition* t, const ltl::formula* f)
|
||||||
|
{
|
||||||
|
t->condition &= formula_to_bdd(f, dict_, this);
|
||||||
|
f->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This assumes that all variables in \a f are known from dict.
|
||||||
|
void add_conditions(transition* t, bdd f)
|
||||||
|
{
|
||||||
|
dict_->register_propositions(f, this);
|
||||||
|
t->condition &= f;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool has_acceptance_condition(const ltl::formula* f) const
|
||||||
|
{
|
||||||
|
return dict_->is_registered_acceptance_variable(f, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//old tgba explicit labelled interface
|
||||||
|
bool has_state(const typename State::Label_t& name)
|
||||||
|
{
|
||||||
|
return ls_.find(name) != ls_.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
const typename State::Label_t& get_label(const State* s) const
|
||||||
|
{
|
||||||
|
typename sl_map::const_iterator i = sl_.find(s);
|
||||||
|
assert(i != sl_.end());
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
const typename State::Label_t& get_label(const spot::state* s) const
|
||||||
|
{
|
||||||
|
const State* se = down_cast<const State*>(s);
|
||||||
|
assert(se);
|
||||||
|
return get_label(se);
|
||||||
|
}
|
||||||
|
|
||||||
|
transition*
|
||||||
|
create_trainsition(const typename State::Label_t& source,
|
||||||
|
const typename State::Label_t& dest)
|
||||||
|
{
|
||||||
|
// It's important that the source be created before the
|
||||||
|
// destination, so the first source encountered becomes the
|
||||||
|
// default initial state.
|
||||||
|
State* s = add_state(source);
|
||||||
|
return create_transition(s, add_state(dest));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
complement_all_acceptance_conditions()
|
complement_all_acceptance_conditions()
|
||||||
{
|
{
|
||||||
bdd all = all_acceptance_conditions();
|
bdd all = this->all_acceptance_conditions();
|
||||||
typename ns_map::iterator i;
|
typename ls_map::iterator i;
|
||||||
for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i)
|
for (i = ls_.begin(); i != ls_.end(); ++i)
|
||||||
{
|
{
|
||||||
state_explicit::transitions_t::iterator i2;
|
typename State::transitions_t::iterator i2;
|
||||||
for (i2 = i->second->successors.begin();
|
for (i2 = i->second.successors.begin();
|
||||||
i2 != i->second->successors.end(); ++i2)
|
i2 != i->second.successors.end(); ++i2)
|
||||||
{
|
i2->acceptance_conditions = all - i2->acceptance_conditions;
|
||||||
i2->acceptance_conditions = all - i2->acceptance_conditions;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
merge_transitions()
|
||||||
|
{
|
||||||
|
typename ls_map::iterator i;
|
||||||
|
for (i = ls_.begin(); i != ls_.end(); ++i)
|
||||||
|
{
|
||||||
|
typename State::transitions_t::iterator t1;
|
||||||
|
for (t1 = i->second.successors.begin();
|
||||||
|
t1 != i->second.successors.end(); ++t1)
|
||||||
|
{
|
||||||
|
bdd acc = t1->acceptance_conditions;
|
||||||
|
const state_explicit<typename State::Label_t,
|
||||||
|
typename State::label_hash_t>* dest = t1->dest;
|
||||||
|
|
||||||
|
// Find another transition with the same destination and
|
||||||
|
// acceptance conditions.
|
||||||
|
typename State::transitions_t::iterator t2 = t1;
|
||||||
|
++t2;
|
||||||
|
while (t2 != i->second.successors.end())
|
||||||
|
{
|
||||||
|
typename State::transitions_t::iterator t2copy = t2++;
|
||||||
|
if (t2copy->acceptance_conditions == acc && t2copy->dest == dest)
|
||||||
|
{
|
||||||
|
t1->condition |= t2copy->condition;
|
||||||
|
i->second.successors.erase(t2copy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the state_explicit for \a name, creating the state if
|
||||||
|
/// it does not exist.
|
||||||
|
State* add_state(const typename State::Label_t& name)
|
||||||
|
{
|
||||||
|
typename ls_map::iterator i = ls_.find(name);
|
||||||
|
if (i == ls_.end())
|
||||||
|
{
|
||||||
|
State s(name);
|
||||||
|
ls_[name] = s;
|
||||||
|
sl_[&ls_[name]] = name;
|
||||||
|
|
||||||
|
// The first state we add is the inititial state.
|
||||||
|
// It can also be overridden with set_init_state().
|
||||||
|
if (!init_)
|
||||||
|
init_ = &ls_[name];
|
||||||
|
|
||||||
|
return &(ls_[name]);
|
||||||
|
}
|
||||||
|
return &(i->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
State*
|
||||||
|
set_init_state(const typename State::Label_t& state)
|
||||||
|
{
|
||||||
|
State* s = add_state(state);
|
||||||
|
init_ = s;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tgba interface
|
||||||
|
virtual ~explicit_graph()
|
||||||
|
{
|
||||||
|
typename ls_map::iterator i = ls_.begin();
|
||||||
|
|
||||||
|
while (i != ls_.end())
|
||||||
|
{
|
||||||
|
typename State::Label_t s = i->first;
|
||||||
|
|
||||||
|
// Do not erase the same state twice(Because of possible aliases).
|
||||||
|
if (sl_.erase(&(i->second)))
|
||||||
|
i->second.destroy();
|
||||||
|
|
||||||
|
++i;
|
||||||
|
destroy_key<typename State::Label_t> dest;
|
||||||
|
dest.destroy(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual State* get_init_state() const
|
||||||
|
{
|
||||||
|
if (!init_)
|
||||||
|
const_cast<explicit_graph<State, Type>*>(this)->add_default_init();
|
||||||
|
|
||||||
|
return init_;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual tgba_explicit_succ_iterator<State>*
|
||||||
|
succ_iter(const spot::state* state,
|
||||||
|
const spot::state* global_state = 0,
|
||||||
|
const tgba* global_automaton = 0) const
|
||||||
|
{
|
||||||
|
const State* s = down_cast<const State*>(state);
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
(void) global_state;
|
||||||
|
(void) global_automaton;
|
||||||
|
|
||||||
|
return
|
||||||
|
new tgba_explicit_succ_iterator<State>(s,
|
||||||
|
this
|
||||||
|
->all_acceptance_conditions());
|
||||||
|
}
|
||||||
|
|
||||||
|
//no need?
|
||||||
|
virtual std::string format_state(const spot::state* state) const
|
||||||
|
{
|
||||||
|
const State* se = down_cast<const State*>(state);
|
||||||
|
assert(se);
|
||||||
|
typename sl_map::const_iterator i = sl_.find(se);
|
||||||
|
assert(i != sl_.end());
|
||||||
|
return State::to_string(i->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// old implementation in tgba_explicit_string
|
||||||
|
/// Create an alias for a state. Any reference to \a alias_name
|
||||||
|
/// will act as a reference to \a real_name.
|
||||||
|
void add_state_alias(const typename State::Label_t& alias,
|
||||||
|
const typename State::Label_t& real)
|
||||||
|
{
|
||||||
|
ls_[alias] = *(add_state(real));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
ls_map ls_;
|
||||||
|
sl_map sl_;
|
||||||
|
State* init_;
|
||||||
|
|
||||||
|
bdd_dict* dict_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename State>
|
||||||
|
class tgba_explicit: public explicit_graph<State, tgba>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
typedef typename State::transition transition;
|
||||||
|
public:
|
||||||
|
typedef State state;
|
||||||
|
|
||||||
|
tgba_explicit(bdd_dict* dict):
|
||||||
|
explicit_graph<State,tgba>(dict),
|
||||||
|
all_acceptance_conditions_(bddfalse),
|
||||||
|
all_acceptance_conditions_computed_(false),
|
||||||
|
neg_acceptance_conditions_(bddtrue)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \brief Copy the acceptance conditions of a tgba.
|
||||||
|
///
|
||||||
|
/// If used, this function should be called before creating any
|
||||||
|
/// transition.
|
||||||
|
void copy_acceptance_conditions_of(const tgba *a)
|
||||||
|
{
|
||||||
|
assert(neg_acceptance_conditions_ == bddtrue);
|
||||||
|
assert(all_acceptance_conditions_computed_ == false);
|
||||||
|
bdd f = a->neg_acceptance_conditions();
|
||||||
|
this->dict_->register_acceptance_variables(f, this);
|
||||||
|
neg_acceptance_conditions_ = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The acceptance conditions.
|
||||||
|
void set_acceptance_conditions(bdd acc)
|
||||||
|
{
|
||||||
|
assert(neg_acceptance_conditions_ == bddtrue);
|
||||||
|
assert(all_acceptance_conditions_computed_ == false);
|
||||||
|
|
||||||
|
this->dict_->register_acceptance_variables(bdd_support(acc), this);
|
||||||
|
neg_acceptance_conditions_ = compute_neg_acceptance_conditions(acc);
|
||||||
|
all_acceptance_conditions_computed_ = true;
|
||||||
|
all_acceptance_conditions_ = acc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void add_acceptance_condition(transition* t, const ltl::formula* f)
|
||||||
|
{
|
||||||
|
bdd c = get_acceptance_condition(f);
|
||||||
|
t->acceptance_conditions |= c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This assumes that all acceptance conditions in \a f are known from
|
||||||
|
/// dict.
|
||||||
|
void add_acceptance_conditions(transition* t, bdd f)
|
||||||
|
{
|
||||||
|
bdd sup = bdd_support(f);
|
||||||
|
this->dict_->register_acceptance_variables(sup, this);
|
||||||
|
while (sup != bddtrue)
|
||||||
|
{
|
||||||
|
neg_acceptance_conditions_ &= bdd_nithvar(bdd_var(sup));
|
||||||
|
sup = bdd_high(sup);
|
||||||
|
}
|
||||||
|
t->acceptance_conditions |= f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// tgba interface
|
||||||
|
virtual ~tgba_explicit()
|
||||||
|
{
|
||||||
|
this->dict_->unregister_all_my_variables(this);
|
||||||
|
// These have already been destroyed by subclasses.
|
||||||
|
// Prevent destroying by tgba::~tgba.
|
||||||
|
this->last_support_conditions_input_ = 0;
|
||||||
|
this->last_support_variables_input_ = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bdd all_acceptance_conditions() const
|
||||||
|
{
|
||||||
|
if (!all_acceptance_conditions_computed_)
|
||||||
|
{
|
||||||
|
all_acceptance_conditions_ =
|
||||||
|
compute_all_acceptance_conditions(neg_acceptance_conditions_);
|
||||||
|
all_acceptance_conditions_computed_ = true;
|
||||||
|
}
|
||||||
|
return all_acceptance_conditions_;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bdd_dict* get_dict() const
|
||||||
|
{
|
||||||
|
return this->dict_;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bdd neg_acceptance_conditions() const
|
||||||
|
{
|
||||||
|
return neg_acceptance_conditions_;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
declare_acceptance_condition(const ltl::formula* f)
|
declare_acceptance_condition(const ltl::formula* f)
|
||||||
{
|
{
|
||||||
int v = dict_->register_acceptance_variable(f, this);
|
int v = this->dict_->register_acceptance_variable(f, this);
|
||||||
f->destroy();
|
f->destroy();
|
||||||
bdd neg = bdd_nithvar(v);
|
bdd neg = bdd_nithvar(v);
|
||||||
neg_acceptance_conditions_ &= neg;
|
neg_acceptance_conditions_ &= neg;
|
||||||
|
|
||||||
// Append neg to all acceptance conditions.
|
// Append neg to all acceptance conditions.
|
||||||
typename ns_map::iterator i;
|
typename explicit_graph<State, tgba>::ls_map::iterator i;
|
||||||
for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i)
|
for (i = this->ls_.begin(); i != this->ls_.end(); ++i)
|
||||||
{
|
{
|
||||||
state_explicit::transitions_t::iterator i2;
|
typename State::transitions_t::iterator i2;
|
||||||
for (i2 = i->second->successors.begin();
|
for (i2 = i->second.successors.begin();
|
||||||
i2 != i->second->successors.end(); ++i2)
|
i2 != i->second.successors.end(); ++i2)
|
||||||
i2->acceptance_conditions &= neg;
|
i2->acceptance_conditions &= neg;
|
||||||
}
|
}
|
||||||
|
|
||||||
all_acceptance_conditions_computed_ = false;
|
all_acceptance_conditions_computed_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
void
|
bdd get_acceptance_condition(const ltl::formula* f)
|
||||||
merge_transitions()
|
|
||||||
{
|
{
|
||||||
typename ns_map::iterator i;
|
bdd_dict::fv_map::iterator i = this->dict_->acc_map.find(f);
|
||||||
for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i)
|
assert(this->has_acceptance_condition(f));
|
||||||
{
|
f->destroy();
|
||||||
state_explicit::transitions_t::iterator t1;
|
bdd v = bdd_ithvar(i->second);
|
||||||
for (t1 = i->second->successors.begin();
|
v &= bdd_exist(neg_acceptance_conditions_, v);
|
||||||
t1 != i->second->successors.end(); ++t1)
|
return v;
|
||||||
{
|
|
||||||
bdd acc = t1->acceptance_conditions;
|
|
||||||
const state* dest = t1->dest;
|
|
||||||
|
|
||||||
// Find another transition with the same destination and
|
|
||||||
// acceptance conditions.
|
|
||||||
state_explicit::transitions_t::iterator t2 = t1;
|
|
||||||
++t2;
|
|
||||||
while (t2 != i->second->successors.end())
|
|
||||||
{
|
|
||||||
state_explicit::transitions_t::iterator t2copy = t2++;
|
|
||||||
if (t2copy->acceptance_conditions == acc
|
|
||||||
&& t2copy->dest == dest)
|
|
||||||
{
|
|
||||||
t1->condition |= t2copy->condition;
|
|
||||||
i->second->successors.erase(t2copy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bdd compute_support_conditions(const spot::state* in) const
|
||||||
virtual
|
|
||||||
~tgba_explicit_labelled()
|
|
||||||
{
|
{
|
||||||
// These have already been destroyed by subclasses.
|
const State* s = down_cast<const State*>(in);
|
||||||
// Prevent destroying by tgba::~tgba.
|
assert(s);
|
||||||
last_support_conditions_input_ = 0;
|
const typename State::transitions_t& st = s->successors;
|
||||||
last_support_variables_input_ = 0;
|
|
||||||
|
bdd res = bddfalse;
|
||||||
|
|
||||||
|
typename State::transitions_t::const_iterator i;
|
||||||
|
for (i = st.begin(); i != st.end(); ++i)
|
||||||
|
res |= i->condition;
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
virtual bdd compute_support_variables(const spot::state* in) const
|
||||||
|
|
||||||
#ifndef SWIG
|
|
||||||
class tgba_explicit_string:
|
|
||||||
public tgba_explicit_labelled<std::string, string_hash>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
tgba_explicit_string(bdd_dict* dict):
|
|
||||||
tgba_explicit_labelled<std::string, string_hash>(dict)
|
|
||||||
{};
|
|
||||||
virtual ~tgba_explicit_string();
|
|
||||||
virtual state* add_default_init();
|
|
||||||
virtual std::string format_state(const spot::state* s) const;
|
|
||||||
|
|
||||||
/// Create an alias for a state. Any reference to \a alias_name
|
|
||||||
/// will act as a reference to \a real_name.
|
|
||||||
virtual
|
|
||||||
void add_state_alias(const std::string& alias_name,
|
|
||||||
const std::string& real_name)
|
|
||||||
{
|
{
|
||||||
name_state_map_[alias_name] = add_state(real_name);
|
const State* s = down_cast<const State*>(in);
|
||||||
|
assert(s);
|
||||||
|
const typename State::transitions_t& st = s->successors;
|
||||||
|
|
||||||
|
bdd res = bddtrue;
|
||||||
|
|
||||||
|
typename State::transitions_t::const_iterator i;
|
||||||
|
for (i = st.begin(); i != st.end(); ++i)
|
||||||
|
res &= bdd_support(i->condition);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
#else
|
|
||||||
class tgba_explicit_string: public tgba
|
|
||||||
{
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SWIG
|
mutable bdd all_acceptance_conditions_;
|
||||||
class tgba_explicit_formula:
|
mutable bool all_acceptance_conditions_computed_;
|
||||||
public tgba_explicit_labelled<const ltl::formula*, ltl::formula_ptr_hash>
|
bdd neg_acceptance_conditions_;
|
||||||
{
|
|
||||||
public:
|
|
||||||
tgba_explicit_formula(bdd_dict* dict):
|
|
||||||
tgba_explicit_labelled<const ltl::formula*, ltl::formula_ptr_hash>(dict)
|
|
||||||
{};
|
|
||||||
virtual ~tgba_explicit_formula();
|
|
||||||
virtual state* add_default_init();
|
|
||||||
virtual std::string format_state(const spot::state* s) const;
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
class tgba_explicit_formula: public tgba
|
|
||||||
{
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SWIG
|
private:
|
||||||
class tgba_explicit_number:
|
// Disallow copy.
|
||||||
public tgba_explicit_labelled<int, identity_hash<int> >
|
tgba_explicit(const tgba_explicit<State>& other);
|
||||||
{
|
tgba_explicit& operator=(const tgba_explicit& other);
|
||||||
public:
|
|
||||||
tgba_explicit_number(bdd_dict* dict):
|
|
||||||
tgba_explicit_labelled<int, identity_hash<int> >(dict)
|
|
||||||
{};
|
|
||||||
virtual ~tgba_explicit_number();
|
|
||||||
virtual state* add_default_init();
|
|
||||||
virtual std::string format_state(const spot::state* s) const;
|
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
class tgba_explicit_number: public tgba
|
|
||||||
{
|
typedef tgba_explicit<state_explicit_string> tgba_explicit_string;
|
||||||
};
|
typedef tgba_explicit<state_explicit_formula> tgba_explicit_formula;
|
||||||
#endif
|
typedef tgba_explicit<state_explicit_number> tgba_explicit_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TGBA_TGBAEXPLICIT_HH
|
#endif // SPOT_TGBA_TGBAEXPLICIT_HH
|
||||||
|
|
|
||||||
|
|
@ -148,15 +148,15 @@ namespace spot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba_explicit::transition*
|
tgba_explicit_string::transition*
|
||||||
tgba_reduc::create_transition(const spot::state* source,
|
tgba_reduc::create_transition(const spot::state* source,
|
||||||
const spot::state* dest)
|
const spot::state* dest)
|
||||||
{
|
{
|
||||||
const std::string ss = aut_->format_state(source);
|
const std::string ss = aut_->format_state(source);
|
||||||
const std::string sd = aut_->format_state(dest);
|
const std::string sd = aut_->format_state(dest);
|
||||||
|
|
||||||
tgba_explicit::state* s = tgba_explicit_string::add_state(ss);
|
state_explicit_string* s = tgba_explicit_string::add_state(ss);
|
||||||
tgba_explicit::state* d = tgba_explicit_string::add_state(sd);
|
state_explicit_string* d = tgba_explicit_string::add_state(sd);
|
||||||
|
|
||||||
transition t;
|
transition t;
|
||||||
t.dest = d;
|
t.dest = d;
|
||||||
|
|
@ -175,7 +175,7 @@ namespace spot
|
||||||
|
|
||||||
t.condition = bddtrue;
|
t.condition = bddtrue;
|
||||||
t.acceptance_conditions = bddfalse;
|
t.acceptance_conditions = bddfalse;
|
||||||
state_explicit::transitions_t::iterator is
|
state_explicit_string::transitions_t::iterator is
|
||||||
= s->successors.insert(s->successors.end(), t);
|
= s->successors.insert(s->successors.end(), t);
|
||||||
return &*is;
|
return &*is;
|
||||||
}
|
}
|
||||||
|
|
@ -190,10 +190,10 @@ namespace spot
|
||||||
bdd cond_simul;
|
bdd cond_simul;
|
||||||
bdd acc_simul;
|
bdd acc_simul;
|
||||||
std::list<state*> ltmp;
|
std::list<state*> ltmp;
|
||||||
const tgba_explicit::state* s1 =
|
const state_explicit_string* s1 =
|
||||||
name_state_map_[tgba_explicit_string::format_state(s)];
|
&(ls_[tgba_explicit_string::format_state(s)]);
|
||||||
const tgba_explicit::state* s2 =
|
const state_explicit_string* s2 =
|
||||||
name_state_map_[tgba_explicit_string::format_state(simul)];
|
&(ls_[tgba_explicit_string::format_state(simul)]);
|
||||||
|
|
||||||
sp_map::iterator i = state_predecessor_map_.find(s1);
|
sp_map::iterator i = state_predecessor_map_.find(s1);
|
||||||
if (i == state_predecessor_map_.end()) // 0 predecessor
|
if (i == state_predecessor_map_.end()) // 0 predecessor
|
||||||
|
|
@ -205,7 +205,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
// We check if simul belong to the successor of p,
|
// We check if simul belong to the successor of p,
|
||||||
// as s belong too.
|
// as s belong too.
|
||||||
for (state_explicit::transitions_t::iterator
|
for (state_explicit_string::transitions_t::iterator
|
||||||
j = (*p)->successors.begin();
|
j = (*p)->successors.begin();
|
||||||
j != (*p)->successors.end(); ++j)
|
j != (*p)->successors.end(); ++j)
|
||||||
if (j->dest == s2) // simul belong to the successor of p.
|
if (j->dest == s2) // simul belong to the successor of p.
|
||||||
|
|
@ -221,7 +221,7 @@ namespace spot
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// for all successor of p, a predecessor of s and simul.
|
// for all successor of p, a predecessor of s and simul.
|
||||||
for (state_explicit::transitions_t::iterator
|
for (state_explicit_string::transitions_t::iterator
|
||||||
j = (*p)->successors.begin();
|
j = (*p)->successors.begin();
|
||||||
j != (*p)->successors.end(); ++j)
|
j != (*p)->successors.end(); ++j)
|
||||||
{
|
{
|
||||||
|
|
@ -233,7 +233,7 @@ namespace spot
|
||||||
((!j->acceptance_conditions) | acc_simul) == bddtrue))
|
((!j->acceptance_conditions) | acc_simul) == bddtrue))
|
||||||
{
|
{
|
||||||
// We can redirect transition leading to s on simul.
|
// We can redirect transition leading to s on simul.
|
||||||
j->dest = const_cast<tgba_explicit::state*>(s2);
|
j->dest = const_cast<state_explicit_string*>(s2);
|
||||||
|
|
||||||
// We memorize that we have to remove p
|
// We memorize that we have to remove p
|
||||||
// of the predecessor of s.
|
// of the predecessor of s.
|
||||||
|
|
@ -273,19 +273,20 @@ namespace spot
|
||||||
// merge_state => NO PREDECESSOR. But it can be have some
|
// merge_state => NO PREDECESSOR. But it can be have some
|
||||||
// predecessor in state_predecessor_map_.
|
// predecessor in state_predecessor_map_.
|
||||||
|
|
||||||
ns_map::iterator k =
|
ls_map::iterator k =
|
||||||
name_state_map_.find(tgba_explicit_string::format_state(s));
|
ls_.find(tgba_explicit_string::format_state(s));
|
||||||
if (k == name_state_map_.end()) // 0 predecessor
|
if (k == ls_.end()) // 0 predecessor
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tgba_explicit::state* st =
|
state_explicit_string* st =
|
||||||
name_state_map_[tgba_explicit_string::format_state(s)];
|
&(ls_[tgba_explicit_string::format_state(s)]);
|
||||||
|
|
||||||
// for all successor q of s, we remove s of the predecessor of q.
|
// for all successor q of s, we remove s of the predecessor of q.
|
||||||
// Note that the initial node can't be removed.
|
// Note that the initial node can't be removed.
|
||||||
for (state_explicit::transitions_t::iterator j =
|
for (state_explicit_string::transitions_t::iterator j =
|
||||||
st->successors.begin(); j != st->successors.end(); ++j)
|
st->successors.begin(); j != st->successors.end(); ++j)
|
||||||
this->remove_predecessor_state(j->dest, st);
|
this->remove_predecessor_state(down_cast<const state_explicit_string*>
|
||||||
|
(j->dest), st);
|
||||||
|
|
||||||
|
|
||||||
sp_map::iterator i = state_predecessor_map_.find(st);
|
sp_map::iterator i = state_predecessor_map_.find(st);
|
||||||
|
|
@ -297,7 +298,7 @@ namespace spot
|
||||||
p != (i->second)->end(); ++p)
|
p != (i->second)->end(); ++p)
|
||||||
{
|
{
|
||||||
// for all transition of p, a predecessor of s.
|
// for all transition of p, a predecessor of s.
|
||||||
for (state_explicit::transitions_t::iterator
|
for (state_explicit_string::transitions_t::iterator
|
||||||
j = (*p)->successors.begin();
|
j = (*p)->successors.begin();
|
||||||
j != (*p)->successors.end();)
|
j != (*p)->successors.end();)
|
||||||
{
|
{
|
||||||
|
|
@ -321,11 +322,11 @@ namespace spot
|
||||||
void
|
void
|
||||||
tgba_reduc::merge_state(const spot::state* sim1, const spot::state* sim2)
|
tgba_reduc::merge_state(const spot::state* sim1, const spot::state* sim2)
|
||||||
{
|
{
|
||||||
const tgba_explicit::state* s1 =
|
const state_explicit_string* s1 =
|
||||||
name_state_map_[tgba_explicit_string::format_state(sim1)];
|
&(ls_[tgba_explicit_string::format_state(sim1)]);
|
||||||
const tgba_explicit::state* s2 =
|
const state_explicit_string* s2 =
|
||||||
name_state_map_[tgba_explicit_string::format_state(sim2)];
|
&(ls_[tgba_explicit_string::format_state(sim2)]);
|
||||||
const tgba_explicit::state* stmp = s1;
|
const state_explicit_string* stmp = s1;
|
||||||
const spot::state* simtmp = sim1;
|
const spot::state* simtmp = sim1;
|
||||||
|
|
||||||
// if sim1 is the init state, we remove sim2.
|
// if sim1 is the init state, we remove sim2.
|
||||||
|
|
@ -354,7 +355,7 @@ namespace spot
|
||||||
p != (i->second)->end(); ++p)
|
p != (i->second)->end(); ++p)
|
||||||
{
|
{
|
||||||
// for all successor of p, a predecessor of s1.
|
// for all successor of p, a predecessor of s1.
|
||||||
for (state_explicit::transitions_t::iterator
|
for (state_explicit_string::transitions_t::iterator
|
||||||
j = (*p)->successors.begin();
|
j = (*p)->successors.begin();
|
||||||
j != (*p)->successors.end(); ++j)
|
j != (*p)->successors.end(); ++j)
|
||||||
{
|
{
|
||||||
|
|
@ -362,7 +363,7 @@ namespace spot
|
||||||
if (j->dest == s1)
|
if (j->dest == s1)
|
||||||
{
|
{
|
||||||
// ... make it s2.
|
// ... make it s2.
|
||||||
j->dest = const_cast<tgba_explicit::state*>(s2);
|
j->dest = const_cast<state_explicit_string*>(s2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -373,7 +374,7 @@ namespace spot
|
||||||
// leaving s1 (possible when the simulation is delayed). Since s2
|
// leaving s1 (possible when the simulation is delayed). Since s2
|
||||||
// simulates s1, s2 has some labels that imply these of s1, so we
|
// simulates s1, s2 has some labels that imply these of s1, so we
|
||||||
// can put the acceptance conditions on its arcs.
|
// can put the acceptance conditions on its arcs.
|
||||||
for (state_explicit::transitions_t::const_iterator
|
for (state_explicit_string::transitions_t::const_iterator
|
||||||
j = s1->successors.begin();
|
j = s1->successors.begin();
|
||||||
j != s1->successors.end(); ++j)
|
j != s1->successors.end(); ++j)
|
||||||
{
|
{
|
||||||
|
|
@ -381,7 +382,7 @@ namespace spot
|
||||||
t.dest = j->dest;
|
t.dest = j->dest;
|
||||||
t.condition = j->condition;
|
t.condition = j->condition;
|
||||||
t.acceptance_conditions = j->acceptance_conditions;
|
t.acceptance_conditions = j->acceptance_conditions;
|
||||||
const_cast<state_explicit*>(s2)->successors.push_back(t);
|
const_cast<state_explicit_string*>(s2)->successors.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We remove all the predecessor of s1.
|
// We remove all the predecessor of s1.
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,9 @@ namespace spot
|
||||||
void display_scc(std::ostream& os);
|
void display_scc(std::ostream& os);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef Sgi::hash_map<const tgba_explicit::state*,
|
typedef Sgi::hash_map<const state_explicit_string*,
|
||||||
std::list<state*>*,
|
std::list<state*>*,
|
||||||
ptr_hash<tgba_explicit::state> > sp_map;
|
ptr_hash<state_explicit_string> > sp_map;
|
||||||
sp_map state_predecessor_map_;
|
sp_map state_predecessor_map_;
|
||||||
|
|
||||||
// Interface of tgba_reachable_iterator_breadth_first
|
// Interface of tgba_reachable_iterator_breadth_first
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
dst->destroy();
|
dst->destroy();
|
||||||
}
|
}
|
||||||
tgba_explicit::transition* t =
|
state_explicit_string::transition* t =
|
||||||
sub_a->create_transition(cur_format, dst_format);
|
sub_a->create_transition(cur_format, dst_format);
|
||||||
sub_a->add_conditions(t, sit->current_condition());
|
sub_a->add_conditions(t, sit->current_condition());
|
||||||
sub_a->
|
sub_a->
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ namespace spot
|
||||||
std::ostringstream out_name;
|
std::ostringstream out_name;
|
||||||
out_name << "(#" << out << ") " << this->aut_->format_state(out_s);
|
out_name << "(#" << out << ") " << this->aut_->format_state(out_s);
|
||||||
|
|
||||||
tgba_explicit::transition* t =
|
state_explicit_string::transition* t =
|
||||||
out_->create_transition(in_name.str(), out_name.str());
|
out_->create_transition(in_name.str(), out_name.str());
|
||||||
out_->add_conditions(t, si->current_condition());
|
out_->add_conditions(t, si->current_condition());
|
||||||
out_->add_acceptance_conditions(t, si->current_acceptance_conditions());
|
out_->add_acceptance_conditions(t, si->current_acceptance_conditions());
|
||||||
|
|
@ -69,7 +69,7 @@ namespace spot
|
||||||
|
|
||||||
} // anonymous
|
} // anonymous
|
||||||
|
|
||||||
tgba_explicit*
|
tgba_explicit_string*
|
||||||
tgba_dupexp_bfs(const tgba* aut)
|
tgba_dupexp_bfs(const tgba* aut)
|
||||||
{
|
{
|
||||||
dupexp_iter<tgba_reachable_iterator_breadth_first> di(aut);
|
dupexp_iter<tgba_reachable_iterator_breadth_first> di(aut);
|
||||||
|
|
@ -77,7 +77,7 @@ namespace spot
|
||||||
return di.result();
|
return di.result();
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba_explicit*
|
tgba_explicit_string*
|
||||||
tgba_dupexp_dfs(const tgba* aut)
|
tgba_dupexp_dfs(const tgba* aut)
|
||||||
{
|
{
|
||||||
dupexp_iter<tgba_reachable_iterator_depth_first> di(aut);
|
dupexp_iter<tgba_reachable_iterator_depth_first> di(aut);
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,11 @@ namespace spot
|
||||||
/// \brief Build an explicit automata from all states of \a aut,
|
/// \brief Build an explicit automata from all states of \a aut,
|
||||||
/// numbering states in bread first order as they are processed.
|
/// numbering states in bread first order as they are processed.
|
||||||
/// \ingroup tgba_misc
|
/// \ingroup tgba_misc
|
||||||
tgba_explicit* tgba_dupexp_bfs(const tgba* aut);
|
tgba_explicit_string* tgba_dupexp_bfs(const tgba* aut);
|
||||||
/// \brief Build an explicit automata from all states of \a aut,
|
/// \brief Build an explicit automata from all states of \a aut,
|
||||||
/// numbering states in depth first order as they are processed.
|
/// numbering states in depth first order as they are processed.
|
||||||
/// \ingroup tgba_misc
|
/// \ingroup tgba_misc
|
||||||
tgba_explicit* tgba_dupexp_dfs(const tgba* aut);
|
tgba_explicit_string* tgba_dupexp_dfs(const tgba* aut);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TGBAALGOS_DUPEXP_HH
|
#endif // SPOT_TGBAALGOS_DUPEXP_HH
|
||||||
|
|
|
||||||
|
|
@ -302,12 +302,12 @@ namespace spot
|
||||||
|
|
||||||
const state* s = a->get_init_state();
|
const state* s = a->get_init_state();
|
||||||
int number = 1;
|
int number = 1;
|
||||||
tgba_explicit::state* source;
|
state_explicit_string* source;
|
||||||
tgba_explicit::state* dest;
|
state_explicit_string* dest;
|
||||||
const tgba_run::steps* l;
|
const tgba_run::steps* l;
|
||||||
bdd seen_acc = bddfalse;
|
bdd seen_acc = bddfalse;
|
||||||
|
|
||||||
typedef Sgi::hash_map<const state*, tgba_explicit::state*,
|
typedef Sgi::hash_map<const state*, state_explicit_string*,
|
||||||
state_ptr_hash, state_ptr_equal> state_map;
|
state_ptr_hash, state_ptr_equal> state_map;
|
||||||
state_map seen;
|
state_map seen;
|
||||||
|
|
||||||
|
|
@ -380,7 +380,8 @@ namespace spot
|
||||||
else
|
else
|
||||||
dest = its->second;
|
dest = its->second;
|
||||||
|
|
||||||
tgba_explicit::transition* t = res->create_transition(source, dest);
|
state_explicit_string::transition* t =
|
||||||
|
res->create_transition(source, dest);
|
||||||
res->add_conditions(t, label);
|
res->add_conditions(t, label);
|
||||||
res->add_acceptance_conditions(t, acc);
|
res->add_acceptance_conditions(t, acc);
|
||||||
source = dest;
|
source = dest;
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ namespace spot
|
||||||
|
|
||||||
void
|
void
|
||||||
conj_bdd_to_acc(tgba_explicit_formula* a, bdd b,
|
conj_bdd_to_acc(tgba_explicit_formula* a, bdd b,
|
||||||
tgba_explicit::transition* t)
|
state_explicit_formula::transition* t)
|
||||||
{
|
{
|
||||||
assert(b != bddfalse);
|
assert(b != bddfalse);
|
||||||
while (b != bddtrue)
|
while (b != bddtrue)
|
||||||
|
|
@ -692,7 +692,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tgba_explicit*
|
tgba_explicit_formula*
|
||||||
ltl_to_tgba_fm(const formula* f, bdd_dict* dict,
|
ltl_to_tgba_fm(const formula* f, bdd_dict* dict,
|
||||||
bool exprop, bool symb_merge, bool branching_postponement,
|
bool exprop, bool symb_merge, bool branching_postponement,
|
||||||
bool fair_loop_approx, const atomic_prop_set* unobs,
|
bool fair_loop_approx, const atomic_prop_set* unobs,
|
||||||
|
|
@ -945,7 +945,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
if (!a->has_state(constant::true_instance()))
|
if (!a->has_state(constant::true_instance()))
|
||||||
formulae_to_translate.insert(constant::true_instance());
|
formulae_to_translate.insert(constant::true_instance());
|
||||||
tgba_explicit::transition* t =
|
state_explicit_formula::transition* t =
|
||||||
a->create_transition(now, constant::true_instance());
|
a->create_transition(now, constant::true_instance());
|
||||||
a->add_condition(t, d.bdd_to_formula(cond_for_true));
|
a->add_condition(t, d.bdd_to_formula(cond_for_true));
|
||||||
}
|
}
|
||||||
|
|
@ -969,7 +969,7 @@ namespace spot
|
||||||
bdd cond = j->second - cond_for_true;
|
bdd cond = j->second - cond_for_true;
|
||||||
if (cond == bddfalse) // Skip false transitions.
|
if (cond == bddfalse) // Skip false transitions.
|
||||||
continue;
|
continue;
|
||||||
tgba_explicit::transition* t =
|
state_explicit_formula::transition* t =
|
||||||
a->create_transition(now, dest);
|
a->create_transition(now, dest);
|
||||||
a->add_condition(t, d.bdd_to_formula(cond));
|
a->add_condition(t, d.bdd_to_formula(cond));
|
||||||
d.conj_bdd_to_acc(a, j->first, t);
|
d.conj_bdd_to_acc(a, j->first, t);
|
||||||
|
|
|
||||||
|
|
@ -122,12 +122,13 @@ namespace spot
|
||||||
/// \endverbatim
|
/// \endverbatim
|
||||||
///
|
///
|
||||||
/// \return A spot::tgba_explicit that recognizes the language of \a f.
|
/// \return A spot::tgba_explicit that recognizes the language of \a f.
|
||||||
tgba_explicit* ltl_to_tgba_fm(const ltl::formula* f, bdd_dict* dict,
|
tgba_explicit_formula*
|
||||||
bool exprop = false, bool symb_merge = true,
|
ltl_to_tgba_fm(const ltl::formula* f, bdd_dict* dict,
|
||||||
bool branching_postponement = false,
|
bool exprop = false, bool symb_merge = true,
|
||||||
bool fair_loop_approx = false,
|
bool branching_postponement = false,
|
||||||
const ltl::atomic_prop_set* unobs = 0,
|
bool fair_loop_approx = false,
|
||||||
int reduce_ltl = ltl::Reduce_None);
|
const ltl::atomic_prop_set* unobs = 0,
|
||||||
|
int reduce_ltl = ltl::Reduce_None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TGBAALGOS_LTL2TGBA_FM_HH
|
#endif // SPOT_TGBAALGOS_LTL2TGBA_FM_HH
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ namespace spot
|
||||||
state_num[*hit] = num;
|
state_num[*hit] = num;
|
||||||
++num;
|
++num;
|
||||||
}
|
}
|
||||||
typedef tgba_explicit_number::transition trs;
|
typedef state_explicit_number::transition trs;
|
||||||
tgba_explicit_number* res = new tgba_explicit_number(a->get_dict());
|
tgba_explicit_number* res = new tgba_explicit_number(a->get_dict());
|
||||||
// For each transition in the initial automaton, add the corresponding
|
// For each transition in the initial automaton, add the corresponding
|
||||||
// transition in res.
|
// transition in res.
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ namespace spot
|
||||||
// Add that transition.
|
// Add that transition.
|
||||||
power_set::const_iterator i = seen.find(dest);
|
power_set::const_iterator i = seen.find(dest);
|
||||||
int dest_num;
|
int dest_num;
|
||||||
tgba_explicit::transition* t;
|
state_explicit_number::transition* t;
|
||||||
if (i != seen.end())
|
if (i != seen.end())
|
||||||
{
|
{
|
||||||
dest_num = i->second;
|
dest_num = i->second;
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,9 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
random_labels(tgba_explicit* aut,
|
random_labels(tgba_explicit_string* aut,
|
||||||
tgba_explicit::state* src, const tgba_explicit::state* dest,
|
state_explicit_string* src,
|
||||||
|
const state_explicit_string* dest,
|
||||||
int* props, int props_n, float t,
|
int* props, int props_n, float t,
|
||||||
const std::list<bdd>& accs, float a)
|
const std::list<bdd>& accs, float a)
|
||||||
{
|
{
|
||||||
|
|
@ -84,7 +85,7 @@ namespace spot
|
||||||
if (drand() < a)
|
if (drand() < a)
|
||||||
ac |= *i;
|
ac |= *i;
|
||||||
|
|
||||||
tgba_explicit::transition* u = aut->create_transition(src, dest);
|
state_explicit_string::transition* u = aut->create_transition(src, dest);
|
||||||
aut->add_conditions(u, p);
|
aut->add_conditions(u, p);
|
||||||
aut->add_acceptance_conditions(u, ac);
|
aut->add_acceptance_conditions(u, ac);
|
||||||
}
|
}
|
||||||
|
|
@ -107,7 +108,7 @@ namespace spot
|
||||||
i != ap->end(); ++i)
|
i != ap->end(); ++i)
|
||||||
props[pi++] = dict->register_proposition(*i, res);
|
props[pi++] = dict->register_proposition(*i, res);
|
||||||
|
|
||||||
std::vector<tgba_explicit::state*> states(n);
|
std::vector<state_explicit_string*> states(n);
|
||||||
// Indirect access to state[] to help random selection of successors.
|
// Indirect access to state[] to help random selection of successors.
|
||||||
std::vector<int> state_randomizer(n);
|
std::vector<int> state_randomizer(n);
|
||||||
|
|
||||||
|
|
@ -153,7 +154,7 @@ namespace spot
|
||||||
|
|
||||||
while (!nodes_to_process.empty())
|
while (!nodes_to_process.empty())
|
||||||
{
|
{
|
||||||
tgba_explicit::state* src = states[*nodes_to_process.begin()];
|
state_explicit_string* src = states[*nodes_to_process.begin()];
|
||||||
nodes_to_process.erase(nodes_to_process.begin());
|
nodes_to_process.erase(nodes_to_process.begin());
|
||||||
|
|
||||||
// Choose a random number of successors (at least one), using
|
// Choose a random number of successors (at least one), using
|
||||||
|
|
@ -195,7 +196,7 @@ namespace spot
|
||||||
state_randomizer[index] = state_randomizer[possibilities];
|
state_randomizer[index] = state_randomizer[possibilities];
|
||||||
state_randomizer[possibilities] = x;
|
state_randomizer[possibilities] = x;
|
||||||
|
|
||||||
tgba_explicit::state* dest = states[x];
|
state_explicit_string* dest = states[x];
|
||||||
|
|
||||||
random_labels(res, src, dest, props, props_n, t, accs, a);
|
random_labels(res, src, dest, props, props_n, t, accs, a);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace spot
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
tgba_explicit::transition*
|
state_explicit_string::transition*
|
||||||
create_transition(const tgba* aut, tgba_explicit_string* out_aut,
|
create_transition(const tgba* aut, tgba_explicit_string* out_aut,
|
||||||
const state* in_s, int in,
|
const state* in_s, int in,
|
||||||
const state* out_s, int out)
|
const state* out_s, int out)
|
||||||
|
|
@ -43,7 +43,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
tgba_explicit::transition*
|
state_explicit_formula::transition*
|
||||||
create_transition(const tgba* aut, tgba_explicit_formula* out_aut,
|
create_transition(const tgba* aut, tgba_explicit_formula* out_aut,
|
||||||
const state* in_s, int, const state* out_s, int)
|
const state* in_s, int, const state* out_s, int)
|
||||||
{
|
{
|
||||||
|
|
@ -62,6 +62,8 @@ namespace spot
|
||||||
class filter_iter: public tgba_reachable_iterator_depth_first
|
class filter_iter: public tgba_reachable_iterator_depth_first
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef T output_t;
|
||||||
|
|
||||||
filter_iter(const tgba* a,
|
filter_iter(const tgba* a,
|
||||||
const scc_map& sm,
|
const scc_map& sm,
|
||||||
const std::vector<bool>& useless,
|
const std::vector<bool>& useless,
|
||||||
|
|
@ -94,7 +96,7 @@ namespace spot
|
||||||
const state* out_s, int out,
|
const state* out_s, int out,
|
||||||
const tgba_succ_iterator* si)
|
const tgba_succ_iterator* si)
|
||||||
{
|
{
|
||||||
tgba_explicit::transition* t =
|
typename output_t::state::transition* t =
|
||||||
create_transition(this->aut_, out_, in_s, in, out_s, out);
|
create_transition(this->aut_, out_, in_s, in, out_s, out);
|
||||||
out_->add_conditions(t, si->current_condition());
|
out_->add_conditions(t, si->current_condition());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ lines: line
|
||||||
|
|
||||||
line: strident ',' strident ',' condition ',' acc_list ';'
|
line: strident ',' strident ',' condition ',' acc_list ';'
|
||||||
{
|
{
|
||||||
spot::tgba_explicit::transition* t
|
spot::state_explicit_string::transition* t
|
||||||
= result->create_transition(*$1, *$3);
|
= result->create_transition(*$1, *$3);
|
||||||
if ($5)
|
if ($5)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ check_PROGRAMS = \
|
||||||
bddprod \
|
bddprod \
|
||||||
complement \
|
complement \
|
||||||
explicit \
|
explicit \
|
||||||
|
explicit2 \
|
||||||
expldot \
|
expldot \
|
||||||
explprod \
|
explprod \
|
||||||
intvcomp \
|
intvcomp \
|
||||||
|
|
@ -53,6 +54,7 @@ bddprod_SOURCES = ltlprod.cc
|
||||||
bddprod_CXXFLAGS = -DBDD_CONCRETE_PRODUCT
|
bddprod_CXXFLAGS = -DBDD_CONCRETE_PRODUCT
|
||||||
complement_SOURCES = complementation.cc
|
complement_SOURCES = complementation.cc
|
||||||
explicit_SOURCES = explicit.cc
|
explicit_SOURCES = explicit.cc
|
||||||
|
explicit2_SOURCES = explicit2.cc
|
||||||
expldot_SOURCES = powerset.cc
|
expldot_SOURCES = powerset.cc
|
||||||
expldot_CXXFLAGS = -DDOTTY
|
expldot_CXXFLAGS = -DDOTTY
|
||||||
explprod_SOURCES = explprod.cc
|
explprod_SOURCES = explprod.cc
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||||
spot::tgba_parse_error_list pel;
|
spot::tgba_parse_error_list pel;
|
||||||
spot::tgba_explicit* a = spot::tgba_parse(file, pel, dict, env);
|
spot::tgba_explicit_string* a = spot::tgba_parse(file, pel, dict, env);
|
||||||
if (spot::format_tgba_parse_errors(std::cerr, file, pel))
|
if (spot::format_tgba_parse_errors(std::cerr, file, pel))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ main()
|
||||||
spot::ltl::default_environment::instance();
|
spot::ltl::default_environment::instance();
|
||||||
spot::tgba_explicit_string* a = new spot::tgba_explicit_string(dict);
|
spot::tgba_explicit_string* a = new spot::tgba_explicit_string(dict);
|
||||||
|
|
||||||
typedef spot::tgba_explicit::transition trans;
|
typedef spot::state_explicit_string::transition trans;
|
||||||
|
|
||||||
trans* t1 = a->create_transition("state 0", "state 1");
|
trans* t1 = a->create_transition("state 0", "state 1");
|
||||||
trans* t2 = a->create_transition("state 1", "state 2");
|
trans* t2 = a->create_transition("state 1", "state 2");
|
||||||
|
|
|
||||||
126
src/tgbatest/explicit2.cc
Normal file
126
src/tgbatest/explicit2.cc
Normal file
|
|
@ -0,0 +1,126 @@
|
||||||
|
// Copyright (C) 2012 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 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 <iostream>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "ltlenv/defaultenv.hh"
|
||||||
|
#include "ltlast/allnodes.hh"
|
||||||
|
|
||||||
|
#include "tgba/tgbaexplicit.hh"
|
||||||
|
|
||||||
|
using namespace spot;
|
||||||
|
|
||||||
|
void
|
||||||
|
create_tgba_explicit_string(bdd_dict* d)
|
||||||
|
{
|
||||||
|
tgba_explicit<state_explicit_string>* tgba =
|
||||||
|
new tgba_explicit<state_explicit_string>(d);
|
||||||
|
state_explicit_string* s1 = tgba->add_state("toto");
|
||||||
|
state_explicit_string* s2 = tgba->add_state("tata");
|
||||||
|
state_explicit_string::transition* t =
|
||||||
|
tgba->create_transition(s1, s2);
|
||||||
|
(void) t;
|
||||||
|
|
||||||
|
tgba_explicit_succ_iterator<state_explicit_string>* it
|
||||||
|
= tgba->succ_iter(tgba->get_init_state());
|
||||||
|
for (it->first(); !it->done(); it->next())
|
||||||
|
{
|
||||||
|
state_explicit_string* se = it->current_state();
|
||||||
|
std::cout << se->label() << std::endl;
|
||||||
|
se->destroy();
|
||||||
|
}
|
||||||
|
delete it;
|
||||||
|
|
||||||
|
delete tgba;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
create_tgba_explicit_number(bdd_dict* d)
|
||||||
|
{
|
||||||
|
tgba_explicit<state_explicit_number>* tgba =
|
||||||
|
new tgba_explicit<state_explicit_number>(d);
|
||||||
|
|
||||||
|
state_explicit_number* s1 = tgba->add_state(51);
|
||||||
|
state_explicit_number* s2 = tgba->add_state(69);
|
||||||
|
|
||||||
|
state_explicit_number::transition* t =
|
||||||
|
tgba->create_transition(s1, s2);
|
||||||
|
(void) t;
|
||||||
|
|
||||||
|
tgba_explicit_succ_iterator<state_explicit_number>* it =
|
||||||
|
tgba->succ_iter(tgba->get_init_state());
|
||||||
|
for (it->first(); !it->done(); it->next())
|
||||||
|
{
|
||||||
|
state_explicit_number* s = it->current_state();
|
||||||
|
std::cout << s->label() << std::endl;
|
||||||
|
s->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete it;
|
||||||
|
delete tgba;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
create_tgba_explicit_formula(bdd_dict* d, spot::ltl::default_environment& e)
|
||||||
|
{
|
||||||
|
tgba_explicit<state_explicit_formula>* tgba =
|
||||||
|
new tgba_explicit<state_explicit_formula>(d);
|
||||||
|
|
||||||
|
state_explicit_formula* s1 = tgba->add_state(e.require("a"));
|
||||||
|
state_explicit_formula* s2 = tgba->add_state(e.require("b"));
|
||||||
|
|
||||||
|
state_explicit_formula::transition* t =
|
||||||
|
tgba->create_transition(s1, s2);
|
||||||
|
(void) t;
|
||||||
|
|
||||||
|
tgba_explicit_succ_iterator<state_explicit_formula>* it =
|
||||||
|
tgba->succ_iter(tgba->get_init_state());
|
||||||
|
for (it->first(); !it->done(); it->next())
|
||||||
|
{
|
||||||
|
state_explicit_formula* s = it->current_state();
|
||||||
|
std::cout << s->label() << std::endl;
|
||||||
|
s->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete it;
|
||||||
|
delete tgba;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
|
|
||||||
|
bdd_dict* d = new spot::bdd_dict();
|
||||||
|
spot::ltl::default_environment& e =
|
||||||
|
spot::ltl::default_environment::instance();
|
||||||
|
|
||||||
|
create_tgba_explicit_string(d);
|
||||||
|
create_tgba_explicit_number(d);
|
||||||
|
create_tgba_explicit_formula(d, e);
|
||||||
|
|
||||||
|
delete d;
|
||||||
|
assert(spot::ltl::atomic_prop::instance_count() == 0);
|
||||||
|
assert(spot::ltl::unop::instance_count() == 0);
|
||||||
|
assert(spot::ltl::binop::instance_count() == 0);
|
||||||
|
assert(spot::ltl::multop::instance_count() == 0);
|
||||||
|
}
|
||||||
|
|
@ -49,11 +49,11 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||||
spot::tgba_parse_error_list pel1;
|
spot::tgba_parse_error_list pel1;
|
||||||
spot::tgba_explicit* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
|
spot::tgba_explicit_string* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
|
||||||
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel1))
|
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel1))
|
||||||
return 2;
|
return 2;
|
||||||
spot::tgba_parse_error_list pel2;
|
spot::tgba_parse_error_list pel2;
|
||||||
spot::tgba_explicit* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
|
spot::tgba_explicit_string* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
|
||||||
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
|
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1058,7 +1058,7 @@ main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const spot::tgba_explicit* expl = 0;
|
const spot::tgba_explicit_string* expl = 0;
|
||||||
switch (dupexp)
|
switch (dupexp)
|
||||||
{
|
{
|
||||||
case NoneDup:
|
case NoneDup:
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ main(int argc, char** argv)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
spot::tgba_parse_error_list pel2;
|
spot::tgba_parse_error_list pel2;
|
||||||
spot::tgba_explicit* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
|
spot::tgba_explicit_string* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
|
||||||
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
|
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,13 +50,13 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||||
spot::tgba_parse_error_list pel;
|
spot::tgba_parse_error_list pel;
|
||||||
spot::tgba_explicit* a = spot::tgba_parse(argv[1], pel, dict, env);
|
spot::tgba_explicit_string* a = spot::tgba_parse(argv[1], pel, dict, env);
|
||||||
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel))
|
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
|
||||||
#ifndef DOTTY
|
#ifndef DOTTY
|
||||||
spot::tgba_explicit* e = spot::tgba_powerset(a);
|
spot::tgba_explicit_number* e = spot::tgba_powerset(a);
|
||||||
spot::tgba_save_reachable(std::cout, e);
|
spot::tgba_save_reachable(std::cout, e);
|
||||||
delete e;
|
delete e;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,8 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||||
spot::tgba_parse_error_list pel;
|
spot::tgba_parse_error_list pel;
|
||||||
spot::tgba_explicit* a = spot::tgba_parse(argv[filename_index],
|
spot::tgba_explicit_string* a = spot::tgba_parse(argv[filename_index],
|
||||||
pel, dict, env, env, debug);
|
pel, dict, env, env, debug);
|
||||||
|
|
||||||
if (spot::format_tgba_parse_errors(std::cerr, argv[filename_index], pel))
|
if (spot::format_tgba_parse_errors(std::cerr, argv[filename_index], pel))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
|
||||||
|
|
@ -49,15 +49,15 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||||
spot::tgba_parse_error_list pel1;
|
spot::tgba_parse_error_list pel1;
|
||||||
spot::tgba_explicit* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
|
spot::tgba_explicit_string* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
|
||||||
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel1))
|
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel1))
|
||||||
return 2;
|
return 2;
|
||||||
spot::tgba_parse_error_list pel2;
|
spot::tgba_parse_error_list pel2;
|
||||||
spot::tgba_explicit* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
|
spot::tgba_explicit_string* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
|
||||||
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
|
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
|
||||||
return 2;
|
return 2;
|
||||||
spot::tgba_parse_error_list pel3;
|
spot::tgba_parse_error_list pel3;
|
||||||
spot::tgba_explicit* a3 = spot::tgba_parse(argv[3], pel3, dict, env);
|
spot::tgba_explicit_string* a3 = spot::tgba_parse(argv[3], pel3, dict, env);
|
||||||
if (spot::format_tgba_parse_errors(std::cerr, argv[3], pel3))
|
if (spot::format_tgba_parse_errors(std::cerr, argv[3], pel3))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue