GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/cegqi/nested_qe.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
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
 * Methods for counterexample-guided quantifier instantiation
14
 * based on nested quantifier elimination.
15
 */
16
17
#include "cvc5_private.h"
18
19
#ifndef CVC5__THEORY__QUANTIFIERS__CEQGI__NESTED_QE_H
20
#define CVC5__THEORY__QUANTIFIERS__CEQGI__NESTED_QE_H
21
22
#include <unordered_set>
23
24
#include "context/cdhashmap.h"
25
#include "expr/node.h"
26
27
namespace cvc5 {
28
namespace theory {
29
namespace quantifiers {
30
31
class NestedQe
32
{
33
  using NodeNodeMap = context::CDHashMap<Node, Node>;
34
35
 public:
36
  NestedQe(context::UserContext* u);
37
30
  ~NestedQe() {}
38
  /**
39
   * Process quantified formula. If this returns true, then q was processed
40
   * via nested quantifier elimination (either during this call or previously
41
   * in this user context). If q was processed in this call, the lemma:
42
   *   (= q qqe)
43
   * is added to lem, where qqe is the result of nested quantifier elimination
44
   * on q.
45
   */
46
  bool process(Node q, std::vector<Node>& lems);
47
  /**
48
   * Have we processed q using the above method?
49
   */
50
  bool hasProcessed(Node q) const;
51
52
  /**
53
   * Get nested quantification. Returns true if q has nested quantifiers.
54
   * Adds each nested quantifier in the body of q to nqs.
55
   */
56
  static bool getNestedQuantification(Node q, std::unordered_set<Node>& nqs);
57
  /**
58
   * Does quantified formula q have nested quantification?
59
   */
60
  static bool hasNestedQuantification(Node q);
61
  /**
62
   * Do nested quantifier elimination. Returns a formula that is equivalent to
63
   * q and has no nested quantification. If keepTopLevel is false, then the
64
   * returned formula is quantifier-free. Otherwise, it is a quantified formula
65
   * with no nested quantification.
66
   */
67
  static Node doNestedQe(Node q, bool keepTopLevel = false);
68
  /**
69
   * Run quantifier elimination on quantified formula q, where q has no nested
70
   * quantification. This method invokes a subsolver for performing quantifier
71
   * elimination.
72
   */
73
  static Node doQe(Node q);
74
75
 private:
76
  /**
77
   * Mapping from quantified formulas q to the result of doNestedQe(q, true).
78
   */
79
  NodeNodeMap d_qnqe;
80
};
81
82
}  // namespace quantifiers
83
}  // namespace theory
84
}  // namespace cvc5
85
86
#endif