GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/quantifiers_preprocess.h Lines: 1 1 100.0 %
Date: 2021-09-15 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
 * Preprocessor for the theory of quantifiers.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__QUANTIFIERS__QUANTIFIERS_PREPROCESS_H
19
#define CVC5__THEORY__QUANTIFIERS__QUANTIFIERS_PREPROCESS_H
20
21
#include "proof/trust_node.h"
22
#include "smt/env_obj.h"
23
24
namespace cvc5 {
25
namespace theory {
26
namespace quantifiers {
27
28
/**
29
 * Module for doing preprocessing that is pertinent to quantifiers. These
30
 * operations cannot be done in the rewriter since e.g. preskolemization
31
 * depends on knowing the polarity of the position in which quantifiers occur.
32
 */
33
18165
class QuantifiersPreprocess : protected EnvObj
34
{
35
 public:
36
  QuantifiersPreprocess(Env& env);
37
  /** preprocess
38
   *
39
   * This returns the result of applying simple quantifiers-specific
40
   * pre-processing to n, including but not limited to:
41
   * - pre-skolemization,
42
   * - aggressive prenexing.
43
   * The argument isInst is set to true if n is an instance of a previously
44
   * registered quantified formula. If this flag is true, we do not apply
45
   * certain steps like pre-skolemization since we know they will have no
46
   * effect.
47
   *
48
   * The result is wrapped in a trust node of kind TrustNodeKind::REWRITE.
49
   */
50
  TrustNode preprocess(Node n, bool isInst = false) const;
51
52
 private:
53
  using NodePolPairHashFunction = PairHashFunction<Node, bool, std::hash<Node>>;
54
  /**
55
   * Pre-skolemize quantifiers. Return the pre-skolemized form of n.
56
   *
57
   * @param n The formula to preskolemize.
58
   * @param polarity The polarity of n in the input.
59
   * @param fvs The free variables
60
   * @param visited Cache of visited (node, polarity) pairs.
61
   */
62
  Node preSkolemizeQuantifiers(
63
      Node n,
64
      bool polarity,
65
      std::vector<TNode>& fvs,
66
      std::unordered_map<std::pair<Node, bool>, Node, NodePolPairHashFunction>&
67
          visited) const;
68
  /**
69
   * Apply prenexing aggressively. Returns the prenex normal form of n.
70
   */
71
  Node computePrenexAgg(Node n, std::map<Node, Node>& visited) const;
72
};
73
74
}  // namespace quantifiers
75
}  // namespace theory
76
}  // namespace cvc5
77
78
#endif /* CVC5__THEORY__QUANTIFIERS__QUANTIFIERS_REWRITER_H */