* src/tgba/bddprint.cc, src/tgba/bddprint.hh,

src/tgba/dictunion.hh, src/tgba/ltl2tgba.cc, src/tgba/ltl2tgba.hh,
src/tgba/tgbabddconcretefactory.hh,
src/tgba/tgbabddconcreteproduct.cc,
src/tgba/tgbabddconcreteproduct.hh, src/tgba/tgbabddfactory.hh,
src/tgba/tgbabddtranslatefactory.hh, src/tgbaalgos/dotty.cc:
Add Doxygen comments.
This commit is contained in:
Alexandre Duret-Lutz 2003-05-27 15:18:32 +00:00
parent ddf05b5d47
commit 4146426bfc
12 changed files with 114 additions and 31 deletions

View file

@ -1,5 +1,13 @@
2003-05-27 Alexandre Duret-Lutz <aduret@src.lip6.fr> 2003-05-27 Alexandre Duret-Lutz <aduret@src.lip6.fr>
* src/tgba/bddprint.cc, src/tgba/bddprint.hh,
src/tgba/dictunion.hh, src/tgba/ltl2tgba.cc, src/tgba/ltl2tgba.hh,
src/tgba/tgbabddconcretefactory.hh,
src/tgba/tgbabddconcreteproduct.cc,
src/tgba/tgbabddconcreteproduct.hh, src/tgba/tgbabddfactory.hh,
src/tgba/tgbabddtranslatefactory.hh, src/tgbaalgos/dotty.cc:
Add Doxygen comments.
* src/tgba/bddfactory.hh, src/tgba/statebdd.hh, * src/tgba/bddfactory.hh, src/tgba/statebdd.hh,
src/tgba/succiterconcrete.hh, src/tgba/tgbabddconcrete.hh, src/tgba/succiterconcrete.hh, src/tgba/tgbabddconcrete.hh,
src/tgba/tgbabddcoredata.hh, src/tgba/tgbabdddict.hh: Add src/tgba/tgbabddcoredata.hh, src/tgba/tgbabdddict.hh: Add

View file

