File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -1252,21 +1252,24 @@ theorem mulRec_eq_mul_signExtend_truncate (l r : BitVec w) (s : Nat) :
1252
1252
rw [heq, ← BitVec.mul_add]
1253
1253
rw [← zeroExtend_truncate_succ_eq_zeroExtend_truncate_add_pot]
1254
1254
1255
- theorem zeroExtend_zeroExtend_of_lt (x : BitVec w)
1256
- (u v : Nat) (hi : i ≤ j ) :
1257
- (x.zeroExtend i |> .zeroExtend j) = x.zeroExtend j := by
1255
+ /-- Zero extending by number of bits larger than the bitwidth has no effect. -/
1256
+ theorem zeroExtend_of_ge {x : BitVec w} {i j : Nat} (hi : i ≥ w ) :
1257
+ (x.zeroExtend i) .zeroExtend j = x.zeroExtend j := by
1258
1258
ext k
1259
1259
simp
1260
1260
intros hx;
1261
- have hk : k < j := by omega
1262
- sorry
1263
- -- omega
1261
+ have hi' : k < w := BitVec.lt_of_getLsb _ _ hx
1262
+ omega
1263
+
1264
+ /-- Zero extending by the bitwidth has no effect. -/
1265
+ theorem zeroExtend_eq_self {x : BitVec w} : x.zeroExtend w = x := by
1266
+ ext i
1267
+ simp [getLsb_zeroExtend]
1264
1268
1265
1269
theorem getLsb_mul (x y : BitVec w) (i : Nat) :
1266
1270
(x * y).getLsb i = (mulRec x y w).getLsb i := by
1267
1271
simp [mulRec_eq_mul_signExtend_truncate]
1268
- rw [truncate]
1269
- sorry
1272
+ rw [truncate, zeroExtend_of_ge (by omega), zeroExtend_eq_self]
1270
1273
1271
1274
/-! ### le and lt -/
1272
1275
You can’t perform that action at this time.
0 commit comments