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

Line Exec Source
1
/*********************                                                        */
2
/*! \file solution_filter.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 Utility for filtering sygus solutions.
13
 **/
14
15
#include "cvc4_private.h"
16
17
#ifndef CVC4__THEORY__QUANTIFIERS__SOLUTION_FILTER_H
18
#define CVC4__THEORY__QUANTIFIERS__SOLUTION_FILTER_H
19
20
#include <map>
21
#include <unordered_set>
22
#include "expr/node.h"
23
#include "theory/quantifiers/expr_miner.h"
24
#include "theory/quantifiers/lazy_trie.h"
25
#include "theory/quantifiers/sygus_sampler.h"
26
27
namespace CVC4 {
28
namespace theory {
29
namespace quantifiers {
30
31
/**
32
 * This class is used to filter solutions based on logical strength.
33
 *
34
 * Currently, it is used to filter predicate solutions that are collectively
35
 * entailed by the previous predicate solutions (if we are looking for logically
36
 * stronger solutions), or to filter predicate solutions that entail any
37
 * previous predicate (if we are looking for logically weaker solutions).
38
 */
39
class SolutionFilterStrength : public ExprMiner
40
{
41
 public:
42
  SolutionFilterStrength();
43
12
  ~SolutionFilterStrength() {}
44
  /** initialize */
45
  void initialize(const std::vector<Node>& vars,
46
                  SygusSampler* ss = nullptr) override;
47
  /**
48
   * Add term to this miner. It is expected that n has Boolean type.
49
   *
50
   * If d_isStrong is true, then if this method returns false, then the
51
   * entailment n_1 ^ ... ^ n_m |= n holds, where n_1, ..., n_m are the terms
52
   * previously registered to this class.
53
   *
54
   * Dually, if d_isStrong is false, then if this method returns false, then
55
   * the entailment n |= n_1 V ... V n_m holds.
56
   */
57
  bool addTerm(Node n, std::ostream& out) override;
58
  /** set logically strong */
59
  void setLogicallyStrong(bool isStrong);
60
61
 private:
62
  /**
63
   * Set of all (non-filtered) terms registered to this class. We store the
64
   * negation of these terms if d_isStrong is false.
65
   */
66
  std::vector<Node> d_curr_sols;
67
  /** whether we are trying to find the logically strongest solutions */
68
  bool d_isStrong;
69
};
70
71
}  // namespace quantifiers
72
}  // namespace theory
73
}  // namespace CVC4
74
75
#endif /* CVC4__THEORY__QUANTIFIERS__SOLUTION_FILTER_H */