Skip to content

Commit cc42a17

Browse files
feat: add ushiftRight_*_distrib theorems (#4667)
1 parent e106be1 commit cc42a17

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Init/Data/BitVec/Lemmas.lean

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,21 @@ theorem getLsb_shiftLeft' {x : BitVec w₁} {y : BitVec w₂} {i : Nat} :
733733
getLsb (x >>> i) j = getLsb x (i+j) := by
734734
unfold getLsb ; simp
735735

736+
theorem ushiftRight_xor_distrib (x y : BitVec w) (n : Nat) :
737+
(x ^^^ y) >>> n = (x >>> n) ^^^ (y >>> n) := by
738+
ext
739+
simp
740+
741+
theorem ushiftRight_and_distrib (x y : BitVec w) (n : Nat) :
742+
(x &&& y) >>> n = (x >>> n) &&& (y >>> n) := by
743+
ext
744+
simp
745+
746+
theorem ushiftRight_or_distrib (x y : BitVec w) (n : Nat) :
747+
(x ||| y) >>> n = (x >>> n) ||| (y >>> n) := by
748+
ext
749+
simp
750+
736751
@[simp]
737752
theorem ushiftRight_zero_eq (x : BitVec w) : x >>> 0 = x := by
738753
simp [bv_toNat]

0 commit comments

Comments
 (0)