Skip to content

Commit

Permalink
chore: improve BitVec ext lemmas
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Dec 10, 2024
1 parent c7b8c5c commit 7c8991a
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 113 deletions.
10 changes: 5 additions & 5 deletions src/Init/Data/BitVec/Bitblast.lean
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,15 @@ theorem msb_neg {w : Nat} {x : BitVec w} :
case true =>
apply hmin
apply eq_of_getMsbD_eq
rintro ⟨i, hi
intro i hi
simp only [getMsbD_intMin, w_pos, decide_true, Bool.true_and]
cases i
case zero => exact hmsb
case succ => exact getMsbD_x _ hi (by omega)
case false =>
apply hzero
apply eq_of_getMsbD_eq
rintro ⟨i, hi
intro i hi
simp only [getMsbD_zero]
cases i
case zero => exact hmsb
Expand Down Expand Up @@ -573,11 +573,11 @@ theorem setWidth_setWidth_succ_eq_setWidth_setWidth_add_twoPow (x : BitVec w) (i
setWidth w (x.setWidth (i + 1)) =
setWidth w (x.setWidth i) + (x &&& twoPow w i) := by
rw [add_eq_or_of_and_eq_zero]
· ext k
simp only [getLsbD_setWidth, Fin.is_lt, decide_true, Bool.true_and, getLsbD_or, getLsbD_and]
· ext k h
simp only [getLsbD_setWidth, h, decide_true, Bool.true_and, getLsbD_or, getLsbD_and]
by_cases hik : i = k
· subst hik
simp
simp [h]
· simp only [getLsbD_twoPow, hik, decide_false, Bool.and_false, Bool.or_false]
by_cases hik' : k < (i + 1)
· have hik'' : k < i := by omega
Expand Down
Loading

0 comments on commit 7c8991a

Please sign in to comment.