Skip to content

Commit

Permalink
Restore extractLsb_or
Browse files Browse the repository at this point in the history
  • Loading branch information
pennyannn committed Sep 30, 2024
1 parent 83a63f4 commit 1becfad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Arm/BitVec.lean
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,16 @@ def extractLsByte (val : BitVec w₁) (n : Nat) : BitVec 8 :=
theorem extractLsByte_def (val : BitVec w₁) (n : Nat) :
val.extractLsByte n = val.extractLsb' (n * 8) 8 := rfl

-- TODO: upstream
theorem extractLsb_or (x y : BitVec w₁) (n : Nat) :
(x ||| y).extractLsb n lo = (x.extractLsb n lo ||| y.extractLsb n lo) := by
apply BitVec.eq_of_getLsbD_eq
simp only [getLsbD_extract, getLsbD_or]
intros i
by_cases h : (i : Nat) ≤ n - lo
· simp only [h, decide_True, Bool.true_and]
· simp only [h, decide_False, Bool.false_and, Bool.or_self]

-- TODO: upstream
theorem extractLsb'_or (x y : BitVec w₁) (n : Nat) :
(x ||| y).extractLsb' lo n = (x.extractLsb' lo n ||| y.extractLsb' lo n) := by
Expand Down

0 comments on commit 1becfad

Please sign in to comment.