File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -2921,6 +2921,21 @@ theorem toInt_intMin {w : Nat} :
2921
2921
rw [Nat.mul_comm]
2922
2922
simp [w_pos]
2923
2923
2924
+ theorem toInt_intMin_le (x : BitVec w) :
2925
+ (intMin w).toInt ≤ x.toInt := by
2926
+ cases w
2927
+ case zero => simp [@of_length_zero x]
2928
+ case succ w =>
2929
+ simp only [toInt_intMin, Nat.add_one_sub_one, Int.ofNat_emod]
2930
+ have : 0 < 2 ^ w := Nat.two_pow_pos w
2931
+ rw [Int.emod_eq_of_lt (by omega) (by omega)]
2932
+ rw [BitVec.toInt_eq_toNat_bmod]
2933
+ rw [show (2 ^ w : Nat) = ((2 ^ (w + 1 ) : Nat) : Int) / 2 by omega]
2934
+ apply Int.le_bmod (by omega)
2935
+
2936
+ theorem intMin_sle (x : BitVec w) : (intMin w).sle x := by
2937
+ simp only [BitVec.sle, toInt_intMin_le x, decide_True]
2938
+
2924
2939
@[simp]
2925
2940
theorem neg_intMin {w : Nat} : -intMin w = intMin w := by
2926
2941
by_cases h : 0 < w
You can’t perform that action at this time.
0 commit comments