9 #ifndef CPROVER_GOTO_SYNTHESIZER_EXPR_ENUMERATOR_H
10 #define CPROVER_GOTO_SYNTHESIZER_EXPR_ENUMERATOR_H
165 const std::function<
bool(
const partitiont &)> partition_check,
168 arity(enumerators.size()),
173 arity > 1,
"arity should be greater than one for non_leaf_enumeratort");
191 const enumeratorst::const_iterator &it,
193 const partitiont::const_iterator &it_partition)
const;
197 std::list<partitiont>
223 const std::function<
bool(
const partitiont &)> partition_check,
224 const bool exchangeable,
236 const std::function<
bool(
const partitiont &)> partition_check,
243 &enumerator_1 == &enumerator_2,
344 const std::string &
id,
std::list< exprt > expr_listt
Enumerators that enumerates expressions in the union of enumerated expressions of sub-enumerators.
const enumeratorst sub_enumerators
expr_sett enumerate(const std::size_t size) const override
alternatives_enumeratort(const enumeratorst &enumerators, const namespacet &ns)
Enumerator that enumerates binary functional expressions.
const bool is_exchangeable
binary_functional_enumeratort(const irep_idt &op, const enumerator_baset &enumerator_1, const enumerator_baset &enumerator_2, const std::function< bool(const partitiont &)> partition_check, const bool exchangeable, const namespacet &ns)
bool is_equivalence_class_representation(const expr_listt &exprs) const override
Determine whether a tuple of expressions is the representation of some equivalence class.
binary_functional_enumeratort(const irep_idt &op, const enumerator_baset &enumerator_1, const enumerator_baset &enumerator_2, const namespacet &ns)
binary_functional_enumeratort(const irep_idt &op, const enumerator_baset &enumerator_1, const enumerator_baset &enumerator_2, const std::function< bool(const partitiont &)> partition_check, const namespacet &ns)
exprt instantiate(const expr_listt &exprs) const override
Combine a list of sub-expressions to construct the top-level expression.
bool is_commutative(const irep_idt &op) const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
A base class for expression enumerators.
virtual expr_sett enumerate(const std::size_t size) const =0
enumerator_baset(const namespacet &ns)
enumerator_baset(const enumerator_baset &other)=delete
virtual ~enumerator_baset()=default
enumerator_baset & operator=(const enumerator_baset &other)=delete
Factory for enumerator that can be used to represent a tree grammar.
enumerator_factoryt(const namespacet &ns)
void add_placeholder(const recursive_enumerator_placeholdert &placeholder)
Add a new placeholder/nonterminal to the grammar.
std::set< std::string > nonterminal_set
Set of nonterminals in the grammar.
std::map< std::string, const enumeratorst > productions_map
Map from names of nonterminals to rhs of productions with lhs being them.
void attach_productions(const std::string &id, const enumeratorst &enumerators)
Attach enumerators to the placeholder with id.
Base class for all expressions.
Enumerator that enumerates leaf expressions from a given list.
expr_sett enumerate(const std::size_t size) const override
Enumerate expressions in the set of leaf_exprs.
leaf_enumeratort(const expr_sett &leaf_exprs, const namespacet &ns)
const expr_sett leaf_exprs
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Non-leaf enumerator enumerates expressions of form f(a_1, a_2, ..., a_n) where a_i's are sub-expressi...
expr_sett enumerate(const std::size_t size) const override
non_leaf_enumeratort(const enumeratorst &enumerators, const namespacet &ns)
As default: no optimization. partition_check Accept all partitions.
std::list< partitiont > get_partitions(const std::size_t n, const std::size_t k) const
Enumerate all partitions of n into k components.
virtual exprt instantiate(const expr_listt &exprs) const =0
Combine a list of sub-expressions to construct the top-level expression.
non_leaf_enumeratort(const enumeratorst &enumerators, const std::function< bool(const partitiont &)> partition_check, const namespacet &ns)
const std::function< bool(const partitiont &)> is_good_partition
const enumeratorst sub_enumerators
std::set< expr_listt > cartesian_product_of_enumerators(const enumeratorst &enumerators, const enumeratorst::const_iterator &it, const partitiont &partition, const partitiont::const_iterator &it_partition) const
Given a list enumerators of enumerators, return the Cartesian product of expressions enumerated by ea...
virtual bool is_equivalence_class_representation(const expr_listt &es) const
As default, keep all expression tuples.
Placeholders for actual enumerators, which represent nonterminals.
const enumerator_factoryt & factory
expr_sett enumerate(const std::size_t size) const override
recursive_enumerator_placeholdert(enumerator_factoryt &factory, const std::string &id, const namespacet &ns)
const std::string identifier
std::unordered_set< exprt, irep_hash > expr_sett
std::list< exprt > expr_listt
std::set< exprt > expr_sett
std::list< const enumerator_baset * > enumeratorst
std::list< std::size_t > partitiont