Bitwise operations on integers #
Recursors #
Int.bitCasesOn
: Parity disjunction. Something is true/defined onℤ
if it's true/defined for even and for odd values.
bitwise ops #
@[simp]
Defines a function from ℤ
conditionally, if it is defined for odd and even integers separately
using bit
.
Equations
Instances For
@[simp]
theorem
Int.bit_negSucc
(b : Bool)
(n : ℕ)
:
Int.bit b (Int.negSucc n) = Int.negSucc (Nat.bit (!b) n)
@[simp]
theorem
Int.testBit_succ
(m : ℕ)
(b : Bool)
(n : ℤ)
:
Int.testBit (Int.bit b n) (Nat.succ m) = Int.testBit n m
@[simp]
theorem
Int.bitwise_bit
(f : Bool → Bool → Bool)
(a : Bool)
(m : ℤ)
(b : Bool)
(n : ℤ)
:
Int.bitwise f (Int.bit a m) (Int.bit b n) = Int.bit (f a b) (Int.bitwise f m n)
@[simp]
theorem
Int.testBit_bitwise
(f : Bool → Bool → Bool)
(m : ℤ)
(n : ℤ)
(k : ℕ)
:
Int.testBit (Int.bitwise f m n) k = f (Int.testBit m k) (Int.testBit n k)
@[simp]
theorem
Int.testBit_lor
(m : ℤ)
(n : ℤ)
(k : ℕ)
:
Int.testBit (Int.lor m n) k = (Int.testBit m k || Int.testBit n k)
@[simp]
theorem
Int.testBit_land
(m : ℤ)
(n : ℤ)
(k : ℕ)
:
Int.testBit (Int.land m n) k = (Int.testBit m k && Int.testBit n k)
@[simp]
theorem
Int.testBit_ldiff
(m : ℤ)
(n : ℤ)
(k : ℕ)
:
Int.testBit (Int.ldiff m n) k = (Int.testBit m k && !Int.testBit n k)
@[simp]
theorem
Int.testBit_lxor
(m : ℤ)
(n : ℤ)
(k : ℕ)
:
Int.testBit (Int.xor m n) k = xor (Int.testBit m k) (Int.testBit n k)
@[simp]
@[simp]
theorem
Int.shiftLeft_negSucc
(m : ℕ)
(n : ℕ)
:
Int.negSucc m <<< ↑n = Int.negSucc (Nat.shiftLeft' true m n)
@[simp]