@@ -3167,7 +3167,7 @@ theorem addRecAux_setWidth_extractAndExtend {x : BitVec w} (hn : n ≤ w) (hv :
31673167 omega
31683168 · simp [hk0]
31693169
3170- theorem th3 {x : BitVec w} (h : n ≤ w) (hw : 1 < w) (hv : v < w) (hn : n ≤ m):
3170+ theorem addRecAux_extractAndExtendPopulate_setWidth {x : BitVec w} (h : n ≤ w) (hv : v < w) (hn : n ≤ m):
31713171 (extractAndExtendPopulate v (setWidth m x)).addRecAux n 0 #v = (extractAndExtendPopulate v x).addRecAux n 0 #v := by
31723172 induction n generalizing v m
31733173 · case _ =>
@@ -3229,7 +3229,7 @@ theorem addRecAux_extractAndExtendPopulate_setWidth_eq {x : BitVec (w + 1)} (h :
32293229 have hext2 := extractLsb'_extractAndExtendPopulate_eq (w := w + 1 ) (len := w) (i := w) (x := x)
32303230 have hext1 := extractLsb'_extractAndExtendPopulate_eq (w := w) (len := w) (i := w) (x := (x.setWidth w))
32313231 congr 1
3232- · rw [th3 ( by omega) (by omega) (by omega) (by omega)]
3232+ · rw [addRecAux_extractAndExtendPopulate_setWidth (by omega) (by omega) (by omega)]
32333233 · rw [hext1, hext2]
32343234 ext k hk
32353235 simp
@@ -3264,7 +3264,7 @@ theorem addRecAux_extractAndExtendPopulateAux_le_of_le {x : BitVec w} (hn : n
32643264 omega
32653265 rw [Nat.mod_eq_of_lt (b := 2 ^ ((w + 1 + 1 ))) (by omega)]
32663266 omega
3267- simp only [toNat_add, -extractLsb'_toNat, add_mod_mod, ge_iff_le]
3267+ simp only [toNat_add, ge_iff_le]
32683268 rw [Nat.mod_eq_of_lt]
32693269 · omega
32703270 · have := Nat.lt_two_pow_self (n := w + 1 + 1 )
@@ -3306,7 +3306,7 @@ theorem addRecAux_extractAndExtendPopulateAux_le_of_le' {x : BitVec w} (h : n <
33063306 · case _ n ihn =>
33073307 simp
33083308 rw [← addRecAux_zero_add]
3309- simp only [toNat_add, -extractLsb'_toNat, add_mod_mod ]
3309+ simp only [toNat_add]
33103310 have : (extractLsb' (n * v) v (extractAndExtendPopulate v x)).toNat ≤ 1 := by
33113311 rw [extractLsb'_extractAndExtendPopulate_eq]
33123312 simp
@@ -3337,7 +3337,7 @@ theorem toNat_addRecAux_extractAndExtendPopulate {x : BitVec w} (hn : n ≤ w) (
33373337 conv =>
33383338 rhs
33393339 rw [← addRecAux_zero_add]
3340- simp only [toNat_add, ihn (by omega), -extractLsb'_toNat, add_mod_mod ]
3340+ simp only [toNat_add, ihn (by omega)]
33413341 rw [extractLsb'_extractAndExtendPopulate_eq]
33423342 rw [extractLsb'_extractAndExtendPopulate_eq]
33433343 rcases v with _|v
@@ -3379,8 +3379,7 @@ theorem setWidth_addRecAux_estractAndExtendPopuate_of_le {x : BitVec (w' + 1)} (
33793379 · simp [setWidth_add_eq_mod]
33803380 rw [ihn hle]
33813381 apply eq_of_toNat_eq
3382- simp only [toNat_umod, toNat_add, toNat_setWidth, -extractLsb'_toNat, add_mod_mod,
3383- toNat_twoPow]
3382+ simp only [toNat_umod, toNat_add, toNat_setWidth, add_mod_mod, toNat_twoPow]
33843383 rw [extractLsb'_extractAndExtendPopulate_eq]
33853384 have := addRecAux_extractAndExtendPopulateAux_le_of_le (x := x) (n := n') (by omega)
33863385 have hbool : extractLsb' n' 1 (setWidth (w' + 1 ) x) = BitVec.ofBool ((setWidth (w' + 1 ) x).getLsbD n') := by
@@ -3411,7 +3410,13 @@ theorem setWidth_addRecAux_estractAndExtendPopuate_of_le {x : BitVec (w' + 1)} (
34113410 rw [Nat.mod_eq_of_lt]
34123411 · rw [hbool']
34133412 cases ht : x.getLsbD n'
3414- <;> simp [show n' < w' + 1 + 1 by omega, show n' < w' + 1 by omega, ← getLsbD_eq_getElem, ht]
3413+ · simp only [getLsbD_setWidth, show n' < w' + 1 by omega, decide_true, ht,
3414+ Bool.and_false, ofBool_false, ofNat_eq_ofNat, truncate_eq_setWidth, setWidth_zero,
3415+ toNat_ofNat, zero_mod, Nat.add_zero]
3416+ · simp only [getLsbD_setWidth, show n' < w' + 1 by omega, decide_true, ht,
3417+ Bool.and_self, ofBool_true, ofNat_eq_ofNat, truncate_eq_setWidth, toNat_setWidth,
3418+ toNat_ofNat, Nat.pow_one, mod_succ, zero_lt_succ, one_mod_two_pow,
3419+ Nat.lt_add_left_iff_pos]
34153420 · have h2 : ((extractAndExtendPopulate (w' + 1 + 1 ) x).addRecAux n' 0 #(w' + 1 + 1 )).toNat +
34163421 (zeroExtend (w' + 1 + 1 ) (extractLsb' n' 1 x)).toNat ≤ n' + 1 := by
34173422 rw [hbool']
@@ -3490,7 +3495,7 @@ theorem setWidth_addRecAux_estractAndExtendPopuate_of_le {x : BitVec (w' + 1)} (
34903495 · rw [Nat.mod_eq_of_lt]
34913496 · rw [Nat.add_assoc]
34923497 congr 1
3493- · rw [th3 ( by omega) (by omega) (by omega) (by omega)]
3498+ · rw [addRecAux_extractAndExtendPopulate_setWidth (by omega) (by omega) (by omega)]
34943499 rw [toNat_addRecAux_extractAndExtendPopulate (by omega) (by omega) (by omega) (by omega)]
34953500 · rw [heq14Nat, heq23Nat, Nat.add_comm]
34963501 · omega
0 commit comments