spot  2.16
twa.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 <cstddef>
22 #include <spot/twa/fwd.hh>
23 #include <spot/twa/acc.hh>
24 #include <spot/twa/bdddict.hh>
25 #include <cassert>
26 #include <memory>
27 #include <unordered_map>
28 #include <functional>
29 #include <array>
30 #include <vector>
31 #include <spot/misc/casts.hh>
32 #include <spot/misc/hash.hh>
33 #include <spot/tl/formula.hh>
34 #include <spot/misc/trival.hh>
35 
36 namespace spot
37 {
38  struct twa_run;
41  typedef std::shared_ptr<twa_run> twa_run_ptr;
42 
43  struct twa_word;
44  typedef std::shared_ptr<twa_word> twa_word_ptr;
45 
48  class SPOT_API state
49  {
50  public:
61  virtual int compare(const state* other) const = 0;
62 
82  virtual size_t hash() const = 0;
83 
85  virtual state* clone() const = 0;
86 
96  virtual void destroy() const
97  {
98  delete this;
99  }
100 
101  protected:
108  virtual ~state()
109  {
110  }
111  };
112 
118 #ifndef SWIG
126 #endif // !defined SWIG
128  {
130  bool
131  operator()(const state* left, const state* right) const
132  {
133  SPOT_ASSERT(left);
134  return left->compare(right) < 0;
135  }
136  };
137 
143 #ifndef SWIG
152 #endif // !defined SWIG
154  {
156  bool
157  operator()(const state* left, const state* right) const
158  {
159  SPOT_ASSERT(left);
160  return 0 == left->compare(right);
161  }
162  };
163 
170 #ifndef SWIG
179 #endif // !defined SWIG
181  {
183  size_t
184  operator()(const state* that) const
185  {
186  SPOT_ASSERT(that);
187  return that->hash();
188  }
189  };
190 
196  typedef std::unordered_set<const state*,
198 
202  template<class val>
203  using state_map = std::unordered_map<const state*, val,
205 
208  class SPOT_API state_unicity_table
209  {
210  state_set m;
211  public:
212 
221  const state* operator()(const state* s)
222  {
223  auto p = m.insert(s);
224  if (!p.second)
225  s->destroy();
226  return *p.first;
227  }
228 
233  const state* is_new(const state* s)
234  {
235  auto p = m.insert(s);
236  if (!p.second)
237  {
238  s->destroy();
239  return nullptr;
240  }
241  return *p.first;
242  }
243 
245  {
246  for (state_set::iterator i = m.begin(); i != m.end();)
247  {
248  // Advance the iterator before destroying its key. This
249  // avoids issues with old g++ implementations.
250  state_set::iterator old = i++;
251  (*old)->destroy();
252  }
253  }
254 
256  size_t
258  {
259  return m.size();
260  }
261  };
262 
263  // Functions related to shared_ptr.
265 
272  typedef std::shared_ptr<const state> shared_state;
273 
283  inline void shared_state_deleter(state* s) { s->destroy(); }
284 
290 #ifndef SWIG
298 #endif // !defined SWIG
300  {
302  bool
304  shared_state right) const
305  {
306  SPOT_ASSERT(left);
307  return left->compare(right.get()) < 0;
308  }
309  };
310 
316 #ifndef SWIG
328 #endif // !defined SWIG
330  {
332  bool
334  shared_state right) const
335  {
336  SPOT_ASSERT(left);
337  return 0 == left->compare(right.get());
338  }
339  };
340 
347 #ifndef SWIG
359 #endif // !defined SWIG
361  {
363  size_t
365  {
366  SPOT_ASSERT(that);
367  return that->hash();
368  }
369  };
370 
372  typedef std::unordered_set<shared_state,
373  state_shared_ptr_hash,
375 
424  class SPOT_API twa_succ_iterator
425  {
426  public:
427  virtual
429  {
430  }
431 
434 
449  virtual bool first() = 0;
450 
461  virtual bool next() = 0;
462 
478  virtual bool done() const = 0;
479 
481 
484 
494  virtual const state* dst() const = 0;
498  virtual bdd cond() const = 0;
501  virtual acc_cond::mark_t acc() const = 0;
502 
504  };
505 
506  namespace internal
507  {
513  struct SPOT_API succ_iterator
514  {
515  protected:
516  twa_succ_iterator* it_;
517  public:
518 
519  succ_iterator(twa_succ_iterator* it):
520  it_(it)
521  {
522  }
523 
524  bool operator==(succ_iterator o) const
525  {
526  return it_ == o.it_;
527  }
528 
529  bool operator!=(succ_iterator o) const
530  {
531  return it_ != o.it_;
532  }
533 
534  const twa_succ_iterator* operator*() const
535  {
536  return it_;
537  }
538 
539  void operator++()
540  {
541  if (!it_->next())
542  it_ = nullptr;
543  }
544  };
545 
546 #ifndef SWIG
552  class twa_succ_iterable
553  {
554  protected:
555  const twa* aut_;
556  twa_succ_iterator* it_;
557  public:
558  twa_succ_iterable(const twa* aut, twa_succ_iterator* it)
559  : aut_(aut), it_(it)
560  {
561  }
562 
563  twa_succ_iterable(twa_succ_iterable&& other) noexcept
564  : aut_(other.aut_), it_(other.it_)
565  {
566  other.it_ = nullptr;
567  }
568 
569  ~twa_succ_iterable(); // Defined in this file after twa
570 
571  internal::succ_iterator begin()
572  {
573  return it_->first() ? it_ : nullptr;
574  }
575 
576  internal::succ_iterator end()
577  {
578  return nullptr;
579  }
580  };
581 #endif // SWIG
582  }
583 
591 
594 
647  class SPOT_API twa: public std::enable_shared_from_this<twa>
648  {
649  protected:
651  twa(const bdd_dict_ptr& d);
656  public:
657 
658  virtual ~twa();
659 
665  virtual const state* get_init_state() const = 0;
666 
674  virtual twa_succ_iterator*
675  succ_iter(const state* local_state) const = 0;
676 
677 #ifndef SWIG
701  internal::twa_succ_iterable
702  succ(const state* s) const
703  {
704  return {this, succ_iter(s)};
705  }
706  #endif
707 
713  {
714  if (iter_cache_)
715  delete i;
716  else
717  iter_cache_ = i;
718  }
719 
737  {
738  return dict_;
739  }
740 
754  {
755  int res = dict_->has_registered_proposition(ap, this);
756  if (res < 0)
757  {
758  aps_.emplace_back(ap);
759  res = dict_->register_proposition(ap, this);
760  bddaps_ &= bdd_ithvar(res);
761  }
762  return res;
763  }
764 
765  int register_ap(std::string ap)
766  {
767  return register_ap(formula::ap(ap));
768  }
770 
774  void unregister_ap(int num);
775 
788  {
789  if (!aps_.empty())
790  throw std::runtime_error("register_aps_from_dict() may not be"
791  " called on an automaton that has already"
792  " registered some AP");
793  auto& m = get_dict()->bdd_map;
794  unsigned s = m.size();
795  for (unsigned n = 0; n < s; ++n)
796  if (m[n].refs.contains(this))
797  {
798  aps_.emplace_back(m[n].f);
799  bddaps_ &= bdd_ithvar(n);
800  }
801  }
802 
805  const std::vector<formula>& ap() const
806  {
807  return aps_;
808  }
809 
811  bdd ap_vars() const
812  {
813  return bddaps_;
814  }
815 
822  virtual std::string format_state(const state* s) const = 0;
823 
837  virtual state* project_state(const state* s,
838  const const_twa_ptr& t) const;
839 
842  const acc_cond& acc() const
843  {
844  return acc_;
845  }
846 
848  {
849  return acc_;
850  }
852 
862  virtual bool is_empty() const;
863 
875  virtual twa_run_ptr accepting_run() const;
876 
888  virtual twa_word_ptr accepting_word() const;
889 
896  virtual bool intersects(const_twa_ptr other) const;
897 
903  virtual bool intersects(const_twa_word_ptr w) const;
904 
916 
921 
932 
943 
944  private:
945  acc_cond acc_;
946 
947  public:
949  unsigned num_sets() const
950  {
951  return acc_.num_sets();
952  }
953 
956  {
957  return acc_.get_acceptance();
958  }
959 
964  void set_acceptance(unsigned num, const acc_cond::acc_code& c)
965  {
966  acc_ = acc_cond(num, c);
967  }
968 
972  void set_acceptance(const acc_cond& c)
973  {
974  acc_ = c;
975  }
976 
979  {
980  acc_ = a->acc();
981  }
982 
984  void copy_ap_of(const const_twa_ptr& a)
985  {
986  for (auto f: a->ap())
987  this->register_ap(f);
988  }
989 
992 
1005  void set_generalized_buchi(unsigned num)
1006  {
1008  }
1009 
1022  void set_generalized_co_buchi(unsigned num)
1023  {
1025  }
1026 
1043  {
1044  acc_ = acc_cond(1, acc_cond::acc_code::buchi());
1045  return {0};
1046  }
1047 
1064  {
1066  return {0};
1067  }
1068 
1069  private:
1070  std::vector<formula> aps_;
1071  bdd bddaps_;
1072 
1074  struct bprop
1075  {
1076  trival::repr_t state_based_acc:2; // State-based acceptance.
1077  trival::repr_t inherently_weak:2; // Inherently Weak automaton.
1078  trival::repr_t weak:2; // Weak automaton.
1079  trival::repr_t terminal:2; // Terminal automaton.
1080  trival::repr_t universal:2; // Universal automaton.
1081  trival::repr_t unambiguous:2; // Unambiguous automaton.
1082  trival::repr_t stutter_invariant:2; // Stutter invariant language.
1083  trival::repr_t very_weak:2; // very-weak, or 1-weak
1084  trival::repr_t semi_deterministic:2; // semi-deterministic automaton.
1085  trival::repr_t complete:2; // Complete automaton.
1086  };
1087  union
1088  {
1089  unsigned props;
1090  bprop is;
1091  };
1092 
1093  protected:
1094 #ifndef SWIG
1098  std::unordered_map<std::string,
1099  std::pair<void*,
1100  std::function<void(void*)>>> named_prop_;
1101 #endif
1106  void* get_named_prop_(std::string s) const;
1107 
1108  public:
1109 
1110 #ifndef SWIG
1126  void set_named_prop(std::string s,
1127  void* val, std::function<void(void*)> destructor);
1128 
1144  template<typename T>
1145  void set_named_prop(std::string s, T* val)
1146  {
1147  set_named_prop(s, val,
1148  [](void *p) noexcept { delete static_cast<T*>(p); });
1149  }
1150 
1161  void set_named_prop(std::string s, std::nullptr_t);
1162 
1178  template<typename T>
1179  T* get_named_prop(std::string s) const
1180  {
1181  if (void* p = get_named_prop_(s))
1182  return static_cast<T*>(p);
1183  else
1184  return nullptr;
1185  }
1186 
1199  template<typename T>
1200  T* get_or_set_named_prop(std::string s)
1201  {
1202  if (void* p = get_named_prop_(s))
1203  return static_cast<T*>(p);
1204 
1205  auto tmp = new T;
1206  set_named_prop(s, tmp);
1207  return tmp;
1208  }
1209 
1210 #endif
1211 
1217  {
1218  // Destroy all named properties.
1219  for (auto& np: named_prop_)
1220  np.second.second(np.second.first);
1221  named_prop_.clear();
1222  }
1223 
1231  {
1232  if (num_sets() == 0)
1233  return trival(true);
1234  return trival::from_repr_t(is.state_based_acc);
1235  }
1236 
1242  {
1243  is.state_based_acc = val.val();
1244  }
1245 
1250  trival is_sba() const
1251  {
1252  return prop_state_acc() && acc().is_buchi();
1253  }
1254 
1264  {
1265  return trival::from_repr_t(is.inherently_weak);
1266  }
1267 
1276  {
1277  is.inherently_weak = val.val();
1278  if (!val)
1279  is.very_weak = is.terminal = is.weak = val.val();
1280  }
1281 
1294  {
1295  return trival::from_repr_t(is.terminal);
1296  }
1297 
1306  {
1307  is.terminal = val.val();
1308  if (val)
1309  is.inherently_weak = is.weak = val.val();
1310  }
1311 
1320  {
1321  return trival::from_repr_t(is.weak);
1322  }
1323 
1332  void prop_weak(trival val)
1333  {
1334  is.weak = val.val();
1335  if (val)
1336  is.inherently_weak = val.val();
1337  if (!val)
1338  is.very_weak = is.terminal = val.val();
1339  }
1340 
1350  {
1351  return trival::from_repr_t(is.very_weak);
1352  }
1353 
1362  {
1363  is.very_weak = val.val();
1364  if (val)
1365  is.weak = is.inherently_weak = val.val();
1366  }
1367 
1368 
1381  {
1382  return trival::from_repr_t(is.complete);
1383  }
1384 
1389  {
1390  is.complete = val.val();
1391  }
1392 
1405  {
1406  return trival::from_repr_t(is.universal);
1407  }
1408 
1417  {
1418  is.universal = val.val();
1419  if (val)
1420  // universal implies unambiguous and semi-deterministic
1421  is.unambiguous = is.semi_deterministic = val.val();
1422  }
1423 
1438  {
1439  return trival::from_repr_t(is.unambiguous);
1440  }
1441 
1449  {
1450  is.unambiguous = val.val();
1451  if (!val)
1452  is.universal = val.val();
1453  }
1454 
1468  {
1469  return trival::from_repr_t(is.semi_deterministic);
1470  }
1471 
1479  {
1480  is.semi_deterministic = val.val();
1481  if (!val)
1482  is.universal = val.val();
1483  }
1484 
1498  {
1499  return trival::from_repr_t(is.stutter_invariant);
1500  }
1501 
1504  {
1505  is.stutter_invariant = val.val();
1506  }
1507 
1547  struct prop_set
1548  {
1553  bool complete;
1555 
1558  : state_based(false),
1559  inherently_weak(false),
1560  deterministic(false),
1561  improve_det(false),
1562  complete(false),
1563  stutter_inv(false)
1564  {
1565  }
1566 
1578  prop_set(bool state_based,
1579  bool inherently_weak,
1580  bool deterministic,
1581  bool improve_det,
1582  bool complete,
1583  bool stutter_inv)
1584  : state_based(state_based),
1585  inherently_weak(inherently_weak),
1586  deterministic(deterministic),
1587  improve_det(improve_det),
1588  complete(complete),
1589  stutter_inv(stutter_inv)
1590  {
1591  }
1592 
1608  static prop_set all()
1609  {
1610  return { true, true, true, true, true, true };
1611  }
1612  };
1613 
1624  void prop_copy(const const_twa_ptr& other, prop_set p)
1625  {
1626  if (p.state_based)
1627  prop_state_acc(other->prop_state_acc());
1628  if (p.inherently_weak)
1629  {
1630  prop_terminal(other->prop_terminal());
1631  prop_weak(other->prop_weak());
1632  prop_very_weak(other->prop_very_weak());
1633  prop_inherently_weak(other->prop_inherently_weak());
1634  }
1635  if (p.deterministic)
1636  {
1637  prop_universal(other->prop_universal());
1638  prop_semi_deterministic(other->prop_semi_deterministic());
1639  prop_unambiguous(other->prop_unambiguous());
1640  }
1641  else if (p.improve_det)
1642  {
1643  if (other->prop_universal().is_true())
1644  {
1645  prop_universal(true);
1646  }
1647  else
1648  {
1649  if (other->prop_semi_deterministic().is_true())
1650  prop_semi_deterministic(true);
1651  if (other->prop_unambiguous().is_true())
1652  prop_unambiguous(true);
1653  }
1654  }
1655  if (p.complete)
1656  prop_complete(other->prop_complete());
1657  if (p.stutter_inv)
1658  prop_stutter_invariant(other->prop_stutter_invariant());
1659  }
1660 
1667  {
1668  if (!p.state_based)
1669  prop_state_acc(trival::maybe());
1670  if (!p.inherently_weak)
1671  {
1672  prop_terminal(trival::maybe());
1673  prop_weak(trival::maybe());
1674  prop_very_weak(trival::maybe());
1675  prop_inherently_weak(trival::maybe());
1676  }
1677  if (!p.deterministic)
1678  {
1679  if (!(p.improve_det && prop_universal().is_true()))
1680  prop_universal(trival::maybe());
1681  if (!(p.improve_det && prop_semi_deterministic().is_true()))
1682  prop_semi_deterministic(trival::maybe());
1683  if (!(p.improve_det && prop_unambiguous().is_true()))
1684  prop_unambiguous(trival::maybe());
1685  }
1686  if (!p.complete)
1687  prop_complete(trival::maybe());
1688  if (!p.stutter_inv)
1689  prop_stutter_invariant(trival::maybe());
1690  }
1691 
1696  void prop_reset()
1697  {
1698  prop_keep({});
1699  }
1700  };
1701 
1702 #ifndef SWIG
1703  namespace internal
1704  {
1705  inline twa_succ_iterable::~twa_succ_iterable()
1706  {
1707  if (it_)
1708  aut_->release_iter(it_);
1709  }
1710  }
1711 #endif // SWIG
1712 
1715 
1718 
1721 
1724 
1727 
1730 
1733 
1736 
1739 
1742 }
An acceptance condition.
Definition: acc.hh:54
const acc_code & get_acceptance() const
Retrieve the acceptance formula.
Definition: acc.hh:1601
unsigned num_sets() const
The number of sets used in the acceptance condition.
Definition: acc.hh:2128
Main class for temporal logic formula.
Definition: formula.hh:847
static formula ap(const std::string &name)
Build an atomic proposition.
Definition: formula.hh:1049
Render state pointers unique via a hash table.
Definition: twa.hh:209
size_t size()
Return the number of unique states in the table.
Definition: twa.hh:257
const state * is_new(const state *s)
Canonicalize state pointer.
Definition: twa.hh:233
const state * operator()(const state *s)
Canonicalize state pointer.
Definition: twa.hh:221
Abstract class for states.
Definition: twa.hh:49
virtual size_t hash() const =0
Hash a state.
virtual state * clone() const =0
Duplicate a state.
virtual void destroy() const
Release a state.
Definition: twa.hh:96
virtual ~state()
Destructor.
Definition: twa.hh:108
virtual int compare(const state *other) const =0
Compares two states (that come from the same automaton).
A class implementing Kleene's three-valued logic.
Definition: trival.hh:33
static constexpr trival maybe() noexcept
Return a trival representing the maybe (unknown) value.
Definition: trival.hh:71
signed char repr_t
Definition: trival.hh:37
static trival from_repr_t(repr_t v)
Construct from a raw repr_t value.
Definition: trival.hh:58
constexpr value_t val() const
Return the raw value_t enumerator.
Definition: trival.hh:101
Iterate over the successors of a state.
Definition: twa.hh:425
virtual acc_cond::mark_t acc() const =0
Get the acceptance mark of the edge leading to this successor.
virtual const state * dst() const =0
Get the destination state of the current edge.
virtual bool done() const =0
Check whether the iteration is finished.
virtual bool first()=0
Position the iterator on the first successor (if any).
virtual bool next()=0
Jump to the next successor (if any).
virtual bdd cond() const =0
Get the condition on the edge leading to this successor.
A Transition-based ω-Automaton.
Definition: twa.hh:648
void prop_terminal(trival val)
Set the terminal property.
Definition: twa.hh:1305
void copy_acceptance_of(const const_twa_ptr &a)
Copy the acceptance condition of another TωA.
Definition: twa.hh:978
twa(const bdd_dict_ptr &d)
Construct a TωA using the given BDD dictionary.
void set_acceptance(unsigned num, const acc_cond::acc_code &c)
Set the acceptance condition of the automaton.
Definition: twa.hh:964
virtual twa_run_ptr intersecting_run(const_twa_ptr other) const
Return an accepting run recognizing a word accepted by two automata.
void prop_reset()
Reset all automaton properties to trival::maybe().
Definition: twa.hh:1696
virtual bool intersects(const_twa_word_ptr w) const
Check if this automaton _word intersects a word.
virtual const state * get_init_state() const =0
Get the initial state of the automaton.
void prop_inherently_weak(trival val)
Set the "inherently weak" property.
Definition: twa.hh:1275
acc_cond & acc()
The acceptance condition of the automaton.
Definition: twa.hh:847
trival prop_universal() const
Whether the automaton is universal.
Definition: twa.hh:1404
void set_generalized_buchi(unsigned num)
Set generalized Büchi acceptance.
Definition: twa.hh:1005
void prop_keep(prop_set p)
Keep only a subset of properties of the current automaton.
Definition: twa.hh:1666
acc_cond::mark_t set_buchi()
Set Büchi acceptance.
Definition: twa.hh:1042
void set_generalized_co_buchi(unsigned num)
Set generalized co-Büchi acceptance.
Definition: twa.hh:1022
void release_named_properties()
Destroy all named properties.
Definition: twa.hh:1216
void set_named_prop(std::string s, void *val, std::function< void(void *)> destructor)
Declare a named property.
bdd_dict_ptr dict_
BDD dictionary used by the automaton.
Definition: twa.hh:655
void prop_weak(trival val)
Set the weak property.
Definition: twa.hh:1332
T * get_named_prop(std::string s) const
Retrieve a named property.
Definition: twa.hh:1179
trival prop_unambiguous() const
Whether the automaton is unambiguous.
Definition: twa.hh:1437
T * get_or_set_named_prop(std::string s)
Create or retrieve a named property.
Definition: twa.hh:1200
trival prop_stutter_invariant() const
Whether the automaton is stutter-invariant.
Definition: twa.hh:1497
void set_named_prop(std::string s, std::nullptr_t)
Erase a named property.
bdd ap_vars() const
The set of atomic propositions as a conjunction.
Definition: twa.hh:811
virtual state * project_state(const state *s, const const_twa_ptr &t) const
Project a state on an automaton.
void set_named_prop(std::string s, T *val)
Declare a named property.
Definition: twa.hh:1145
virtual twa_run_ptr accepting_run() const
Return an accepting run if one exists.
void prop_stutter_invariant(trival val)
Set the stutter-invariant property.
Definition: twa.hh:1503
void copy_named_properties_of(const const_twa_ptr &a)
Copy all the named properties of a into this automaton.
trival prop_terminal() const
Whether the automaton is terminal.
Definition: twa.hh:1293
trival prop_state_acc() const
Whether the automaton uses state-based acceptance.
Definition: twa.hh:1230
void set_acceptance(const acc_cond &c)
Set the acceptance condition of the automaton.
Definition: twa.hh:972
std::unordered_map< std::string, std::pair< void *, std::function< void(void *)> > > named_prop_
Storage for named properties.
Definition: twa.hh:1100
void copy_ap_of(const const_twa_ptr &a)
Copy the atomic propositions of another TωA.
Definition: twa.hh:984
trival prop_inherently_weak() const
Whether the automaton is inherently weak.
Definition: twa.hh:1263
void prop_semi_deterministic(trival val)
Set the semi-deterministic property.
Definition: twa.hh:1478
unsigned num_sets() const
Number of acceptance sets used by the automaton.
Definition: twa.hh:949
virtual twa_word_ptr exclusive_word(const_twa_ptr other) const
Return a word accepted by exactly one of the two automata.
void prop_complete(trival val)
Set the complete property.
Definition: twa.hh:1388
void prop_unambiguous(trival val)
Set the unambiguous property.
Definition: twa.hh:1448
void prop_copy(const const_twa_ptr &other, prop_set p)
Copy the properties of another automaton.
Definition: twa.hh:1624
const acc_cond & acc() const
The acceptance condition of the automaton.
Definition: twa.hh:842
virtual twa_succ_iterator * succ_iter(const state *local_state) const =0
Get an iterator over the successors of local_state.
unsigned props
All property flags packed as a bitmask.
Definition: twa.hh:1089
void unregister_ap(int num)
Unregister an atomic proposition.
trival prop_very_weak() const
Whether the automaton is very-weak.
Definition: twa.hh:1349
virtual std::string format_state(const state *s) const =0
Format the state as a string for printing.
acc_cond::mark_t set_co_buchi()
Set co-Büchi acceptance.
Definition: twa.hh:1063
void prop_very_weak(trival val)
Set the very-weak property.
Definition: twa.hh:1361
void prop_state_acc(trival val)
Set the state-based-acceptance property.
Definition: twa.hh:1241
trival prop_complete() const
Whether the automaton is complete.
Definition: twa.hh:1380
bdd_dict_ptr get_dict() const
Get the dictionary associated to the automaton.
Definition: twa.hh:736
void * get_named_prop_(std::string s) const
Look up a named property by name.
trival prop_weak() const
Whether the automaton is weak.
Definition: twa.hh:1319
trival is_sba() const
Whether this is a state-based Büchi automaton.
Definition: twa.hh:1250
void prop_universal(trival val)
Set the universal property.
Definition: twa.hh:1416
virtual bool is_empty() const
Check whether the language of the automaton is empty.
void register_aps_from_dict()
Register all atomic propositions that have already been registered by the bdd_dict for this automaton...
Definition: twa.hh:787
const std::vector< formula > & ap() const
The vector of atomic propositions registered by this automaton.
Definition: twa.hh:805
virtual twa_run_ptr exclusive_run(const_twa_ptr other) const
Return an accepting run recognizing a word accepted by exactly one of the two automata.
virtual twa_word_ptr accepting_word() const
Return an accepting word if one exists.
trival prop_semi_deterministic() const
Whether the automaton is semi-deterministic.
Definition: twa.hh:1467
bprop is
Named access to individual property flags.
Definition: twa.hh:1090
virtual twa_word_ptr intersecting_word(const_twa_ptr other) const
Return a word accepted by two automata.
void release_iter(twa_succ_iterator *i) const
Release an iterator after usage.
Definition: twa.hh:712
int register_ap(std::string ap)
Register an atomic proposition designated by ap.
Definition: twa.hh:765
twa_succ_iterator * iter_cache_
Any iterator returned via release_iter.
Definition: twa.hh:653
virtual bool intersects(const_twa_ptr other) const
Check whether the language of this automaton intersects that of the other automaton.
const acc_cond::acc_code & get_acceptance() const
Acceptance formula used by the automaton.
Definition: twa.hh:955
internal::twa_succ_iterable succ(const state *s) const
Build an iterable over the successors of s.
Definition: twa.hh:702
int register_ap(formula ap)
Register an atomic proposition designated by ap.
Definition: twa.hh:753
LTL/PSL formula interface.
@ ap
Atomic proposition.
twa_graph_ptr complete(const const_twa_ptr &aut)
Clone a twa and complete it.
std::shared_ptr< const state > shared_state
Shared pointer to a const state.
Definition: twa.hh:272
std::shared_ptr< twa_run > twa_run_ptr
Shared pointer to a twa_run.
Definition: twa.hh:38
void shared_state_deleter(state *s)
Deleter for shared_state: calls state::destroy().
Definition: twa.hh:283
std::shared_ptr< twa_word > twa_word_ptr
Shared pointer to a mutable twa_word.
Definition: fwd.hh:60
std::shared_ptr< const twa_word > const_twa_word_ptr
Shared pointer to a const twa_word.
Definition: fwd.hh:54
std::shared_ptr< bdd_dict > bdd_dict_ptr
Shared pointer to a bdd_dict.
Definition: bdddict.hh:304
std::shared_ptr< const twa > const_twa_ptr
Shared pointer to a const twa.
Definition: fwd.hh:36
Definition: automata.hh:26
std::unordered_set< shared_state, state_shared_ptr_hash, state_shared_ptr_equal > shared_state_set
Unordered set of shared states.
Definition: twa.hh:374
constexpr bool operator==(trival a, trival b)
Equality comparison of two trival values.
Definition: trival.hh:134
std::unordered_map< const state *, val, state_ptr_hash, state_ptr_equal > state_map
Unordered map of abstract states.
Definition: twa.hh:204
std::unordered_set< const state *, state_ptr_hash, state_ptr_equal > state_set
Unordered set of abstract states.
Definition: twa.hh:197
constexpr bool operator!=(trival a, trival b)
Inequality comparison of two trival values.
Definition: trival.hh:140
An acceptance formula.
Definition: acc.hh:456
static acc_code generalized_buchi(unsigned n)
Build a generalized-Büchi acceptance condition with n sets.
Definition: acc.hh:770
static acc_code cobuchi()
Build a co-Büchi acceptance condition.
Definition: acc.hh:760
static acc_code buchi()
Build a Büchi acceptance condition.
Definition: acc.hh:752
static acc_code generalized_co_buchi(unsigned n)
Build a generalized-co-Büchi acceptance condition with n sets.
Definition: acc.hh:784
An acceptance mark.
Definition: acc.hh:76
An Equivalence Relation for state pointers.
Definition: twa.hh:154
bool operator()(const state *left, const state *right) const
Test two state pointers for equality via state::compare().
Definition: twa.hh:157
Hash Function for state pointers.
Definition: twa.hh:181
size_t operator()(const state *that) const
Hash a state pointer using state::hash().
Definition: twa.hh:184
Strict Weak Ordering for state pointers.
Definition: twa.hh:128
bool operator()(const state *left, const state *right) const
Compare two state pointers using state::compare().
Definition: twa.hh:131
An Equivalence Relation for shared_state.
Definition: twa.hh:330
bool operator()(shared_state left, shared_state right) const
Test two shared states for equality via state::compare().
Definition: twa.hh:333
Hash Function for shared_state.
Definition: twa.hh:361
size_t operator()(shared_state that) const
Hash a shared state using state::hash().
Definition: twa.hh:364
Strict Weak Ordering for shared_state.
Definition: twa.hh:300
bool operator()(shared_state left, shared_state right) const
Compare two shared states using state::compare().
Definition: twa.hh:303
A structure for selecting a set of automaton properties to copy.
Definition: twa.hh:1548
bool deterministic
preserve deterministic, semi-det, unambiguous
Definition: twa.hh:1551
bool improve_det
improve deterministic, semi-det, unambiguous
Definition: twa.hh:1552
bool stutter_inv
preserve stutter invariance
Definition: twa.hh:1554
static prop_set all()
An all-true prop_set.
Definition: twa.hh:1608
bool inherently_weak
preserve inherently weak, weak, & terminal
Definition: twa.hh:1550
prop_set(bool state_based, bool inherently_weak, bool deterministic, bool improve_det, bool complete, bool stutter_inv)
Construct a prop_set with explicit flag values.
Definition: twa.hh:1578
bool complete
preserve completeness
Definition: twa.hh:1553
prop_set()
Construct a prop_set with all flags set to false.
Definition: twa.hh:1557
bool state_based
preserve state-based acceptance
Definition: twa.hh:1549
An infinite word stored as a lasso.
Definition: word.hh:35

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.1