Skip to content

Commit e7be64b

Browse files
committed
chore: use x/y consistently to name bitvectors
This is purely a naming change to make our bitvector proofs more consistent.
1 parent 35e1554 commit e7be64b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Init/Data/BitVec/Lemmas.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ theorem ofFin_eq_ofNat : @BitVec.ofFin w (Fin.mk x lt) = BitVec.ofNat w x := by
2323
simp only [BitVec.ofNat, Fin.ofNat', lt, Nat.mod_eq_of_lt]
2424

2525
/-- 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
2727
| ⟨_, _⟩, ⟨_, _⟩, rfl => rfl
2828

2929
@[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
228228
/-! ### toInt/ofInt -/
229229

230230
/-- 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)
235235
else
236-
(i.toNat : Int) - (2^n : Nat) :=
236+
(x.toNat : Int) - (2^n : Nat) :=
237237
rfl
238238

239239
theorem msb_eq_false_iff_two_mul_lt (x : BitVec w) : x.msb = false2 * 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) :=
260260
omega
261261

262262
/-- 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
264264
intro eq
265265
simp [toInt_eq_toNat_cond] at eq
266266
apply eq_of_toNat_eq
267267
revert eq
268-
have _ilt := i.isLt
269-
have _jlt := j.isLt
268+
have _xlt := x.isLt
269+
have _ylt := y.isLt
270270
split <;> split <;> omega
271271

272272
theorem toInt_inj (x y : BitVec n) : x.toInt = y.toInt ↔ x = y :=

0 commit comments

Comments
 (0)