1 /********************* */
2 /*! \file expr_miner_manager.h
4 ** Top contributors (to current version):
5 ** Andrew Reynolds, Mathias Preiner
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2020 by the authors listed in the file AUTHORS
8 ** in the top-level source directory and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
12 ** \brief Expression miner manager, which manages individual expression miners.
15 #include "cvc4_private.h"
17 #ifndef CVC4__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H
18 #define CVC4__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H
20 #include "expr/node.h"
21 #include "theory/quantifiers/candidate_rewrite_database.h"
22 #include "theory/quantifiers/extended_rewrite.h"
23 #include "theory/quantifiers/query_generator.h"
24 #include "theory/quantifiers/solution_filter.h"
25 #include "theory/quantifiers/sygus_sampler.h"
30 class QuantifiersEngine
;
32 namespace quantifiers
{
34 /** ExpressionMinerManager
36 * This class manages a set of expression miners. It provides a common place
37 * to register expressions so that multiple mining algorithms can be run in
38 * coordination, possibly sharing information and utilities like a common
41 class ExpressionMinerManager
44 ExpressionMinerManager();
45 ~ExpressionMinerManager() {}
46 /** Initialize this class
48 * Initializes this class, informing it that the free variables of terms
49 * added to this class via addTerm will have free variables that are a subset
50 * of vars, and have type tn. All expression miners in this class with be
51 * initialized with this variable list. The arguments nsamples and
52 * unique_type_ids are used for initializing the sampler class of this manager
53 * (see SygusSampler::initialize for details).
55 void initialize(const std::vector
<Node
>& vars
,
58 bool unique_type_ids
= false);
59 /** Initialize this class, sygus version
61 * Initializes this class, informing it that the terms added to this class
62 * via calls to addTerm will be generated by the grammar of f. The method
63 * takes a pointer to the quantifiers engine qe. If the argument useSygusType
64 * is true, the terms added to this class are the sygus datatype terms.
65 * If useSygusType is false, the terms are the builtin equivalent of these
66 * terms. The argument nsamples is used to initialize the sampler.
68 void initializeSygus(QuantifiersEngine
* qe
,
72 /** enable rewrite rule synthesis (--sygus-rr-synth) */
73 void enableRewriteRuleSynth();
74 /** enable query generation (--sygus-query-gen) */
75 void enableQueryGeneration(unsigned deqThresh
);
76 /** filter strong solutions (--sygus-filter-sol=strong) */
77 void enableFilterStrongSolutions();
78 /** filter weak solutions (--sygus-filter-sol=weak) */
79 void enableFilterWeakSolutions();
82 * Expression miners may print information on the output stream out, for
83 * instance, candidate-rewrites. The method returns true if the term sol is
84 * distinct (up to T-equivalence) with all previous terms added to this class,
85 * which is computed based on the miners that this manager enables.
87 bool addTerm(Node sol
, std::ostream
& out
);
89 * Same as above, but the argument rew_print is set to true if a rewrite rule
90 * was printed on the output stream out.
92 bool addTerm(Node sol
, std::ostream
& out
, bool& rew_print
);
95 /** whether we are doing rewrite synthesis */
97 /** whether we are doing query generation */
99 /** whether we are filtering solutions based on logical strength */
100 bool d_doFilterLogicalStrength
;
101 /** the sygus function passed to initializeSygus, if any */
103 /** whether we are using sygus types */
104 bool d_use_sygus_type
;
105 /** pointer to the quantifiers engine, used if d_use_sygus is true */
106 QuantifiersEngine
* d_qe
;
107 /** the sygus term database of d_qe */
109 /** candidate rewrite database */
110 CandidateRewriteDatabase d_crd
;
111 /** query generator */
113 /** solution filter based on logical strength */
114 SolutionFilterStrength d_sols
;
115 /** sygus sampler object */
116 SygusSampler d_sampler
;
117 /** extended rewriter object */
118 ExtendedRewriter d_ext_rew
;
121 } // namespace quantifiers
122 } // namespace theory
125 #endif /* CVC4__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H */