* src/tgba/bdddict.cc (bdd_dict::is_registered): Split as ... (bdd_dict::is_registered_proposition, bdd_dict::is_registered_state, bdd_dict::is_registered_accepting_variable): ... these. * src/tgba/bdddict.hh: Likewise. * src/tgba/tgbaexplicit.cc (tgba_explicit::set_init_state): New method. (tgba_explicit::declare_accepting_condition): Arrange so that this function can be called during the construction of the automaton. (tgba_explicit::complement_all_accepting_conditions): New method. (tgba_explicit::has_accepting_condition): Adjust to call bdd_dict::is_registered_accepting_variable. * src/tgba/tgbaexplicit.hh (tgba_explicit::set_init_state, tgba_explicit::complement_all_accepting_conditions): New methods. * src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_fm.hh: New files. * src/tgbaalgos/Makefile.am (tgbaalgos_HEADERS, libtgbaalgos_la_SOURCES): Add them. * src/tgbaalgos/ltl2tgba.hh: Add bibtex entry in comment. * src/tgbatest/Makefile.am (check_PROGRAMS): Remove spotlbtt and tbalbtt. (tbalbtt_SOURCES, tbalbtt_CXXFLAGS, spotlbtt_SOURCES): Remove. * src/tgbatest/spotlbtt.cc: Delete, superseded by "ltl2tgba -F -t". * src/tgbatest/ltl2tgba.cc: Implement the -f and -F options. * src/tgbatest/spotlbtt.test: Use "ltl2tgba -F -t" instead of "spotlbtt", "ltl2tgba -F -t -D" instead of "tbalbtt", and add also check the ltl2tgba_fm translator. * wrap/python/spot.i: Wrap ltl2tgba_fm. * wrap/python/cgi/ltl2tgba.in: Add radio buttons to select between ltl2tgba and ltl2tgba_fm. * wrap/python/tests/ltl2tgba.py: Add support for the -f option. * wrap/python/tests/ltl2tgba.test: Try the -f option.
132 lines
3.5 KiB
C++
132 lines
3.5 KiB
C++
#ifndef SPOT_TGBA_TGBAEXPLICIT_HH
|
|
# define SPOT_TGBA_TGBAEXPLICIT_HH
|
|
|
|
#include <list>
|
|
#include <map>
|
|
#include "tgba.hh"
|
|
#include "ltlast/formula.hh"
|
|
|
|
namespace spot
|
|
{
|
|
// Forward declarations. See below.
|
|
class state_explicit;
|
|
class tgba_explicit_succ_iterator;
|
|
|
|
/// Explicit representation of a spot::tgba.
|
|
class tgba_explicit: public tgba
|
|
{
|
|
public:
|
|
tgba_explicit(bdd_dict* dict);
|
|
|
|
struct transition;
|
|
typedef std::list<transition*> state;
|
|
|
|
/// Explicit transitions (used by spot::tgba_explicit).
|
|
struct transition
|
|
{
|
|
bdd condition;
|
|
bdd accepting_conditions;
|
|
state* dest;
|
|
};
|
|
|
|
void set_init_state(const std::string& state);
|
|
|
|
transition*
|
|
create_transition(const std::string& source, const std::string& dest);
|
|
|
|
void add_condition(transition* t, ltl::formula* f);
|
|
void add_neg_condition(transition* t, ltl::formula* f);
|
|
void declare_accepting_condition(ltl::formula* f);
|
|
bool has_accepting_condition(ltl::formula* f) const;
|
|
void add_accepting_condition(transition* t, ltl::formula* f);
|
|
void complement_all_accepting_conditions();
|
|
|
|
// 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 std::string format_state(const spot::state* state) const;
|
|
|
|
virtual bdd all_accepting_conditions() const;
|
|
virtual bdd neg_accepting_conditions() const;
|
|
|
|
protected:
|
|
virtual bdd compute_support_conditions(const spot::state* state) const;
|
|
virtual bdd compute_support_variables(const spot::state* state) const;
|
|
|
|
state* add_state(const std::string& name);
|
|
bdd get_condition(ltl::formula* f);
|
|
bdd get_accepting_condition(ltl::formula* f);
|
|
|
|
typedef std::map<const std::string, tgba_explicit::state*> ns_map;
|
|
typedef std::map<const tgba_explicit::state*, std::string> sn_map;
|
|
ns_map name_state_map_;
|
|
sn_map state_name_map_;
|
|
bdd_dict* dict_;
|
|
tgba_explicit::state* init_;
|
|
mutable bdd all_accepting_conditions_;
|
|
bdd neg_accepting_conditions_;
|
|
mutable bool all_accepting_conditions_computed_;
|
|
|
|
private:
|
|
// Disallow copy.
|
|
tgba_explicit(const tgba_explicit& other);
|
|
tgba_explicit& tgba_explicit::operator=(const tgba_explicit& other);
|
|
};
|
|
|
|
|
|
/// States used by spot::tgba_explicit.
|
|
class state_explicit : public spot::state
|
|
{
|
|
public:
|
|
state_explicit(const tgba_explicit::state* s)
|
|
: state_(s)
|
|
{
|
|
}
|
|
|
|
virtual int compare(const spot::state* other) const;
|
|
|
|
virtual state_explicit* clone() const;
|
|
|
|
virtual ~state_explicit()
|
|
{
|
|
}
|
|
|
|
const tgba_explicit::state* get_state() const;
|
|
private:
|
|
const tgba_explicit::state* state_;
|
|
};
|
|
|
|
|
|
/// Successor iterators used by spot::tgba_explicit.
|
|
class tgba_explicit_succ_iterator: public tgba_succ_iterator
|
|
{
|
|
public:
|
|
tgba_explicit_succ_iterator(const tgba_explicit::state* s, bdd all_acc);
|
|
|
|
virtual
|
|
~tgba_explicit_succ_iterator()
|
|
{
|
|
}
|
|
|
|
virtual void first();
|
|
virtual void next();
|
|
virtual bool done() const;
|
|
|
|
virtual state_explicit* current_state() const;
|
|
virtual bdd current_condition() const;
|
|
virtual bdd current_accepting_conditions() const;
|
|
|
|
private:
|
|
const tgba_explicit::state* s_;
|
|
tgba_explicit::state::const_iterator i_;
|
|
bdd all_accepting_conditions_;
|
|
};
|
|
|
|
}
|
|
|
|
#endif // SPOT_TGBA_TGBAEXPLICIT_HH
|