GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/arith/arith_rewriter.h Lines: 3 3 100.0 %
Date: 2021-09-15 Branches: 1 2 50.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
9939
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
  static RewriteResponse postRewritePow2(TNode t);
68
69
  static RewriteResponse preRewriteTranscendental(TNode t);
70
  static RewriteResponse postRewriteTranscendental(TNode t);
71
72
  static RewriteResponse preRewriteAtom(TNode t);
73
  static RewriteResponse postRewriteAtom(TNode t);
74
75
  static bool isAtom(TNode n);
76
77
8471541
  static inline bool isTerm(TNode n) {
78
8471541
    return !isAtom(n);
79
  }
80
  /** return rewrite */
81
  static RewriteResponse returnRewrite(TNode t, Node ret, Rewrite r);
82
  /** The operator elimination utility */
83
  OperatorElim& d_opElim;
84
}; /* class ArithRewriter */
85
86
}  // namespace arith
87
}  // namespace theory
88
}  // namespace cvc5
89
90
#endif /* CVC5__THEORY__ARITH__ARITH_REWRITER_H */