Start the ELTL translation (LACIM).
Merge all eltlast/ files into formula.hh (except automatop.hh).
This commit is contained in:
parent
862302590c
commit
8c0d1003b0
55 changed files with 2000 additions and 422 deletions
|
|
@ -25,7 +25,6 @@
|
|||
#include <ltlvisit/clone.hh>
|
||||
#include <ltlvisit/destroy.hh>
|
||||
#include <ltlvisit/tostring.hh>
|
||||
#include <ltlvisit/tostring.hh>
|
||||
#include <ltlenv/defaultenv.hh>
|
||||
#include "bdddict.hh"
|
||||
|
||||
|
|
@ -47,7 +46,8 @@ namespace spot
|
|||
}
|
||||
|
||||
int
|
||||
bdd_dict::register_proposition(const ltl::formula* f, const void* for_me)
|
||||
bdd_dict::register_proposition(const internal::base_formula* f,
|
||||
const void* for_me)
|
||||
{
|
||||
int num;
|
||||
// Do not build a variable that already exists.
|
||||
|
|
@ -58,7 +58,7 @@ namespace spot
|
|||
}
|
||||
else
|
||||
{
|
||||
f = clone(f);
|
||||
f = f->clone();
|
||||
num = allocate_variables(1);
|
||||
var_map[f] = num;
|
||||
var_formula_map[num] = f;
|
||||
|
|
@ -82,7 +82,8 @@ namespace spot
|
|||
}
|
||||
|
||||
int
|
||||
bdd_dict::register_state(const ltl::formula* f, const void* for_me)
|
||||
bdd_dict::register_state(const internal::base_formula* f,
|
||||
const void* for_me)
|
||||
{
|
||||
int num;
|
||||
// Do not build a state that already exists.
|
||||
|
|
@ -93,7 +94,7 @@ namespace spot
|
|||
}
|
||||
else
|
||||
{
|
||||
f = ltl::clone(f);
|
||||
f = f->clone();
|
||||
num = allocate_variables(2);
|
||||
now_map[f] = num;
|
||||
now_formula_map[num] = f;
|
||||
|
|
@ -107,8 +108,8 @@ namespace spot
|
|||
}
|
||||
|
||||
int
|
||||
bdd_dict::register_acceptance_variable(const ltl::formula* f,
|
||||
const void* for_me)
|
||||
bdd_dict::register_acceptance_variable(const internal::base_formula* f,
|
||||
const void* for_me)
|
||||
{
|
||||
int num;
|
||||
// Do not build an acceptance variable that already exists.
|
||||
|
|
@ -119,7 +120,7 @@ namespace spot
|
|||
}
|
||||
else
|
||||
{
|
||||
f = clone(f);
|
||||
f = f->clone();
|
||||
num = allocate_variables(1);
|
||||
acc_map[f] = num;
|
||||
acc_formula_map[num] = f;
|
||||
|
|
@ -150,13 +151,14 @@ namespace spot
|
|||
assert(i != acc_formula_map.end());
|
||||
std::ostringstream s;
|
||||
// FIXME: We could be smarter and reuse unused "$n" numbers.
|
||||
s << ltl::to_string(i->second) << "$"
|
||||
s << i->second->to_string()
|
||||
<< "$"
|
||||
<< ++clone_counts[var];
|
||||
ltl::formula* f =
|
||||
internal::base_formula* f =
|
||||
ltl::atomic_prop::instance(s.str(),
|
||||
ltl::default_environment::instance());
|
||||
int res = register_acceptance_variable(f, for_me);
|
||||
ltl::destroy(f);
|
||||
f->destroy();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +235,7 @@ namespace spot
|
|||
// Let's free it. First, we need to find
|
||||
// if this is a Now, a Var, or an Acc variable.
|
||||
int n = 1;
|
||||
const ltl::formula* f = 0;
|
||||
const internal::base_formula* f = 0;
|
||||
vf_map::iterator vi = var_formula_map.find(var);
|
||||
if (vi != var_formula_map.end())
|
||||
{
|
||||
|
|
@ -278,7 +280,7 @@ namespace spot
|
|||
// formula itself.
|
||||
release_variables(var, n);
|
||||
if (f)
|
||||
ltl::destroy(f);
|
||||
f->destroy();
|
||||
var_refs.erase(cur);
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +299,8 @@ namespace spot
|
|||
}
|
||||
|
||||
bool
|
||||
bdd_dict::is_registered_proposition(const ltl::formula* f, const void* by_me)
|
||||
bdd_dict::is_registered_proposition(const internal::base_formula* f,
|
||||
const void* by_me)
|
||||
{
|
||||
fv_map::iterator fi = var_map.find(f);
|
||||
if (fi == var_map.end())
|
||||
|
|
@ -307,7 +310,8 @@ namespace spot
|
|||
}
|
||||
|
||||
bool
|
||||
bdd_dict::is_registered_state(const ltl::formula* f, const void* by_me)
|
||||
bdd_dict::is_registered_state(const internal::base_formula* f,
|
||||
const void* by_me)
|
||||
{
|
||||
fv_map::iterator fi = now_map.find(f);
|
||||
if (fi == now_map.end())
|
||||
|
|
@ -317,7 +321,7 @@ namespace spot
|
|||
}
|
||||
|
||||
bool
|
||||
bdd_dict::is_registered_acceptance_variable(const ltl::formula* f,
|
||||
bdd_dict::is_registered_acceptance_variable(const internal::base_formula* f,
|
||||
const void* by_me)
|
||||
{
|
||||
fv_map::iterator fi = acc_map.find(f);
|
||||
|
|
@ -336,23 +340,23 @@ namespace spot
|
|||
{
|
||||
os << " " << fi->second << " (x"
|
||||
<< var_refs.find(fi->second)->second.size() << "): ";
|
||||
to_string(fi->first, os) << std::endl;
|
||||
fi->first->to_string(os) << std::endl;
|
||||
}
|
||||
os << "States:" << std::endl;
|
||||
for (fi = now_map.begin(); fi != now_map.end(); ++fi)
|
||||
{
|
||||
int refs = var_refs.find(fi->second)->second.size();
|
||||
os << " " << fi->second << " (x" << refs << "): Now[";
|
||||
to_string(fi->first, os) << "]" << std::endl;
|
||||
fi->first->to_string(os) << "]" << std::endl;
|
||||
os << " " << fi->second + 1 << " (x" << refs << "): Next[";
|
||||
to_string(fi->first, os) << "]" << std::endl;
|
||||
fi->first->to_string(os) << "]" << std::endl;
|
||||
}
|
||||
os << "Acceptance Conditions:" << std::endl;
|
||||
for (fi = acc_map.begin(); fi != acc_map.end(); ++fi)
|
||||
{
|
||||
os << " " << fi->second << " (x"
|
||||
<< var_refs.find(fi->second)->second.size() << "): Acc[";
|
||||
to_string(fi->first, os) << "]" << std::endl;
|
||||
fi->first->to_string(os) << "]" << std::endl;
|
||||
}
|
||||
os << "Ref counts:" << std::endl;
|
||||
vr_map::const_iterator ri;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// 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.
|
||||
// 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.
|
||||
//
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
#include <map>
|
||||
#include <iosfwd>
|
||||
#include <bdd.h>
|
||||
#include "ltlast/formula.hh"
|
||||
#include "internal/baseformula.hh"
|
||||
#include "misc/bddalloc.hh"
|
||||
|
||||
namespace spot
|
||||
|
|
@ -43,9 +43,9 @@ namespace spot
|
|||
~bdd_dict();
|
||||
|
||||
/// Formula-to-BDD-variable maps.
|
||||
typedef std::map<const ltl::formula*, int> fv_map;
|
||||
typedef std::map<const internal::base_formula*, int> fv_map;
|
||||
/// BDD-variable-to-formula maps.
|
||||
typedef std::map<int, const ltl::formula*> vf_map;
|
||||
typedef std::map<int, const internal::base_formula*> vf_map;
|
||||
|
||||
fv_map now_map; ///< Maps formulae to "Now" BDD variables
|
||||
vf_map now_formula_map; ///< Maps "Now" BDD variables to formulae
|
||||
|
|
@ -77,7 +77,8 @@ namespace spot
|
|||
///
|
||||
/// \return The variable number. Use bdd_ithvar() or bdd_nithvar()
|
||||
/// to convert this to a BDD.
|
||||
int register_proposition(const ltl::formula* f, const void* for_me);
|
||||
int
|
||||
register_proposition(const internal::base_formula* f, const void* for_me);
|
||||
|
||||
/// \brief Register BDD variables as atomic propositions.
|
||||
///
|
||||
|
|
@ -99,7 +100,7 @@ namespace spot
|
|||
/// \return The first variable number. Add one to get the second
|
||||
/// variable. Use bdd_ithvar() or bdd_nithvar() to convert this
|
||||
/// to a BDD.
|
||||
int register_state(const ltl::formula* f, const void* for_me);
|
||||
int register_state(const internal::base_formula* f, const void* for_me);
|
||||
|
||||
/// \brief Register an atomic proposition.
|
||||
///
|
||||
|
|
@ -111,7 +112,8 @@ namespace spot
|
|||
///
|
||||
/// \return The variable number. Use bdd_ithvar() or bdd_nithvar()
|
||||
/// to convert this to a BDD.
|
||||
int register_acceptance_variable(const ltl::formula* f, const void* for_me);
|
||||
int register_acceptance_variable(const internal::base_formula* f,
|
||||
const void* for_me);
|
||||
|
||||
/// \brief Clone an acceptance variable VAR for FOR_ME.
|
||||
///
|
||||
|
|
@ -156,9 +158,12 @@ namespace spot
|
|||
|
||||
/// @{
|
||||
/// Check whether formula \a f has already been registered by \a by_me.
|
||||
bool is_registered_proposition(const ltl::formula* f, const void* by_me);
|
||||
bool is_registered_state(const ltl::formula* f, const void* by_me);
|
||||
bool is_registered_acceptance_variable(const ltl::formula* f,
|
||||
bool is_registered_proposition(const internal::base_formula* f,
|
||||
const void* by_me);
|
||||
|
||||
bool is_registered_state(const internal::base_formula* f,
|
||||
const void* by_me);
|
||||
bool is_registered_acceptance_variable(const internal::base_formula* f,
|
||||
const void* by_me);
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@
|
|||
#include <cassert>
|
||||
#include <ostream>
|
||||
#include "bddprint.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "formula2bdd.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -42,7 +40,7 @@ namespace spot
|
|||
bdd_dict::vf_map::const_iterator isi =
|
||||
dict->var_formula_map.find(var);
|
||||
if (isi != dict->var_formula_map.end())
|
||||
to_string(isi->second, o);
|
||||
isi->second->to_string(o);
|
||||
else
|
||||
{
|
||||
isi = dict->acc_formula_map.find(var);
|
||||
|
|
@ -51,12 +49,12 @@ namespace spot
|
|||
if (want_acc)
|
||||
{
|
||||
o << "Acc[";
|
||||
to_string(isi->second, o) << "]";
|
||||
isi->second->to_string(o) << "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
o << "\"";
|
||||
to_string(isi->second, o) << "\"";
|
||||
isi->second->to_string(o) << "\"";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -64,14 +62,14 @@ namespace spot
|
|||
isi = dict->now_formula_map.find(var);
|
||||
if (isi != dict->now_formula_map.end())
|
||||
{
|
||||
o << "Now["; to_string(isi->second, o) << "]";
|
||||
o << "Now["; isi->second->to_string(o) << "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
isi = dict->now_formula_map.find(var - 1);
|
||||
if (isi != dict->now_formula_map.end())
|
||||
{
|
||||
o << "Next["; to_string(isi->second, o) << "]";
|
||||
o << "Next["; isi->second->to_string(o) << "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ namespace spot
|
|||
int var = bdd_var(b);
|
||||
bdd_dict::vf_map::const_iterator isi = d->var_formula_map.find(var);
|
||||
assert(isi != d->var_formula_map.end());
|
||||
formula* res = clone(isi->second);
|
||||
formula* res = clone(dynamic_cast<const ltl::formula*>(isi->second));
|
||||
|
||||
bdd high = bdd_high(b);
|
||||
if (high == bddfalse)
|
||||
|
|
|
|||
|
|
@ -19,9 +19,8 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "ltlvisit/clone.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
#include "tgbabddconcretefactory.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
tgba_bdd_concrete_factory::tgba_bdd_concrete_factory(bdd_dict* dict)
|
||||
|
|
@ -33,12 +32,12 @@ namespace spot
|
|||
{
|
||||
acc_map_::iterator ai;
|
||||
for (ai = acc_.begin(); ai != acc_.end(); ++ai)
|
||||
destroy(ai->first);
|
||||
ai->first->destroy();
|
||||
get_dict()->unregister_all_my_variables(this);
|
||||
}
|
||||
|
||||
int
|
||||
tgba_bdd_concrete_factory::create_state(const ltl::formula* f)
|
||||
tgba_bdd_concrete_factory::create_state(const internal::base_formula* f)
|
||||
{
|
||||
int num = get_dict()->register_state(f, this);
|
||||
// Keep track of all "Now" variables for easy
|
||||
|
|
@ -48,7 +47,7 @@ namespace spot
|
|||
}
|
||||
|
||||
int
|
||||
tgba_bdd_concrete_factory::create_atomic_prop(const ltl::formula* f)
|
||||
tgba_bdd_concrete_factory::create_atomic_prop(const internal::base_formula* f)
|
||||
{
|
||||
int num = get_dict()->register_proposition(f, this);
|
||||
// Keep track of all atomic proposition for easy
|
||||
|
|
@ -58,8 +57,9 @@ namespace spot
|
|||
}
|
||||
|
||||
void
|
||||
tgba_bdd_concrete_factory::declare_acceptance_condition(bdd b,
|
||||
const ltl::formula* a)
|
||||
tgba_bdd_concrete_factory::declare_acceptance_condition(
|
||||
bdd b,
|
||||
const internal::base_formula* a)
|
||||
{
|
||||
// Maintain a conjunction of BDDs associated to A. We will latter
|
||||
// (in tgba_bdd_concrete_factory::finish()) associate this
|
||||
|
|
@ -67,7 +67,7 @@ namespace spot
|
|||
acc_map_::iterator ai = acc_.find(a);
|
||||
if (ai == acc_.end())
|
||||
{
|
||||
a = clone(a);
|
||||
a = a->clone();
|
||||
acc_[a] = b;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
# define SPOT_TGBA_TGBABDDCONCRETEFACTORY_HH
|
||||
|
||||
#include "misc/hash.hh"
|
||||
#include "ltlast/formula.hh"
|
||||
#include "internal/baseformula.hh"
|
||||
#include "tgbabddfactory.hh"
|
||||
|
||||
namespace spot
|
||||
|
|
@ -45,7 +45,7 @@ namespace spot
|
|||
/// The state variables are not created if they already exist.
|
||||
/// Instead their existing variable numbers are returned.
|
||||
/// Variable numbers can be turned into BDD using ithvar().
|
||||
int create_state(const ltl::formula* f);
|
||||
int create_state(const internal::base_formula* f);
|
||||
|
||||
/// Create an atomic proposition variable for formula \a f.
|
||||
///
|
||||
|
|
@ -55,7 +55,7 @@ namespace spot
|
|||
/// The atomic proposition is not created if it already exists.
|
||||
/// Instead its existing variable number is returned. Variable numbers
|
||||
/// can be turned into BDD using ithvar().
|
||||
int create_atomic_prop(const ltl::formula* f);
|
||||
int create_atomic_prop(const internal::base_formula* f);
|
||||
|
||||
/// Declare an acceptance condition.
|
||||
///
|
||||
|
|
@ -68,7 +68,7 @@ namespace spot
|
|||
/// \param b a BDD indicating which variables are in the
|
||||
/// acceptance set
|
||||
/// \param a the formula associated
|
||||
void declare_acceptance_condition(bdd b, const ltl::formula* a);
|
||||
void declare_acceptance_condition(bdd b, const internal::base_formula* a);
|
||||
|
||||
const tgba_bdd_core_data& get_core_data() const;
|
||||
bdd_dict* get_dict() const;
|
||||
|
|
@ -86,8 +86,8 @@ namespace spot
|
|||
private:
|
||||
tgba_bdd_core_data data_; ///< Core data for the new automata.
|
||||
|
||||
typedef Sgi::hash_map<const ltl::formula*, bdd,
|
||||
ltl::formula_ptr_hash> acc_map_;
|
||||
typedef Sgi::hash_map<const internal::base_formula*, bdd,
|
||||
internal::formula_ptr_hash> acc_map_;
|
||||
acc_map_ acc_; ///< BDD associated to each acceptance condition
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2003, 2004, 2005, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
// Copyright (C) 2003, 2004, 2005, 2008 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.
|
||||
//
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
#include "tgbatba.hh"
|
||||
#include "bddprint.hh"
|
||||
#include "misc/hashfunc.hh"
|
||||
#include "ltlast/formula.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue