Skip to content

Commit a39c234

Browse files
committed
chore(Data/Rat/Lemmas): deprecate num_mk and den_mk (leanprover-community#33334)
1 parent 5a89fda commit a39c234

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

Mathlib/Data/Rat/Lemmas.lean

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,13 @@ theorem num_den_mk {q : ℚ} {n d : ℤ} (hd : d ≠ 0) (qdf : q = n /. d) :
5656
rw [qdf]
5757
exact Rat.num_ne_zero.2 ((divInt_ne_zero hd).mpr hn)
5858

59-
theorem num_mk (n d : ℤ) : (n /. d).num = d.sign * n / n.gcd d := by
60-
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
61-
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_natCast]
62-
rcases d with ((_ | _) | _) <;>
63-
simp [divInt, mkRat, Rat.normalize_eq, Int.sign, Int.gcd,
64-
Int.zero_ediv, this]
65-
66-
theorem den_mk (n d : ℤ) : (n /. d).den = if d = 0 then 1 else d.natAbs / n.gcd d := by
67-
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
68-
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_natCast]
69-
rcases d with ((_ | _) | _) <;>
70-
simp [divInt, mkRat, Rat.normalize_eq, Int.gcd,
71-
if_neg (Nat.cast_add_one_ne_zero _), this]
59+
@[deprecated Rat.num_divInt (since := "2025-12-27")]
60+
theorem num_mk (n d : ℤ) : (n /. d).num = d.sign * n / n.gcd d :=
61+
Int.gcd_comm .. ▸ Rat.num_divInt ..
62+
63+
@[deprecated Rat.den_divInt (since := "2025-12-27")]
64+
theorem den_mk (n d : ℤ) : (n /. d).den = if d = 0 then 1 else d.natAbs / n.gcd d :=
65+
Int.gcd_comm .. ▸ Rat.den_divInt ..
7266

7367
theorem add_den_dvd_lcm (q₁ q₂ : ℚ) : (q₁ + q₂).den ∣ q₁.den.lcm q₂.den := by
7468
rw [add_def, normalize_eq, Nat.div_dvd_iff_dvd_mul (Nat.gcd_dvd_right _ _)

0 commit comments

Comments
 (0)