GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/passes/foreign_theory_rewrite.h Lines: 1 1 100.0 %
Date: 2021-03-22 Branches: 0 0 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file foreign_theory_rewrite.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Yoni Zohar, Gereon Kremer
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 The foreign_theory_rewrite preprocessing pass
13
 **
14
 ** Simplifies nodes of one theory using rewrites from another.
15
 **/
16
17
#include "cvc4_private.h"
18
19
#ifndef CVC4__PREPROCESSING__PASSES__FOREIGN_THEORY_REWRITE_H
20
#define CVC4__PREPROCESSING__PASSES__FOREIGN_THEORY_REWRITE_H
21
22
#include "context/cdhashmap.h"
23
#include "expr/node.h"
24
#include "preprocessing/preprocessing_pass.h"
25
26
namespace CVC4 {
27
namespace preprocessing {
28
namespace passes {
29
30
using CDNodeMap = context::CDHashMap<Node, Node, NodeHashFunction>;
31
32
17984
class ForeignTheoryRewrite : public PreprocessingPass
33
{
34
 public:
35
  ForeignTheoryRewrite(PreprocessingPassContext* preprocContext);
36
37
 protected:
38
  PreprocessingPassResult applyInternal(
39
      AssertionPipeline* assertionsToPreprocess) override;
40
  /** the main function that simplifies n.
41
   * does a traversal on n and call rewriting fucntions.
42
   */
43
  Node simplify(Node n);
44
  /** A specific simplification function specific for GEQ
45
   * constraints in strings.
46
   */
47
  static Node rewriteStringsGeq(Node n);
48
  /** invoke rewrite functions for n.
49
   * based on the structure of n (typically its kind)
50
   * we invoke rewrites from other theories.
51
   * For example: when encountering a `>=` node,
52
   * we invoke rewrites from the theory of strings.
53
   */
54
  static Node foreignRewrite(Node n);
55
  /** construct a node with the same operator as originalNode whose children are
56
   * processedChildren
57
   */
58
  static Node reconstructNode(Node originalNode, std::vector<Node> newChildren);
59
  /** A cache to store the simplified nodes */
60
  CDNodeMap d_cache;
61
};
62
63
}  // namespace passes
64
}  // namespace preprocessing
65
}  // namespace CVC4
66
67
#endif /* CVC4__PREPROCESSING__PASSES__FOREIGN_THEORY_REWRITE_H */