21#include <spot/twa/twagraph.hh>
22#include <spot/misc/bddlt.hh>
23#include <spot/misc/trival.hh>
24#include <spot/twaalgos/backprop.hh>
116 struct SPOT_API
mtdfa:
public std::enable_shared_from_this<mtdfa>
123 mtdfa(
const bdd_dict_ptr& dict) noexcept
130 dict_->unregister_all_my_variables(
this);
133 std::vector<bdd> states;
134 std::vector<formula> names;
152 return states.size();
162 return states.size() + bdd_has_true(states);
167 bool is_empty()
const;
180 bool labels =
true)
const;
199 twa_graph_ptr
as_twa(
bool state_based =
false,
bool labels =
true)
const;
235 bool ignore_non_registered_ap =
false);
242 return controllable_variables_;
247 bdd controllable_variables_ = bddtrue;
250 typedef std::shared_ptr<mtdfa> mtdfa_ptr;
251 typedef std::shared_ptr<const mtdfa> const_mtdfa_ptr;
281 bool fuse_same_bdds =
true,
282 bool simplify_terms =
true,
283 bool detect_empty_univ =
true);
330 const std::vector<std::string>& outvars,
333 bool one_step_preprocess =
false,
334 bool realizability =
false,
335 bool fuse_same_bdds =
true,
336 bool simplify_terms =
true,
337 bool detect_empty_univ =
true);
372 bool minimize =
true,
bool order_for_aps =
true,
373 bool want_names =
true,
374 bool fuse_same_bdds =
true,
375 bool simplify_terms =
true);
399 SPOT_API mtdfa_ptr product(
const mtdfa_ptr& dfa1,
const mtdfa_ptr& dfa2);
403 SPOT_API mtdfa_ptr
product_or(
const mtdfa_ptr& dfa1,
const mtdfa_ptr& dfa2);
411 SPOT_API mtdfa_ptr
product_xor(
const mtdfa_ptr& dfa1,
const mtdfa_ptr& dfa2);
419 SPOT_API mtdfa_ptr
product_xnor(
const mtdfa_ptr& dfa1,
const mtdfa_ptr& dfa2);
427 const mtdfa_ptr& dfa2);
448 bool simplify_terms =
true);
451 bool detect_empty_univ =
true,
452 const std::vector<std::string>* outvars =
nullptr,
453 bool do_backprop =
false,
454 bool realizability =
false,
455 bool one_step_preprocess =
false,
458 mtdfa_ptr ltlf_synthesis_with_dfs(
formula f,
459 const std::vector<std::string>*
461 bool realizability =
false,
462 bool ont_step_preprocess =
false);
465 std::pair<formula, bool> leaf_to_formula(
int b,
int term)
const;
467 formula terminal_to_formula(
int t)
const;
469 int formula_to_terminal(
formula f,
bool may_stop =
false);
470 bdd formula_to_terminal_bdd(
formula f,
bool may_stop =
false);
471 int formula_to_terminal_bdd_as_int(
formula f,
bool may_stop =
false);
473 bdd combine_and(bdd left, bdd right);
474 bdd combine_or(bdd left, bdd right);
475 bdd combine_implies(bdd left, bdd right);
476 bdd combine_equiv(bdd left, bdd right);
477 bdd combine_xor(bdd left, bdd right);
478 bdd combine_not(bdd b);
482 bddExtCache* get_cache()
489 std::unordered_map<formula, int> formula_to_var_;
490 std::unordered_map<bdd, formula, bdd_hash> propositional_equiv_;
492 std::unordered_map<formula, bdd> formula_to_bdd_;
493 std::unordered_map<formula, int> formula_to_int_;
494 std::vector<formula> int_to_formula_;
497 bool simplify_terms_;
513 SPOT_API std::vector<bool>
528 SPOT_API std::vector<bool>
531 SPOT_API std::vector<trival>
546 const std::vector<bool>& winning_states);
549 const std::vector<trival>& winning_states);
571 bool preserve_names =
false);
598 SPOT_API twa_graph_ptr
Definition: backprop.hh:31
"Semi-internal" class used to implement spot::ltlf_to_mtdfa()
Definition: ltlf2dfa.hh:445
A Transition-based ω-Automaton.
Definition: twa.hh:619
mtdfa_ptr product_or(const mtdfa_ptr &dfa1, const mtdfa_ptr &dfa2)
Combine two MTDFAs to sum their languages.
mtdfa_ptr twadfa_to_mtdfa(const twa_graph_ptr &twa)
Convert a TWA (representing a DFA) into an MTDFA.
mtdfa_ptr product_xor(const mtdfa_ptr &dfa1, const mtdfa_ptr &dfa2)
Combine two MTDFAs to build the exclusive sum of their languages.
twa_graph_ptr mtdfa_strategy_to_mealy(mtdfa_ptr strategy, bool labels=true)
Convert an MTDFA representing a strategy to a TwA with the "synthesis-output" property.
mtdfa_ptr product_xnor(const mtdfa_ptr &dfa1, const mtdfa_ptr &dfa2)
Combine two MTDFAs to keep words that are handled similarly in both operands.
mtdfa_ptr ltlf_to_mtdfa_compose(formula f, const bdd_dict_ptr &dict, bool minimize=true, bool order_for_aps=true, bool want_names=true, bool fuse_same_bdds=true, bool simplify_terms=true)
Convert an LTLf formula into a MTDFA, with a compositional approach.
mtdfa_ptr ltlf_to_mtdfa(formula f, const bdd_dict_ptr &dict, bool fuse_same_bdds=true, bool simplify_terms=true, bool detect_empty_univ=true)
Convert an LTLf formula into an MTDFA.
std::vector< bool > mtdfa_winning_region(mtdfa_ptr dfa)
Compute the winning region of the MTDFA interpreted as a game.
mtdfa_ptr minimize_mtdfa(const mtdfa_ptr &dfa)
Minimize a MTDFA.
mtdfa_ptr ltlf_to_mtdfa_for_synthesis(formula f, const bdd_dict_ptr &dict, const std::vector< std::string > &outvars, ltlf_synthesis_backprop backprop=dfs_node_backprop, bool one_step_preprocess=false, bool realizability=false, bool fuse_same_bdds=true, bool simplify_terms=true, bool detect_empty_univ=true)
Solve (or start solving) LTLf synthesis.
mtdfa_ptr mtdfa_winning_strategy(mtdfa_ptr dfa, bool backprop_nodes)
Compute a strategy for an MTDFA interpreted as a game.
mtdfa_ptr mtdfa_restrict_as_game(mtdfa_ptr dfa)
Build a generalized strategy from a set of winning states.
backprop_graph mtdfa_to_backprop(mtdfa_ptr dfa, bool early_stop=true, bool preserve_names=false)
Build a backprop_graph from dfa.
mtdfa_ptr product_implies(const mtdfa_ptr &dfa1, const mtdfa_ptr &dfa2)
Combine two MTDFAs to build an implication.
Definition: automata.hh:26
std::vector< bool > mtdfa_winning_region_lazy(mtdfa_ptr dfa)
Compute the winning region of the MTDFA interpreted as a game. Lazy version.
ltlf_synthesis_backprop
Definition: ltlf2dfa.hh:286
@ state_refine
no backpropagation, just local refinement
Definition: ltlf2dfa.hh:287
@ dfs_strict_node_backprop
on-the-fly, DFS that stops on visited states
Definition: ltlf2dfa.hh:290
@ dfs_node_backprop
on-the-fly, DFS that stops on visited nodes
Definition: ltlf2dfa.hh:289
@ bfs_node_backprop
on-the-fly
Definition: ltlf2dfa.hh:288
std::vector< trival > mtdfa_winning_region_lazy3(mtdfa_ptr dfa)
Compute the winning region of the MTDFA interpreted as a game. Lazy version.
twa_graph_ptr complement(const const_twa_graph_ptr &aut, const output_aborter *aborter=nullptr)
Complement a TωA.
statistics about an mtdfa instance
Definition: ltlf2dfa.hh:50
unsigned nodes
Number of internal nodes (or decision nodes)
Definition: ltlf2dfa.hh:67
unsigned long long paths
Number of paths between a root and a leaf (terminal or constant)
Definition: ltlf2dfa.hh:88
unsigned terminals
Number of terminal nodes.
Definition: ltlf2dfa.hh:74
unsigned aps
number of atomic propositions
Definition: ltlf2dfa.hh:62
bool has_false
Whether the true and false constants are used.
Definition: ltlf2dfa.hh:81
bool has_true
Whether the true and false constants are used.
Definition: ltlf2dfa.hh:80
unsigned states
number of roots
Definition: ltlf2dfa.hh:55
unsigned long long edges
Number of pairs (root, leaf) for which a path exists.
Definition: ltlf2dfa.hh:93
a DFA represented using shared multi-terminal BDDs
Definition: ltlf2dfa.hh:117
unsigned num_states() const
The number of states in the automaton.
Definition: ltlf2dfa.hh:160
twa_graph_ptr as_twa(bool state_based=false, bool labels=true) const
Convert this automaton to a spot::twa_graph.
void set_controllable_variables(const std::vector< std::string > &vars, bool ignore_non_registered_ap=false)
declare a list of controllable variables
bdd_dict_ptr get_dict() const
get the bdd_dict associated to this automaton
Definition: ltlf2dfa.hh:217
std::vector< formula > aps
The list of atomic propositions possibly used by the automaton.
Definition: ltlf2dfa.hh:144
void set_controllable_variables(bdd vars)
declare a list of controllable variables
mtdfa_stats get_stats(bool nodes, bool paths) const
compute some statistics about the automaton
bdd get_controllable_variables() const
Returns the conjunction of controllable variables.
Definition: ltlf2dfa.hh:240
unsigned num_roots() const
the number of MTBDDs roots
Definition: ltlf2dfa.hh:150
std::ostream & print_dot(std::ostream &os, int index=-1, bool labels=true) const
Print the states array of MTBDD in graphviz format.
mtdfa(const bdd_dict_ptr &dict) noexcept
create an empty mtdfa
Definition: ltlf2dfa.hh:123