1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/********************* */
/*! \file nested_qe.h
** \verbatim
** Top contributors (to current version):
** Andrew Reynolds
** This file is part of the CVC4 project.
** Copyright (c) 2009-2020 by the authors listed in the file AUTHORS
** in the top-level source directory and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
**
** \brief Methods for counterexample-guided quantifier instantiation
** based on nested quantifier elimination.
**/
#include "cvc4_private.h"
#ifndef CVC4__THEORY__QUANTIFIERS__CEQGI__NESTED_QE_H
#define CVC4__THEORY__QUANTIFIERS__CEQGI__NESTED_QE_H
#include <unordered_set>
#include "context/cdhashmap.h"
#include "expr/node.h"
namespace CVC4 {
namespace theory {
namespace quantifiers {
class NestedQe
{
using NodeNodeMap = context::CDHashMap<Node, Node, NodeHashFunction>;
public:
NestedQe(context::UserContext* u);
~NestedQe() {}
/**
* Process quantified formula. If this returns true, then q was processed
* via nested quantifier elimination (either during this call or previously
* in this user context). If q was processed in this call, the lemma:
* (= q qqe)
* is added to lem, where qqe is the result of nested quantifier elimination
* on q.
*/
bool process(Node q, std::vector<Node>& lems);
/**
* Have we processed q using the above method?
*/
bool hasProcessed(Node q) const;
/**
* Get nested quantification. Returns true if q has nested quantifiers.
* Adds each nested quantifier in the body of q to nqs.
*/
static bool getNestedQuantification(
Node q, std::unordered_set<Node, NodeHashFunction>& nqs);
/**
* Does quantified formula q have nested quantification?
*/
static bool hasNestedQuantification(Node q);
/**
* Do nested quantifier elimination. Returns a formula that is equivalent to
* q and has no nested quantification. If keepTopLevel is false, then the
* returned formula is quantifier-free. Otherwise, it is a quantified formula
* with no nested quantification.
*/
static Node doNestedQe(Node q, bool keepTopLevel = false);
/**
* Run quantifier elimination on quantified formula q, where q has no nested
* quantification. This method invokes a subsolver for performing quantifier
* elimination.
*/
static Node doQe(Node q);
private:
/**
* Mapping from quantified formulas q to the result of doNestedQe(q, true).
*/
NodeNodeMap d_qnqe;
};
} // namespace quantifiers
} // namespace theory
} // namespace CVC4
#endif
|