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>
130 dict_->unregister_all_my_variables(
this);
152 return states.size();
162 return states.size() + bdd_has_true(states);
181 bool labels =
true)
const;
236 bool ignore_non_registered_ap =
false);
243 return controllable_variables_;
248 bdd controllable_variables_ = bddtrue;
298 bool fuse_same_bdds =
true,
299 bool simplify_terms =
true,
300 bool detect_empty_univ =
true,
301 bool preserve_quantifiers_in_names =
false);
323 bool one_step_preprocess =
true;
331 bool terminating_semantics =
true;
334 bool fuse_same_bdds =
true;
337 bool simplify_terms =
true;
344 bool detect_empty_univ =
true;
395 const std::vector<std::string>& outvars,
398 bool realizability =
false,
434 bool minimize =
true,
bool order_for_aps =
true,
435 bool want_names =
true,
436 bool fuse_same_bdds =
true,
437 bool simplify_terms =
true);
514 const std::vector<formula>& aps,
533 const std::vector<formula>& aps,
553 bool simplify_terms =
true);
557 bool detect_empty_univ =
true,
558 bool preserve_quantifiers_in_names =
false);
562 bool detect_empty_univ =
true,
563 const std::vector<std::string>* outvars
565 bool do_backprop =
false,
566 bool realizability =
false,
567 bool one_step_preprocess =
false,
569 bool terminating_semantics =
true,
570 bool preserve_quantifiers_in_names
623 std::unordered_map<formula, int> formula_to_var_;
624 std::unordered_map<formula, bdd> propositional_equiv_bdd_;
625 std::unordered_map<bdd, formula, bdd_hash> propositional_equiv_;
626 std::unordered_map<formula, int> propeq_to_int_;
628 std::unordered_map<formula, bdd> formula_to_bdd_;
629 std::unordered_map<formula, int> formula_to_int_;
630 std::vector<formula> int_to_formula_;
633 bool simplify_terms_;
649 SPOT_API std::vector<bool>
664 SPOT_API std::vector<bool>
667 SPOT_API std::vector<trival>
682 const std::vector<bool>& winning_states);
685 const std::vector<trival>& winning_states);
707 bool preserve_names =
false);
Graph used for backward propagation of winning conditions in parity games.
Definition: backprop.hh:34
"Semi-internal" class used to implement ltlf_to_mtdfa()
Definition: ltlf2dfa.hh:549
bdd propeq_encode(formula f)
Encode a formula using propositional equivalences.
int formula_to_terminal(formula f, bool may_stop=false)
Convert a formula to a terminal index.
int formula_to_int(formula f)
Convert a formula to an integer key.
bdd formula_to_terminal_bdd(formula f, bool may_stop=false)
Convert a formula to a terminal BDD.
ltlf_translator(const bdd_dict_ptr &dict, bool simplify_terms=true)
Construct the translator with the given BDD dictionary.
std::pair< formula, bool > leaf_to_formula(int b, int term) const
Convert a leaf value to a formula.
bdd combine_equiv(bdd left, bdd right)
Combine two BDDs with equivalence.
formula propeq_representative(formula f)
Get the representative for a propositional equiv.
int formula_propeq_to_terminal(formula f, bool may_stop=false)
Convert propositional equiv formula to terminal.
bdd combine_implies(bdd left, bdd right)
Combine two BDDs with implication.
int formula_propeq_to_terminal_bdd_as_int(formula f, bool may_stop)
Convert propositional equiv formula to terminal BDD int.
bdd combine_and(bdd left, bdd right)
Combine two BDDs with logical AND.
bddExtCache * get_cache()
Return a pointer to the internal BDD cache.
Definition: ltlf2dfa.hh:616
bdd ltlf_to_mtbdd(formula f)
Convert an LTLf formula to an MTBDD.
int formula_to_terminal_bdd_as_int(formula f, bool may_stop=false)
Convert a formula to a terminal BDD integer.
bdd combine_xor(bdd left, bdd right)
Combine two BDDs with exclusive OR.
mtdfa_ptr ltlf_to_mtdfa_synthesis(formula f, bool fuse_same_bdds, bool detect_empty_univ=true, const std::vector< std::string > *outvars=nullptr, bool do_backprop=false, bool realizability=false, bool one_step_preprocess=false, bool bfs=true, bool terminating_semantics=true, bool preserve_quantifiers_in_names=false)
Translate an LTLf formula to MTdfa for synthesis.
bdd combine_or(bdd left, bdd right)
Combine two BDDs with logical OR.
bdd combine_not(bdd b)
Negate a BDD.
formula terminal_to_formula(int t) const
Convert a terminal integer to a formula.
mtdfa_ptr ltlf_to_mtdfa(formula f, bool fuse_same_bdds, bool detect_empty_univ=true, bool preserve_quantifiers_in_names=false)
Translate an LTLf formula to a Multi-Terminal DFA.
int formula_propeq_to_int(formula f)
Convert propositional equiv formula to int.
A Transition-based ω-Automaton.
Definition: twa.hh:648
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.
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 realizability=false, ltlf_synthesis_options options={})
Solve (or start solving) LTLf synthesis.
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.
std::shared_ptr< const mtdfa > const_mtdfa_ptr
Shared pointer to a const mtdfa.
Definition: ltlf2dfa.hh:256
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, bool preserve_quantifiers_in_names=false)
Convert an LTLf formula into an MTDFA.
twa_graph_ptr mtdfa_strategy_to_mealy(mtdfa_ptr strategy, bool labels=true, bool loop=false)
Convert an MTDFA representing a strategy to a TwA with the "synthesis-output" property.
mtdfa_ptr product(const mtdfa_ptr &dfa1, const mtdfa_ptr &dfa2)
Combine two MTDFAs to intersect their languages.
ltlf_synthesis_backprop
Backpropagation mode for LTLf synthesis.
Definition: ltlf2dfa.hh:306
mtdfa_ptr trim(const mtdfa_ptr &dfa)
Trim an MTDFA.
mtdfa_ptr quantify_forall(const mtdfa_ptr &dfa, bdd vars, bool trim=true)
Universally quantify variables in an MTDFA.
mtdfa_ptr minimize_mtdfa(const mtdfa_ptr &dfa)
Minimize a MTDFA.
mtdfa_ptr mtdfa_winning_strategy(mtdfa_ptr dfa, bool backprop_nodes)
Compute a strategy for an MTDFA interpreted as a game.
std::vector< bool > mtdfa_winning_region(mtdfa_ptr dfa)
Compute the winning region of the MTDFA interpreted as a game.
std::shared_ptr< mtdfa > mtdfa_ptr
Shared pointer to a mtdfa.
Definition: ltlf2dfa.hh:253
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 quantify_exists(const mtdfa_ptr &dfa, bdd vars, bool trim=true)
Existentially quantify variables in an MTDFA.
mtdfa_ptr product_implies(const mtdfa_ptr &dfa1, const mtdfa_ptr &dfa2)
Combine two MTDFAs to build an implication.
@ state_refine
no backpropagation, just local refinement
Definition: ltlf2dfa.hh:307
@ dfs_node_backprop
on-the-fly, DFS
Definition: ltlf2dfa.hh:309
@ bfs_node_backprop
on-the-fly, BFS
Definition: ltlf2dfa.hh:308
twa_graph_ptr complement(const const_twa_graph_ptr &aut, const output_aborter *aborter=nullptr)
Complement a TωA.
std::shared_ptr< bdd_dict > bdd_dict_ptr
Shared pointer to a bdd_dict.
Definition: bdddict.hh:304
std::shared_ptr< twa_graph > twa_graph_ptr
Shared pointer to a mutable twa_graph.
Definition: fwd.hh:44
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.
std::vector< trival > mtdfa_winning_region_lazy3(mtdfa_ptr dfa)
Compute the winning region of the MTDFA interpreted as a game. Lazy version.
Fine-tuning options for LTLf synthesis.
Definition: ltlf2dfa.hh:318
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.
std::ostream & print_dot(std::ostream &os, int index=-1, bool labels=true) const
Print the states array of MTBDD in graphviz format.
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:218
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.
std::vector< formula > names
Definition: ltlf2dfa.hh:134
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:241
std::vector< bdd > states
BDD transitions for each root state.
Definition: ltlf2dfa.hh:133
unsigned num_roots() const
The number of MTBDDs roots.
Definition: ltlf2dfa.hh:150
bool is_empty() const
Check if the automaton recognizes the empty language.
mtdfa(const bdd_dict_ptr &dict) noexcept
Create an empty mtdfa.
Definition: ltlf2dfa.hh:123