1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/******************************************************************************
* Top contributors (to current version):
* Andrew Reynolds
*
* This file is part of the cvc5 project.
*
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
* in the top-level source directory and their institutional affiliations.
* All rights reserved. See the file COPYING in the top-level source
* directory for licensing information.
* ****************************************************************************
*
* Type for rewrites for arithmetic.
*/
#include "cvc5_private.h"
#ifndef CVC5__THEORY__ARITH__REWRITES_H
#define CVC5__THEORY__ARITH__REWRITES_H
#include <iosfwd>
namespace cvc5 {
namespace theory {
namespace arith {
/**
* Types of rewrites used by arithmetic
*/
enum class Rewrite : uint32_t
{
NONE,
// constant evaluation
CONST_EVAL,
// (mod x c) replaced by total (mod x c) if c != 0
MOD_TOTAL_BY_CONST,
// (div x c) replaced by total (div x c) if c != 0
DIV_TOTAL_BY_CONST,
// Total versions choose arbitrary values for 0 denominator:
// (div x 0) ---> 0
// (mod x 0) ---> 0
DIV_MOD_BY_ZERO,
// (mod x 1) --> 0
MOD_BY_ONE,
// (div x 1) --> x
DIV_BY_ONE,
// (div x (- c)) ---> (- (div x c))
// (mod x (- c)) ---> (mod x c)
DIV_MOD_PULL_NEG_DEN,
// (mod (mod x c) c) --> (mod x c)
MOD_OVER_MOD,
// (mod (op ... (mod x c) ...) c) ---> (mod (op ... x ...) c) where
// op is one of { NONLINEAR_MULT, MULT, PLUS }.
MOD_CHILD_MOD,
// (div (mod x c) c) --> 0
DIV_OVER_MOD
};
/**
* Converts an rewrite to a string. Note: This function is also used in
* `safe_print()`. Changing this functions name or signature will result in
* `safe_print()` printing "<unsupported>" instead of the proper strings for
* the enum values.
*
* @param r The rewrite
* @return The name of the rewrite
*/
const char* toString(Rewrite r);
/**
* Writes an rewrite name to a stream.
*
* @param out The stream to write to
* @param r The rewrite to write to the stream
* @return The stream
*/
std::ostream& operator<<(std::ostream& out, Rewrite r);
} // namespace arith
} // namespace theory
} // namespace cvc5
#endif /* CVC5__THEORY__ARITH__REWRITES_H */
|