GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/expr_miner.h Lines: 2 2 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
 * expr_miner
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__QUANTIFIERS__EXPRESSION_MINER_H
19
#define CVC5__THEORY__QUANTIFIERS__EXPRESSION_MINER_H
20
21
#include <map>
22
#include <memory>
23
#include <vector>
24
25
#include "expr/node.h"
26
#include "smt/smt_engine.h"
27
#include "theory/quantifiers/sygus_sampler.h"
28
29
namespace cvc5 {
30
namespace theory {
31
namespace quantifiers {
32
33
/** Expression miner
34
 *
35
 * This is a virtual base class for modules that "mines" certain information
36
 * from (enumerated) expressions. This includes:
37
 * - candidate rewrite rules (--sygus-rr-synth)
38
 */
39
class ExprMiner
40
{
41
 public:
42
80
  ExprMiner() : d_sampler(nullptr) {}
43
80
  virtual ~ExprMiner() {}
44
  /** initialize
45
   *
46
   * This initializes this expression miner. The argument vars indicates the
47
   * free variables of terms that will be added to this class. The argument
48
   * sampler gives an (optional) pointer to a sampler, which is used to
49
   * sample tuples of valuations of these variables.
50
   */
51
  virtual void initialize(const std::vector<Node>& vars,
52
                          SygusSampler* ss = nullptr);
53
  /** add term
54
   *
55
   * This registers term n with this expression miner. The output stream out
56
   * is provided as an argument for the purposes of outputting the result of
57
   * the expression mining done by this class. For example, candidate-rewrite
58
   * output is printed on out by the candidate rewrite generator miner.
59
   */
60
  virtual bool addTerm(Node n, std::ostream& out) = 0;
61
62
 protected:
63
  /** the set of variables used by this class */
64
  std::vector<Node> d_vars;
65
  /** pointer to the sygus sampler object we are using */
66
  SygusSampler* d_sampler;
67
  /**
68
   * Maps to skolems for each free variable that appears in a check. This is
69
   * used during initializeChecker so that query (which may contain free
70
   * variables) is converted to a formula without free variables.
71
   */
72
  std::map<Node, Node> d_fv_to_skolem;
73
  /** convert */
74
  Node convertToSkolem(Node n);
75
  /** initialize checker
76
   *
77
   * This function initializes the smt engine smte to check the satisfiability
78
   * of the argument "query", which is a formula whose free variables (of
79
   * kind BOUND_VARIABLE) are a subset of d_vars.
80
   */
81
  void initializeChecker(std::unique_ptr<SmtEngine>& smte, Node query);
82
  /**
83
   * Run the satisfiability check on query and return the result
84
   * (sat/unsat/unknown).
85
   *
86
   * In contrast to the above method, this call should be used for cases where
87
   * the model for the query is not important.
88
   */
89
  Result doCheck(Node query);
90
};
91
92
}  // namespace quantifiers
93
}  // namespace theory
94
}  // namespace cvc5
95
96
#endif /* CVC5__THEORY__QUANTIFIERS__EXPRESSION_MINER_H */