30 #include <spot/misc/_config.h>
31 #include <spot/misc/bitset.hh>
32 #include <spot/misc/trival.hh>
45 SPOT_DEPRECATED(
"mark_t no longer relies on unsigned, stop using value_t")
46 typedef unsigned value_t;
65 [[noreturn]]
static void report_too_many_sets();
102 template<
class iterator>
103 mark_t(
const iterator& begin,
const iterator& end)
106 for (iterator i = begin; i != end; ++i)
107 if (SPOT_LIKELY(*i < SPOT_MAX_ACCSETS))
110 report_too_many_sets();
114 mark_t(std::initializer_list<unsigned> vals)
115 :
mark_t(vals.begin(), vals.end())
140 return SPOT_MAX_ACCSETS;
150 return mark_t(_value_t::mone());
153 size_t hash() const noexcept
155 std::hash<decltype(
id)> h;
160 bool operator==(
unsigned o)
const
162 SPOT_ASSERT(o == 0U);
168 bool operator!=(
unsigned o)
const
170 SPOT_ASSERT(o == 0U);
175 bool operator==(mark_t o)
const
180 bool operator!=(mark_t o)
const
185 bool operator<(mark_t o)
const
190 bool operator<=(mark_t o)
const
195 bool operator>(mark_t o)
const
200 bool operator>=(mark_t o)
const
205 explicit operator bool()
const
210 bool has(
unsigned u)
const
212 return !!this->operator&(mark_t({0}) << u);
220 void clear(
unsigned u)
225 mark_t& operator&=(mark_t r)
231 mark_t& operator|=(mark_t r)
237 mark_t& operator-=(mark_t r)
243 mark_t& operator^=(mark_t r)
249 mark_t operator&(mark_t r)
const
259 mark_t operator-(mark_t r)
const
264 mark_t operator~()
const
269 mark_t operator^(mark_t r)
const
274 #if SPOT_DEBUG || defined(SWIGPYTHON)
275 # define SPOT_WRAP_OP(ins) \
280 catch (const std::runtime_error& e) \
282 report_too_many_sets(); \
285 # define SPOT_WRAP_OP(ins) ins;
287 mark_t operator<<(
unsigned i)
const
289 SPOT_WRAP_OP(
return id << i);
292 mark_t& operator<<=(
unsigned i)
294 SPOT_WRAP_OP(
id <<= i;
return *
this);
297 mark_t operator>>(
unsigned i)
const
299 SPOT_WRAP_OP(
return id >> i);
302 mark_t& operator>>=(
unsigned i)
304 SPOT_WRAP_OP(
id >>= i;
return *
this);
308 mark_t strip(mark_t y)
const
322 auto rm = (~yv) & (yv - 1);
324 auto lm = ~(yv ^ (yv - 1));
325 xv = ((xv & lm) >> 1) | (xv & rm);
335 return !((*this) - m);
342 return *
this != m && this->subset(m);
358 return id.highest()+1;
370 return id.lowest()+1;
391 return id && !(
id & (
id - 1));
402 return !!(
id & (
id - 1));
417 template<
class iterator>
435 friend std::ostream& operator<<(std::ostream& os,
mark_t m);
437 std::string as_string()
const
439 std::ostringstream os;
447 { Inf, Fin, InfNeg, FinNeg,
And,
Or };
478 struct SPOT_API
acc_code:
public std::vector<acc_word>
483 bool operator==(
const acc_code& other)
const
485 unsigned pos = size();
486 if (other.size() != pos)
490 auto op = (*this)[pos - 1].sub.op;
491 auto sz = (*this)[pos - 1].sub.size;
492 if (other[pos - 1].sub.op !=
op ||
493 other[pos - 1].sub.size != sz)
497 case acc_cond::acc_op::And:
498 case acc_cond::acc_op::Or:
501 case acc_cond::acc_op::Inf:
502 case acc_cond::acc_op::InfNeg:
503 case acc_cond::acc_op::Fin:
504 case acc_cond::acc_op::FinNeg:
506 if (other[pos].mark != (*
this)[pos].mark)
514 bool operator<(
const acc_code& other)
const
516 unsigned pos = size();
517 auto osize = other.size();
524 auto op = (*this)[pos - 1].sub.op;
525 auto oop = other[pos - 1].sub.op;
530 auto sz = (*this)[pos - 1].sub.size;
531 auto osz = other[pos - 1].sub.size;
538 case acc_cond::acc_op::And:
539 case acc_cond::acc_op::Or:
542 case acc_cond::acc_op::Inf:
543 case acc_cond::acc_op::InfNeg:
544 case acc_cond::acc_op::Fin:
545 case acc_cond::acc_op::FinNeg:
548 auto m = (*this)[pos].mark;
549 auto om = other[pos].mark;
561 bool operator>(
const acc_code& other)
const
563 return other < *
this;
566 bool operator<=(
const acc_code& other)
const
568 return !(other < *
this);
571 bool operator>=(
const acc_code& other)
const
573 return !(*
this < other);
576 bool operator!=(
const acc_code& other)
const
578 return !(*
this == other);
589 return s == 0 || ((*this)[s - 1].sub.op == acc_op::Inf
590 && !((*this)[s - 2].mark));
604 && (*this)[s - 1].sub.op == acc_op::Fin && !((*this)[s - 2].mark);
618 res[1].sub.op = acc_op::Fin;
644 res[1].sub.op = acc_op::Fin;
676 res[1].sub.op = acc_op::FinNeg;
683 return fin_neg(
mark_t(vals));
700 res[1].sub.op = acc_op::Inf;
732 res[1].sub.op = acc_op::InfNeg;
739 return inf_neg(
mark_t(vals));
769 m >>= mark_t::max_accsets() - n;
783 m >>= mark_t::max_accsets() - n;
796 res |= inf({2*n - 1}) & fin({2*n - 2});
811 res &= inf({2*n - 1}) | fin({2*n - 2});
829 template<
class Iterator>
834 for (Iterator i = begin; i != end; ++i)
838 for (
unsigned ni = *i; ni > 0; --ni)
840 auto pair = inf(m) & fin({f});
841 std::swap(pair, res);
842 res |= std::move(pair);
857 return parity(
true, is_odd, sets);
861 return parity_max(
true, sets);
865 return parity_max(
false, sets);
869 return parity(
false, is_odd, sets);
873 return parity_min(
true, sets);
877 return parity_min(
false, sets);
902 if (is_t() || r.
is_f())
907 if (is_f() || r.
is_t())
909 unsigned s = size() - 1;
910 unsigned rs = r.size() - 1;
913 if (((*
this)[s].sub.op == acc_op::Inf
914 && r[rs].sub.op == acc_op::Inf)
915 || ((*
this)[s].sub.op == acc_op::InfNeg
916 && r[rs].sub.op == acc_op::InfNeg))
918 (*this)[s - 1].mark |= r[rs - 1].mark;
928 if ((*
this)[s].sub.op == acc_op::And)
930 auto start = &(*this)[s] - (*this)[s].sub.size;
931 auto pos = &(*this)[s] - 1;
935 if (pos->sub.op == acc_op::Inf)
940 pos -= pos->sub.size + 1;
943 else if ((*
this)[s].sub.op == acc_op::Inf)
945 left_inf = &(*this)[s - 1];
948 const acc_word* right_inf =
nullptr;
949 auto right_end = &r.back();
950 if (right_end->sub.op == acc_op::And)
953 auto pos = --right_end;
956 if (pos->sub.op == acc_op::Inf)
961 pos -= pos->sub.size + 1;
964 else if (right_end->sub.op == acc_op::Inf)
966 right_inf = right_end - 1;
970 if (left_inf && right_inf)
972 carry = left_inf->mark;
973 auto pos = left_inf - &(*this)[0];
974 erase(begin() + pos, begin() + pos + 2);
977 insert(end(), &r[0], right_end + 1);
979 (*this)[sz + (right_inf - &r[0])].mark |= carry;
982 w.sub.op = acc_op::And;
1009 if (is_t() || r.
is_f())
1011 if (is_f() || r.
is_t())
1016 unsigned s = size() - 1;
1017 unsigned rs = r.size() - 1;
1019 if (((*
this)[s].sub.op == acc_op::Fin
1020 && r[rs].sub.op == acc_op::Fin)
1021 || ((*
this)[s].sub.op == acc_op::FinNeg
1022 && r[rs].sub.op == acc_op::FinNeg))
1024 (*this)[s - 1].mark |= r[rs - 1].mark;
1034 if ((*
this)[s].sub.op == acc_op::Or)
1036 auto start = &(*this)[s] - (*this)[s].sub.size;
1037 auto pos = &(*this)[s] - 1;
1041 if (pos->sub.op == acc_op::Fin)
1046 pos -= pos->sub.size + 1;
1049 else if ((*
this)[s].sub.op == acc_op::Fin)
1051 left_fin = &(*this)[s - 1];
1054 const acc_word* right_fin =
nullptr;
1055 auto right_end = &r.back();
1056 if (right_end->sub.op == acc_op::Or)
1059 auto pos = --right_end;
1062 if (pos->sub.op == acc_op::Fin)
1064 right_fin = pos - 1;
1067 pos -= pos->sub.size + 1;
1070 else if (right_end->sub.op == acc_op::Fin)
1072 right_fin = right_end - 1;
1076 if (left_fin && right_fin)
1078 carry = left_fin->mark;
1079 auto pos = (left_fin - &(*this)[0]);
1080 this->erase(begin() + pos, begin() + pos + 2);
1083 insert(end(), &r[0], right_end + 1);
1085 (*this)[sz + (right_fin - &r[0])].mark |= carry;
1087 w.sub.op = acc_op::Or;
1088 w.sub.size = size();
1118 if (SPOT_UNLIKELY(sets >= mark_t::max_accsets()))
1119 report_too_many_sets();
1122 unsigned pos = size();
1125 switch ((*
this)[pos - 1].sub.op)
1127 case acc_cond::acc_op::And:
1128 case acc_cond::acc_op::Or:
1131 case acc_cond::acc_op::Inf:
1132 case acc_cond::acc_op::InfNeg:
1133 case acc_cond::acc_op::Fin:
1134 case acc_cond::acc_op::FinNeg:
1136 (*this)[pos].mark <<= sets;
1298 std::tuple<int, acc_cond::acc_code, acc_cond::acc_code>
1313 std::vector<std::vector<int>>
1339 mark_t always_present)
const;
1390 std::vector<std::pair<acc_cond::mark_t, acc_cond::mark_t>>
1410 std::function<
void(std::ostream&,
int)>
1411 set_printer =
nullptr)
const;
1419 std::function<
void(std::ostream&,
int)>
1420 set_printer =
nullptr)
const;
1428 std::function<
void(std::ostream&,
int)>
1429 set_printer =
nullptr)
const;
1464 : std::vector<
acc_word>(other - other->sub.size, other + 1)
1481 : num_(0U), all_({}), code_(code)
1484 uses_fin_acceptance_ = check_fin_acceptance();
1492 : num_(0
U), all_({}), code_(code)
1494 add_sets(code.used_sets().max_set());
1495 uses_fin_acceptance_ = check_fin_acceptance();
1500 : num_(o.num_), all_(o.all_), code_(o.code_),
1501 uses_fin_acceptance_(o.uses_fin_acceptance_)
1511 uses_fin_acceptance_ = o.uses_fin_acceptance_;
1525 uses_fin_acceptance_ = check_fin_acceptance();
1540 bool operator==(
const acc_cond& other)
const
1545 bool operator!=(
const acc_cond& other)
const
1547 return !(*
this == other);
1553 return uses_fin_acceptance_;
1559 return code_.is_t();
1568 return num_ == 0 && is_t();
1574 return code_.is_f();
1583 return num_ == 0 && is_f();
1592 unsigned s = code_.size();
1594 s == 2 && code_[1].sub.op == acc_op::Inf && code_[0].mark == all_sets();
1603 return num_ == 1 && is_generalized_co_buchi();
1610 set_acceptance(inf(all_sets()));
1617 set_acceptance(fin(all_sets()));
1626 unsigned s = code_.size();
1627 return (s == 0 && num_ == 0) || (s == 2 && code_[1].sub.op == acc_op::Inf
1628 && code_[0].mark == all_sets());
1637 unsigned s = code_.size();
1639 code_[1].sub.op == acc_op::Fin && code_[0].mark == all_sets());
1692 bool operator==(
rs_pair o)
const
1694 return fin == o.fin && inf == o.inf;
1696 bool operator!=(
rs_pair o)
const
1698 return fin != o.fin || inf != o.inf;
1700 bool operator<(
rs_pair o)
const
1702 return fin < o.fin || (!(o.fin < fin) && inf < o.inf);
1704 bool operator<=(
rs_pair o)
const
1706 return !(o < *
this);
1708 bool operator>(
rs_pair o)
const
1712 bool operator>=(
rs_pair o)
const
1714 return !(*
this < o);
1775 bool is_parity(
bool& max,
bool& odd,
bool equiv =
false)
const;
1784 return is_parity(max, odd);
1796 return acc_cond(num_, code_.unit_propagation());
1802 std::pair<bool, acc_cond::mark_t> unsat_mark()
const
1804 return sat_unsat_mark(
false);
1809 std::pair<bool, acc_cond::mark_t> sat_mark()
const
1811 return sat_unsat_mark(
true);
1815 bool check_fin_acceptance()
const;
1816 std::pair<bool, acc_cond::mark_t> sat_unsat_mark(
bool)
const;
1829 return acc_code::inf(mark);
1834 return inf(
mark_t(vals.begin(), vals.end()));
1856 return acc_code::inf_neg(mark);
1861 return inf_neg(
mark_t(vals.begin(), vals.end()));
1874 return acc_code::fin(mark);
1879 return fin(
mark_t(vals.begin(), vals.end()));
1901 return acc_code::fin_neg(mark);
1906 return fin_neg(
mark_t(vals.begin(), vals.end()));
1920 if (num > mark_t::max_accsets())
1921 report_too_many_sets();
1940 SPOT_ASSERT(u < num_sets());
1963 return code_.accepting(inf);
1973 return code_.inf_satisfiable(inf);
1989 return code_.maybe_accepting(infinitely_often, always_present);
2009 std::ostream& format(std::ostream& os,
mark_t m)
const
2018 std::
string format(mark_t m)
const
2020 std::ostringstream os;
2039 template<
class iterator>
2043 for (
unsigned x = 0; x < num_; ++x)
2048 auto all = comp(u |
mark_t({x}));
2051 for (iterator y = begin; y != end; ++y)
2081 return {num_sets(), code_.
remove(rem, missing)};
2091 { num_sets() - (all_sets() & rem).count(), code_.
strip(rem, missing) };
2097 return {num_sets(), code_.
force_inf(m)};
2104 return {num_sets(), code_.
remove(all_sets() - rem,
true)};
2118 std::string
name(
const char* fmt =
"alo")
const;
2133 return code_.fin_unit();
2149 return code_.inf_unit();
2158 return code_.fin_one();
2183 auto [f, c] = code_.fin_one_extract();
2184 return {f, {num_sets(), std::move(c)}};
2203 std::tuple<int, acc_cond, acc_cond>
2206 auto [f, l, r] = code_.fin_unit_one_split();
2207 return {f, {num_sets(), std::move(l)}, {num_sets(), std::move(r)}};
2239 bool uses_fin_acceptance_ =
false;
2244 typedef std::vector<acc_cond::rs_pair> rs_pairs;
2248 : pairs_(p), view_marks_(m) {}
2274 return !visible(p.inf) && visible(p.fin) ? p.fin
2283 return !visible(p.fin) && visible(p.inf) ? p.inf
2291 for (
const auto& p: pairs_)
2292 if (p.fin.has(mark) && visible(p.fin) && visible(p.inf))
2297 const rs_pairs& pairs()
const
2303 template<
typename filter>
2307 for (
const auto& p: pairs_)
2314 return !!(view_marks_ & v);
2317 const rs_pairs& pairs_;
2323 std::ostream& operator<<(std::ostream& os,
const acc_cond& acc);
2332 typedef unsigned value_type;
2333 typedef const value_type& reference;
2334 typedef const value_type* pointer;
2335 typedef std::ptrdiff_t difference_type;
2336 typedef std::forward_iterator_tag iterator_category;
2358 value_type operator*()
const
2361 return m_.min_set() - 1;
2366 m_.clear(this->
operator*());
2410 struct hash<
spot::acc_cond::mark_t>
An acceptance condition.
Definition: acc.hh:62
bool inf_satisfiable(mark_t inf) const
Assuming that we will visit at least all sets in inf, is there any chance that we will satisfy the co...
Definition: acc.hh:1971
mark_t all_sets() const
Construct a mark_t with all declared sets.
Definition: acc.hh:1954
static acc_code fin_neg(mark_t mark)
Construct a generalized co-Büchi acceptance for complemented sets.
Definition: acc.hh:1899
static acc_code inf_neg(mark_t mark)
Construct a generalized Büchi acceptance for complemented sets.
Definition: acc.hh:1854
acc_cond unit_propagation()
Remove superfluous Fin and Inf by unit propagation.
Definition: acc.hh:1794
void set_generalized_co_buchi()
Change the acceptance condition to generalized-co-Büchi, over all declared sets.
Definition: acc.hh:1615
const acc_code & get_acceptance() const
Retrieve the acceptance formula.
Definition: acc.hh:1529
static acc_code fin(mark_t mark)
Construct a generalized co-Büchi acceptance.
Definition: acc.hh:1872
bool is_co_buchi() const
Whether the acceptance condition is "co-Büchi".
Definition: acc.hh:1601
bool accepting(mark_t inf) const
Check whether visiting exactly all sets inf infinitely often satisfies the acceptance condition.
Definition: acc.hh:1961
static acc_code inf(mark_t mark)
Construct a generalized Büchi acceptance.
Definition: acc.hh:1827
bool is_generalized_buchi() const
Whether the acceptance condition is "generalized-Büchi".
Definition: acc.hh:1624
static acc_code fin_neg(std::initializer_list< unsigned > vals)
Construct a generalized co-Büchi acceptance for complemented sets.
Definition: acc.hh:1904
static acc_code inf(std::initializer_list< unsigned > vals)
Construct a generalized Büchi acceptance.
Definition: acc.hh:1832
unsigned add_set()
Add a single set to the acceptance condition.
Definition: acc.hh:1932
bool is_parity(bool &max, bool &odd, bool equiv=false) const
check is the acceptance condition matches one of the four type of parity acceptance defined in the HO...
mark_t mark(unsigned u) const
Build a mark_t with a single set.
Definition: acc.hh:1938
void set_generalized_buchi()
Change the acceptance condition to generalized-Büchi, over all declared sets.
Definition: acc.hh:1608
acc_cond force_inf(mark_t m) const
For all x in m, replaces Fin(x) by false.
Definition: acc.hh:2095
acc_cond remove(mark_t rem, bool missing) const
Remove all the acceptance sets in rem.
Definition: acc.hh:2079
std::tuple< int, acc_cond, acc_cond > fin_unit_one_split() const
Split an acceptance condition, trying to select one unit-Fin.
Definition: acc.hh:2204
acc_op
Operators for acceptance formulas.
Definition: acc.hh:447
acc_cond(unsigned n_sets=0, const acc_code &code={})
Build an acceptance condition.
Definition: acc.hh:1480
unsigned add_sets(unsigned num)
Add more sets to the acceptance condition.
Definition: acc.hh:1914
bool is_parity() const
check is the acceptance condition matches one of the four type of parity acceptance defined in the HO...
Definition: acc.hh:1780
bool is_t() const
Whether the acceptance formula is "t" (true)
Definition: acc.hh:1557
bool is_generalized_rabin(std::vector< unsigned > &pairs) const
Is the acceptance condition generalized-Rabin?
mark_t comp(const mark_t &l) const
Complement a mark_t.
Definition: acc.hh:1948
std::vector< acc_cond > top_conjuncts() const
Return the top-level conjuncts.
std::pair< int, acc_cond > fin_one_extract() const
Return one acceptance set i that appears as Fin(i) in the condition, and all disjuncts containing it ...
Definition: acc.hh:2181
static acc_code fin(std::initializer_list< unsigned > vals)
Construct a generalized co-Büchi acceptance.
Definition: acc.hh:1877
bool is_generalized_co_buchi() const
Whether the acceptance condition is "generalized-co-Büchi".
Definition: acc.hh:1635
acc_cond restrict_to(mark_t rem) const
Restrict an acceptance condition to a subset of set numbers that are occurring at some point.
Definition: acc.hh:2102
trival maybe_accepting(mark_t infinitely_often, mark_t always_present) const
Check potential acceptance of an SCC.
Definition: acc.hh:1987
std::string name(const char *fmt="alo") const
Return the name of this acceptance condition, in the specified format.
bool is_none() const
Whether the acceptance condition is "none".
Definition: acc.hh:1581
void set_acceptance(const acc_code &code)
Change the acceptance formula.
Definition: acc.hh:1522
int is_rabin() const
Check if the acceptance condition matches the Rabin acceptance of the HOA format.
bool is_rabin_like(std::vector< rs_pair > &pairs) const
Test whether an acceptance condition is Rabin-like and returns each Rabin pair in an std::vector<rs_p...
mark_t accepting_sets(mark_t inf) const
Return an accepting subset of inf.
bool is_all() const
Whether the acceptance condition is "all".
Definition: acc.hh:1566
acc_cond strip(mark_t rem, bool missing) const
Remove acceptance sets, and shift set numbers.
Definition: acc.hh:2088
int fin_one() const
Return one acceptance set i that appear as Fin(i) in the condition.
Definition: acc.hh:2156
mark_t useless(iterator begin, iterator end) const
Compute useless acceptance sets given a list of mark_t that occur in an SCC.
Definition: acc.hh:2040
int is_streett() const
Check if the acceptance condition matches the Streett acceptance of the HOA format.
mark_t fin_unit() const
Find a Fin(i) that is a unit clause.
Definition: acc.hh:2131
acc_code & get_acceptance()
Retrieve the acceptance formula.
Definition: acc.hh:1535
bool is_generalized_streett(std::vector< unsigned > &pairs) const
Is the acceptance condition generalized-Streett?
acc_cond(const acc_code &code)
Build an acceptance condition.
Definition: acc.hh:1491
acc_cond(const acc_cond &o)
Copy an acceptance condition.
Definition: acc.hh:1499
acc_cond & operator=(const acc_cond &o)
Copy an acceptance condition.
Definition: acc.hh:1506
static acc_code inf_neg(std::initializer_list< unsigned > vals)
Construct a generalized Büchi acceptance for complemented sets.
Definition: acc.hh:1859
bool is_streett_like(std::vector< rs_pair > &pairs) const
Test whether an acceptance condition is Streett-like and returns each Streett pair in an std::vector<...
bool is_buchi() const
Whether the acceptance condition is "Büchi".
Definition: acc.hh:1590
mark_t inf_unit() const
Find a Inf(i) that is a unit clause.
Definition: acc.hh:2147
bool uses_fin_acceptance() const
Whether the acceptance condition uses Fin terms.
Definition: acc.hh:1551
bool is_f() const
Whether the acceptance formula is "f" (false)
Definition: acc.hh:1572
unsigned num_sets() const
The number of sets used in the acceptance condition.
Definition: acc.hh:2027
std::vector< acc_cond > top_disjuncts() const
Return the top-level disjuncts.
A class implementing Kleene's three-valued logic.
Definition: trival.hh:34
op
Operator types.
Definition: formula.hh:79
@ And
(omega-Rational) And
Definition: automata.hh:27
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:131
An acceptance formula.
Definition: acc.hh:479
std::vector< std::pair< acc_cond::mark_t, acc_cond::mark_t > > useless_colors_patterns() const
Find patterns of useless colors.
std::tuple< int, acc_cond::acc_code, acc_cond::acc_code > fin_unit_one_split() const
Split an acceptance condition, trying to select one unit-Fin.
static acc_code parity_max(bool is_odd, unsigned sets)
Build a parity acceptance condition.
Definition: acc.hh:855
static acc_code inf(mark_t m)
Construct a generalized Büchi acceptance.
Definition: acc.hh:695
acc_code to_cnf() const
Convert the acceptance formula into disjunctive normal form.
acc_code operator&(acc_code &&r) const
Conjunct the current condition with r.
Definition: acc.hh:998
acc_code force_inf(mark_t m) const
For all x in m, replaces Fin(x) by false.
std::ostream & to_html(std::ostream &os, std::function< void(std::ostream &, int)> set_printer=nullptr) const
Print the acceptance formula as HTML.
static acc_code inf_neg(std::initializer_list< unsigned > vals)
Construct a generalized Büchi acceptance for complemented sets.
Definition: acc.hh:737
std::vector< acc_code > top_disjuncts() const
Return the top-level disjuncts.
trival maybe_accepting(mark_t infinitely_often, mark_t always_present) const
Check potential acceptance of an SCC.
acc_code operator|(const acc_code &r) const
Disjunct the current condition with r.
Definition: acc.hh:1104
std::vector< std::vector< int > > missing(mark_t inf, bool accepting) const
Help closing accepting or rejecting cycle.
acc_code operator|(acc_code &&r) const
Disjunct the current condition with r.
Definition: acc.hh:1095
static acc_code fin(std::initializer_list< unsigned > vals)
Construct a generalized co-Büchi acceptance.
Definition: acc.hh:649
bool is_dnf() const
Whether the acceptance formula is in disjunctive normal form.
acc_code operator&(const acc_code &r) const
Conjunct the current condition with r.
Definition: acc.hh:989
static acc_code inf(std::initializer_list< unsigned > vals)
Construct a generalized Büchi acceptance.
Definition: acc.hh:705
static acc_code parity_min_even(unsigned sets)
Build a parity acceptance condition.
Definition: acc.hh:875
static acc_code parity(bool is_max, bool is_odd, unsigned sets)
Build a parity acceptance condition.
std::pair< acc_cond::mark_t, acc_cond::mark_t > used_inf_fin_sets() const
Return the sets used as Inf or Fin in the acceptance condition.
mark_t used_once_sets() const
Return the sets that appears only once in the acceptance.
bool is_f() const
Is this the "false" acceptance condition?
Definition: acc.hh:599
std::ostream & to_text(std::ostream &os, std::function< void(std::ostream &, int)> set_printer=nullptr) const
Print the acceptance formula as text.
static acc_code generalized_buchi(unsigned n)
Build a generalized-Büchi acceptance condition with n sets.
Definition: acc.hh:764
static acc_code parity_min_odd(unsigned sets)
Build a parity acceptance condition.
Definition: acc.hh:871
acc_code(const acc_word *other)
Copy a part of another acceptance formula.
Definition: acc.hh:1463
mark_t fin_unit() const
Find a Fin(i) that is a unit clause.
static acc_code parity_max_even(unsigned sets)
Build a parity acceptance condition.
Definition: acc.hh:863
static acc_code f()
Construct the "false" acceptance condition.
Definition: acc.hh:613
bool accepting(mark_t inf) const
Check whether visiting exactly all sets inf infinitely often satisfies the acceptance condition.
friend std::ostream & operator<<(std::ostream &os, const acc_code &code)
prints the acceptance formula as text
static acc_code parity_max_odd(unsigned sets)
Build a parity acceptance condition.
Definition: acc.hh:859
bool is_t() const
Is this the "true" acceptance condition?
Definition: acc.hh:585
acc_code operator<<(unsigned sets) const
Apply a left shift to all mark_t that appear in the condition.
Definition: acc.hh:1147
static acc_code random(unsigned n, double reuse=0.0)
Build a random acceptance condition.
static acc_code rabin(unsigned n)
Build a Rabin condition with n pairs.
Definition: acc.hh:791
acc_code()
Build an empty acceptance formula.
Definition: acc.hh:1458
static acc_code cobuchi()
Build a co-Büchi acceptance condition.
Definition: acc.hh:754
acc_code complement() const
Complement an acceptance formula.
static acc_code inf_neg(mark_t m)
Construct a generalized Büchi acceptance for complemented sets.
Definition: acc.hh:727
bdd to_bdd(const bdd *map) const
Convert the acceptance formula into a BDD.
int fin_one() const
Return one acceptance set i that appears as Fin(i) in the condition.
acc_cond::mark_t used_sets() const
Return the set of sets appearing in the condition.
acc_code strip(acc_cond::mark_t rem, bool missing) const
Remove acceptance sets, and shift set numbers.
acc_code(const char *input)
Construct an acc_code from a string.
static acc_code fin_neg(std::initializer_list< unsigned > vals)
Construct a generalized co-Büchi acceptance for complemented sets.
Definition: acc.hh:681
acc_code & operator<<=(unsigned sets)
Apply a left shift to all mark_t that appear in the condition.
Definition: acc.hh:1116
mark_t inf_unit() const
Find a Inf(i) that is a unit clause.
static acc_code streett(unsigned n)
Build a Streett condition with n pairs.
Definition: acc.hh:806
std::vector< acc_code > top_conjuncts() const
Return the top-level conjuncts.
static acc_code t()
Construct the "true" acceptance condition.
Definition: acc.hh:627
static acc_code fin_neg(mark_t m)
Construct a generalized co-Büchi acceptance for complemented sets.
Definition: acc.hh:671
static acc_code parity_min(bool is_odd, unsigned sets)
Build a parity acceptance condition.
Definition: acc.hh:867
std::pair< int, acc_code > fin_one_extract() const
Return one acceptance set i that appears as Fin(i) in the condition, and all disjuncts containing it ...
static acc_code fin(mark_t m)
Construct a generalized co-Büchi acceptance.
Definition: acc.hh:639
bool inf_satisfiable(mark_t inf) const
Assuming that we will visit at least all sets in inf, is there any chance that we will satisfy the co...
bool is_cnf() const
Whether the acceptance formula is in conjunctive normal form.
static acc_code buchi()
Build a Büchi acceptance condition.
Definition: acc.hh:746
static acc_code generalized_co_buchi(unsigned n)
Build a generalized-co-Büchi acceptance condition with n sets.
Definition: acc.hh:778
std::vector< unsigned > symmetries() const
compute the symmetry class of the acceptance sets.
acc_code remove(acc_cond::mark_t rem, bool missing) const
Remove all the acceptance sets in rem.
acc_code to_dnf() const
Convert the acceptance formula into disjunctive normal form.
static acc_code generalized_rabin(Iterator begin, Iterator end)
Build a generalized Rabin condition.
Definition: acc.hh:830
acc_code & operator|=(const acc_code &r)
Disjunct the current condition in place with r.
Definition: acc.hh:1007
acc_code & operator&=(const acc_code &r)
Conjunct the current condition in place with r.
Definition: acc.hh:900
std::ostream & to_latex(std::ostream &os, std::function< void(std::ostream &, int)> set_printer=nullptr) const
Print the acceptance formula as LaTeX.
An acceptance mark.
Definition: acc.hh:85
bool is_singleton() const
Whether the mark contains only one bit set.
Definition: acc.hh:385
mark_t lowest() const
A mark_t where all bits have been removed except the lowest one.
Definition: acc.hh:379
unsigned max_set() const
The number of the highest set used plus one.
Definition: acc.hh:355
mark_t & remove_some(unsigned n)
Remove n bits that where set.
Definition: acc.hh:409
constexpr static unsigned max_accsets()
The maximum number of acceptance sets supported by this implementation.
Definition: acc.hh:138
static mark_t all()
A mark_t with all bits set to one.
Definition: acc.hh:148
spot::internal::mark_container sets() const
Returns some iterable object that contains the used sets.
Definition: acc.hh:2401
bool proper_subset(mark_t m) const
Whether the set of bits represented by *this is a proper subset of those represented by m.
Definition: acc.hh:340
mark_t(const iterator &begin, const iterator &end)
Create a mark_t from a range of set numbers.
Definition: acc.hh:103
unsigned count() const
Number of bits sets.
Definition: acc.hh:346
mark_t()=default
Initialize an empty mark_t.
mark_t(std::initializer_list< unsigned > vals)
Create a mark_t from a list of set numbers.
Definition: acc.hh:114
bool has_many() const
Whether the mark contains at least two bits set.
Definition: acc.hh:396
unsigned min_set() const
The number of the lowest set used plus one.
Definition: acc.hh:367
bool subset(mark_t m) const
Whether the set of bits represented by *this is a subset of those represented by m.
Definition: acc.hh:333
void fill(iterator here) const
Fill a container with the indices of the bits that are set.
Definition: acc.hh:418
Rabin/streett pairs used by is_rabin_like and is_streett_like.
Definition: acc.hh:1678
A "node" in an acceptance formulas.
Definition: acc.hh:457