rename tgba files as twa
Automatic mass renaming. * src/graphtest/tgbagraph.cc, src/tgba/acc.cc, src/tgba/acc.hh, src/tgba/bdddict.cc, src/tgba/bdddict.hh, src/tgba/bddprint.cc, src/tgba/bddprint.hh, src/tgba/formula2bdd.cc, src/tgba/formula2bdd.hh, src/tgba/fwd.hh, src/tgba/Makefile.am, src/tgba/taatgba.cc, src/tgba/taatgba.hh, src/tgba/tgba.cc, src/tgba/tgbagraph.cc, src/tgba/tgbagraph.hh, src/tgba/tgba.hh, src/tgba/tgbamask.cc, src/tgba/tgbamask.hh, src/tgba/tgbaproduct.cc, src/tgba/tgbaproduct.hh, src/tgba/tgbaproxy.cc, src/tgba/tgbaproxy.hh, src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh, src/tgba/.cvsignore: Rename as... * src/graphtest/twagraph.cc, src/twa/acc.cc, src/twa/acc.hh, src/twa/bdddict.cc, src/twa/bdddict.hh, src/twa/bddprint.cc, src/twa/bddprint.hh, src/twa/formula2bdd.cc, src/twa/formula2bdd.hh, src/twa/fwd.hh, src/twa/Makefile.am, src/twa/taatgba.cc, src/twa/taatgba.hh, src/twa/twa.cc, src/twa/twagraph.cc, src/twa/twagraph.hh, src/twa/twa.hh, src/twa/twamask.cc, src/twa/twamask.hh, src/twa/twaproduct.cc, src/twa/twaproduct.hh, src/twa/twaproxy.cc, src/twa/twaproxy.hh, src/twa/twasafracomplement.cc, src/twa/twasafracomplement.hh, src/twa/.cvsignore: ... these. * README, bench/stutter/stutter_invariance_randomgraph.cc, configure.ac, iface/ltsmin/modelcheck.cc, src/Makefile.am, src/bin/common_aoutput.cc, src/bin/common_conv.hh, src/bin/common_trans.hh, src/bin/dstar2tgba.cc, src/bin/ltl2tgta.cc, src/bin/randaut.cc, src/dstarparse/dra2ba.cc, src/dstarparse/public.hh, src/graphtest/Makefile.am, src/graphtest/ngraph.cc, src/hoaparse/hoaparse.yy, src/hoaparse/public.hh, src/kripke/fairkripke.hh, src/kripke/kripkeexplicit.cc, src/kripke/kripkeprint.cc, src/kripkeparse/kripkeparse.yy, src/ltlvisit/apcollect.cc, src/ltlvisit/apcollect.hh, src/ltlvisit/exclusive.hh, src/ltlvisit/simplify.cc, src/ltlvisit/simplify.hh, src/priv/accmap.hh, src/ta/ta.hh, src/ta/taexplicit.cc, src/ta/taexplicit.hh, src/ta/tgta.hh, src/ta/tgtaexplicit.cc, src/ta/tgtaexplicit.hh, src/ta/tgtaproduct.hh, src/taalgos/dotty.cc, src/taalgos/emptinessta.cc, src/taalgos/minimize.cc, src/taalgos/tgba2ta.cc, src/taalgos/tgba2ta.hh, src/tgbaalgos/are_isomorphic.cc, src/tgbaalgos/are_isomorphic.hh, src/tgbaalgos/bfssteps.cc, src/tgbaalgos/canonicalize.cc, src/tgbaalgos/canonicalize.hh, src/tgbaalgos/cleanacc.hh, src/tgbaalgos/complete.hh, src/tgbaalgos/compsusp.cc, src/tgbaalgos/compsusp.hh, src/tgbaalgos/degen.cc, src/tgbaalgos/degen.hh, src/tgbaalgos/dotty.cc, src/tgbaalgos/dotty.hh, src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtbasat.hh, src/tgbaalgos/dtgbacomp.hh, src/tgbaalgos/dtgbasat.cc, src/tgbaalgos/dtgbasat.hh, src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh, src/tgbaalgos/emptiness.cc, src/tgbaalgos/emptiness.hh, src/tgbaalgos/gtec/sccstack.hh, src/tgbaalgos/gtec/status.hh, src/tgbaalgos/gv04.cc, src/tgbaalgos/gv04.hh, src/tgbaalgos/hoa.cc, src/tgbaalgos/hoa.hh, src/tgbaalgos/isdet.hh, src/tgbaalgos/lbtt.cc, src/tgbaalgos/lbtt.hh, src/tgbaalgos/ltl2taa.hh, src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/magic.cc, src/tgbaalgos/magic.hh, src/tgbaalgos/mask.hh, src/tgbaalgos/minimize.hh, src/tgbaalgos/ndfs_result.hxx, src/tgbaalgos/neverclaim.cc, src/tgbaalgos/neverclaim.hh, src/tgbaalgos/postproc.hh, src/tgbaalgos/powerset.cc, src/tgbaalgos/powerset.hh, src/tgbaalgos/product.cc, src/tgbaalgos/product.hh, src/tgbaalgos/projrun.cc, src/tgbaalgos/projrun.hh, src/tgbaalgos/randomgraph.cc, src/tgbaalgos/randomgraph.hh, src/tgbaalgos/randomize.hh, src/tgbaalgos/reachiter.hh, src/tgbaalgos/reducerun.cc, src/tgbaalgos/reducerun.hh, src/tgbaalgos/relabel.hh, src/tgbaalgos/remfin.hh, src/tgbaalgos/remprop.hh, src/tgbaalgos/replayrun.cc, src/tgbaalgos/replayrun.hh, src/tgbaalgos/sbacc.hh, src/tgbaalgos/scc.cc, src/tgbaalgos/scc.hh, src/tgbaalgos/sccfilter.hh, src/tgbaalgos/sccinfo.cc, src/tgbaalgos/sccinfo.hh, src/tgbaalgos/se05.cc, src/tgbaalgos/se05.hh, src/tgbaalgos/simulation.cc, src/tgbaalgos/simulation.hh, src/tgbaalgos/stats.cc, src/tgbaalgos/stats.hh, src/tgbaalgos/stripacc.hh, src/tgbaalgos/stutter.cc, src/tgbaalgos/stutter.hh, src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03.hh, src/tgbaalgos/tau03opt.cc, src/tgbaalgos/tau03opt.hh, src/tgbaalgos/totgba.cc, src/tgbaalgos/totgba.hh, src/tgbaalgos/weight.hh, src/tgbaalgos/word.cc, src/tgbatest/acc.cc, src/tgbatest/complementation.cc, src/tgbatest/emptchk.cc, src/tgbatest/ltl2tgba.cc, src/tgbatest/taatgba.cc, wrap/python/spot_impl.i: Adjust.
This commit is contained in:
parent
8839f50a0f
commit
703fbd0e99
154 changed files with 232 additions and 231 deletions
|
|
@ -1,445 +0,0 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2009, 2011, 2012, 2014, 2015 Laboratoire de Recherche et
|
||||
// Développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de
|
||||
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
// Université Pierre et Marie Curie.
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
// Spot is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "tgbaproduct.hh"
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include "misc/hashfunc.hh"
|
||||
#include "kripke/kripke.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// state_product
|
||||
|
||||
state_product::~state_product()
|
||||
{
|
||||
left_->destroy();
|
||||
right_->destroy();
|
||||
}
|
||||
|
||||
void
|
||||
state_product::destroy() const
|
||||
{
|
||||
if (--count_)
|
||||
return;
|
||||
fixed_size_pool* p = pool_;
|
||||
this->~state_product();
|
||||
p->deallocate(this);
|
||||
}
|
||||
|
||||
int
|
||||
state_product::compare(const state* other) const
|
||||
{
|
||||
const state_product* o = down_cast<const state_product*>(other);
|
||||
assert(o);
|
||||
int res = left_->compare(o->left());
|
||||
if (res != 0)
|
||||
return res;
|
||||
return right_->compare(o->right());
|
||||
}
|
||||
|
||||
size_t
|
||||
state_product::hash() const
|
||||
{
|
||||
// We assume that size_t is 32-bit wide.
|
||||
return wang32_hash(left_->hash()) ^ wang32_hash(right_->hash());
|
||||
}
|
||||
|
||||
state_product*
|
||||
state_product::clone() const
|
||||
{
|
||||
++count_;
|
||||
return const_cast<state_product*>(this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// twa_succ_iterator_product
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class twa_succ_iterator_product_common: public twa_succ_iterator
|
||||
{
|
||||
public:
|
||||
twa_succ_iterator_product_common(twa_succ_iterator* left,
|
||||
twa_succ_iterator* right,
|
||||
const twa_product* prod,
|
||||
fixed_size_pool* pool)
|
||||
: left_(left), right_(right), prod_(prod), pool_(pool)
|
||||
{
|
||||
}
|
||||
|
||||
void recycle(const const_twa_ptr& l, twa_succ_iterator* left,
|
||||
const_twa_ptr r, twa_succ_iterator* right)
|
||||
{
|
||||
l->release_iter(left_);
|
||||
left_ = left;
|
||||
r->release_iter(right_);
|
||||
right_ = right;
|
||||
}
|
||||
|
||||
virtual ~twa_succ_iterator_product_common()
|
||||
{
|
||||
delete left_;
|
||||
delete right_;
|
||||
}
|
||||
|
||||
virtual bool next_non_false_() = 0;
|
||||
|
||||
bool first()
|
||||
{
|
||||
if (!right_)
|
||||
return false;
|
||||
|
||||
// If one of the two successor sets is empty initially, we
|
||||
// reset right_, so that done() can detect this situation
|
||||
// easily. (We choose to reset right_ because this variable
|
||||
// is already used by done().)
|
||||
if (!(left_->first() && right_->first()))
|
||||
{
|
||||
delete right_;
|
||||
right_ = 0;
|
||||
return false;
|
||||
}
|
||||
return next_non_false_();
|
||||
}
|
||||
|
||||
bool done() const
|
||||
{
|
||||
return !right_ || right_->done();
|
||||
}
|
||||
|
||||
state_product* current_state() const
|
||||
{
|
||||
return new(pool_->allocate()) state_product(left_->current_state(),
|
||||
right_->current_state(),
|
||||
pool_);
|
||||
}
|
||||
|
||||
protected:
|
||||
twa_succ_iterator* left_;
|
||||
twa_succ_iterator* right_;
|
||||
const twa_product* prod_;
|
||||
fixed_size_pool* pool_;
|
||||
friend class spot::twa_product;
|
||||
};
|
||||
|
||||
|
||||
/// \brief Iterate over the successors of a product computed on the fly.
|
||||
class twa_succ_iterator_product: public twa_succ_iterator_product_common
|
||||
{
|
||||
public:
|
||||
twa_succ_iterator_product(twa_succ_iterator* left,
|
||||
twa_succ_iterator* right,
|
||||
const twa_product* prod,
|
||||
fixed_size_pool* pool)
|
||||
: twa_succ_iterator_product_common(left, right, prod, pool)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~twa_succ_iterator_product()
|
||||
{
|
||||
}
|
||||
|
||||
bool step_()
|
||||
{
|
||||
if (left_->next())
|
||||
return true;
|
||||
left_->first();
|
||||
return right_->next();
|
||||
}
|
||||
|
||||
bool next_non_false_()
|
||||
{
|
||||
assert(!done());
|
||||
do
|
||||
{
|
||||
bdd l = left_->current_condition();
|
||||
bdd r = right_->current_condition();
|
||||
bdd current_cond = l & r;
|
||||
|
||||
if (current_cond != bddfalse)
|
||||
{
|
||||
current_cond_ = current_cond;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
while (step_());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool next()
|
||||
{
|
||||
if (step_())
|
||||
return next_non_false_();
|
||||
return false;
|
||||
}
|
||||
|
||||
bdd current_condition() const
|
||||
{
|
||||
return current_cond_;
|
||||
}
|
||||
|
||||
acc_cond::mark_t current_acceptance_conditions() const
|
||||
{
|
||||
return
|
||||
prod_->acc().join(prod_->left_acc(),
|
||||
left_->current_acceptance_conditions(),
|
||||
prod_->right_acc(),
|
||||
right_->current_acceptance_conditions());
|
||||
}
|
||||
|
||||
protected:
|
||||
bdd current_cond_;
|
||||
};
|
||||
|
||||
/// Iterate over the successors of a product computed on the fly.
|
||||
/// This one assumes that LEFT is an iterator over a Kripke structure
|
||||
class twa_succ_iterator_product_kripke:
|
||||
public twa_succ_iterator_product_common
|
||||
{
|
||||
public:
|
||||
twa_succ_iterator_product_kripke(twa_succ_iterator* left,
|
||||
twa_succ_iterator* right,
|
||||
const twa_product* prod,
|
||||
fixed_size_pool* pool)
|
||||
: twa_succ_iterator_product_common(left, right, prod, pool)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~twa_succ_iterator_product_kripke()
|
||||
{
|
||||
}
|
||||
|
||||
bool next_non_false_()
|
||||
{
|
||||
// All the transitions of left_ iterator have the
|
||||
// same label, because it is a Kripke structure.
|
||||
bdd l = left_->current_condition();
|
||||
assert(!right_->done());
|
||||
do
|
||||
{
|
||||
bdd r = right_->current_condition();
|
||||
bdd current_cond = l & r;
|
||||
|
||||
if (current_cond != bddfalse)
|
||||
{
|
||||
current_cond_ = current_cond;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
while (right_->next());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool next()
|
||||
{
|
||||
if (left_->next())
|
||||
return true;
|
||||
left_->first();
|
||||
if (right_->next())
|
||||
return next_non_false_();
|
||||
return false;
|
||||
}
|
||||
|
||||
bdd current_condition() const
|
||||
{
|
||||
return current_cond_;
|
||||
}
|
||||
|
||||
acc_cond::mark_t current_acceptance_conditions() const
|
||||
{
|
||||
return right_->current_acceptance_conditions();
|
||||
}
|
||||
|
||||
protected:
|
||||
bdd current_cond_;
|
||||
};
|
||||
|
||||
} // anonymous
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// twa_product
|
||||
|
||||
twa_product::twa_product(const const_twa_ptr& left,
|
||||
const const_twa_ptr& right)
|
||||
: twa(left->get_dict()), left_(left), right_(right),
|
||||
pool_(sizeof(state_product))
|
||||
{
|
||||
assert(get_dict() == right_->get_dict());
|
||||
|
||||
// If one of the side is a Kripke structure, it is easier to deal
|
||||
// with (we don't have to fix the acceptance conditions, and
|
||||
// computing the successors can be improved a bit).
|
||||
if (dynamic_cast<const kripke*>(left_.get()))
|
||||
{
|
||||
left_kripke_ = true;
|
||||
}
|
||||
else if (dynamic_cast<const kripke*>(right_.get()))
|
||||
{
|
||||
std::swap(left_, right_);
|
||||
left_kripke_ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
left_kripke_ = false;
|
||||
}
|
||||
|
||||
auto d = get_dict();
|
||||
d->register_all_propositions_of(&left_, this);
|
||||
d->register_all_propositions_of(&right_, this);
|
||||
|
||||
assert(acc_.num_sets() == 0);
|
||||
auto left_num = left->acc().num_sets();
|
||||
auto right_acc = right->get_acceptance();
|
||||
right_acc.shift_left(left_num);
|
||||
right_acc.append_and(left->get_acceptance());
|
||||
set_acceptance(left_num + right->acc().num_sets(), right_acc);
|
||||
}
|
||||
|
||||
twa_product::~twa_product()
|
||||
{
|
||||
get_dict()->unregister_all_my_variables(this);
|
||||
// Prevent these states from being destroyed by ~tgba(): they
|
||||
// will be destroyed before when the pool is destructed.
|
||||
if (last_support_conditions_input_)
|
||||
{
|
||||
last_support_conditions_input_->destroy();
|
||||
last_support_conditions_input_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
state*
|
||||
twa_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(),
|
||||
right_->get_init_state(), p);
|
||||
}
|
||||
|
||||
twa_succ_iterator*
|
||||
twa_product::succ_iter(const state* state) const
|
||||
{
|
||||
const state_product* s = down_cast<const state_product*>(state);
|
||||
assert(s);
|
||||
twa_succ_iterator* li = left_->succ_iter(s->left());
|
||||
twa_succ_iterator* ri = right_->succ_iter(s->right());
|
||||
|
||||
if (iter_cache_)
|
||||
{
|
||||
twa_succ_iterator_product_common* it =
|
||||
down_cast<twa_succ_iterator_product_common*>(iter_cache_);
|
||||
it->recycle(left_, li, right_, ri);
|
||||
iter_cache_ = nullptr;
|
||||
return it;
|
||||
}
|
||||
|
||||
fixed_size_pool* p = const_cast<fixed_size_pool*>(&pool_);
|
||||
if (left_kripke_)
|
||||
return new twa_succ_iterator_product_kripke(li, ri, this, p);
|
||||
else
|
||||
return new twa_succ_iterator_product(li, ri, this, p);
|
||||
}
|
||||
|
||||
bdd
|
||||
twa_product::compute_support_conditions(const state* in) const
|
||||
{
|
||||
const state_product* s = down_cast<const state_product*>(in);
|
||||
assert(s);
|
||||
bdd lsc = left_->support_conditions(s->left());
|
||||
bdd rsc = right_->support_conditions(s->right());
|
||||
return lsc & rsc;
|
||||
}
|
||||
|
||||
const acc_cond& twa_product::left_acc() const
|
||||
{
|
||||
return left_->acc();
|
||||
}
|
||||
|
||||
const acc_cond& twa_product::right_acc() const
|
||||
{
|
||||
return right_->acc();
|
||||
}
|
||||
|
||||
std::string
|
||||
twa_product::format_state(const state* state) const
|
||||
{
|
||||
const state_product* s = down_cast<const state_product*>(state);
|
||||
assert(s);
|
||||
return (left_->format_state(s->left())
|
||||
+ " * "
|
||||
+ right_->format_state(s->right()));
|
||||
}
|
||||
|
||||
state*
|
||||
twa_product::project_state(const state* s, const const_twa_ptr& t) const
|
||||
{
|
||||
const state_product* s2 = down_cast<const state_product*>(s);
|
||||
assert(s2);
|
||||
if (t.get() == this)
|
||||
return s2->clone();
|
||||
state* res = left_->project_state(s2->left(), t);
|
||||
if (res)
|
||||
return res;
|
||||
return right_->project_state(s2->right(), t);
|
||||
}
|
||||
|
||||
std::string
|
||||
twa_product::transition_annotation(const twa_succ_iterator* t) const
|
||||
{
|
||||
const twa_succ_iterator_product_common* i =
|
||||
down_cast<const twa_succ_iterator_product_common*>(t);
|
||||
assert(i);
|
||||
std::string left = left_->transition_annotation(i->left_);
|
||||
std::string right = right_->transition_annotation(i->right_);
|
||||
if (left == "")
|
||||
return right;
|
||||
if (right == "")
|
||||
return left;
|
||||
return "<" + left + ", " + right + ">";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// twa_product_init
|
||||
|
||||
twa_product_init::twa_product_init(const const_twa_ptr& left,
|
||||
const const_twa_ptr& right,
|
||||
const state* left_init,
|
||||
const state* right_init)
|
||||
: twa_product(left, right),
|
||||
left_init_(left_init), right_init_(right_init)
|
||||
{
|
||||
if (left_ != left)
|
||||
std::swap(left_init_, right_init_);
|
||||
}
|
||||
|
||||
state*
|
||||
twa_product_init::get_init_state() const
|
||||
{
|
||||
fixed_size_pool* p = const_cast<fixed_size_pool*>(&pool_);
|
||||
return new(p->allocate()) state_product(left_init_->clone(),
|
||||
right_init_->clone(), p);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue