File: Mathlib/Data/Rat/Lemmas.lean

full_name: Rat.num_dvd
code: theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a 
goal: (Rat.divInt a b).num ∣ a

full_name: Rat.den_dvd
code: theorem den_dvd (a b : ℤ) : ((a /. b).den : ℤ) ∣ b 
goal: ↑(Rat.divInt a b).den ∣ b

full_name: Rat.num_den_mk
code: theorem num_den_mk {q : ℚ} {n d : ℤ} (hd : d ≠ 0) (qdf : q = n /. d) :
    ∃ c : ℤ, n = c * q.num ∧ d = c * q.den 
goal: ∃ c, n = c * q.num ∧ d = c * ↑q.den

full_name: Rat.num_mk
code: theorem num_mk (n d : ℤ) : (n /. d).num = d.sign * n / n.gcd d 
goal: (Rat.divInt n d).num = d.sign * n / ↑(n.gcd d)

full_name: Rat.den_mk
code: theorem den_mk (n d : ℤ) : (n /. d).den = if d = 0 then 1 else d.natAbs / n.gcd d 
goal: (Rat.divInt n d).den = if d = 0 then 1 else d.natAbs / n.gcd d

full_name: Rat.add_den_dvd
code: theorem add_den_dvd (q₁ q₂ : ℚ) : (q₁ + q₂).den ∣ q₁.den * q₂.den 
goal: (q₁ + q₂).den ∣ q₁.den * q₂.den

full_name: Rat.mul_den_dvd
code: theorem mul_den_dvd (q₁ q₂ : ℚ) : (q₁ * q₂).den ∣ q₁.den * q₂.den 
goal: (q₁ * q₂).den ∣ q₁.den * q₂.den

full_name: Rat.mul_num
code: theorem mul_num (q₁ q₂ : ℚ) :
    (q₁ * q₂).num = q₁.num * q₂.num / Nat.gcd (q₁.num * q₂.num).natAbs (q₁.den * q₂.den) 
goal: (q₁ * q₂).num = q₁.num * q₂.num / ↑((q₁.num * q₂.num).natAbs.gcd (q₁.den * q₂.den))

full_name: Rat.mul_den
code: theorem mul_den (q₁ q₂ : ℚ) :
    (q₁ * q₂).den =
      q₁.den * q₂.den / Nat.gcd (q₁.num * q₂.num).natAbs (q₁.den * q₂.den) 
goal: (q₁ * q₂).den = q₁.den * q₂.den / (q₁.num * q₂.num).natAbs.gcd (q₁.den * q₂.den)

full_name: Rat.mul_self_num
code: theorem mul_self_num (q : ℚ) : (q * q).num = q.num * q.num 
goal: (q * q).num = q.num * q.num

full_name: Rat.mul_self_den
code: theorem mul_self_den (q : ℚ) : (q * q).den = q.den * q.den 
goal: (q * q).den = q.den * q.den

full_name: Rat.add_num_den
code: theorem add_num_den (q r : ℚ) :
    q + r = (q.num * r.den + q.den * r.num : ℤ) /. (↑q.den * ↑r.den : ℤ) 
goal: q + r = Rat.divInt (q.num * ↑r.den + ↑q.den * r.num) (↑q.den * ↑r.den)

full_name: Rat.isSquare_iff
code: theorem isSquare_iff {q : ℚ} : IsSquare q ↔ IsSquare q.num ∧ IsSquare q.den 
goal: IsSquare q ↔ IsSquare q.num ∧ IsSquare q.den

full_name: Rat.isSquare_natCast_iff
code: @[norm_cast, simp]
theorem isSquare_natCast_iff {n : ℕ} : IsSquare (n : ℚ) ↔ IsSquare n 
goal: IsSquare ↑n ↔ IsSquare n

full_name: Rat.isSquare_intCast_iff
code: @[norm_cast, simp]
theorem isSquare_intCast_iff {z : ℤ} : IsSquare (z : ℚ) ↔ IsSquare z 
goal: IsSquare ↑z ↔ IsSquare z

full_name: Rat.isSquare_ofNat_iff
code: @[simp]
theorem isSquare_ofNat_iff {n : ℕ} :
    IsSquare (no_index (OfNat.ofNat n) : ℚ) ↔ IsSquare (OfNat.ofNat n : ℕ) 
