@@ -23,7 +23,7 @@ theorem ofFin_eq_ofNat : @BitVec.ofFin w (Fin.mk x lt) = BitVec.ofNat w x := by
23
23
simp only [BitVec.ofNat, Fin.ofNat', lt, Nat.mod_eq_of_lt]
24
24
25
25
/-- Prove equality of bitvectors in terms of nat operations. -/
26
- theorem eq_of_toNat_eq {n} : ∀ {i j : BitVec n}, i .toNat = j .toNat → i = j
26
+ theorem eq_of_toNat_eq {n} : ∀ {x y : BitVec n}, x .toNat = y .toNat → x = y
27
27
| ⟨_, _⟩, ⟨_, _⟩, rfl => rfl
28
28
29
29
@[simp] theorem val_toFin (x : BitVec w) : x.toFin.val = x.toNat := rfl
@@ -228,12 +228,12 @@ theorem toNat_ge_of_msb_true {x : BitVec n} (p : BitVec.msb x = true) : x.toNat
228
228
/-! ### toInt/ofInt -/
229
229
230
230
/-- Prove equality of bitvectors in terms of nat operations. -/
231
- theorem toInt_eq_toNat_cond (i : BitVec n) :
232
- i .toInt =
233
- if 2 *i .toNat < 2 ^n then
234
- (i .toNat : Int)
231
+ theorem toInt_eq_toNat_cond (x : BitVec n) :
232
+ x .toInt =
233
+ if 2 *x .toNat < 2 ^n then
234
+ (x .toNat : Int)
235
235
else
236
- (i .toNat : Int) - (2 ^n : Nat) :=
236
+ (x .toNat : Int) - (2 ^n : Nat) :=
237
237
rfl
238
238
239
239
theorem msb_eq_false_iff_two_mul_lt (x : BitVec w) : x.msb = false ↔ 2 * x.toNat < 2 ^w := by
@@ -260,13 +260,13 @@ theorem toInt_eq_toNat_bmod (x : BitVec n) : x.toInt = Int.bmod x.toNat (2^n) :=
260
260
omega
261
261
262
262
/-- Prove equality of bitvectors in terms of nat operations. -/
263
- theorem eq_of_toInt_eq {i j : BitVec n} : i .toInt = j .toInt → i = j := by
263
+ theorem eq_of_toInt_eq {x y : BitVec n} : x .toInt = y .toInt → x = y := by
264
264
intro eq
265
265
simp [toInt_eq_toNat_cond] at eq
266
266
apply eq_of_toNat_eq
267
267
revert eq
268
- have _ilt := i .isLt
269
- have _jlt := j .isLt
268
+ have _xlt := x .isLt
269
+ have _ylt := y .isLt
270
270
split <;> split <;> omega
271
271
272
272
theorem toInt_inj (x y : BitVec n) : x.toInt = y.toInt ↔ x = y :=
0 commit comments