|
LLZK 0.1.0
Veridise's ZK Language IR
|
An inclusive interval [a, b] where a and b are arbitrary integers not necessarily bound to a given field. More...
#include <Intervals.h>
Public Member Functions | |
| UnreducedInterval (const llvm::DynamicAPInt &x, const llvm::DynamicAPInt &y) | |
| UnreducedInterval (int64_t x, int64_t y) | |
| This constructor is primarily for convenience for unit tests. | |
| Interval | reduce (const Field &field) const |
| Reduce the interval to an interval in the given field. | |
| UnreducedInterval | intersect (const UnreducedInterval &rhs) const |
| Compute and return the intersection of this interval and the given RHS. | |
| UnreducedInterval | doUnion (const UnreducedInterval &rhs) const |
| Compute and return the union of this interval and the given RHS. | |
| UnreducedInterval | computeLTPart (const UnreducedInterval &rhs) const |
| Return the part of the interval that is guaranteed to be less than the rhs's max value. | |
| UnreducedInterval | computeLEPart (const UnreducedInterval &rhs) const |
| Return the part of the interval that is less than or equal to the rhs's upper bound. | |
| UnreducedInterval | computeGTPart (const UnreducedInterval &rhs) const |
| Return the part of the interval that is greater than the rhs's lower bound. | |
| UnreducedInterval | computeGEPart (const UnreducedInterval &rhs) const |
| Return the part of the interval that is greater than or equal to the rhs's lower bound. | |
| UnreducedInterval | operator- () const |
| bool | overlaps (const UnreducedInterval &rhs) const |
| llvm::DynamicAPInt | getLHS () const |
| llvm::DynamicAPInt | getRHS () const |
| llvm::DynamicAPInt | width () const |
| Compute the width of this interval within a given field f. | |
| bool | isEmpty () const |
| Returns true iff width() is zero. | |
| bool | isNotEmpty () const |
| void | print (llvm::raw_ostream &os) const |
Friends | |
| UnreducedInterval | operator+ (const UnreducedInterval &lhs, const UnreducedInterval &rhs) |
| UnreducedInterval | operator- (const UnreducedInterval &lhs, const UnreducedInterval &rhs) |
| UnreducedInterval | operator* (const UnreducedInterval &lhs, const UnreducedInterval &rhs) |
| std::strong_ordering | operator<=> (const UnreducedInterval &lhs, const UnreducedInterval &rhs) |
| bool | operator== (const UnreducedInterval &lhs, const UnreducedInterval &rhs) |
| llvm::raw_ostream & | operator<< (llvm::raw_ostream &os, const UnreducedInterval &ui) |
An inclusive interval [a, b] where a and b are arbitrary integers not necessarily bound to a given field.
Definition at line 26 of file Intervals.h.
|
inline |
Definition at line 28 of file Intervals.h.
|
inline |
This constructor is primarily for convenience for unit tests.
Definition at line 30 of file Intervals.h.
| UnreducedInterval llzk::UnreducedInterval::computeGEPart | ( | const UnreducedInterval & | rhs | ) | const |
Return the part of the interval that is greater than or equal to the rhs's lower bound.
For example, given *this = [0, 7] and rhs = [3, 5], this function would return [3, 7], since rhs has a minimum value of 3. If this interval's upper bound is less than the rhs's lower bound, the returned interval will be "empty" (an interval where a > b). For example, if *this = [0, 6] and rhs = [7, 10], then no part of *this is greater than or equal to rhs.
Definition at line 83 of file Intervals.cpp.
| UnreducedInterval llzk::UnreducedInterval::computeGTPart | ( | const UnreducedInterval & | rhs | ) | const |
Return the part of the interval that is greater than the rhs's lower bound.
For example, given *this = [0, 7] and rhs = [3, 5], this function would return [4, 7], since rhs has a minimum value of 3. If this interval's upper bound is less than or equal to the rhs's lower bound, the returned interval will be "empty" (an interval where a > b). For example, if *this = [0, 7] and rhs = [7, 10], then no part of *this is greater than rhs.
Definition at line 75 of file Intervals.cpp.
| UnreducedInterval llzk::UnreducedInterval::computeLEPart | ( | const UnreducedInterval & | rhs | ) | const |
Return the part of the interval that is less than or equal to the rhs's upper bound.
For example, given *this = [0, 7] and rhs = [3, 5], this function would return [0, 5], since rhs has a max value of 5. If this interval's lower bound is greater than to the rhs's upper bound, the returned interval will be "empty" (an interval where a > b). For example, if *this = [8, 10] and rhs = [0, 7], then no part of *this is less than or equal to rhs.
Definition at line 68 of file Intervals.cpp.
| UnreducedInterval llzk::UnreducedInterval::computeLTPart | ( | const UnreducedInterval & | rhs | ) | const |
Return the part of the interval that is guaranteed to be less than the rhs's max value.
For example, given *this = [0, 7] and rhs = [3, 5], this function would return [0, 4], since rhs has a max value of 5. If this interval's lower bound is greater than or equal to the rhs's upper bound, the returned interval will be "empty" (an interval where a > b). For example, if *this = [7, 10] and rhs = [0, 7], then no part of *this is less than rhs.
Definition at line 60 of file Intervals.cpp.
| UnreducedInterval llzk::UnreducedInterval::doUnion | ( | const UnreducedInterval & | rhs | ) | const |
Compute and return the union of this interval and the given RHS.
| rhs |
Definition at line 55 of file Intervals.cpp.
|
inline |
Definition at line 106 of file Intervals.h.
|
inline |
Definition at line 107 of file Intervals.h.
| UnreducedInterval llzk::UnreducedInterval::intersect | ( | const UnreducedInterval & | rhs | ) | const |
Compute and return the intersection of this interval and the given RHS.
| rhs |
Definition at line 50 of file Intervals.cpp.
|
inline |
Returns true iff width() is zero.
Definition at line 114 of file Intervals.h.
|
inline |
Definition at line 116 of file Intervals.h.
| UnreducedInterval llzk::UnreducedInterval::operator- | ( | ) | const |
Definition at line 90 of file Intervals.cpp.
| bool llzk::UnreducedInterval::overlaps | ( | const UnreducedInterval & | rhs | ) | const |
Definition at line 118 of file Intervals.cpp.
|
inline |
Definition at line 118 of file Intervals.h.
Reduce the interval to an interval in the given field.
| field |
Definition at line 20 of file Intervals.cpp.
| DynamicAPInt llzk::UnreducedInterval::width | ( | ) | const |
Compute the width of this interval within a given field f.
If a > b, returns 0. Otherwise, returns b - a + 1.
Definition at line 132 of file Intervals.cpp.
|
friend |
Definition at line 106 of file Intervals.cpp.
|
friend |
Definition at line 97 of file Intervals.cpp.
|
friend |
Definition at line 102 of file Intervals.cpp.
|
friend |
Definition at line 120 of file Intervals.h.
|
friend |
Definition at line 122 of file Intervals.cpp.
|
friend |
Definition at line 101 of file Intervals.h.