spot  2.11.6
twa.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2009, 2011, 2013-2022 Laboratoire de Recherche et
3 // Développement de l'Epita (LRDE).
4 // Copyright (C) 2003-2005 Laboratoire d'Informatique de Paris 6
5 // (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
6 // Pierre et Marie Curie.
7 //
8 // This file is part of Spot, a model checking library.
9 //
10 // Spot is free software; you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Spot is distributed in the hope that it will be useful, but WITHOUT
16 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 // License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23 #pragma once
24 
25 #include <cstddef>
26 #include <spot/twa/fwd.hh>
27 #include <spot/twa/acc.hh>
28 #include <spot/twa/bdddict.hh>
29 #include <cassert>
30 #include <memory>
31 #include <unordered_map>
32 #include <functional>
33 #include <array>
34 #include <vector>
35 #include <spot/misc/casts.hh>
36 #include <spot/misc/hash.hh>
37 #include <spot/tl/formula.hh>
38 #include <spot/misc/trival.hh>
39 
40 namespace spot
41 {
42  struct twa_run;
43  typedef std::shared_ptr<twa_run> twa_run_ptr;
44 
45  struct twa_word;
46  typedef std::shared_ptr<twa_word> twa_word_ptr;
47 
50  class SPOT_API state
51  {
52  public:
63  virtual int compare(const state* other) const = 0;
64 
84  virtual size_t hash() const = 0;
85 
87  virtual state* clone() const = 0;
88 
98  virtual void destroy() const
99  {
100  delete this;
101  }
102 
103  protected:
110  virtual ~state()
111  {
112  }
113  };
114 
128  {
129  bool
130  operator()(const state* left, const state* right) const
131  {
132  SPOT_ASSERT(left);
133  return left->compare(right) < 0;
134  }
135  };
136 
151  {
152  bool
153  operator()(const state* left, const state* right) const
154  {
155  SPOT_ASSERT(left);
156  return 0 == left->compare(right);
157  }
158  };
159 
175  {
176  size_t
177  operator()(const state* that) const
178  {
179  SPOT_ASSERT(that);
180  return that->hash();
181  }
182  };
183 
189  typedef std::unordered_set<const state*,
191 
195  template<class val>
196  using state_map = std::unordered_map<const state*, val,
198 
201  class SPOT_API state_unicity_table
202  {
203  state_set m;
204  public:
205 
214  const state* operator()(const state* s)
215  {
216  auto p = m.insert(s);
217  if (!p.second)
218  s->destroy();
219  return *p.first;
220  }
221 
226  const state* is_new(const state* s)
227  {
228  auto p = m.insert(s);
229  if (!p.second)
230  {
231  s->destroy();
232  return nullptr;
233  }
234  return *p.first;
235  }
236 
238  {
239  for (state_set::iterator i = m.begin(); i != m.end();)
240  {
241  // Advance the iterator before destroying its key. This
242  // avoids issues with old g++ implementations.
243  state_set::iterator old = i++;
244  (*old)->destroy();
245  }
246  }
247 
248  size_t
249  size()
250  {
251  return m.size();
252  }
253  };
254 
255 
256 
257  // Functions related to shared_ptr.
259 
260  typedef std::shared_ptr<const state> shared_state;
261 
262  inline void shared_state_deleter(state* s) { s->destroy(); }
263 
278  {
279  bool
280  operator()(shared_state left,
281  shared_state right) const
282  {
283  SPOT_ASSERT(left);
284  return left->compare(right.get()) < 0;
285  }
286  };
287 
306  {
307  bool
308  operator()(shared_state left,
309  shared_state right) const
310  {
311  SPOT_ASSERT(left);
312  return 0 == left->compare(right.get());
313  }
314  };
315 
335  {
336  size_t
337  operator()(shared_state that) const
338  {
339  SPOT_ASSERT(that);
340  return that->hash();
341  }
342  };
343 
345  typedef std::unordered_set<shared_state,
348 
397  class SPOT_API twa_succ_iterator
398  {
399  public:
400  virtual
402  {
403  }
404 
407 
422  virtual bool first() = 0;
423 
434  virtual bool next() = 0;
435 
451  virtual bool done() const = 0;
452 
454 
457 
467  virtual const state* dst() const = 0;
471  virtual bdd cond() const = 0;
474  virtual acc_cond::mark_t acc() const = 0;
475 
477  };
478 
479  namespace internal
480  {
486  struct SPOT_API succ_iterator
487  {
488  protected:
489  twa_succ_iterator* it_;
490  public:
491 
493  it_(it)
494  {
495  }
496 
497  bool operator==(succ_iterator o) const
498  {
499  return it_ == o.it_;
500  }
501 
502  bool operator!=(succ_iterator o) const
503  {
504  return it_ != o.it_;
505  }
506 
507  const twa_succ_iterator* operator*() const
508  {
509  return it_;
510  }
511 
512  void operator++()
513  {
514  if (!it_->next())
515  it_ = nullptr;
516  }
517  };
518 
519 #ifndef SWIG
526  {
527  protected:
528  const twa* aut_;
529  twa_succ_iterator* it_;
530  public:
531  twa_succ_iterable(const twa* aut, twa_succ_iterator* it)
532  : aut_(aut), it_(it)
533  {
534  }
535 
536  twa_succ_iterable(twa_succ_iterable&& other) noexcept
537  : aut_(other.aut_), it_(other.it_)
538  {
539  other.it_ = nullptr;
540  }
541 
542  ~twa_succ_iterable(); // Defined in this file after twa
543 
545  {
546  return it_->first() ? it_ : nullptr;
547  }
548 
550  {
551  return nullptr;
552  }
553  };
554 #endif // SWIG
555  }
556 
566 
569 
622  class SPOT_API twa: public std::enable_shared_from_this<twa>
623  {
624  protected:
625  twa(const bdd_dict_ptr& d);
629  bdd_dict_ptr dict_;
630  public:
631 
632  virtual ~twa();
633 
639  virtual const state* get_init_state() const = 0;
640 
648  virtual twa_succ_iterator*
649  succ_iter(const state* local_state) const = 0;
650 
651 #ifndef SWIG
676  succ(const state* s) const
677  {
678  return {this, succ_iter(s)};
679  }
680  #endif
681 
687  {
688  if (iter_cache_)
689  delete i;
690  else
691  iter_cache_ = i;
692  }
693 
710  bdd_dict_ptr get_dict() const
711  {
712  return dict_;
713  }
714 
728  {
729  int res = dict_->has_registered_proposition(ap, this);
730  if (res < 0)
731  {
732  aps_.emplace_back(ap);
733  res = dict_->register_proposition(ap, this);
734  bddaps_ &= bdd_ithvar(res);
735  }
736  return res;
737  }
738 
739  int register_ap(std::string ap)
740  {
741  return register_ap(formula::ap(ap));
742  }
744 
748  void unregister_ap(int num);
749 
762  {
763  if (!aps_.empty())
764  throw std::runtime_error("register_aps_from_dict() may not be"
765  " called on an automaton that has already"
766  " registered some AP");
767  auto& m = get_dict()->bdd_map;
768  unsigned s = m.size();
769  for (unsigned n = 0; n < s; ++n)
770  if (m[n].refs.find(this) != m[n].refs.end())
771  {
772  aps_.emplace_back(m[n].f);
773  bddaps_ &= bdd_ithvar(n);
774  }
775  }
776 
779  const std::vector<formula>& ap() const
780  {
781  return aps_;
782  }
783 
785  bdd ap_vars() const
786  {
787  return bddaps_;
788  }
789 
796  virtual std::string format_state(const state* s) const = 0;
797 
811  virtual state* project_state(const state* s,
812  const const_twa_ptr& t) const;
813 
816  const acc_cond& acc() const
817  {
818  return acc_;
819  }
820 
822  {
823  return acc_;
824  }
826 
836  virtual bool is_empty() const;
837 
849  virtual twa_run_ptr accepting_run() const;
850 
862  virtual twa_word_ptr accepting_word() const;
863 
870  virtual bool intersects(const_twa_ptr other) const;
871 
882  virtual twa_run_ptr intersecting_run(const_twa_ptr other) const;
883 
884  // (undocumented)
885  //
886  // If \a from_other is true, the returned run will be over the
887  // \a other automaton. Otherwise, the run will be over this
888  // automaton.
889  //
890  // This function was deprecated in Spot 2.8.
891  SPOT_DEPRECATED("replace a->intersecting_run(b, true) "
892  "by b->intersecting_run(a).")
893  twa_run_ptr intersecting_run(const_twa_ptr other,
894  bool from_other) const
895  {
896  if (from_other)
897  return other->intersecting_run(shared_from_this());
898  else
899  return this->intersecting_run(other);
900  }
901 
905  virtual twa_word_ptr intersecting_word(const_twa_ptr other) const;
906 
916  virtual twa_run_ptr exclusive_run(const_twa_ptr other) const;
917 
927  virtual twa_word_ptr exclusive_word(const_twa_ptr other) const;
928 
929  private:
930  acc_cond acc_;
931 
932  public:
934  unsigned num_sets() const
935  {
936  return acc_.num_sets();
937  }
938 
941  {
942  return acc_.get_acceptance();
943  }
944 
949  void set_acceptance(unsigned num, const acc_cond::acc_code& c)
950  {
951  acc_ = acc_cond(num, c);
952  }
953 
957  void set_acceptance(const acc_cond& c)
958  {
959  acc_ = c;
960  }
961 
963  void copy_acceptance_of(const const_twa_ptr& a)
964  {
965  acc_ = a->acc();
966  }
967 
969  void copy_ap_of(const const_twa_ptr& a)
970  {
971  for (auto f: a->ap())
972  this->register_ap(f);
973  }
974 
976  void copy_named_properties_of(const const_twa_ptr& a);
977 
990  void set_generalized_buchi(unsigned num)
991  {
993  }
994 
1007  void set_generalized_co_buchi(unsigned num)
1008  {
1010  }
1011 
1028  {
1029  acc_ = acc_cond(1, acc_cond::acc_code::buchi());
1030  return {0};
1031  }
1032 
1049  {
1051  return {0};
1052  }
1053 
1054  private:
1055  std::vector<formula> aps_;
1056  bdd bddaps_;
1057 
1059  struct bprop
1060  {
1061  trival::repr_t state_based_acc:2; // State-based acceptance.
1062  trival::repr_t inherently_weak:2; // Inherently Weak automaton.
1063  trival::repr_t weak:2; // Weak automaton.
1064  trival::repr_t terminal:2; // Terminal automaton.
1065  trival::repr_t universal:2; // Universal automaton.
1066  trival::repr_t unambiguous:2; // Unambiguous automaton.
1067  trival::repr_t stutter_invariant:2; // Stutter invariant language.
1068  trival::repr_t very_weak:2; // very-weak, or 1-weak
1069  trival::repr_t semi_deterministic:2; // semi-deterministic automaton.
1070  trival::repr_t complete:2; // Complete automaton.
1071  };
1072  union
1073  {
1074  unsigned props;
1075  bprop is;
1076  };
1077 
1078  protected:
1079 #ifndef SWIG
1080  // Dynamic properties, are given with a name and a destructor function.
1081  std::unordered_map<std::string,
1082  std::pair<void*,
1083  std::function<void(void*)>>> named_prop_;
1084 #endif
1085  void* get_named_prop_(std::string s) const;
1086 
1087  public:
1088 
1089 #ifndef SWIG
1105  void set_named_prop(std::string s,
1106  void* val, std::function<void(void*)> destructor);
1107 
1123  template<typename T>
1124  void set_named_prop(std::string s, T* val)
1125  {
1126  set_named_prop(s, val,
1127  [](void *p) noexcept { delete static_cast<T*>(p); });
1128  }
1129 
1140  void set_named_prop(std::string s, std::nullptr_t);
1141 
1157  template<typename T>
1158  T* get_named_prop(std::string s) const
1159  {
1160  if (void* p = get_named_prop_(s))
1161  return static_cast<T*>(p);
1162  else
1163  return nullptr;
1164  }
1165 
1178  template<typename T>
1179  T* get_or_set_named_prop(std::string s)
1180  {
1181  if (void* p = get_named_prop_(s))
1182  return static_cast<T*>(p);
1183 
1184  auto tmp = new T;
1185  set_named_prop(s, tmp);
1186  return tmp;
1187  }
1188 
1189 #endif
1190 
1196  {
1197  // Destroy all named properties.
1198  for (auto& np: named_prop_)
1199  np.second.second(np.second.first);
1200  named_prop_.clear();
1201  }
1202 
1210  {
1211  if (num_sets() == 0)
1212  return trival(true);
1213  return trival::from_repr_t(is.state_based_acc);
1214  }
1215 
1221  {
1222  is.state_based_acc = val.val();
1223  }
1224 
1229  trival is_sba() const
1230  {
1231  return prop_state_acc() && acc().is_buchi();
1232  }
1233 
1243  {
1244  return trival::from_repr_t(is.inherently_weak);
1245  }
1246 
1255  {
1256  is.inherently_weak = val.val();
1257  if (!val)
1258  is.very_weak = is.terminal = is.weak = val.val();
1259  }
1260 
1273  {
1274  return trival::from_repr_t(is.terminal);
1275  }
1276 
1285  {
1286  is.terminal = val.val();
1287  if (val)
1288  is.inherently_weak = is.weak = val.val();
1289  }
1290 
1299  {
1300  return trival::from_repr_t(is.weak);
1301  }
1302 
1311  void prop_weak(trival val)
1312  {
1313  is.weak = val.val();
1314  if (val)
1315  is.inherently_weak = val.val();
1316  if (!val)
1317  is.very_weak = is.terminal = val.val();
1318  }
1319 
1329  {
1330  return trival::from_repr_t(is.very_weak);
1331  }
1332 
1341  {
1342  is.very_weak = val.val();
1343  if (val)
1344  is.weak = is.inherently_weak = val.val();
1345  }
1346 
1347 
1360  {
1361  return trival::from_repr_t(is.complete);
1362  }
1363 
1368  {
1369  is.complete = val.val();
1370  }
1371 
1384  {
1385  return trival::from_repr_t(is.universal);
1386  }
1387 
1396  {
1397  is.universal = val.val();
1398  if (val)
1399  // universal implies unambiguous and semi-deterministic
1400  is.unambiguous = is.semi_deterministic = val.val();
1401  }
1402 
1403  // Starting with Spot 2.4, an automaton is deterministic if it is
1404  // both universal and existential, but as we already have
1405  // twa::is_existential(), we only need to additionally record the
1406  // universal property. Before that, the deterministic property
1407  // was just a synonym for universal, hence we keep the deprecated
1408  // function prop_deterministic() with this meaning.
1409  SPOT_DEPRECATED("use prop_universal() instead")
1410  void prop_deterministic(trival val)
1411  {
1412  prop_universal(val);
1413  }
1414 
1415  SPOT_DEPRECATED("use prop_universal() instead")
1416  trival prop_deterministic() const
1417  {
1418  return prop_universal();
1419  }
1420 
1435  {
1436  return trival::from_repr_t(is.unambiguous);
1437  }
1438 
1446  {
1447  is.unambiguous = val.val();
1448  if (!val)
1449  is.universal = val.val();
1450  }
1451 
1465  {
1466  return trival::from_repr_t(is.semi_deterministic);
1467  }
1468 
1476  {
1477  is.semi_deterministic = val.val();
1478  if (!val)
1479  is.universal = val.val();
1480  }
1481 
1495  {
1496  return trival::from_repr_t(is.stutter_invariant);
1497  }
1498 
1501  {
1502  is.stutter_invariant = val.val();
1503  }
1504 
1544  struct prop_set
1545  {
1546  bool state_based;
1547  bool inherently_weak;
1548  bool deterministic;
1549  bool improve_det;
1550  bool complete;
1551  bool stutter_inv;
1552 
1553  prop_set()
1554  : state_based(false),
1555  inherently_weak(false),
1556  deterministic(false),
1557  improve_det(false),
1558  complete(false),
1559  stutter_inv(false)
1560  {
1561  }
1562 
1563  prop_set(bool state_based,
1564  bool inherently_weak,
1565  bool deterministic,
1566  bool improve_det,
1567  bool complete,
1568  bool stutter_inv)
1569  : state_based(state_based),
1570  inherently_weak(inherently_weak),
1571  deterministic(deterministic),
1572  improve_det(improve_det),
1573  complete(complete),
1574  stutter_inv(stutter_inv)
1575  {
1576  }
1577 
1578 #ifndef SWIG
1579  // The "complete" argument was added in Spot 2.4
1580  SPOT_DEPRECATED("prop_set() now takes 6 arguments")
1581  prop_set(bool state_based,
1582  bool inherently_weak,
1583  bool deterministic,
1584  bool improve_det,
1585  bool stutter_inv)
1586  : state_based(state_based),
1587  inherently_weak(inherently_weak),
1588  deterministic(deterministic),
1589  improve_det(improve_det),
1590  complete(false),
1591  stutter_inv(stutter_inv)
1592  {
1593  }
1594 #endif
1595 
1611  static prop_set all()
1612  {
1613  return { true, true, true, true, true, true };
1614  }
1615  };
1616 
1627  void prop_copy(const const_twa_ptr& other, prop_set p)
1628  {
1629  if (p.state_based)
1630  prop_state_acc(other->prop_state_acc());
1631  if (p.inherently_weak)
1632  {
1633  prop_terminal(other->prop_terminal());
1634  prop_weak(other->prop_weak());
1635  prop_very_weak(other->prop_very_weak());
1636  prop_inherently_weak(other->prop_inherently_weak());
1637  }
1638  if (p.deterministic)
1639  {
1640  prop_universal(other->prop_universal());
1641  prop_semi_deterministic(other->prop_semi_deterministic());
1642  prop_unambiguous(other->prop_unambiguous());
1643  }
1644  else if (p.improve_det)
1645  {
1646  if (other->prop_universal().is_true())
1647  {
1648  prop_universal(true);
1649  }
1650  else
1651  {
1652  if (other->prop_semi_deterministic().is_true())
1653  prop_semi_deterministic(true);
1654  if (other->prop_unambiguous().is_true())
1655  prop_unambiguous(true);
1656  }
1657  }
1658  if (p.complete)
1659  prop_complete(other->prop_complete());
1660  if (p.stutter_inv)
1661  prop_stutter_invariant(other->prop_stutter_invariant());
1662  }
1663 
1669  void prop_keep(prop_set p)
1670  {
1671  if (!p.state_based)
1672  prop_state_acc(trival::maybe());
1673  if (!p.inherently_weak)
1674  {
1675  prop_terminal(trival::maybe());
1676  prop_weak(trival::maybe());
1677  prop_very_weak(trival::maybe());
1678  prop_inherently_weak(trival::maybe());
1679  }
1680  if (!p.deterministic)
1681  {
1682  if (!(p.improve_det && prop_universal().is_true()))
1683  prop_universal(trival::maybe());
1684  if (!(p.improve_det && prop_semi_deterministic().is_true()))
1685  prop_semi_deterministic(trival::maybe());
1686  if (!(p.improve_det && prop_unambiguous().is_true()))
1687  prop_unambiguous(trival::maybe());
1688  }
1689  if (!p.complete)
1690  prop_complete(trival::maybe());
1691  if (!p.stutter_inv)
1692  prop_stutter_invariant(trival::maybe());
1693  }
1694 
1695  void prop_reset()
1696  {
1697  prop_keep({});
1698  }
1699  };
1700 
1701 #ifndef SWIG
1702  namespace internal
1703  {
1704  inline twa_succ_iterable::~twa_succ_iterable()
1705  {
1706  if (it_)
1707  aut_->release_iter(it_);
1708  }
1709  }
1710 #endif // SWIG
1711 
1714 
1717 
1720 
1723 
1726 
1729 
1732 
1735 
1738 
1741 }
An acceptance condition.
Definition: acc.hh:62
const acc_code & get_acceptance() const
Retrieve the acceptance formula.
Definition: acc.hh:1529
unsigned num_sets() const
The number of sets used in the acceptance condition.
Definition: acc.hh:2027
Main class for temporal logic formula.
Definition: formula.hh:717
static formula ap(const std::string &name)
Build an atomic proposition.
Definition: formula.hh:863
Helper class to iterate over the successors of a state using the on-the-fly interface.
Definition: twa.hh:526
Render state pointers unique via a hash table.
Definition: twa.hh:202
const state * is_new(const state *s)
Canonicalize state pointer.
Definition: twa.hh:226
const state * operator()(const state *s)
Canonicalize state pointer.
Definition: twa.hh:214
Abstract class for states.
Definition: twa.hh:51
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:98
virtual ~state()
Destructor.
Definition: twa.hh:110
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:34
Iterate over the successors of a state.
Definition: twa.hh:398
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:623
void prop_terminal(trival val)
Set the terminal property.
Definition: twa.hh:1284
void copy_acceptance_of(const const_twa_ptr &a)
Copy the acceptance condition of another TωA.
Definition: twa.hh:963
void set_acceptance(unsigned num, const acc_cond::acc_code &c)
Set the acceptance condition of the automaton.
Definition: twa.hh:949
virtual twa_run_ptr intersecting_run(const_twa_ptr other) const
Return an accepting run recognizing a word accepted by two automata.
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:1254
acc_cond & acc()
The acceptance condition of the automaton.
Definition: twa.hh:821
trival prop_universal() const
Whether the automaton is universal.
Definition: twa.hh:1383
void set_generalized_buchi(unsigned num)
Set generalized Büchi acceptance.
Definition: twa.hh:990
acc_cond::mark_t set_buchi()
Set Büchi acceptance.
Definition: twa.hh:1027
void set_generalized_co_buchi(unsigned num)
Set generalized co-Büchi acceptance.
Definition: twa.hh:1007
void release_named_properties()
Destroy all named properties.
Definition: twa.hh:1195
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:629
void prop_weak(trival val)
Set the weak property.
Definition: twa.hh:1311
T * get_named_prop(std::string s) const
Retrieve a named property.
Definition: twa.hh:1158
trival prop_unambiguous() const
Whether the automaton is unambiguous.
Definition: twa.hh:1434
T * get_or_set_named_prop(std::string s)
Create or retrieve a named property.
Definition: twa.hh:1179
trival prop_stutter_invariant() const
Whether the automaton is stutter-invariant.
Definition: twa.hh:1494
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:785
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:1124
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:1500
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:1272
trival prop_state_acc() const
Whether the automaton uses state-based acceptance.
Definition: twa.hh:1209
void set_acceptance(const acc_cond &c)
Set the acceptance condition of the automaton.
Definition: twa.hh:957
void copy_ap_of(const const_twa_ptr &a)
Copy the atomic propositions of another TωA.
Definition: twa.hh:969
trival prop_inherently_weak() const
Whether the automaton is inherently weak.
Definition: twa.hh:1242
void prop_semi_deterministic(trival val)
Set the semi-deterministic property.
Definition: twa.hh:1475
unsigned num_sets() const
Number of acceptance sets used by the automaton.
Definition: twa.hh:934
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:1367
void prop_unambiguous(trival val)
Set the unambiguous property.
Definition: twa.hh:1445
const acc_cond & acc() const
The acceptance condition of the automaton.
Definition: twa.hh:816
virtual twa_succ_iterator * succ_iter(const state *local_state) const =0
Get an iterator over the successors of local_state.
void unregister_ap(int num)
Unregister an atomic proposition.
trival prop_very_weak() const
Whether the automaton is very-weak.
Definition: twa.hh:1328
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:1048
void prop_very_weak(trival val)
Set the very-weak property.
Definition: twa.hh:1340
void prop_state_acc(trival val)
Set the state-based-acceptance property.
Definition: twa.hh:1220
trival prop_complete() const
Whether the automaton is complete.
Definition: twa.hh:1359
bdd_dict_ptr get_dict() const
Get the dictionary associated to the automaton.
Definition: twa.hh:710
trival prop_weak() const
Whether the automaton is weak.
Definition: twa.hh:1298
trival is_sba() const
Whether this is a state-based Büchi automaton.
Definition: twa.hh:1229
void prop_universal(trival val)
Set the universal property.
Definition: twa.hh:1395
virtual bool is_empty() const
Check whether the language of the automaton is empty.
static prop_set all()
A structure for selecting a set of automaton properties to copy.
Definition: twa.hh:1611
void register_aps_from_dict()
Register all atomic propositions that have already been registered by the bdd_dict for this automaton...
Definition: twa.hh:761
const std::vector< formula > & ap() const
The vector of atomic propositions registered by this automaton.
Definition: twa.hh:779
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:1464
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:686
int register_ap(std::string ap)
Register an atomic proposition designated by ap.
Definition: twa.hh:739
twa_succ_iterator * iter_cache_
Any iterator returned via release_iter.
Definition: twa.hh:627
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:940
internal::twa_succ_iterable succ(const state *s) const
Build an iterable over the successors of s.
Definition: twa.hh:676
int register_ap(formula ap)
Register an atomic proposition designated by ap.
Definition: twa.hh:727
LTL/PSL formula interface.
@ ap
Atomic proposition.
SPOT_DEPRECATED("use to_parity() instead") twa_graph_ptr iar(const const_twa_graph_ptr &aut
Turn a Rabin-like or Streett-like automaton into a parity automaton based on the index appearence rec...
Definition: automata.hh:27
void prop_keep(prop_set p)
Keep only a subset of properties of the current automaton.
Definition: twa.hh:1669
std::unordered_set< shared_state, state_shared_ptr_hash, state_shared_ptr_equal > shared_state_set
Unordered set of shared states.
Definition: twa.hh:347
void prop_copy(const const_twa_ptr &other, prop_set p)
Copy the properties of another automaton.
Definition: twa.hh:1627
std::unordered_map< const state *, val, state_ptr_hash, state_ptr_equal > state_map
Unordered map of abstract states.
Definition: twa.hh:197
std::unordered_set< const state *, state_ptr_hash, state_ptr_equal > state_set
Unordered set of abstract states.
Definition: twa.hh:190
twa_graph_ptr complete(const const_twa_ptr &aut)
Clone a twa and complete it.
An acceptance formula.
Definition: acc.hh:479
static acc_code generalized_buchi(unsigned n)
Build a generalized-Büchi acceptance condition with n sets.
Definition: acc.hh:764
static acc_code cobuchi()
Build a co-Büchi acceptance condition.
Definition: acc.hh:754
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
An acceptance mark.
Definition: acc.hh:85
Helper structure to iterate over the successors of a state using the on-the-fly interface.
Definition: twa.hh:487
An Equivalence Relation for state*.
Definition: twa.hh:151
Hash Function for state*.
Definition: twa.hh:175
Strict Weak Ordering for state*.
Definition: twa.hh:128
An Equivalence Relation for shared_state (shared_ptr<const state*>).
Definition: twa.hh:306
Hash Function for shared_state (shared_ptr<const state*>).
Definition: twa.hh:335
Strict Weak Ordering for shared_state (shared_ptr<const state*>).
Definition: twa.hh:278

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