Skip to content

Commit 93674cf

Browse files
committed
remove redundant proofs
1 parent ea02646 commit 93674cf

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

src/Init/Data/BitVec/Lemmas.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,7 @@ theorem sub_def {n} (x y : BitVec n) : x - y = .ofNat n ((2^n - y.toNat) + x.toN
19821982

19831983
@[simp, bv_toNat] theorem toInt_sub {x y : BitVec w} :
19841984
(x - y).toInt = (x.toInt - y.toInt).bmod (2^w) := by
1985-
simp [toInt_eq_toNat_bmod, Int.natCast_sub (2 ^ w) y.toNat (by omega)]
1985+
simp [toInt_eq_toNat_bmod, @Int.ofNat_sub y.toNat (2 ^ w) (by omega)]
19861986

19871987
-- We prefer this lemma to `toNat_sub` for the `bv_toNat` simp set.
19881988
-- For reasons we don't yet understand, unfolding via `toNat_sub` sometimes

src/Init/Data/Int/Lemmas.lean

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,6 @@ def eq_add_one_iff_neg_eq_negSucc {m n : Nat} : m = n + 1 ↔ -↑m = -[n+1] :=
6868

6969
@[norm_cast] theorem ofNat_inj : ((m : Nat) : Int) = (n : Nat) ↔ m = n := ⟨ofNat.inj, congrArg _⟩
7070

71-
@[local simp] theorem ofNat_sub_ofNat (m n : Nat) (h : n ≤ m) : (↑m - ↑n : Int) = ↑(m - n) := by
72-
simp only [instHSub, Sub.sub, Int.sub, instHAdd, Add.add, Int.add]
73-
split
74-
case h_1 _ _ _ nb _ hb =>
75-
symm at hb
76-
cases n <;> simp_all [(@ofNat_inj nb 0).mp]
77-
case h_2 _ _ na _ ha hb =>
78-
have h' := eq_add_one_iff_neg_eq_negSucc.mpr hb
79-
have h'' := (@ofNat_inj m na).mp ha
80-
rw [h', h''] at h
81-
simp [subNatNat_of_sub h, ofNat_inj, h', h'']
82-
· simp_all
83-
· simp_all
84-
8571
theorem ofNat_eq_zero : ((n : Nat) : Int) = 0 ↔ n = 0 := ofNat_inj
8672

8773
theorem ofNat_ne_zero : ((n : Nat) : Int) ≠ 0 ↔ n ≠ 0 := not_congr ofNat_eq_zero
@@ -554,12 +540,6 @@ theorem natCast_one : ((1 : Nat) : Int) = (1 : Int) := rfl
554540
-- so it still makes sense to tag the lemmas with `@[simp]`.
555541
simp
556542

557-
@[simp] theorem natCast_sub (a b : Nat) (h : b ≤ a) :
558-
((a - b : Nat) : Int) = (a : Int) - (b : Int) := by
559-
simp [h]
560-
-- Note this only works because of local simp attributes in this file,
561-
-- so it still makes sense to tag the lemmas with `@[simp]`.
562-
563543
@[simp] theorem natCast_mul (a b : Nat) : ((a * b : Nat) : Int) = (a : Int) * (b : Int) := by
564544
simp
565545

src/Init/Omega/Int.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,13 @@ theorem ofNat_sub_dichotomy {a b : Nat} :
9494
b ≤ a ∧ ((a - b : Nat) : Int) = a - b ∨ a < b ∧ ((a - b : Nat) : Int) = 0 := by
9595
by_cases h : b ≤ a
9696
· left
97-
simp [h]
97+
have t := Int.ofNat_sub h
98+
simp at t
99+
exact ⟨h, t⟩
98100
· right
99-
simp [Int.ofNat_sub_eq_zero, Nat.not_le.mp, h]
101+
have t := Nat.not_le.mp h
102+
simp [Int.ofNat_sub_eq_zero h]
103+
exact t
100104

101105
theorem ofNat_congr {a b : Nat} (h : a = b) : (a : Int) = (b : Int) := congrArg _ h
102106

0 commit comments

Comments
 (0)