@@ -52,7 +52,7 @@ theorem normalize_self (r : Rat) : normalize r.num r.den r.den_nz = r := (mk_eq_
5252theorem normalize_mul_left {a : Nat} (d0 : d ≠ 0 ) (a0 : a ≠ 0 ) :
5353 normalize (↑a * n) (a * d) (Nat.mul_ne_zero a0 d0) = normalize n d d0 := by
5454 simp [normalize_eq, mk'.injEq, Int.natAbs_mul, Nat.gcd_mul_left,
55- Nat.mul_div_mul_left _ _ (Nat.pos_of_ne_zero a0), Int.ofNat_mul ,
55+ Nat.mul_div_mul_left _ _ (Nat.pos_of_ne_zero a0), Int.natCast_mul ,
5656 Int.mul_ediv_mul_of_pos _ _ (Int.ofNat_pos.2 <| Nat.pos_of_ne_zero a0)]
5757
5858theorem normalize_mul_right {a : Nat} (d0 : d ≠ 0 ) (a0 : a ≠ 0 ) :
@@ -68,7 +68,7 @@ theorem normalize_eq_iff (z₁ : d₁ ≠ 0) (z₂ : d₂ ≠ 0) :
6868 have hd₁ := Int.ofNat_dvd.2 <| Nat.gcd_dvd_right n₁.natAbs d₁
6969 have hd₂ := Int.ofNat_dvd.2 <| Nat.gcd_dvd_right n₂.natAbs d₂
7070 rw [← Int.ediv_mul_cancel (Int.dvd_trans hd₂ (Int.dvd_mul_left ..)),
71- Int.mul_ediv_assoc _ hd₂, ← Int.ofNat_ediv , ← h.2 , Int.ofNat_ediv ,
71+ Int.mul_ediv_assoc _ hd₂, ← Int.natCast_ediv , ← h.2 , Int.natCast_ediv ,
7272 ← Int.mul_ediv_assoc _ hd₁, Int.mul_ediv_assoc' _ hn₁,
7373 Int.mul_right_comm, h.1 , Int.ediv_mul_cancel hn₂]
7474 · rw [← normalize_mul_right _ z₂, ← normalize_mul_left z₂ z₁, Int.mul_comm d₁, h]
@@ -172,10 +172,10 @@ theorem divInt_num_den (z : d ≠ 0) (h : n /. d = ⟨n', d', z', c⟩) :
172172 rcases Int.eq_nat_or_neg d with ⟨_, rfl | rfl⟩ <;>
173173 simp_all [divInt_neg', Int.ofNat_eq_zero, Int.neg_eq_zero]
174174 · have ⟨m, h₁, h₂⟩ := mkRat_num_den z h; exists m
175- simp [Int.ofNat_eq_zero, Int.ofNat_mul , h₁, h₂]
175+ simp [Int.ofNat_eq_zero, Int.natCast_mul , h₁, h₂]
176176 · have ⟨m, h₁, h₂⟩ := mkRat_num_den z h; exists -m
177177 rw [← Int.neg_inj, Int.neg_neg] at h₂
178- simp [Int.ofNat_eq_zero, Int.ofNat_mul , h₁, h₂, Int.mul_neg, Int.neg_eq_zero]
178+ simp [Int.ofNat_eq_zero, Int.natCast_mul , h₁, h₂, Int.mul_neg, Int.neg_eq_zero]
179179
180180@[simp] theorem ofInt_ofNat : ofInt (OfNat.ofNat n) = OfNat.ofNat n := rfl
181181
@@ -209,7 +209,7 @@ theorem normalize_add_normalize (n₁ n₂) {d₁ d₂} (z₁ z₂) :
209209 cases e₁ : normalize n₁ d₁ z₁; rcases normalize_num_den e₁ with ⟨g₁, zg₁, rfl, rfl⟩
210210 cases e₂ : normalize n₂ d₂ z₂; rcases normalize_num_den e₂ with ⟨g₂, zg₂, rfl, rfl⟩
211211 simp only [add_def]; rw [← normalize_mul_right _ (Nat.mul_ne_zero zg₁ zg₂)]; congr 1
212- · rw [Int.add_mul]; simp [Int.ofNat_mul , Int.mul_assoc, Int.mul_left_comm, Int.mul_comm]
212+ · rw [Int.add_mul]; simp [Int.natCast_mul , Int.mul_assoc, Int.mul_left_comm, Int.mul_comm]
213213 · simp [Nat.mul_left_comm, Nat.mul_comm]
214214
215215theorem mkRat_add_mkRat (n₁ n₂ : Int) {d₁ d₂} (z₁ : d₁ ≠ 0 ) (z₂ : d₂ ≠ 0 ) :
@@ -220,8 +220,8 @@ theorem divInt_add_divInt (n₁ n₂ : Int) {d₁ d₂} (z₁ : d₁ ≠ 0) (z
220220 n₁ /. d₁ + n₂ /. d₂ = (n₁ * d₂ + n₂ * d₁) /. (d₁ * d₂) := by
221221 rcases Int.eq_nat_or_neg d₁ with ⟨_, rfl | rfl⟩ <;>
222222 rcases Int.eq_nat_or_neg d₂ with ⟨_, rfl | rfl⟩ <;>
223- simp_all [- Int.natCast_mul, Int.ofNat_eq_zero, Int.neg_eq_zero, divInt_neg', Int.mul_neg,
224- Int.ofNat_mul_ofNat, Int. neg_add, Int.neg_mul, mkRat_add_mkRat]
223+ simp_all [← Int.natCast_mul, Int.ofNat_eq_zero, Int.neg_eq_zero, divInt_neg', Int.mul_neg,
224+ Int.neg_add, Int.neg_mul, mkRat_add_mkRat]
225225
226226@[simp] theorem neg_num (a : Rat) : (-a).num = -a.num := rfl
227227@[simp] theorem neg_den (a : Rat) : (-a).den = a.den := rfl
@@ -246,7 +246,7 @@ theorem sub_def (a b : Rat) :
246246 (Nat.dvd_trans (Nat.gcd_dvd_right ..) <|
247247 Nat.dvd_trans (Nat.gcd_dvd_right ..) (Nat.dvd_mul_left ..)),
248248 ← normalize_mul_right _ this]; congr 1
249- · simp only [Int.sub_mul, Int.mul_assoc, Int.ofNat_mul_ofNat ,
249+ · simp only [Int.sub_mul, Int.mul_assoc, ← Int.natCast_mul ,
250250 Nat.div_mul_cancel (Nat.gcd_dvd_left ..), Nat.div_mul_cancel (Nat.gcd_dvd_right ..)]
251251 · rw [Nat.mul_right_comm, Nat.div_mul_cancel (Nat.gcd_dvd_left ..)]
252252
@@ -267,7 +267,7 @@ theorem mul_def (a b : Rat) :
267267 have H1 : a.num.natAbs.gcd b.den ≠ 0 := Nat.gcd_ne_zero_right b.den_nz
268268 have H2 : b.num.natAbs.gcd a.den ≠ 0 := Nat.gcd_ne_zero_right a.den_nz
269269 rw [mk_eq_normalize, ← normalize_mul_right _ (Nat.mul_ne_zero H1 H2)]; congr 1
270- · rw [Int.ofNat_mul , ← Int.mul_assoc, Int.mul_right_comm (Int.tdiv ..),
270+ · rw [Int.natCast_mul , ← Int.mul_assoc, Int.mul_right_comm (Int.tdiv ..),
271271 Int.tdiv_mul_cancel (Int.ofNat_dvd_left.2 <| Nat.gcd_dvd_left ..), Int.mul_assoc,
272272 Int.tdiv_mul_cancel (Int.ofNat_dvd_left.2 <| Nat.gcd_dvd_left ..)]
273273 · rw [← Nat.mul_assoc, Nat.mul_right_comm, Nat.mul_right_comm (_/_),
@@ -288,7 +288,7 @@ theorem normalize_mul_normalize (n₁ n₂) {d₁ d₂} (z₁ z₂) :
288288 cases e₁ : normalize n₁ d₁ z₁; rcases normalize_num_den e₁ with ⟨g₁, zg₁, rfl, rfl⟩
289289 cases e₂ : normalize n₂ d₂ z₂; rcases normalize_num_den e₂ with ⟨g₂, zg₂, rfl, rfl⟩
290290 simp only [mul_def]; rw [← normalize_mul_right _ (Nat.mul_ne_zero zg₁ zg₂)]; congr 1
291- · simp [Int.ofNat_mul , Int.mul_assoc, Int.mul_left_comm]
291+ · simp [Int.natCast_mul , Int.mul_assoc, Int.mul_left_comm]
292292 · simp [Nat.mul_left_comm, Nat.mul_comm]
293293
294294theorem mkRat_mul_mkRat (n₁ n₂ : Int) (d₁ d₂) :
@@ -300,8 +300,7 @@ theorem divInt_mul_divInt (n₁ n₂ : Int) {d₁ d₂} (z₁ : d₁ ≠ 0) (z
300300 (n₁ /. d₁) * (n₂ /. d₂) = (n₁ * n₂) /. (d₁ * d₂) := by
301301 rcases Int.eq_nat_or_neg d₁ with ⟨_, rfl | rfl⟩ <;>
302302 rcases Int.eq_nat_or_neg d₂ with ⟨_, rfl | rfl⟩ <;>
303- simp_all [-Int.natCast_mul, divInt_neg', Int.mul_neg, Int.ofNat_mul_ofNat, Int.neg_mul,
304- mkRat_mul_mkRat]
303+ simp_all [← Int.natCast_mul, divInt_neg', Int.mul_neg, Int.neg_mul, mkRat_mul_mkRat]
305304
306305theorem inv_def (a : Rat) : a.inv = a.den /. a.num := by
307306 unfold Rat.inv; split
0 commit comments