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