GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/expr_miner_manager.h Lines: 1 1 100.0 %
Date: 2021-09-18 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/query_generator.h"
25
#include "theory/quantifiers/solution_filter.h"
26
#include "theory/quantifiers/sygus_sampler.h"
27
28
namespace cvc5 {
29
namespace theory {
30
namespace quantifiers {
31
32
/** ExpressionMinerManager
33
 *
34
 * This class manages a set of expression miners. It provides a common place
35
 * to register expressions so that multiple mining algorithms can be run in
36
 * coordination, possibly sharing information and utilities like a common
37
 * sampling object.
38
 */
39
class ExpressionMinerManager : protected EnvObj
40
{
41
 public:
42
  ExpressionMinerManager(Env& env);
43
18
  ~ExpressionMinerManager() {}
44
  /**  Initialize this class
45
   *
46
   * Initializes this class, informing it that the free variables of terms
47
   * added to this class via addTerm will have free variables that are a subset
48
   * of vars, and have type tn. All expression miners in this class with be
49
   * initialized with this variable list. The arguments nsamples and
50
   * unique_type_ids are used for initializing the sampler class of this manager
51
   * (see SygusSampler::initialize for details).
52
   */
53
  void initialize(const std::vector<Node>& vars,
54
                  TypeNode tn,
55
                  unsigned nsamples,
56
                  bool unique_type_ids = false);
57
  /** Initialize this class, sygus version
58
   *
59
   * Initializes this class, informing it that the terms added to this class
60
   * via calls to addTerm will be generated by the grammar of f. The method
61
   * takes a pointer to the quantifiers engine qe. If the argument useSygusType
62
   * is true, the terms added to this class are the sygus datatype terms.
63
   * If useSygusType is false, the terms are the builtin equivalent of these
64
   * terms. The argument nsamples is used to initialize the sampler.
65
   */
66
  void initializeSygus(TermDbSygus* tds,
67
                       Node f,
68
                       unsigned nsamples,
69
                       bool useSygusType);
70
  /** enable rewrite rule synthesis (--sygus-rr-synth) */
71
  void enableRewriteRuleSynth();
72
  /** enable query generation (--sygus-query-gen) */
73
  void enableQueryGeneration(unsigned deqThresh);
74
  /** filter strong solutions (--sygus-filter-sol=strong) */
75
  void enableFilterStrongSolutions();
76
  /** filter weak solutions (--sygus-filter-sol=weak) */
77
  void enableFilterWeakSolutions();
78
  /** add term
79
   *
80
   * Expression miners may print information on the output stream out, for
81
   * instance, candidate-rewrites. The method returns true if the term sol is
82
   * distinct (up to T-equivalence) with all previous terms added to this class,
83
   * which is computed based on the miners that this manager enables.
84
   */
85
  bool addTerm(Node sol, std::ostream& out);
86
  /**
87
   * Same as above, but the argument rew_print is set to true if a rewrite rule
88
   * was printed on the output stream out.
89
   */
90
  bool addTerm(Node sol, std::ostream& out, bool& rew_print);
91
92
 private:
93
  /** whether we are doing rewrite synthesis */
94
  bool d_doRewSynth;
95
  /** whether we are doing query generation */
96
  bool d_doQueryGen;
97
  /** whether we are filtering solutions based on logical strength */
98
  bool d_doFilterLogicalStrength;
99
  /** the sygus function passed to initializeSygus, if any */
100
  Node d_sygus_fun;
101
  /** whether we are using sygus types */
102
  bool d_use_sygus_type;
103
  /** the sygus term database of the quantifiers engine */
104
  TermDbSygus* d_tds;
105
  /** candidate rewrite database */
106
  CandidateRewriteDatabase d_crd;
107
  /** query generator */
108
  QueryGenerator d_qg;
109
  /** solution filter based on logical strength */
110
  SolutionFilterStrength d_sols;
111
  /** sygus sampler object */
112
  SygusSampler d_sampler;
113
};
114
115
}  // namespace quantifiers
116
}  // namespace theory
117
}  // namespace cvc5
118
119
#endif /* CVC5__THEORY__QUANTIFIERS__EXPR_MINER_MANAGER_H */