Returns true if n is ≤ exponentiation.threshold and fits in 32 bits. Otherwise,
reports a warning and returns false.
This method ensures there is at most one warning message of this kind in the message log.
The runtime implementation of Nat.pow aborts the process when the exponent does not fit in
32 bits, even if the user increased exponentiation.threshold.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns true if the left shift a <<< n is safe to evaluate given the threshold maxShift:
a is 0, or n is ≤ maxShift and fits in 32 bits.
The runtime implementation of Nat.shiftLeft aborts the process when the shifted value is not 0
and the shift amount does not fit in 32 bits. Thus, every procedure that evaluates a left shift of
literals whose shift amount is not bounded by a machine word size must use this function or
checkShiftLeft.
Equations
- Lean.isSafeShiftLeft a n maxShift = (a == 0 || decide (n ≤ maxShift) && decide (n < UInt32.size))
Instances For
Returns true if isSafeShiftLeft a n threshold, where threshold is the value of the option
shiftLeft.threshold. Otherwise, reports a warning and returns false.
This method ensures there is at most one warning message of this kind in the message log.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns true if bit-vectors of width w are safe to evaluate.
Most bit-vector operations compute 2^w. The bound 2^32 comes from the runtime, not the kernel:
lean_nat_pow (src/runtime/object.cpp) aborts the process when the base is greater than 1 and
the exponent is greater than UINT_MAX, because mpz::pow takes the exponent as an
unsigned int. Thus, procedures that evaluate bit-vector operations on literals must not build a
BitVec w value unless this function returns true.