goal: IsSquare (OfNat.ofNat n) ↔ IsSquare (OfNat.ofNat n)

full_name: Rat.exists_eq_mul_div_num_and_eq_mul_div_den
code: theorem exists_eq_mul_div_num_and_eq_mul_div_den (n : ℤ) {d : ℤ} (d_ne_zero : d ≠ 0) :
    ∃ c : ℤ, n = c * ((n : ℚ) / d).num ∧ (d : ℤ) = c * ((n : ℚ) / d).den 
goal: ∃ c, n = c * (↑n / ↑d).num ∧ d = c * ↑(↑n / ↑d).den

full_name: Rat.mul_num_den'
code: theorem mul_num_den' (q r : ℚ) :
    (q * r).num * q.den * r.den = q.num * r.num * (q * r).den 
goal: (q * r).num * ↑q.den * ↑r.den = q.num * r.num * ↑(q * r).den

full_name: Rat.add_num_den'
code: theorem add_num_den' (q r : ℚ) :
    (q + r).num * q.den * r.den = (q.num * r.den + r.num * q.den) * (q + r).den 
goal: (q + r).num * ↑q.den * ↑r.den = (q.num * ↑r.den + r.num * ↑q.den) * ↑(q + r).den

full_name: Rat.substr_num_den'
code: theorem substr_num_den' (q r : ℚ) :
    (q - r).num * q.den * r.den = (q.num * r.den - r.num * q.den) * (q - r).den 
goal: (q - r).num * ↑q.den * ↑r.den = (q.num * ↑r.den - r.num * ↑q.den) * ↑(q - r).den

full_name: Rat.inv_neg
code: protected theorem inv_neg (q : ℚ) : (-q)⁻¹ = -q⁻¹ 
goal: (-q)⁻¹ = -q⁻¹

full_name: Rat.num_div_eq_of_coprime
code: theorem num_div_eq_of_coprime {a b : ℤ} (hb0 : 0 < b) (h : Nat.Coprime a.natAbs b.natAbs) :
    (a / b : ℚ).num = a 
goal: (↑a / ↑b).num = a

full_name: Rat.den_div_eq_of_coprime
code: theorem den_div_eq_of_coprime {a b : ℤ} (hb0 : 0 < b) (h : Nat.Coprime a.natAbs b.natAbs) :
    ((a / b : ℚ).den : ℤ) = b 
goal: ↑(↑a / ↑b).den = b

full_name: Rat.div_int_inj
code: theorem div_int_inj {a b c d : ℤ} (hb0 : 0 < b) (hd0 : 0 < d) (h1 : Nat.Coprime a.natAbs b.natAbs)
    (h2 : Nat.Coprime c.natAbs d.natAbs) (h : (a : ℚ) / b = (c : ℚ) / d) : a = c ∧ b = d 
goal: a = c ∧ b = d

full_name: Rat.intCast_div_self
code: @[norm_cast]
theorem intCast_div_self (n : ℤ) : ((n / n : ℤ) : ℚ) = n / n 
goal: ↑(n / n) = ↑n / ↑n

full_name: Rat.natCast_div_self
code: @[norm_cast]
theorem natCast_div_self (n : ℕ) : ((n / n : ℕ) : ℚ) = n / n 
goal: ↑(n / n) = ↑n / ↑n

full_name: Rat.intCast_div
code: theorem intCast_div (a b : ℤ) (h : b ∣ a) : ((a / b : ℤ) : ℚ) = a / b 
goal: ↑(a / b) = ↑a / ↑b

full_name: Rat.natCast_div
code: theorem natCast_div (a b : ℕ) (h : b ∣ a) : ((a / b : ℕ) : ℚ) = a / b 
goal: ↑(a / b) = ↑a / ↑b

full_name: Rat.den_div_intCast_eq_one_iff
code: theorem den_div_intCast_eq_one_iff (m n : ℤ) (hn : n ≠ 0) : ((m : ℚ) / n).den = 1 ↔ n ∣ m 
goal: (↑m / ↑n).den = 1 ↔ n ∣ m

full_name: Rat.den_div_natCast_eq_one_iff
code: theorem den_div_natCast_eq_one_iff (m n : ℕ) (hn : n ≠ 0) : ((m : ℚ) / n).den = 1 ↔ n ∣ m 
goal: (↑m / ↑n).den = 1 ↔ n ∣ m

