22 #include <spot/mc/reachability.hh> 23 #include <spot/mc/intersect.hh> 24 #include <spot/twa/twa.hh> 25 #include <spot/twacube_algos/convert.hh> 29 template<
typename State,
typename SuccIterator,
30 typename StateHash,
typename StateEqual>
33 StateHash, StateEqual,
34 kripke_to_twa<State, SuccIterator,
35 StateHash, StateEqual>>
41 StateHash, StateEqual>>(sys),
51 res_ = make_twa_graph(dict_);
52 names_ =
new std::vector<std::string>();
58 auto aps = this->sys_.get_ap();
59 for (
unsigned i = 0; i < aps.size(); ++i)
61 auto k = res_->register_ap(aps[i]);
62 reverse_binder_.insert({i, k});
66 void push(State s,
unsigned i)
68 unsigned st = res_->new_state();
69 names_->push_back(this->sys_.to_string(s));
73 void edge(
unsigned src,
unsigned dst)
75 cubeset cs(this->sys_.get_ap().size());
76 bdd cond =
cube_to_bdd(this->todo.back().it->condition(),
78 res_->new_edge(src, dst, cond);
83 res_->set_init_state(1);
84 res_->purge_unreachable_states();
85 res_->set_named_prop<std::vector<std::string>>(
"state-names", names_);
94 spot::twa_graph_ptr res_;
95 std::vector<std::string>* names_;
97 std::unordered_map<int, int> reverse_binder_;
102 template<
typename State,
typename SuccIterator,
103 typename StateHash,
typename StateEqual>
106 StateHash, StateEqual,
107 product_to_twa<State, SuccIterator,
108 StateHash, StateEqual>>
111 using typename intersect<State, SuccIterator, StateHash, StateEqual,
114 StateEqual>>::product_state;
119 :
intersect<State, SuccIterator, StateHash, StateEqual,
121 StateHash, StateEqual>>(sys, twa)
131 res_->set_named_prop<std::vector<std::string>>(
"state-names", names_);
137 auto d = spot::make_bdd_dict();
138 res_ = make_twa_graph(d);
139 names_ =
new std::vector<std::string>();
142 for (
auto ap : this->twa_->get_ap())
144 auto idx = res_->register_ap(
ap);
145 reverse_binder_[i++] = idx;
152 if (this->todo.size())
154 auto c = this->twa_->get_cubeset()
155 .intersection(this->twa_->trans_data
156 (this->todo.back().it_prop).cube_,
157 this->todo.back().it_kripke->condition());
161 this->twa_->get_cubeset().release(c);
162 res_->new_edge(this->map[this->todo.back().st]-1, i-1, x,
163 this->twa_->trans_data
164 (this->todo.back().it_prop).acc_);
167 unsigned st = res_->new_state();
168 names_->push_back(this->sys_.to_string(s.st_kripke) +
169 (
'*' + std::to_string(s.st_prop)));
170 SPOT_ASSERT(st+1 == i);
175 bool update(product_state,
unsigned src,
176 product_state,
unsigned dst,
179 auto c = this->twa_->get_cubeset()
180 .intersection(this->twa_->trans_data
181 (this->todo.back().it_prop).cube_,
182 this->todo.back().it_kripke->condition());
186 this->twa_->get_cubeset().release(c);
187 res_->new_edge(src-1, dst-1, x, cond);
192 bool counterexample_found()
202 bool pop_state(product_state,
unsigned,
bool, product_state,
unsigned)
208 spot::twa_graph_ptr res_;
209 std::vector<std::string>* names_;
210 std::unordered_map<int, int> reverse_binder_;
A Transition-based ω-Automaton.
Definition: twa.hh:622
This class explores (with a DFS) a product between a system and a twa. This exploration is performed ...
Definition: intersect.hh:59
This class is a template representation of a Kripke structure. It is composed of two template paramet...
Definition: kripke.hh:37
bdd cube_to_bdd(spot::cube cube, const cubeset &cubeset, std::unordered_map< int, int > &reverse_binder)
Transform a cube cube into bdd using the map that bind cube indexes to bdd indexes.
This template class provide a sequential reachability of a kripkecube. The algorithm uses a single DF...
Definition: reachability.hh:33