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

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Mathias Preiner
4
 *
5
 * This file is part of the cvc5 project.
6
 *
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.
11
 * ****************************************************************************
12
 *
13
 * Expression miner manager, which manages individual expression miners.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H
19
#define CVC5__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H
20
21
#include "expr/node.h"
22
#include "smt/env_obj.h"
23
#include "theory/quantifiers/candidate_rewrite_database.h"
24
#include "theory/quantifiers/extended_rewrite.h"
25
#include "theory/quantifiers/query_generator.h"
26
#include "theory/quantifiers/solution_filter.h"
27
#include "theory/quantifiers/sygus_sampler.h"
28
29
namespace cvc5 {
30
31
class Env;
32
33
namespace theory {
34
namespace quantifiers {
35
36
/** ExpressionMinerManager
37
 *
38
 * This class manages a set of expression miners. It provides a common place
39
 * to register expressions so that multiple mining algorithms can be run in
40
 * coordination, possibly sharing information and utilities like a common
41
 * sampling object.
42
 */
43
class ExpressionMinerManager : protected EnvObj
44
{
45
 public:
46
  ExpressionMinerManager(Env& env);
47
18
  ~ExpressionMinerManager() {}
48
  /**  Initialize this class
49
   *
50
   * Initializes this class, informing it that the free variables of terms
51
   * added to this class via addTerm will have free variables that are a subset
52
   * of vars, and have type tn. All expression miners in this class with be
53
   * initialized with this variable list. The arguments nsamples and
54
   * unique_type_ids are used for initializing the sampler class of this manager
55
   * (see SygusSampler::initialize for details).
56
   */
57
  void initialize(const std::vector<Node>& vars,
58
                  TypeNode tn,
59
                  unsigned nsamples,
60
                  bool unique_type_ids = false);
61
  /** Initialize this class, sygus version
62
   *
63
   * Initializes this class, informing it that the terms added to this class
64
   * via calls to addTerm will be generated by the grammar of f. The method
65
   * takes a pointer to the quantifiers engine qe. If the argument useSygusType
66
   * is true, the terms added to this class are the sygus datatype terms.
67
   * If useSygusType is false, the terms are the builtin equivalent of these
68
   * terms. The argument nsamples is used to initialize the sampler.
69
   */
70
  void initializeSygus(TermDbSygus* tds,
71
                       Node f,
72
                       unsigned nsamples,
73
                       bool useSygusType);
74
  /** enable rewrite rule synthesis (--sygus-rr-synth) */
75
  void enableRewriteRuleSynth();
76
  /** enable query generation (--sygus-query-gen) */
77
  void enableQueryGeneration(unsigned deqThresh);
78
  /** filter strong solutions (--sygus-filter-sol=strong) */
79
  void enableFilterStrongSolutions();
80
  /** filter weak solutions (--sygus-filter-sol=weak) */
81
  void enableFilterWeakSolutions();
82
  /** add term
83
   *
84
   * Expression miners may print information on the output stream out, for
85
   * instance, candidate-rewrites. The method returns true if the term sol is
86
   * distinct (up to T-equivalence) with all previous terms added to this class,
87
   * which is computed based on the miners that this manager enables.
88
   */
89
  bool addTerm(Node sol, std::ostream& out);
90
  /**
91
   * Same as above, but the argument rew_print is set to true if a rewrite rule
92
   * was printed on the output stream out.
93
   */
94
  bool addTerm(Node sol, std::ostream& out, bool& rew_print);
95
96
 private:
97
  /** whether we are doing rewrite synthesis */
98
  bool d_doRewSynth;
99
  /** whether we are doing query generation */
100
  bool d_doQueryGen;
101
  /** whether we are filtering solutions based on logical strength */
102
  bool d_doFilterLogicalStrength;
103
  /** the sygus function passed to initializeSygus, if any */
104
  Node d_sygus_fun;
105
  /** whether we are using sygus types */
106
  bool d_use_sygus_type;
107
  /** the sygus term database of the quantifiers engine */
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 cvc5
124
125
#endif /* CVC5__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H */