Skip to content

Commit 9df3765

Browse files
committed
chore: wip
1 parent 5c9f78b commit 9df3765

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Init/Data/BitVec/Bitblast.lean

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3229,6 +3229,17 @@ theorem extractLsb'_extractLsb'_eq_of_lt (a : BitVec w) (hlt : i + k ≤ len) :
32293229
intros hlt
32303230
omega
32313231

3232+
theorem extractLsb'_append_extractLsb'_eq_of_lt (a : BitVec (a_length * w)) (ha : 0 < a_length) :
3233+
a = (a.extractLsb' ((a_length - 1) * w) w ++ a.extractLsb' 0 ((a_length - 1) * w)).cast
3234+
(by rw [show w + (a_length - 1) * w= 1 * w + (a_length - 1) * w by omega,
3235+
← Nat.add_mul, show 1 + (a_length - 1) = a_length by omega]) := by
3236+
ext i hi
3237+
simp only [getElem_cast, getElem_append, getElem_extractLsb', Nat.zero_add, dite_eq_ite]
3238+
split
3239+
· rw [← getLsbD_eq_getElem]
3240+
· simp [show (a_length - 1) * w + (i - (a_length - 1) * w) = i by omega]
3241+
rw [← getLsbD_eq_getElem]
3242+
32323243
theorem rec_add_eq_rec_add_iff
32333244
(a : BitVec (a_length * w))
32343245
(halen : a_length = (b_length + 1) / 2)
@@ -3246,7 +3257,11 @@ theorem rec_add_eq_rec_add_iff
32463257
· have hb : b_length = 0 := by omega
32473258
have ha : a_length = 0 := by omega
32483259
simp [ha, hb, recursive_addition]
3249-
·
3260+
· case _ n' ihn =>
3261+
rw [extractLsb'_append_extractLsb'_eq_of_lt (a := a) (by omega)]
3262+
have : a_length - 1 + 1 = a_length := by omega
3263+
rw [this] at *
3264+
rw [recursive_addition_concat (a_length := a_length - 1) (w := w) (a := a)]
32503265
sorry
32513266

32523267
/-- construct the parallel prefix sum circuit of the flattend bitvectors in `l` -/

0 commit comments

Comments
 (0)