File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -1532,10 +1532,6 @@ theorem signExtend_eq_setWidth_of_lt (x : BitVec w) {v : Nat} (hv : v ≤ w):
1532
1532
theorem signExtend_eq (x : BitVec w) : x.signExtend w = x := by
1533
1533
rw [signExtend_eq_setWidth_of_lt _ (Nat.le_refl _), setWidth_eq]
1534
1534
1535
- example (a b : Nat) (h : a ≤ b) : ∃ k : Nat, b = a + k:= by
1536
- exact Nat.exists_eq_add_of_le h
1537
-
1538
-
1539
1535
theorem toNat_signExtend_of_gt (x : BitVec w) {v : Nat} :
1540
1536
(x.signExtend (w + v)).toNat = x.toNat + (2 ^ (w + v) - 2 ^w) * (if x.msb then 1 else 0 ) := by
1541
1537
apply Nat.eq_of_testBit_eq
@@ -1555,8 +1551,9 @@ theorem toNat_signExtend (x : BitVec w) {v : Nat} :
1555
1551
· rw [signExtend_eq_setWidth_of_lt _ h, toNat_setWidth]
1556
1552
simp [Nat.sub_eq_zero_of_le (Nat.pow_le_pow_of_le_right Nat.two_pos h)]
1557
1553
· have ⟨k, hk⟩ := Nat.exists_eq_add_of_le (Nat.le_of_lt (Nat.lt_of_not_le h))
1554
+ have H := Nat.pow_le_pow_of_le_right Nat.two_pos (Nat.le_add_right w k)
1558
1555
rw [hk, toNat_signExtend_of_gt, toNat_setWidth]
1559
- rw [Nat.mod_eq_of_lt (Nat.lt_of_lt_of_le x.isLt ((Nat.pow_le_pow_of_le_right Nat.two_pos ( by simp))) )]
1556
+ rw [Nat.mod_eq_of_lt (Nat.lt_of_lt_of_le x.isLt H )]
1560
1557
1561
1558
1562
1559
/-! ### append -/
You can’t perform that action at this time.
0 commit comments