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