@[irreducible]
A helper for implementing bitwise operators on Nat.
Each bit of the resulting Nat is the result of applying f to the corresponding bits of the input
Nats, up to the position of the highest set bit in either input.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[extern lean_nat_shiftl]
Shifts the binary representation of a value left by the specified number of bits. Usually accessed
via the <<< operator.
Examples:
1 <<< 2 = 41 <<< 3 = 80 <<< 3 = 00xf1 <<< 4 = 0xf10
Instances For
@[extern lean_nat_shiftr]
Shifts the binary representation of a value right by the specified number of bits. Usually accessed
via the >>> operator.
Examples:
4 >>> 2 = 18 >>> 2 = 28 >>> 3 = 10 >>> 3 = 00xf13a >>> 8 = 0xf1
Equations
- x✝.shiftRight 0 = x✝
- x✝.shiftRight m.succ = x✝.shiftRight m / 2
Instances For
Equations
- Nat.instShiftLeft = { shiftLeft := Nat.shiftLeft }
Equations
- Nat.instShiftRight = { shiftRight := Nat.shiftRight }
testBit #
We define an operation for testing individual bits in the binary representation of a number.