21#include <spot/twa/twagraph.hh>
22#include <spot/misc/bddlt.hh>
23#include <unordered_map>
29 struct SPOT_API
mtdswa:
public std::enable_shared_from_this<mtdswa>
32 mtdswa(
const bdd_dict_ptr& dict) noexcept
39 dict_->unregister_all_my_variables(
this);
51 std::vector<formula>
aps;
53 std::vector<bdd> states;
54 std::vector<formula> names;
55 std::vector<acc_cond::mark_t> colors;
61 std::unordered_map<int, int> terminal_to_state_map;
63 std::unordered_map<int, unsigned> highlight_nodes;
65 std::unordered_map<int, int> highlight_groups;
73 unsigned num_roots()
const
85 return states.size() + bdd_has_true(states);
91 std::ostream&
print_dot(std::ostream& os,
const char* opts =
nullptr)
const;
94 twa_graph_ptr
as_twa(
bool state_based =
false,
96 bool complete =
false)
const;
137 bool ignore_non_registered_ap =
false);
144 return controllable_variables_;
149 bdd controllable_variables_ = bddtrue;
153 typedef std::shared_ptr<mtdswa> mtdswa_ptr;
154 typedef std::shared_ptr<const mtdswa> const_mtdswa_ptr;
226 const std::vector<unsigned>& initial_partition);
239 bool simplify_terms =
true);
241 mtdswa_ptr ltl_to_mtdswa(
formula f,
bool fuse_same_bdds);
242 mtdswa_ptr ltl_to_mtdswa_synthesis(
formula f,
243 const std::vector<std::string>& outvars,
244 bool realizability,
int debug = -1);
247 formula leaf_to_formula(
int b,
int term)
const;
249 formula terminal_to_formula(
int t)
const;
251 int formula_propeq_to_int(
formula f);
252 int formula_to_terminal(
formula f);
253 bdd formula_to_terminal_bdd(
formula f);
254 int formula_to_terminal_bdd_as_int(
formula f);
255 int formula_propeq_to_terminal_bdd_as_int(
formula f);
257 bdd combine_and(bdd left, bdd right);
258 bdd combine_or(bdd left, bdd right);
259 bdd combine_implies(bdd left, bdd right);
260 bdd combine_equiv(bdd left, bdd right);
261 bdd combine_xor(bdd left, bdd right);
262 bdd combine_not(bdd b);
264 bdd propeq_encode(
formula f,
int level = 0);
267 bddExtCache* get_cache()
275 struct formula_level_pair
280 bool operator==(
const formula_level_pair& other)
const
282 return f == other.f && level == other.level;
286 struct formula_level_pair_hash
288 std::size_t operator()(
const formula_level_pair& p)
const
290 return p.f.id() ^ (p.level * 0x9e3779b9);
294 std::unordered_map<formula_level_pair, bdd,
295 formula_level_pair_hash> propositional_equiv_bdd_;
296 std::unordered_map<bdd, formula, bdd_hash> propositional_equiv_[2];
298 std::unordered_map<formula, bdd> formula_to_bdd_;
299 std::unordered_map<formula, int> formula_to_int_;
300 std::unordered_map<formula, int> propeq_to_int_;
301 std::vector<formula> int_to_formula_;
304 bool simplify_terms_;
311 bool fuse_same_bdds =
true,
312 bool simplify_terms =
true);
320 const std::vector<std::string>& outvars,
321 bool realizability =
false,
322 bool simplify_terms =
true,
330 SPOT_API twa_graph_ptr
An acceptance condition.
Definition acc.hh:61
"Semi-internal" for translating LTL using MTBDDs
Definition mtdswa.hh:236
Definition automata.hh:26
twa_graph_ptr mtdswa_strategy_to_mealy(mtdswa_ptr strategy, bool labels=true, bool loop=false)
Convert a strategy represented as MTDSwA into a Mealy machine.
mtdswa_ptr obligation_to_mtdswa(formula f, const bdd_dict_ptr &dict, bool fuse_same_bdds=true, bool simplify_terms=true)
Convert a syntactic-obligation to an MTDSwA.
mtdswa_ptr minimize_mtdswa(const mtdswa_ptr &dfa)
Minimization of MTDSwA.
mtdswa_ptr obligation_synthesis(formula f, const bdd_dict_ptr &dict, const std::vector< std::string > &outvars, bool realizability=false, bool simplify_terms=true, int debug=-1)
Reactive synthesis of syntactic-obligations.
std::vector< unsigned > loding_weak_ranking(const mtdswa_ptr &aut, bool fix=false)
preprocess a weak MTDSwA before minimization
mtdswa_ptr dtwa_to_mtdswa(const twa_graph_ptr &aut)
convert deterministic TwA to MTDSwA
std::vector< int > scc_vector(const mtdswa_ptr &aut)
find the SCC of each state
MTBDD-based representation of a state-based ω-automaton.
Definition mtdswa.hh:30
void set_controllable_variables(bdd vars)
declare a list of controllable variables
void set_controllable_variables(const std::vector< std::string > &vars, bool ignore_non_registered_ap=false)
declare a list of controllable variables
std::vector< formula > aps
The list of atomic propositions possibly used by the automaton.
Definition mtdswa.hh:51
unsigned num_states() const
The number of states in the automaton.
Definition mtdswa.hh:83
void sinks_as_constants(bool keep_all_states=false)
converse sink states to bddtrue/bddfalse constants
bdd get_controllable_variables() const
Returns the conjunction of controllable variables.
Definition mtdswa.hh:142
void sinks_as_states()
convert bddtrue/bddfalse nodes to actual states
std::ostream & print_dot(std::ostream &os, const char *opts=nullptr) const
Print the MTBDD.
bdd_dict_ptr get_dict() const
get the bdd_dict associated to this automaton
Definition mtdswa.hh:68
twa_graph_ptr as_twa(bool state_based=false, bool labels=true, bool complete=false) const
convert to twa