22 #include <spot/kripke/kripke.hh> 23 #include <spot/twacube/twacube.hh> 35 unsigned instack_sccs;
36 unsigned instack_item;
56 template<
typename State,
typename SuccIterator,
57 typename StateHash,
typename StateEqual,
58 typename EmptinessCheck>
63 twacube_ptr
twa,
unsigned tid,
bool& stop):
64 sys_(sys), twa_(twa), tid_(tid), stop_(stop)
80 EmptinessCheck&
self()
82 return static_cast<EmptinessCheck&
>(*this);
91 product_state initial = {sys_.initial(tid_), twa_->get_initial()};
92 if (SPOT_LIKELY(
self().push_state(initial, dfs_number+1, 0
U)))
94 todo.push_back({initial, sys_.succ(initial.st_kripke, tid_),
95 twa_->succ(initial.st_prop)});
98 if (todo.back().it_prop->done())
101 forward_iterators(
true);
102 map[initial] = ++dfs_number;
104 while (!todo.empty() && !stop_)
108 if (todo.back().it_kripke->done())
110 bool is_init = todo.size() == 1;
111 auto newtop = is_init? todo.back().st: todo[todo.size() -2].st;
112 if (SPOT_LIKELY(
self().pop_state(todo.back().st,
118 sys_.recycle(todo.back().it_kripke, tid_);
121 if (SPOT_UNLIKELY(
self().counterexample_found()))
128 product_state dst = {
129 todo.back().it_kripke->state(),
130 twa_->trans_storage(todo.back().it_prop, tid_).dst
132 auto acc = twa_->trans_data(todo.back().it_prop, tid_).acc_;
133 forward_iterators(
false);
134 auto it = map.find(dst);
137 if (SPOT_LIKELY(
self().push_state(dst, dfs_number+1, acc)))
139 map[dst] = ++dfs_number;
140 todo.push_back({dst, sys_.succ(dst.st_kripke, tid_),
141 twa_->succ(dst.st_prop)});
142 forward_iterators(
true);
145 else if (SPOT_UNLIKELY(
self().update(todo.back().st,
147 dst, map[dst], acc)))
154 unsigned int states()
164 std::string counterexample()
166 return self().trace();
171 return {dfs_number, transitions, 0
U, 0
U, 0
U,
false};
182 SPOT_ASSERT(!todo.empty());
183 SPOT_ASSERT(!(todo.back().it_prop->done() &&
184 todo.back().it_kripke->done()));
187 if (todo.back().it_kripke->done())
192 SPOT_ASSERT(!(todo.back().it_prop->done()));
193 if (just_pushed && twa_->get_cubeset()
194 .intersect(twa_->trans_data(todo.back().it_prop, tid_).cube_,
195 todo.back().it_kripke->condition()))
201 if (todo.back().it_prop->done())
202 todo.back().it_prop->reset();
204 todo.back().it_prop->next();
206 while (!todo.back().it_kripke->done())
208 while (!todo.back().it_prop->done())
210 if (SPOT_UNLIKELY(twa_->get_cubeset()
211 .intersect(twa_->trans_data(todo.back().it_prop, tid_).cube_,
212 todo.back().it_kripke->condition())))
214 todo.back().it_prop->next();
216 todo.back().it_prop->reset();
217 todo.back().it_kripke->next();
235 return (lhs.st_prop == rhs.st_prop) &&
236 equal(lhs.st_kripke, rhs.st_kripke);
248 return wang32_hash(that.st_prop) ^ hasher(that.st_kripke);
255 SuccIterator* it_kripke;
256 std::shared_ptr<trans_index> it_prop;
260 std::vector<todo_element> todo;
265 unsigned int dfs_number = 0;
266 unsigned int transitions = 0;
size_t wang32_hash(size_t key)
Thomas Wang's 32 bit hash function.
Definition: hashfunc.hh:40
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
bool is_a_kripkecube(kripkecube< State, SuccIter > &)
This method allows to ensure (at compile time) if a given parameter is of type kripkecube. It also check if the iterator has the good interface.
Definition: kripke.hh:63
This class is a template representation of a Kripke structure. It is composed of two template paramet...
Definition: kripke.hh:37
Wrapper to accumulate results from intersection and emptiness checks.
Definition: intersect.hh:30
Definition: intersect.hh:252
Definition: intersect.hh:240
void forward_iterators(bool just_pushed)
Find the first couple of iterator (from the top of the todo stack) that intersect. The parameter indicates wheter the state has just been pushed since the underlying job is slightly different.
Definition: intersect.hh:180
bool run()
The main function that will perform the product on-the-fly and call the emptiness check when necessar...
Definition: intersect.hh:88
Definition: intersect.hh:228
Definition: intersect.hh:222