GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/arith/arith_rewriter.h Lines: 3 3 100.0 %
Date: 2021-05-22 Branches: 1 4 25.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Dejan Jovanovic, Andrew Reynolds, Tim King
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
 * Rewriter for the theory of arithmetic.
14
 *
15
 * This rewrites to the normal form for arithmetic.
16
 * See theory/arith/normal_form.h for more information.
17
 */
18
19
#include "cvc5_private.h"
20
21
#ifndef CVC5__THEORY__ARITH__ARITH_REWRITER_H
22
#define CVC5__THEORY__ARITH__ARITH_REWRITER_H
23
24
#include "theory/arith/rewrites.h"
25
#include "theory/theory_rewriter.h"
26
27
namespace cvc5 {
28
namespace theory {
29
namespace arith {
30
31
class OperatorElim;
32
33
9459
class ArithRewriter : public TheoryRewriter
34
{
35
 public:
36
  ArithRewriter(OperatorElim& oe);
37
  RewriteResponse preRewrite(TNode n) override;
38
  RewriteResponse postRewrite(TNode n) override;
39
  /**
40
   * Expand definition, which eliminates extended operators like div/mod in
41
   * the given node.
42
   */
43
  TrustNode expandDefinition(Node node) override;
44
45
 private:
46
  static Node makeSubtractionNode(TNode l, TNode r);
47
  static Node makeUnaryMinusNode(TNode n);
48
49
  static RewriteResponse preRewriteTerm(TNode t);
50
  static RewriteResponse postRewriteTerm(TNode t);
51
52
  static RewriteResponse rewriteVariable(TNode t);
53
  static RewriteResponse rewriteConstant(TNode t);
54
  static RewriteResponse rewriteMinus(TNode t, bool pre);
55
  static RewriteResponse rewriteUMinus(TNode t, bool pre);
56
  static RewriteResponse rewriteDiv(TNode t, bool pre);
57
  static RewriteResponse rewriteIntsDivMod(TNode t, bool pre);
58
  static RewriteResponse rewriteIntsDivModTotal(TNode t, bool pre);
59
60
  static RewriteResponse preRewritePlus(TNode t);
61
  static RewriteResponse postRewritePlus(TNode t);
62
63
  static RewriteResponse preRewriteMult(TNode t);
64
  static RewriteResponse postRewriteMult(TNode t);
65
66
  static RewriteResponse postRewriteIAnd(TNode t);
67
68
  static RewriteResponse preRewriteTranscendental(TNode t);
69
  static RewriteResponse postRewriteTranscendental(TNode t);
70
71
  static RewriteResponse preRewriteAtom(TNode t);
72
  static RewriteResponse postRewriteAtom(TNode t);
73
74
  static bool isAtom(TNode n);
75
76
7489895
  static inline bool isTerm(TNode n) {
77
7489895
    return !isAtom(n);
78
  }
79
  /** return rewrite */
80
  static RewriteResponse returnRewrite(TNode t, Node ret, Rewrite r);
81
  /** The operator elimination utility */
82
  OperatorElim& d_opElim;
83
}; /* class ArithRewriter */
84
85
}  // namespace arith
86
}  // namespace theory
87
}  // namespace cvc5
88
89
#endif /* CVC5__THEORY__ARITH__ARITH_REWRITER_H */