full_name: Rat.inv_intCast_num_of_pos
code: theorem inv_intCast_num_of_pos {a : ℤ} (ha0 : 0 < a) : (a : ℚ)⁻¹.num = 1 
goal: (↑a)⁻¹.num = 1

full_name: Rat.inv_natCast_num_of_pos
code: theorem inv_natCast_num_of_pos {a : ℕ} (ha0 : 0 < a) : (a : ℚ)⁻¹.num = 1 
goal: (↑a)⁻¹.num = 1

full_name: Rat.inv_intCast_den_of_pos
code: theorem inv_intCast_den_of_pos {a : ℤ} (ha0 : 0 < a) : ((a : ℚ)⁻¹.den : ℤ) = a 
goal: ↑(↑a)⁻¹.den = a

full_name: Rat.inv_natCast_den_of_pos
code: theorem inv_natCast_den_of_pos {a : ℕ} (ha0 : 0 < a) : (a : ℚ)⁻¹.den = a 
goal: (↑a)⁻¹.den = a

full_name: Rat.inv_intCast_num
code: @[simp]
theorem inv_intCast_num (a : ℤ) : (a : ℚ)⁻¹.num = Int.sign a 
goal: (↑a)⁻¹.num = a.sign

full_name: Rat.inv_natCast_num
code: @[simp]
theorem inv_natCast_num (a : ℕ) : (a : ℚ)⁻¹.num = Int.sign a 
goal: (↑a)⁻¹.num = (↑a).sign

full_name: Rat.inv_ofNat_num
code: @[simp]
theorem inv_ofNat_num (a : ℕ) [a.AtLeastTwo] : (no_index (OfNat.ofNat a : ℚ))⁻¹.num = 1 
goal: (OfNat.ofNat a)⁻¹.num = 1

full_name: Rat.inv_intCast_den
code: @[simp]
theorem inv_intCast_den (a : ℤ) : (a : ℚ)⁻¹.den = if a = 0 then 1 else a.natAbs 
goal: (↑a)⁻¹.den = if a = 0 then 1 else a.natAbs

full_name: Rat.inv_natCast_den
code: @[simp]
theorem inv_natCast_den (a : ℕ) : (a : ℚ)⁻¹.den = if a = 0 then 1 else a 
goal: (↑a)⁻¹.den = if a = 0 then 1 else a

full_name: Rat.inv_ofNat_den
code: @[simp]
theorem inv_ofNat_den (a : ℕ) [a.AtLeastTwo] :
    (no_index (OfNat.ofNat a : ℚ))⁻¹.den = OfNat.ofNat a 
goal: (OfNat.ofNat a)⁻¹.den = OfNat.ofNat a

full_name: Rat.forall
code: protected theorem «forall» {p : ℚ → Prop} : (∀ r, p r) ↔ ∀ a b : ℤ, p (a / b) 
goal: (∀ (r : ℚ), p r) ↔ ∀ (a b : ℤ), p (↑a / ↑b)

full_name: Rat.exists
code: protected theorem «exists» {p : ℚ → Prop} : (∃ r, p r) ↔ ∃ a b : ℤ, p (a / b) 
goal: (∃ r, p r) ↔ ∃ a b, p (↑a / ↑b)

full_name: Rat.pnatDen
code: /-- Denominator as `ℕ+`. -/
def pnatDen (x : ℚ) : ℕ+ 
goal: ℕ+

full_name: Rat.coe_pnatDen
code: @[simp]
theorem coe_pnatDen (x : ℚ) : (x.pnatDen : ℕ) = x.den 
goal: ↑x.pnatDen = x.den

full_name: Rat.pnatDen_eq_iff_den_eq
code: theorem pnatDen_eq_iff_den_eq {x : ℚ} {n : ℕ+} : x.pnatDen = n ↔ x.den = ↑n 
goal: x.pnatDen = n ↔ x.den = ↑n

full_name: Rat.pnatDen_one
code: @[simp]
theorem pnatDen_one : (1 : ℚ).pnatDen = 1 
goal: Rat.pnatDen 1 = 1

full_name: Rat.pnatDen_zero
code: @[simp]
theorem pnatDen_zero : (0 : ℚ).pnatDen = 1 
goal: Rat.pnatDen 0 = 1