spot 2.16
Loading...
Searching...
No Matches
sccinfo.hh
1// -*- coding: utf-8 -*-
2// Copyright (C) by the Spot authors, see the AUTHORS file for details.
3//
4// This file is part of Spot, a model checking library.
5//
6// Spot is free software; you can redistribute it and/or modify it
7// under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 3 of the License, or
9// (at your option) any later version.
10//
11// Spot is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14// License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19#pragma once
20
21#include <vector>
22#include <spot/twa/twagraph.hh>
23#include <spot/twaalgos/emptiness.hh>
24#include <spot/misc/bitvect.hh>
25
26namespace spot
27{
28 class scc_info;
29
56 enum class edge_filter_choice { keep, ignore, cut };
58 (*edge_filter)(const twa_graph::edge_storage_t& e, unsigned dst,
59 void* filter_data);
61
62 namespace internal
63 {
64 struct keep_all
65 {
66 template <typename Iterator>
67 bool operator()(Iterator, Iterator) const noexcept
68 {
69 return true;
70 }
71 };
72
73 // Keep only transitions that have at least one destination in the
74 // current SCC.
75 struct keep_inner_scc
76 {
77 private:
78 const std::vector<unsigned>& sccof_;
79 unsigned desired_scc_;
80 public:
81 keep_inner_scc(const std::vector<unsigned>& sccof, unsigned desired_scc)
82 : sccof_(sccof), desired_scc_(desired_scc)
83 {
84 }
85
86 template <typename Iterator>
87 bool operator()(Iterator begin, Iterator end) const noexcept
88 {
89 bool want = false;
90 while (begin != end)
91 if (sccof_[*begin++] == desired_scc_)
92 {
93 want = true;
94 break;
95 }
96 return want;
97 }
98 };
99
100 template <typename Graph, typename Filter>
101 class SPOT_API scc_edge_iterator
102 {
103 public:
104 typedef typename std::conditional<std::is_const<Graph>::value,
105 const typename Graph::edge_storage_t,
106 typename Graph::edge_storage_t>::type
107 value_type;
108 typedef value_type& reference;
109 typedef value_type* pointer;
110 typedef std::ptrdiff_t difference_type;
111 typedef std::forward_iterator_tag iterator_category;
112
113 typedef std::vector<unsigned>::const_iterator state_iterator;
114
115 typedef typename std::conditional<std::is_const<Graph>::value,
116 const typename Graph::edge_vector_t,
117 typename Graph::edge_vector_t>::type
118 tv_t;
119
120 typedef typename std::conditional<std::is_const<Graph>::value,
121 const typename Graph::state_vector,
122 typename Graph::state_vector>::type
123 sv_t;
124 typedef const typename Graph::dests_vector_t dv_t;
125 protected:
126
127 state_iterator pos_;
128 state_iterator end_;
129 unsigned t_;
130 tv_t* tv_;
131 sv_t* sv_;
132 dv_t* dv_;
133
134 Filter filt_;
135 edge_filter efilter_;
136 void* efilter_data_;
137
138
139 void inc_state_maybe_()
140 {
141 while (!t_ && (++pos_ != end_))
142 t_ = (*sv_)[*pos_].succ;
143 }
144
145 void inc_()
146 {
147 t_ = (*tv_)[t_].next_succ;
148 inc_state_maybe_();
149 }
150
151 // Do we ignore the current transition?
152 bool ignore_current()
153 {
154 unsigned dst = (*this)->dst;
155 if ((int)dst >= 0)
156 {
157 // Non-universal branching => a single destination.
158 if (!filt_(&(*this)->dst, 1 + &(*this)->dst))
159 return true;
160 if (efilter_)
161 return efilter_((*tv_)[t_], dst, efilter_data_)
162 != edge_filter_choice::keep;
163 return false;
164 }
165 else
166 {
167 // Universal branching => multiple destinations.
168 const unsigned* d = dv_->data() + ~dst;
169 if (!filt_(d + 1, d + *d + 1))
170 return true;
171 if (efilter_)
172 {
173 // Keep the transition if at least one destination
174 // is not filtered.
175 const unsigned* end = d + *d + 1;
176 for (const unsigned* i = d + 1; i != end; ++i)
177 {
178 if (efilter_((*tv_)[t_], *i, efilter_data_)
179 == edge_filter_choice::keep)
180 return false;
181 }
182 return true;
183 }
184 return false;
185 }
186 }
187
188 public:
189 scc_edge_iterator(state_iterator begin, state_iterator end,
190 tv_t* tv, sv_t* sv, dv_t* dv, Filter filt,
191 edge_filter efilter, void* efilter_data) noexcept
192 : pos_(begin), end_(end), t_(0), tv_(tv), sv_(sv), dv_(dv), filt_(filt),
193 efilter_(efilter), efilter_data_(efilter_data)
194 {
195 if (pos_ == end_)
196 return;
197
198 t_ = (*sv_)[*pos_].succ;
199 inc_state_maybe_();
200 while (pos_ != end_ && ignore_current())
201 inc_();
202 }
203
204 scc_edge_iterator& operator++()
205 {
206 do
207 inc_();
208 while (pos_ != end_ && ignore_current());
209 return *this;
210 }
211
212 scc_edge_iterator operator++(int)
213 {
214 scc_edge_iterator old = *this;
215 ++*this;
216 return old;
217 }
218
219 bool operator==(scc_edge_iterator o) const
220 {
221 return pos_ == o.pos_ && t_ == o.t_;
222 }
223
224 bool operator!=(scc_edge_iterator o) const
225 {
226 return pos_ != o.pos_ || t_ != o.t_;
227 }
228
229 reference operator*() const
230 {
231 return (*tv_)[t_];
232 }
233
234 pointer operator->() const
235 {
236 return &**this;
237 }
238 };
239
240
241 template <typename Graph, typename Filter>
242 class SPOT_API scc_edges
243 {
244 public:
245 typedef scc_edge_iterator<Graph, Filter> iter_t;
246 typedef typename iter_t::tv_t tv_t;
247 typedef typename iter_t::sv_t sv_t;
248 typedef typename iter_t::dv_t dv_t;
249 typedef typename iter_t::state_iterator state_iterator;
250 private:
251 state_iterator begin_;
252 state_iterator end_;
253 tv_t* tv_;
254 sv_t* sv_;
255 dv_t* dv_;
256 Filter filt_;
257 edge_filter efilter_;
258 void* efilter_data_;
259 public:
260
261 scc_edges(state_iterator begin, state_iterator end,
262 tv_t* tv, sv_t* sv, dv_t* dv, Filter filt,
263 edge_filter efilter, void* efilter_data) noexcept
264 : begin_(begin), end_(end), tv_(tv), sv_(sv), dv_(dv), filt_(filt),
265 efilter_(efilter), efilter_data_(efilter_data)
266 {
267 }
268
269 iter_t begin() const
270 {
271 return {begin_, end_, tv_, sv_, dv_, filt_, efilter_, efilter_data_};
272 }
273
274 iter_t end() const
275 {
276 return {end_, end_, nullptr, nullptr, nullptr, filt_, nullptr, nullptr};
277 }
278 };
279 }
280
281
284 class SPOT_API scc_info_node
285 {
286 public:
288 typedef std::vector<unsigned> scc_succs;
289 friend class scc_info;
290 protected:
292 std::vector<unsigned> states_;
293 unsigned one_state_;
296 bool trivial_:1;
297 bool accepting_:1;
298 bool rejecting_:1;
299 bool useful_:1;
300 public:
302 scc_info_node() noexcept:
303 acc_({}), trivial_(true), accepting_(false),
304 rejecting_(false), useful_(false)
305 {
306 }
307
310 acc_cond::mark_t common, bool trivial) noexcept
311 : acc_(acc), common_(common),
312 trivial_(trivial), accepting_(false),
313 rejecting_(false), useful_(false)
314 {
315 }
316
318 bool is_trivial() const
319 {
320 return trivial_;
321 }
322
328 bool is_accepting() const
329 {
330 return accepting_;
331 }
332
338 bool is_rejecting() const
339 {
340 return rejecting_;
341 }
342
344 bool is_useful() const
345 {
346 return useful_;
347 }
348
351 {
352 return acc_;
353 }
354
357 {
358 return common_;
359 }
360
362 const std::vector<unsigned>& states() const
363 {
364 return states_;
365 }
366
368 unsigned one_state() const
369 {
370 return one_state_;
371 }
372
374 const scc_succs& succ() const
375 {
376 return succ_;
377 }
378 };
379
383 {
387 NONE = 0,
392 STOP_ON_ACC = 1,
397 TRACK_STATES = 2,
401 TRACK_SUCCS = 4,
414 };
415
418 inline
420 {
421 return me == scc_info_options::NONE;
422 }
423
426 inline
428 {
429 typedef std::underlying_type_t<scc_info_options> ut;
430 return static_cast<scc_info_options>(static_cast<ut>(left)
431 & static_cast<ut>(right));
432 }
433
436 inline
438 {
439 typedef std::underlying_type_t<scc_info_options> ut;
440 return static_cast<scc_info_options>(static_cast<ut>(left)
441 | static_cast<ut>(right));
442 }
443
444 class SPOT_API scc_and_mark_filter;
445
464 class SPOT_API scc_info
465 {
466 public:
467 // scc_node used to be an inner class, but Swig 3.0.10 does not
468 // support that yet.
471
472 // These types used to be defined here in Spot up to 2.9.
475
476 protected:
477
478 std::vector<unsigned> sccof_;
479 std::vector<scc_node> node_;
481 unsigned initial_state_;
484 int one_acc_scc_ = -1;
486
487 // Update the useful_ bits. Called automatically.
490
492 const scc_node& node(unsigned scc) const
493 {
494 return node_[scc];
495 }
496
497#ifndef SWIG
498 private:
499 [[noreturn]] static void report_need_track_states();
500 [[noreturn]] static void report_need_track_succs();
501 [[noreturn]] static void report_incompatible_stop_on_acc();
502#endif
503
504 public:
508 // Use ~0U instead of -1U to work around a bug in Swig.
509 // See https://github.com/swig/swig/issues/993
510 unsigned initial_state = ~0U,
511 edge_filter filter = nullptr,
512 void* filter_data = nullptr,
513 scc_info_options options = scc_info_options::ALL);
514
516 : scc_info(aut, ~0U, nullptr, nullptr, options)
517 {
518 }
520
528 // we separate the two functions so that we can rename
529 // scc_info(x,options) into scc_info_with_options(x,options) in Python.
530 // Otherwise calling scc_info(aut,options) can be confused with
531 // scc_info(aut,initial_state).
534 {
535 }
537
540 {
541 return aut_;
542 }
543
546 {
547 return options_;
548 }
549
552 {
553 return filter_;
554 }
555
557 void* get_filter_data() const
558 {
559 return filter_data_;
560 }
561
563 unsigned scc_count() const
564 {
565 return node_.size();
566 }
567
577 {
578 return one_acc_scc_;
579 }
580
582 bool reachable_state(unsigned st) const
583 {
584 return scc_of(st) != -1U;
585 }
586
588 unsigned scc_of(unsigned st) const
589 {
590 return sccof_[st];
591 }
592
594 std::vector<scc_node>::const_iterator begin() const
595 {
596 return node_.begin();
597 }
598
600 std::vector<scc_node>::const_iterator end() const
601 {
602 return node_.end();
603 }
604
606 std::vector<scc_node>::const_iterator cbegin() const
607 {
608 return node_.cbegin();
609 }
610
612 std::vector<scc_node>::const_iterator cend() const
613 {
614 return node_.cend();
615 }
616
618 std::vector<scc_node>::const_reverse_iterator rbegin() const
619 {
620 return node_.rbegin();
621 }
622
624 std::vector<scc_node>::const_reverse_iterator rend() const
625 {
626 return node_.rend();
627 }
628
630 const std::vector<unsigned>& states_of(unsigned scc) const
631 {
632 if (SPOT_UNLIKELY(!(options_ & scc_info_options::TRACK_STATES)))
633 report_need_track_states();
634 return node(scc).states();
635 }
636
642 internal::scc_edges<const twa_graph::graph_t, internal::keep_all>
643 edges_of(unsigned scc) const
644 {
645 auto& states = states_of(scc);
646 return {states.begin(), states.end(),
647 &aut_->edge_vector(), &aut_->states(),
648 &aut_->get_graph().dests_vector(),
649 internal::keep_all(), filter_, const_cast<void*>(filter_data_)};
650 }
651
659 internal::scc_edges<const twa_graph::graph_t, internal::keep_inner_scc>
660 inner_edges_of(unsigned scc) const
661 {
662 auto& states = states_of(scc);
663 return {states.begin(), states.end(),
664 &aut_->edge_vector(), &aut_->states(),
665 &aut_->get_graph().dests_vector(),
666 internal::keep_inner_scc(sccof_, scc), filter_,
667 const_cast<void*>(filter_data_)};
668 }
669
671 unsigned one_state_of(unsigned scc) const
672 {
673 return node(scc).one_state();
674 }
675
677 unsigned initial() const
678 {
679 SPOT_ASSERT(filter_ || scc_count() - 1 == scc_of(initial_state_));
680 return scc_of(initial_state_);
681 }
682
684 const scc_succs& succ(unsigned scc) const
685 {
686 if (SPOT_UNLIKELY(!(options_ & scc_info_options::TRACK_SUCCS)))
687 report_need_track_succs();
688 return node(scc).succ();
689 }
690
692 bool is_trivial(unsigned scc) const
693 {
694 return node(scc).is_trivial();
695 }
696
698 bool is_accepting_scc(unsigned scc) const
699 {
700 return node(scc).is_accepting();
701 }
702
704 bool is_rejecting_scc(unsigned scc) const
705 {
706 return node(scc).is_rejecting();
707 }
708
711 bool is_maximally_accepting_scc(unsigned scc) const
712 {
713 return aut_->acc().accepting(acc_sets_of(scc));
714 }
715
721
726 bool check_scc_emptiness(unsigned n) const;
727
735 void get_accepting_run(unsigned scc, twa_run_ptr r) const;
736
738 bool is_useful_scc(unsigned scc) const
739 {
740 if (SPOT_UNLIKELY(!!(options_ & scc_info_options::STOP_ON_ACC)))
741 report_incompatible_stop_on_acc();
742 if (SPOT_UNLIKELY(!(options_ & scc_info_options::TRACK_SUCCS)))
743 report_need_track_succs();
744 return node(scc).is_useful();
745 }
746
748 bool is_useful_state(unsigned st) const
749 {
750 return reachable_state(st) && is_useful_scc(scc_of(st));
751 }
752
755 std::vector<std::set<acc_cond::mark_t>> marks() const;
757 std::set<acc_cond::mark_t> marks_of(unsigned scc) const;
758
762 acc_cond::mark_t acc_sets_of(unsigned scc) const
763 {
764 return node(scc).acc_marks();
765 }
766
770 {
771 return node(scc).common_marks();
772 }
773
775 std::vector<bool> weak_sccs() const;
776
778 bdd scc_ap_support(unsigned scc) const;
779
805 std::vector<twa_graph_ptr> split_on_sets(unsigned scc,
806 acc_cond::mark_t sets,
807 bool preserve_names = false) const;
808 protected:
810 void
812 acc_cond::mark_t all_fin,
813 acc_cond::mark_t all_inf,
814 unsigned nb_pairs,
815 std::vector<acc_cond::rs_pair>& pairs,
816 std::vector<unsigned>& res,
817 std::vector<unsigned>& old) const;
818 public:
823 std::vector<unsigned>
824 states_on_acc_cycle_of(unsigned scc) const;
825 };
826
827
834 class SPOT_API scc_and_mark_filter
835 {
836 protected:
838 unsigned lower_scc_;
842 bool restore_old_acc_ = false;
843 const bitvect* keep_ = nullptr;
844
848 unsigned dst, void* data);
849
852 filter_mark_(const twa_graph::edge_storage_t& e, unsigned, void* data);
853
857 unsigned dst, void* data);
858
859 public:
866 unsigned lower_scc,
867 acc_cond::mark_t cut_sets)
868 : lower_si_(&lower_si), lower_scc_(lower_scc), cut_sets_(cut_sets),
869 aut_(lower_si_->get_aut()), old_acc_(aut_->get_acceptance())
870 {
871 auto f = lower_si.get_filter();
872 if (f == &filter_mark_
873 || f == &filter_scc_and_mark_
874 || f == &filter_scc_and_mark_and_edges_)
875 {
876 const void* data = lower_si.get_filter_data();
877 auto& d = *reinterpret_cast<const scc_and_mark_filter*>(data);
878 cut_sets_ |= d.cut_sets_;
879 if (f == &filter_scc_and_mark_and_edges_)
880 keep_ = d.keep_;
881 }
882 }
883
886 unsigned lower_scc,
887 acc_cond::mark_t cut_sets,
888 const bitvect& keep)
889 : scc_and_mark_filter(lower_si, lower_scc, cut_sets)
890 {
891 keep_ = &keep;
892 }
893
899 acc_cond::mark_t cut_sets)
900 : lower_si_(nullptr), cut_sets_(cut_sets), aut_(aut),
901 old_acc_(aut_->get_acceptance())
902 {
903 }
904
906 {
907 restore_acceptance();
908 }
909
911 void override_acceptance(const acc_cond& new_acc)
912 {
913 std::const_pointer_cast<twa_graph>(aut_)->set_acceptance(new_acc);
914 restore_old_acc_ = true;
915 }
916
919 {
920 if (!restore_old_acc_)
921 return;
922 std::const_pointer_cast<twa_graph>(aut_)->set_acceptance(old_acc_);
923 restore_old_acc_ = false;
924 }
925
928 {
929 return aut_;
930 }
931
933 unsigned start_state() const
934 {
935 if (lower_si_)
936 return lower_si_->one_state_of(lower_scc_);
937 return aut_->get_init_state_number();
938 }
939
942 {
943 if (keep_)
944 return filter_scc_and_mark_and_edges_;
945 if (lower_si_)
946 return filter_scc_and_mark_;
947 if (cut_sets_)
948 return filter_mark_;
949 return nullptr;
950 }
951 };
952
956 SPOT_API std::ostream&
957 dump_scc_info_dot(std::ostream& out,
958 const_twa_graph_ptr aut, scc_info* sccinfo = nullptr);
959
960}
An acceptance condition.
Definition acc.hh:54
A bit vector.
Definition bitvect.hh:51
Create a filter for SCC and marks.
Definition sccinfo.hh:835
static scc_info::edge_filter_choice filter_scc_and_mark_(const twa_graph::edge_storage_t &e, unsigned dst, void *data)
Filter by SCC membership and cut sets.
acc_cond old_acc_
Saved acceptance for restoration.
Definition sccinfo.hh:841
void override_acceptance(const acc_cond &new_acc)
Temporarily override the automaton's acceptance condition.
Definition sccinfo.hh:911
unsigned lower_scc_
SCC number in lower_si_ to restrict to.
Definition sccinfo.hh:838
static scc_info::edge_filter_choice filter_scc_and_mark_and_edges_(const twa_graph::edge_storage_t &e, unsigned dst, void *data)
Filter by SCC, marks, and edge set.
const_twa_graph_ptr aut_
The automaton being filtered.
Definition sccinfo.hh:840
scc_and_mark_filter(const const_twa_graph_ptr &aut, acc_cond::mark_t cut_sets)
Specify how to restrict scc_info to some acceptance sets.
Definition sccinfo.hh:898
scc_and_mark_filter(const scc_info &lower_si, unsigned lower_scc, acc_cond::mark_t cut_sets, const bitvect &keep)
Construct with an additional bitvect of edges to keep.
Definition sccinfo.hh:885
const scc_info * lower_si_
The original scc_info used to filter.
Definition sccinfo.hh:837
const_twa_graph_ptr get_aut() const
Return the filtered automaton.
Definition sccinfo.hh:927
void restore_acceptance()
Restore the original acceptance condition.
Definition sccinfo.hh:918
scc_and_mark_filter(const scc_info &lower_si, unsigned lower_scc, acc_cond::mark_t cut_sets)
Specify how to restrict scc_info to some SCC and acceptance sets.
Definition sccinfo.hh:865
unsigned start_state() const
Return the starting state for scc_info exploration.
Definition sccinfo.hh:933
acc_cond::mark_t cut_sets_
Acceptance sets treated as cut edges.
Definition sccinfo.hh:839
static scc_info::edge_filter_choice filter_mark_(const twa_graph::edge_storage_t &e, unsigned, void *data)
Filter by acceptance marks only.
scc_info::edge_filter get_filter() const
Return the appropriate edge filter function.
Definition sccinfo.hh:941
Storage for SCC related information.
Definition sccinfo.hh:285
acc_cond::mark_t acc_marks() const
Return the union of all acceptance marks in this SCC.
Definition sccinfo.hh:350
bool is_rejecting() const
True if we know that all cycles in the SCC are rejecting.
Definition sccinfo.hh:338
const std::vector< unsigned > & states() const
Return all states belonging to this SCC.
Definition sccinfo.hh:362
scc_succs succ_
Successor SCCs of this SCC.
Definition sccinfo.hh:291
bool rejecting_
True if the SCC is necessarily rejecting.
Definition sccinfo.hh:298
const scc_succs & succ() const
Return the list of successor SCC indices.
Definition sccinfo.hh:374
bool is_accepting() const
True if we know that the SCC has an accepting cycle.
Definition sccinfo.hh:328
bool accepting_
True if the SCC is necessarily accepting.
Definition sccinfo.hh:297
acc_cond::mark_t common_marks() const
Return the marks common to all transitions in this SCC.
Definition sccinfo.hh:356
scc_info_node(acc_cond::mark_t acc, acc_cond::mark_t common, bool trivial) noexcept
Construct an SCC node with given acceptance information.
Definition sccinfo.hh:309
unsigned one_state_
An arbitrary state in this SCC.
Definition sccinfo.hh:293
unsigned one_state() const
Return one arbitrary state in this SCC.
Definition sccinfo.hh:368
acc_cond::mark_t acc_
Union of acceptance marks seen.
Definition sccinfo.hh:294
bool trivial_
True if the SCC has no cycle.
Definition sccinfo.hh:296
bool useful_
True if the SCC can reach an accepting SCC.
Definition sccinfo.hh:299
std::vector< unsigned > states_
States of the component.
Definition sccinfo.hh:292
scc_info_node() noexcept
Default-construct an empty trivial SCC node.
Definition sccinfo.hh:302
acc_cond::mark_t common_
Marks common to all edges.
Definition sccinfo.hh:295
bool is_trivial() const
True if the SCC has no cycle.
Definition sccinfo.hh:318
std::vector< unsigned > scc_succs
List of successor SCC indices.
Definition sccinfo.hh:288
bool is_useful() const
True if the SCC can reach an accepting SCC.
Definition sccinfo.hh:344
Compute an SCC map and gather assorted information.
Definition sccinfo.hh:465
scc_info(const_twa_graph_ptr aut, scc_info_options options)
Create the scc_info map for aut.
Definition sccinfo.hh:515
bool is_maximally_accepting_scc(unsigned scc) const
Whether a cycle going through all edges of the SCC is accepting.
Definition sccinfo.hh:711
std::vector< std::set< acc_cond::mark_t > > marks() const
Returns, for each accepting SCC, the set of all marks appearing in it.
std::vector< unsigned > sccof_
SCC number for each state.
Definition sccinfo.hh:478
int one_accepting_scc() const
Return the number of one accepting SCC if any, -1 otherwise.
Definition sccinfo.hh:576
unsigned scc_count() const
Return the total number of SCCs.
Definition sccinfo.hh:563
bdd scc_ap_support(unsigned scc) const
Return the APs that appear in SCC scc.
unsigned initial() const
Get number of the SCC containing the initial state.
Definition sccinfo.hh:677
unsigned scc_of(unsigned st) const
Return the SCC number containing state st.
Definition sccinfo.hh:588
void determine_usefulness()
Update the useful_ bits for all SCC nodes.
internal::scc_edges< const twa_graph::graph_t, internal::keep_inner_scc > inner_edges_of(unsigned scc) const
A fake container to iterate over all edges between states of an SCC.
Definition sccinfo.hh:660
edge_filter filter_
Optional edge filter function.
Definition sccinfo.hh:482
unsigned one_state_of(unsigned scc) const
Return one arbitrary state in SCC scc.
Definition sccinfo.hh:671
bool is_rejecting_scc(unsigned scc) const
True if SCC scc is necessarily rejecting.
Definition sccinfo.hh:704
const_twa_graph_ptr aut_
The automaton being analyzed.
Definition sccinfo.hh:480
void * get_filter_data() const
Return the user data passed to the edge filter.
Definition sccinfo.hh:557
bool is_useful_state(unsigned st) const
True if state st belongs to a useful SCC.
Definition sccinfo.hh:748
bool check_scc_emptiness(unsigned n) const
Recompute whether an SCC is accepting or not.
const scc_node & node(unsigned scc) const
Return the SCC node for the given SCC index.
Definition sccinfo.hh:492
std::set< acc_cond::mark_t > marks_of(unsigned scc) const
Return the set of all marks appearing in SCC scc.
bool is_trivial(unsigned scc) const
True if SCC scc has no cycle.
Definition sccinfo.hh:692
const_twa_graph_ptr get_aut() const
Return the automaton passed to the constructor.
Definition sccinfo.hh:539
bool is_accepting_scc(unsigned scc) const
True if SCC scc is necessarily accepting.
Definition sccinfo.hh:698
std::vector< scc_node >::const_iterator cbegin() const
Const iterator to the first SCC node.
Definition sccinfo.hh:606
void determine_unknown_acceptance()
Study the SCCs that are currently reported neither as accepting nor as rejecting because of the prese...
void get_accepting_run(unsigned scc, twa_run_ptr r) const
Retrieves an accepting run of the automaton whose cycle is in the SCC.
spot::edge_filter_choice edge_filter_choice
Imported type.
Definition sccinfo.hh:473
const std::vector< unsigned > & states_of(unsigned scc) const
Return all states belonging to SCC scc.
Definition sccinfo.hh:630
std::vector< scc_node >::const_iterator end() const
Past-the-end iterator over SCC nodes.
Definition sccinfo.hh:600
scc_info(const_twa_graph_ptr aut, unsigned initial_state=~0U, edge_filter filter=nullptr, void *filter_data=nullptr, scc_info_options options=scc_info_options::ALL)
Create the scc_info map for aut.
scc_info(const scc_and_mark_filter &filt)
Create an scc_info map from some filter.
Definition sccinfo.hh:532
std::vector< unsigned > states_on_acc_cycle_of(unsigned scc) const
: Get all states visited by any accepting cycles of the 'scc'.
bool reachable_state(unsigned st) const
True if state st is reachable from the initial state.
Definition sccinfo.hh:582
void states_on_acc_cycle_of_rec(unsigned scc, acc_cond::mark_t all_fin, acc_cond::mark_t all_inf, unsigned nb_pairs, std::vector< acc_cond::rs_pair > &pairs, std::vector< unsigned > &res, std::vector< unsigned > &old) const
: Recursive function used by states_on_acc_cycle_of().
std::vector< scc_node >::const_iterator begin() const
Iterator to the first SCC node.
Definition sccinfo.hh:594
scc_info_options get_options() const
Return the options used during construction.
Definition sccinfo.hh:545
scc_info_node scc_node
Alias for scc_info_node.
Definition sccinfo.hh:469
std::vector< scc_node > node_
SCC nodes in reverse topological order.
Definition sccinfo.hh:479
std::vector< scc_node >::const_reverse_iterator rbegin() const
Reverse iterator to the last SCC node.
Definition sccinfo.hh:618
acc_cond::mark_t common_sets_of(unsigned scc) const
Definition sccinfo.hh:769
std::vector< scc_node >::const_reverse_iterator rend() const
Reverse past-the-end iterator over SCC nodes.
Definition sccinfo.hh:624
void * filter_data_
User data passed to the edge filter.
Definition sccinfo.hh:483
internal::scc_edges< const twa_graph::graph_t, internal::keep_all > edges_of(unsigned scc) const
A fake container to iterate over all edges leaving any state of an SCC.
Definition sccinfo.hh:643
edge_filter get_filter() const
Return the edge filter function.
Definition sccinfo.hh:551
unsigned initial_state_
Initial state of the automaton.
Definition sccinfo.hh:481
scc_info_options options_
Options used during construction.
Definition sccinfo.hh:485
std::vector< scc_node >::const_iterator cend() const
Const past-the-end iterator over SCC nodes.
Definition sccinfo.hh:612
bool is_useful_scc(unsigned scc) const
True if SCC scc can reach an accepting SCC.
Definition sccinfo.hh:738
spot::edge_filter edge_filter
Imported edge filter type.
Definition sccinfo.hh:474
acc_cond::mark_t acc_sets_of(unsigned scc) const
Returns, for a given SCC, the set of all colors appearing in it. It is the set of colors that appear ...
Definition sccinfo.hh:762
scc_info_node::scc_succs scc_succs
Successor SCC list.
Definition sccinfo.hh:470
const scc_succs & succ(unsigned scc) const
Return the successor SCCs of SCC scc.
Definition sccinfo.hh:684
scc_info(const scc_and_mark_filter &filt, scc_info_options options)
Create an scc_info map from some filter.
std::vector< twa_graph_ptr > split_on_sets(unsigned scc, acc_cond::mark_t sets, bool preserve_names=false) const
Split an SCC into multiple automata separated by some acceptance sets.
std::vector< bool > weak_sccs() const
Return a vector indicating which SCCs are weak.
spot::internal::edge_storage< unsigned, unsigned, unsigned, internal::boxed_label< twa_graph_edge_data, false > > edge_storage_t
Edge storage type (src, dst, and edge data).
Definition twagraph.hh:218
@ U
until
scc_info_options operator&(scc_info_options left, scc_info_options right)
Bitwise AND of two scc_info_options values.
Definition sccinfo.hh:427
bool operator!(scc_info_options me)
Test if an scc_info_options value equals NONE.
Definition sccinfo.hh:419
std::shared_ptr< twa_run > twa_run_ptr
Shared pointer to a twa_run.
Definition twa.hh:41
edge_filter_choice(* edge_filter)(const twa_graph::edge_storage_t &e, unsigned dst, void *filter_data)
An edge_filter may be called on each edge to decide what to do with it.
Definition sccinfo.hh:58
scc_info_options
Options to alter the behavior of scc_info.
Definition sccinfo.hh:383
edge_filter_choice
An edge_filter may be called on each edge to decide what to do with it.
Definition sccinfo.hh:56
@ ALL
Default behavior: explore everything and track states and succs.
std::shared_ptr< const twa_graph > const_twa_graph_ptr
Shared pointer to a const twa_graph.
Definition fwd.hh:41
Definition automata.hh:26
std::ostream & dump_scc_info_dot(std::ostream &out, const_twa_graph_ptr aut, scc_info *sccinfo=nullptr)
Dump the SCC graph of aut on out.
constexpr bool operator==(trival a, trival b)
Equality comparison of two trival values.
Definition trival.hh:134
const mc_rvalue operator|(const mc_rvalue &lhs, const mc_rvalue &rhs)
This function helps to find the output value from a set of threads that may have different values.
Definition mc.hh:140
constexpr bool operator!=(trival a, trival b)
Inequality comparison of two trival values.
Definition trival.hh:140
An acceptance mark.
Definition acc.hh:76

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.8