@ -4,9 +4,10 @@
namespace spot namespace spot
{ {
/// Global dictionary used by print_handler() to lookup variables.
const tgba_bdd_dict* dict; const tgba_bdd_dict* dict;
/// Stream handler used by Buddy to display BDD variables.
static void static void
print_handler(std::ostream& o, int var) print_handler(std::ostream& o, int var)
{ {

View file

@ -9,13 +9,29 @@
namespace spot namespace spot
{ {
/// \brief Print a BDD as a set.
/// \param os The output stream.
/// \param dict The dictionary to use, to lookup variables.
/// \param b The BDD to print.
std::ostream& bdd_print_set(std::ostream& os, std::ostream& bdd_print_set(std::ostream& os,
const tgba_bdd_dict& dict, bdd b); const tgba_bdd_dict& dict, bdd b);
/// \brief Format a BDD as a set.
/// \param dict The dictionary to use, to lookup variables.
/// \param b The BDD to print.
/// \return The BDD formated as a string.
std::string bdd_format_set(const tgba_bdd_dict& dict, bdd b); std::string bdd_format_set(const tgba_bdd_dict& dict, bdd b);
/// \brief Print a BDD as a diagram in dotty format.
/// \param os The output stream.
/// \param dict The dictionary to use, to lookup variables.
/// \param b The BDD to print.
std::ostream& bdd_print_dot(std::ostream& os, std::ostream& bdd_print_dot(std::ostream& os,
const tgba_bdd_dict& dict, bdd b); const tgba_bdd_dict& dict, bdd b);
/// \brief Print a BDD as a table.
/// \param os The output stream.
/// \param dict The dictionary to use, to lookup variables.
/// \param b The BDD to print.
std::ostream& bdd_print_table(std::ostream& os, std::ostream& bdd_print_table(std::ostream& os,
const tgba_bdd_dict& dict, bdd b); const tgba_bdd_dict& dict, bdd b);

View file

@ -5,6 +5,7 @@
namespace spot namespace spot
{ {
/// Build the union of two dictionaries.
tgba_bdd_dict tgba_bdd_dict
tgba_bdd_dict_union(const tgba_bdd_dict& l, const tgba_bdd_dict& r); tgba_bdd_dict_union(const tgba_bdd_dict& l, const tgba_bdd_dict& r);
} }

View file

@ -3,11 +3,15 @@
#include "tgbabddconcretefactory.hh" #include "tgbabddconcretefactory.hh"
#include "ltl2tgba.hh" #include "ltl2tgba.hh"
// FIXME: Add ref to Couvreur's paper.
namespace spot namespace spot
{ {
using namespace ltl; using namespace ltl;
/// \brief Recursively translate a formula into a BDD.
///
/// The algorithm used here is adapted from Jean-Michel Couvreur's
/// Probataf tool.
class ltl_trad_visitor: public const_visitor class ltl_trad_visitor: public const_visitor
{ {
public: public:
@ -171,7 +175,7 @@ namespace spot
}; };
tgba_bdd_concrete tgba_bdd_concrete
ltl_to_tgba(const formula* f) ltl_to_tgba(const ltl::formula* f)
{ {
tgba_bdd_concrete_factory fact; tgba_bdd_concrete_factory fact;
ltl_trad_visitor v(fact); ltl_trad_visitor v(fact);

View file

@ -6,8 +6,8 @@
namespace spot namespace spot
{ {
/// Build a spot::tgba_bdd_concrete from an LTL formula.
tgba_bdd_concrete ltl_to_tgba(const ltl::formula* f); tgba_bdd_concrete ltl_to_tgba(const ltl::formula* f);
} }
#endif // SPOT_TGBA_LTL2TGBA_HH #endif // SPOT_TGBA_LTL2TGBA_HH

View file

@ -7,24 +7,51 @@
namespace spot namespace spot
{ {
/// Helper class to build a spot::tgba_bdd_concrete object.
class tgba_bdd_concrete_factory: public bdd_factory, public tgba_bdd_factory class tgba_bdd_concrete_factory: public bdd_factory, public tgba_bdd_factory
{ {
public: public:
virtual ~tgba_bdd_concrete_factory(); virtual ~tgba_bdd_concrete_factory();
/// Create a state variable for formula \a f.
///
/// \param f The formula to create a state for.
/// \return The variable number for this state.
///
/// The state 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_state(const ltl::formula* f); int create_state(const ltl::formula* f);
/// Create an atomic proposition variable for formula \a f.
///
/// \param f The formula to create an aotmic proposition for.
/// \return The variable number for this state.
///
/// 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 ltl::formula* f);
/// Create a promise variable for formula \a f.
///
/// \param f The formula to create a promise for.
/// \return The variable number for this state.
///
/// The promise 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_promise(const ltl::formula* f); int create_promise(const ltl::formula* f);
const tgba_bdd_core_data& get_core_data() const; const tgba_bdd_core_data& get_core_data() const;
const tgba_bdd_dict& get_dict() const; const tgba_bdd_dict& get_dict() const;
/// Add a new constraint to the relation.
void add_relation(bdd new_rel); void add_relation(bdd new_rel);
private: private:
tgba_bdd_core_data data_; tgba_bdd_core_data data_; ///< Core data for the new automata.
tgba_bdd_dict dict_; tgba_bdd_dict dict_; ///< Dictionary for the new automata.
}; };
} }

View file

@ -4,6 +4,11 @@
namespace spot namespace spot
{ {
/// \brief Helper class for product().
///
/// As both automata are encoded using BDD, we just have
/// to homogenize the variable numbers before ANDing the
/// relations and initial states.
class tgba_bdd_product_factory: public tgba_bdd_factory class tgba_bdd_product_factory: public tgba_bdd_factory
{ {
public: public:

View file

@ -5,6 +5,10 @@
namespace spot namespace spot
{ {
/// \brief Multiplies two tgba::tgba_bdd_concrete automata.
///
/// This function build the resulting product, as another
/// tgba::tgba_bdd_concrete automaton.
tgba_bdd_concrete tgba_bdd_concrete
product(const tgba_bdd_concrete& left, const tgba_bdd_concrete& right); product(const tgba_bdd_concrete& left, const tgba_bdd_concrete& right);
} }

View file

@ -6,10 +6,16 @@
namespace spot namespace spot
{ {
/// \brief Abstract class for spot::tgba_bdd_concrete factories.
///
/// A spot::tgba_bdd_concrete can be constructed from anything that
/// supplies core data and their associated dictionary.
class tgba_bdd_factory class tgba_bdd_factory
{ {
public: public:
/// Get the core data for the new automata.
virtual const tgba_bdd_core_data& get_core_data() const = 0; virtual const tgba_bdd_core_data& get_core_data() const = 0;
/// Get the dictionary for the new automata.
virtual const tgba_bdd_dict& get_dict() const = 0; virtual const tgba_bdd_dict& get_dict() const = 0;
}; };
} }

View file

@ -7,27 +7,36 @@
namespace spot namespace spot
{ {
/// A spot::tgba_bdd_factory than renumber BDD variables.
class tgba_bdd_translate_factory: public tgba_bdd_factory class tgba_bdd_translate_factory: public tgba_bdd_factory
{ {
public: public:
///\brief Construct a spot::tgba_bdd_translate_factory
///
/// \param from The Automata to copy.
/// \param to The dictionary of variable number to use.
tgba_bdd_translate_factory(const tgba_bdd_concrete& from, tgba_bdd_translate_factory(const tgba_bdd_concrete& from,
const tgba_bdd_dict& to); const tgba_bdd_dict& to);
virtual ~tgba_bdd_translate_factory(); virtual ~tgba_bdd_translate_factory();
bddPair* compute_pairs(const tgba_bdd_dict& from);
const tgba_bdd_core_data& get_core_data() const; const tgba_bdd_core_data& get_core_data() const;
const tgba_bdd_dict& get_dict() const; const tgba_bdd_dict& get_dict() const;
/// Get the new initial state.
bdd get_init_state() const; bdd get_init_state() const;
protected:
/// Compute renaming pairs.
bddPair* compute_pairs(const tgba_bdd_dict& from);
private: private:
tgba_bdd_core_data data_; tgba_bdd_core_data data_;
tgba_bdd_dict dict_; tgba_bdd_dict dict_;
bdd init_; bdd init_;
}; };
/// Reorder the variables of an automata.
tgba_bdd_concrete defrag(const tgba_bdd_concrete& a); tgba_bdd_concrete defrag(const tgba_bdd_concrete& a);
} }

View file

@ -7,6 +7,7 @@ namespace spot
{ {
typedef std::map<state*, int, state_ptr_less_than> seen_map; typedef std::map<state*, int, state_ptr_less_than> seen_map;
/// Output and record a state.
static bool static bool
dotty_state(std::ostream& os, dotty_state(std::ostream& os,
const tgba& g, state* st, seen_map& m, int& node) const tgba& g, state* st, seen_map& m, int& node)
@ -28,6 +29,7 @@ namespace spot
return true; return true;
} }
/// Process successors.
static void static void
dotty_rec(std::ostream& os, dotty_rec(std::ostream& os,
const tgba& g, state* st, seen_map& m, int father) const tgba& g, state* st, seen_map& m, int father)