25 #include <spot/misc/hash.hh>
27 #include <spot/twa/bdddict.hh>
28 #include <spot/twa/twa.hh>
43 typedef std::list<transition*>
state;
90 : s_(s), delete_me_(delete_me)
95 virtual size_t hash()
const override;
123 virtual bool done()
const override;
126 virtual bdd
cond()
const override;
132 typedef taa_tgba::state::const_iterator iterator;
133 typedef std::pair<iterator, iterator> iterator_pair;
134 typedef std::vector<iterator_pair> bounds_t;
136 std::vector<taa_tgba::transition*>,
142 operator()(
const iterator_pair& lhs,
const iterator_pair& rhs)
const
144 return std::distance(lhs.first, lhs.second) <
145 std::distance(rhs.first, rhs.second);
149 std::vector<taa_tgba::transition*>::const_iterator i_;
150 std::vector<taa_tgba::transition*> succ_;
152 const acc_cond& acc_;
157 template<
typename label>
166 for (
auto i: name_state_map_)
168 for (
auto i2: *i.second)
177 std::vector<label> v(1);
184 init_ = add_state_set(s);
190 const std::vector<label>& d)
192 state* src = add_state(s);
198 src->emplace_back(t);
206 std::vector<std::string> vec;
208 return create_transition(s, vec);
232 return format_state_set(ss);
238 typename ns_map::const_iterator i;
239 for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i)
241 taa_tgba::state::const_iterator i2;
242 os <<
"State: " << label_to_string(i->first) << std::endl;
243 for (i2 = i->second->begin(); i2 != i->second->end(); ++i2)
245 os <<
' ' << format_state_set((*i2)->dst)
246 <<
", C:" << (*i2)->condition
247 <<
", A:" << (*i2)->acceptance_conditions << std::endl;
257 typedef std::unordered_map<label, taa_tgba::state*>
ns_map;
273 typename ns_map::iterator i = name_state_map_.find(name);
274 if (i == name_state_map_.end())
277 name_state_map_[name] = s;
278 state_name_map_[s] = name;
288 for (
unsigned i = 0; i < names.size(); ++i)
289 ss->insert(add_state(names[i]));
290 state_set_vec_.emplace_back(ss);
296 state_set::const_iterator i1 = ss->begin();
297 typename sn_map::const_iterator i2;
299 return std::string(
"{}");
302 i2 = state_name_map_.find(*i1);
303 SPOT_ASSERT(i2 != state_name_map_.end());
304 return "{" + label_to_string(i2->second) +
"}";
308 std::string res(
"{");
309 while (i1 != ss->end())
311 i2 = state_name_map_.find(*i1++);
312 SPOT_ASSERT(i2 != state_name_map_.end());
313 res += label_to_string(i2->second);
316 res[res.size() - 1] =
'}';
An acceptance condition.
Definition: acc.hh:54
Definition: taatgba.hh:83
virtual set_state * clone() const override
Duplicate a state.
set_state(const taa_tgba::state_set *s, bool delete_me=false)
Construct a set_state wrapping state set s.
Definition: taatgba.hh:89
virtual size_t hash() const override
Hash a state.
virtual int compare(const spot::state *) const override
Compares two states (that come from the same automaton).
const taa_tgba::state_set * get_state() const
Return the underlying TAA state set.
Abstract class for states.
Definition: twa.hh:49
Successor iterator for alternating automata with tree-and-automata (TAA) transitions.
Definition: taatgba.hh:115
virtual bool next() override
Jump to the next successor (if any).
virtual bdd cond() const override
Get the condition on the edge leading to this successor.
virtual acc_cond::mark_t acc() const override
Get the acceptance mark of the edge leading to this successor.
taa_succ_iterator(const taa_tgba::state_set *s, const acc_cond &acc)
Construct an iterator over the successors of state s.
virtual set_state * dst() const override
Get the destination state of the current edge.
virtual bool done() const override
Check whether the iteration is finished.
virtual bool first() override
Position the iterator on the first successor (if any).
Definition: taatgba.hh:159
virtual std::string format_state(const spot::state *s) const override
Format the state as a string for printing.
Definition: taatgba.hh:228
void set_init_state(const label &s)
Set the initial state to the singleton s.
Definition: taatgba.hh:175
std::unordered_map< label, taa_tgba::state * > ns_map
Map from label to taa_tgba::state*.
Definition: taatgba.hh:257
sn_map state_name_map_
Map from state pointer to label.
Definition: taatgba.hh:263
label label_t
The label type for this automaton.
Definition: taatgba.hh:254
void set_init_state(const std::vector< label > &s)
Set the initial state to the conjunction of states in s.
Definition: taatgba.hh:182
ns_map name_state_map_
Map from label to state pointer.
Definition: taatgba.hh:262
taa_tgba_labelled(const bdd_dict_ptr &dict)
Construct a labelled TAA using the given dictionary.
Definition: taatgba.hh:162
std::unordered_map< const taa_tgba::state *, label, ptr_hash< taa_tgba::state > > sn_map
Map from taa_tgba::state* to label.
Definition: taatgba.hh:260
void add_acceptance_condition(transition *t, formula f)
Add acceptance condition f to transition t.
Definition: taatgba.hh:212
transition * create_transition(const label &s, const std::vector< label > &d)
Create a transition from s to the conjunction of d.
Definition: taatgba.hh:189
transition * create_transition(const label &s, const label &d)
Create a transition from s to singleton destination d.
Definition: taatgba.hh:204
void output(std::ostream &os) const
Output a TAA in a stream.
Definition: taatgba.hh:236
virtual std::string label_to_string(const label_t &lbl) const =0
Return a label as a string.
A TAA-TGBA automaton where states are labelled with strings.
Definition: taatgba.hh:330
taa_tgba_string(const bdd_dict_ptr &dict)
Construct a string-labelled TAA automaton.
Definition: taatgba.hh:333
virtual std::string label_to_string(const std::string &label) const override
Return a label as a string.
A self-loop Transition-based Alternating Automaton (TAA) which is seen as a TGBA (abstract class,...
Definition: taatgba.hh:36
void add_condition(transition *t, formula f)
Add a Boolean condition f to transition t.
std::set< state * > state_set
Type of a set of TAA states.
Definition: taatgba.hh:45
taa_tgba(const bdd_dict_ptr &dict)
Construct a TAA automaton using the given dictionary.
std::vector< taa_tgba::state_set * > ss_vec
Type of a vector of state sets (used internally).
Definition: taatgba.hh:66
virtual spot::state * get_init_state() const override final
Get the initial state of the automaton.
virtual ~taa_tgba()
TGBA interface.
std::list< transition * > state
Type of a TAA state: a list of outgoing transitions.
Definition: taatgba.hh:41
Class for representing a transition.
Definition: twacube.hh:53
Iterate over the successors of a state.
Definition: twa.hh:425
A Transition-based ω-Automaton.
Definition: twa.hh:648
std::shared_ptr< bdd_dict > bdd_dict_ptr
Shared pointer to a bdd_dict.
Definition: bdddict.hh:304
std::shared_ptr< taa_tgba_string > taa_tgba_string_ptr
Shared pointer to a taa_tgba_string automaton.
Definition: taatgba.hh:344
std::shared_ptr< const taa_tgba_string > const_taa_tgba_string_ptr
Shared pointer to a const taa_tgba_string automaton.
Definition: taatgba.hh:347
std::shared_ptr< const taa_tgba_formula > const_taa_tgba_formula_ptr
Shared pointer to a const taa_tgba_formula automaton.
Definition: taatgba.hh:381
taa_tgba_formula_ptr make_taa_tgba_formula(const bdd_dict_ptr &dict)
Construct a taa_tgba_formula automaton.
Definition: taatgba.hh:385
std::shared_ptr< taa_tgba_formula > taa_tgba_formula_ptr
Shared pointer to a taa_tgba_formula automaton.
Definition: taatgba.hh:378
taa_tgba_string_ptr make_taa_tgba_string(const bdd_dict_ptr &dict)
Construct a taa_tgba_string automaton.
Definition: taatgba.hh:351
Definition: automata.hh:26
std::unordered_set< const state *, state_ptr_hash, state_ptr_equal > state_set
Unordered set of abstract states.
Definition: twa.hh:197
An acceptance mark.
Definition: acc.hh:76
A hash function for pointers.
Definition: hash.hh:36
An Equivalence Relation for state pointers.
Definition: twa.hh:154
Hash Function for state pointers.
Definition: twa.hh:181
An explicit TAA transition.
Definition: taatgba.hh:49
bdd condition
Boolean label of the edge.
Definition: taatgba.hh:50
const state_set * dst
Destination state set.
Definition: taatgba.hh:52
acc_cond::mark_t acceptance_conditions
Acceptance marks.
Definition: taatgba.hh:51