GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/expr_miner_manager.h Lines: 1 1 100.0 %
Date: 2021-03-23 Branches: 0 0 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file expr_miner_manager.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Andrew Reynolds, Mathias Preiner
6
 ** This file is part of the CVC4 project.
7
 ** Copyright (c) 2009-2021 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
11
 **
12
 ** \brief Expression miner manager, which manages individual expression miners.
13
 **/
14
15
#include "cvc4_private.h"
16
17
#ifndef CVC4__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H
18
#define CVC4__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H
19
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"
26
27
namespace CVC4 {
28
namespace theory {
29
30
class QuantifiersEngine;
31
32
namespace quantifiers {
33
34
/** ExpressionMinerManager
35
 *
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
39
 * sampling object.
40
 */
41
class ExpressionMinerManager
42
{
43
 public:
44
  ExpressionMinerManager();
45
12
  ~ExpressionMinerManager() {}
46
  /**  Initialize this class
47
   *
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).
54
   */
55
  void initialize(const std::vector<Node>& vars,
56
                  TypeNode tn,
57
                  unsigned nsamples,
58
                  bool unique_type_ids = false);
59
  /** Initialize this class, sygus version
60
   *
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.
67
   */
68
  void initializeSygus(QuantifiersEngine* qe,
69
                       Node f,
70
                       unsigned nsamples,
71
                       bool useSygusType);
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();
80
  /** add term
81
   *
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.
86
   */
87
  bool addTerm(Node sol, std::ostream& out);
88
  /**
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.
91
   */
92
  bool addTerm(Node sol, std::ostream& out, bool& rew_print);
93
94
 private:
95
  /** whether we are doing rewrite synthesis */
96
  bool d_doRewSynth;
97
  /** whether we are doing query generation */
98
  bool d_doQueryGen;
99
  /** whether we are filtering solutions based on logical strength */
100
  bool d_doFilterLogicalStrength;
101
  /** the sygus function passed to initializeSygus, if any */
102
  Node d_sygus_fun;
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 */
108
  TermDbSygus* d_tds;
109
  /** candidate rewrite database */
110
  CandidateRewriteDatabase d_crd;
111
  /** query generator */
112
  QueryGenerator d_qg;
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;
119
};
120
121
}  // namespace quantifiers
122
}  // namespace theory
123
}  // namespace CVC4
124
125
#endif /* CVC4__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H */