64-bit two's complement integers #
Arithmetic wraps, so beware (not really, our uses are formally checked).
@[instance_reducible]
Fast conversion from ℕ
Equations
- instNatCastInt64_interval = { natCast := fun (n : ℕ) => (UInt64.ofNat n).toInt64 }
@[instance_reducible]
Fast conversion from ℤ
Equations
- instIntCastInt64_interval = { intCast := fun (n : ℤ) => Int64.ofInt n }
@[instance_reducible]
Int64 is a commutative ring.
We don't use CommRing.ofMinimalAxioms, since we want our own Sub` instance.
Equations
- One or more equations did not get rendered due to their size.
Conditions for ℤ conversion to commute with arithmetic #
@[simp]
Conversion from ℕ is secretly the same as conversion to UInt64
@[simp]
UInt64.log2 converts to ℤ as toNat
Order lemmas #
@[instance_reducible]
Int64 min (must be defined before LinearOrder)
@[instance_reducible]
Int64 max (must be defined before LinearOrder)
@[instance_reducible]
Int64 is a linear order (though not an ordered algebraic structure)
Equations
- One or more equations did not get rendered due to their size.
Shims for proof backwards compatibility #
Order operations: min, abs #
Left shift #
Right shift, rounding up or down #
@[simp]
0.shiftRightRound = 0
Int64.shiftRightRound rounds correctly
Int64.shiftRightRound reduces abs
Int64.shiftRightRound never produces min from scratch