File: Mathlib/Data/Rat/Defs.lean

full_name: Rat.pos
code: theorem pos (a : ℚ) : 0 < a.den 
goal: 0 < a.den

full_name: Rat.mk'_num_den
code: lemma mk'_num_den (q : ℚ) : mk' q.num q.den q.den_nz q.reduced = q 
goal: { num := q.num, den := q.den, den_nz := ⋯, reduced := ⋯ } = q

full_name: Rat.ofInt_eq_cast
code: @[simp]
theorem ofInt_eq_cast (n : ℤ) : ofInt n = Int.cast n 
goal: Rat.ofInt n = ↑n

full_name: Rat.num_ofNat
code: @[simp] lemma num_ofNat (n : ℕ) : num (no_index (OfNat.ofNat n)) = OfNat.ofNat n 
goal: (OfNat.ofNat n).num = OfNat.ofNat n

full_name: Rat.den_ofNat
code: @[simp] lemma den_ofNat (n : ℕ) : den (no_index (OfNat.ofNat n)) = 1 
goal: (OfNat.ofNat n).den = 1

full_name: Rat.num_natCast
code: @[simp, norm_cast] lemma num_natCast (n : ℕ) : num n = n 
goal: (↑n).num = ↑n

full_name: Rat.den_natCast
code: @[simp, norm_cast] lemma den_natCast (n : ℕ) : den n = 1 
goal: (↑n).den = 1

full_name: Rat.num_intCast
code: @[simp, norm_cast] lemma num_intCast (n : ℤ) : (n : ℚ).num = n 
goal: (↑n).num = n

full_name: Rat.den_intCast
code: @[simp, norm_cast] lemma den_intCast (n : ℤ) : (n : ℚ).den = 1 
goal: (↑n).den = 1

full_name: Rat.intCast_injective
code: lemma intCast_injective : Injective (Int.cast : ℤ → ℚ) 
goal: Function.Injective Int.cast

full_name: Rat.natCast_injective
code: lemma natCast_injective : Injective (Nat.cast : ℕ → ℚ) 
goal: Function.Injective Nat.cast

full_name: Rat.natCast_inj
code: @[simp, nolint simpNF, norm_cast] lemma natCast_inj {m n : ℕ} : (m : ℚ) = n ↔ m = n 
goal: ↑m = ↑n ↔ m = n

full_name: Rat.intCast_eq_zero
code: @[simp, nolint simpNF, norm_cast] lemma intCast_eq_zero {n : ℤ} : (n : ℚ) = 0 ↔ n = 0 
goal: ↑n = 0 ↔ n = 0

full_name: Rat.natCast_eq_zero
code: @[simp, nolint simpNF, norm_cast] lemma natCast_eq_zero {n : ℕ} : (n : ℚ) = 0 ↔ n = 0 
goal: ↑n = 0 ↔ n = 0

full_name: Rat.intCast_eq_one
code: @[simp, nolint simpNF, norm_cast] lemma intCast_eq_one {n : ℤ} : (n : ℚ) = 1 ↔ n = 1 
goal: ↑n = 1 ↔ n = 1

full_name: Rat.natCast_eq_one
code: @[simp, nolint simpNF, norm_cast] lemma natCast_eq_one {n : ℕ} : (n : ℚ) = 1 ↔ n = 1 
goal: ↑n = 1 ↔ n = 1

full_name: Rat.mkRat_eq_divInt
code: lemma mkRat_eq_divInt (n d) : mkRat n d = n /. d 
goal: mkRat n d = Rat.divInt n ↑d

full_name: Rat.mk'_zero
code: @[simp] lemma mk'_zero (d) (h : d ≠ 0) (w) : mk' 0 d h w = 0 
goal: { num := 0, den := d, den_nz := h, reduced := w } = 0

full_name: Rat.num_eq_zero
code: @[simp]
lemma num_eq_zero {q : ℚ} : q.num = 0 ↔ q = 0 
goal: q.num = 0 ↔ q = 0

full_name: Rat.num_ne_zero
code: lemma num_ne_zero {q : ℚ} : q.num ≠ 0 ↔ q ≠ 0 
goal: q.num ≠ 0 ↔ q ≠ 0

full_name: Rat.den_ne_zero
code: @[simp] lemma den_ne_zero (q : ℚ) : q.den ≠ 0 
goal: q.den ≠ 0

full_name: Rat.num_nonneg
code: @[simp] lemma num_nonneg : 0 ≤ q.num ↔ 0 ≤ q 
goal: 0 ≤ q.num ↔ 0 ≤ q

full_name: Rat.divInt_eq_zero
code: @[simp]
theorem divInt_eq_zero {a b : ℤ} (b0 : b ≠ 0) : a /. b = 0 ↔ a = 0 
goal: Rat.divInt a b = 0 ↔ a = 0

full_name: Rat.divInt_ne_zero
code: theorem divInt_ne_zero {a b : ℤ} (b0 : b ≠ 0) : a /. b ≠ 0 ↔ a ≠ 0 
goal: Rat.divInt a b ≠ 0 ↔ a ≠ 0

full_name: Rat.normalize_eq_mk'
code: theorem normalize_eq_mk' (n : Int) (d : Nat) (h : d ≠ 0) (c : Nat.gcd (Int.natAbs n) d = 1) :
    normalize n d h = mk' n d h c 
goal: Rat.normalize n d h = { num := n, den := d, den_nz := h, reduced := c }

full_name: Rat.num_divInt_den
code: lemma num_divInt_den (q : ℚ) : q.num /. q.den = q 
goal: Rat.divInt q.num ↑q.den = q

full_name: Rat.mk'_eq_divInt
code: lemma mk'_eq_divInt {n d h c} : (⟨n, d, h, c⟩ : ℚ) = n /. d 
goal: { num := n, den := d, den_nz := h, reduced := c } = Rat.divInt n ↑d

full_name: Rat.intCast_eq_divInt
code: theorem intCast_eq_divInt (z : ℤ) : (z : ℚ) = z /. 1 
goal: ↑z = Rat.divInt z 1

full_name: Rat.divInt_self'
code: @[simp] lemma divInt_self' {n : ℤ} (hn : n ≠ 0) : n /. n = 1 
goal: Rat.divInt n n = 1

full_name: Rat.numDenCasesOn
code: /-- Define a (dependent) function or prove `∀ r : ℚ, p r` by dealing with rational
numbers of the form `n /. d` with `0 < d` and coprime `n`, `d`. -/
@[elab_as_elim]
def numDenCasesOn.{u} {C : ℚ → Sort u} :
    ∀ (a : ℚ) (_ : ∀ n d, 0 < d → (Int.natAbs n).Coprime d → C (n /. d)), C a
  
goal: ((n : ℤ) → (d : ℕ) → 0 < d → n.natAbs.Coprime d → C (Rat.divInt n ↑d)) → C a

full_name: Rat.numDenCasesOn'
code: /-- Define a (dependent) function or prove `∀ r : ℚ, p r` by dealing with rational
numbers of the form `n /. d` with `d ≠ 0`. -/
@[elab_as_elim]
def numDenCasesOn'.{u} {C : ℚ → Sort u} (a : ℚ) (H : ∀ (n : ℤ) (d : ℕ), d ≠ 0 → C (n /. d)) :
    C a 
goal: C a

full_name: Rat.numDenCasesOn''
code: /-- Define a (dependent) function or prove `∀ r : ℚ, p r` by dealing with rational
numbers of the form `mk' n d` with `d ≠ 0`. -/
@[elab_as_elim]
def numDenCasesOn''.{u} {C : ℚ → Sort u} (a : ℚ)
    (H : ∀ (n : ℤ) (d : ℕ) (nz red), C (mk' n d nz red)) : C a 
goal: C a

full_name: Rat.lift_binop_eq
code: theorem lift_binop_eq (f : ℚ → ℚ → ℚ) (f₁ : ℤ → ℤ → ℤ → ℤ → ℤ) (f₂ : ℤ → ℤ → ℤ → ℤ → ℤ)
    (fv :
      ∀ {n₁ d₁ h₁ c₁ n₂ d₂ h₂ c₂},
        f ⟨n₁, d₁, h₁, c₁⟩ ⟨n₂, d₂, h₂, c₂⟩ = f₁ n₁ d₁ n₂ d₂ /. f₂ n₁ d₁ n₂ d₂)
    (f0 : ∀ {n₁ d₁ n₂ d₂}, d₁ ≠ 0 → d₂ ≠ 0 → f₂ n₁ d₁ n₂ d₂ ≠ 0) (a b c d : ℤ)
    (b0 : b ≠ 0) (d0 : d ≠ 0)
    (H :
      ∀ {n₁ d₁ n₂ d₂}, a * d₁ = n₁ * b → c * d₂ = n₂ * d →
        f₁ n₁ d₁ n₂ d₂ * f₂ a b c d = f₁ a b c d * f₂ n₁ d₁ n₂ d₂) :
    f (a /. b) (c /. d) = f₁ a b c d /. f₂ a b c d 
goal: f (Rat.divInt a b) (Rat.divInt c d) = Rat.divInt (f₁ a b c d) (f₂ a b c d)

full_name: Rat.add_def''
code: @[deprecated divInt_add_divInt (since := "2024-03-18")]
theorem add_def'' {a b c d : ℤ} (b0 : b ≠ 0) (d0 : d ≠ 0) :
    a /. b + c /. d = (a * d + c * b) /. (b * d) 
goal: Rat.divInt a b + Rat.divInt c d = Rat.divInt (a * d + c * b) (b * d)

full_name: Rat.neg_def
code: lemma neg_def (q : ℚ) : -q = -q.num /. q.den 
goal: -q = Rat.divInt (-q.num) ↑q.den

full_name: Rat.divInt_neg
code: @[simp] lemma divInt_neg (n d : ℤ) : n /. -d = -n /. d 
goal: Rat.divInt n (-d) = Rat.divInt (-n) d

full_name: Rat.sub_def''
code: @[deprecated divInt_sub_divInt (since := "2024-03-18")]
lemma sub_def'' {a b c d : ℤ} (b0 : b ≠ 0) (d0 : d ≠ 0) :
    a /. b - c /. d = (a * d - c * b) /. (b * d) 
goal: Rat.divInt a b - Rat.divInt c d = Rat.divInt (a * d - c * b) (b * d)

full_name: Rat.divInt_mul_divInt'
code: @[simp]
lemma divInt_mul_divInt' (n₁ d₁ n₂ d₂ : ℤ) : (n₁ /. d₁) * (n₂ /. d₂) = (n₁ * n₂) /. (d₁ * d₂) 
goal: Rat.divInt n₁ d₁ * Rat.divInt n₂ d₂ = Rat.divInt (n₁ * n₂) (d₁ * d₂)

full_name: Rat.mk'_mul_mk'
code: lemma mk'_mul_mk' (n₁ n₂ : ℤ) (d₁ d₂ : ℕ) (hd₁ hd₂ hnd₁ hnd₂) (h₁₂ : n₁.natAbs.Coprime d₂)
    (h₂₁ : n₂.natAbs.Coprime d₁) :
    mk' n₁ d₁ hd₁ hnd₁ * mk' n₂ d₂ hd₂ hnd₂ = mk' (n₁ * n₂) (d₁ * d₂) (Nat.mul_ne_zero hd₁ hd₂) (by
      rw [Int.natAbs_mul]; exact (hnd₁.mul h₂₁).mul_right (h₁₂.mul hnd₂)) 
goal: { num := n₁, den := d₁, den_nz := hd₁, reduced := hnd₁ } * { num := n₂, den := d₂, den_nz := hd₂, reduced := hnd₂ } =
  { num := n₁ * n₂, den := d₁ * d₂, den_nz := ⋯, reduced := ⋯ }

full_name: Rat.mul_eq_mkRat
code: lemma mul_eq_mkRat (q r : ℚ) : q * r = mkRat (q.num * r.num) (q.den * r.den) 
goal: q * r = mkRat (q.num * r.num) (q.den * r.den)

full_name: Rat.instPowNat
code: instance instPowNat : Pow ℚ ℕ 
goal: Pow ℚ ℕ

full_name: Rat.pow_def
code: lemma pow_def (q : ℚ) (n : ℕ) :
    q ^ n = ⟨q.num ^ n, q.den ^ n,
      by simp [Nat.pow_eq_zero],
      by rw [Int.natAbs_pow]; exact q.reduced.pow _ _⟩ 
goal: q ^ n = { num := q.num ^ n, den := q.den ^ n, den_nz := ⋯, reduced := ⋯ }

full_name: Rat.pow_eq_mkRat
code: lemma pow_eq_mkRat (q : ℚ) (n : ℕ) : q ^ n = mkRat (q.num ^ n) (q.den ^ n) 
goal: q ^ n = mkRat (q.num ^ n) (q.den ^ n)

full_name: Rat.pow_eq_divInt
code: lemma pow_eq_divInt (q : ℚ) (n : ℕ) : q ^ n = q.num ^ n /. q.den ^ n 
goal: q ^ n = Rat.divInt (q.num ^ n) (↑q.den ^ n)

full_name: Rat.num_pow
code: @[simp] lemma num_pow (q : ℚ) (n : ℕ) : (q ^ n).num = q.num ^ n 
goal: (q ^ n).num = q.num ^ n

full_name: Rat.den_pow
code: @[simp] lemma den_pow (q : ℚ) (n : ℕ) : (q ^ n).den = q.den ^ n 
goal: (q ^ n).den = q.den ^ n

full_name: Rat.mk'_pow
code: @[simp] lemma mk'_pow (num : ℤ) (den : ℕ) (hd hdn) (n : ℕ) :
    mk' num den hd hdn ^ n = mk' (num ^ n) (den ^ n)
      (by simp [Nat.pow_eq_zero, hd]) (by rw [Int.natAbs_pow]; exact hdn.pow _ _) 
goal: { num := num, den := den, den_nz := hd, reduced := hdn } ^ n =
  { num := num ^ n, den := den ^ n, den_nz := ⋯, reduced := ⋯ }

full_name: Rat.instInv
code: instance : Inv ℚ 
goal: Inv ℚ

full_name: Rat.inv_divInt'
code: @[simp] lemma inv_divInt' (a b : ℤ) : (a /. b)⁻¹ = b /. a 
goal: (Rat.divInt a b)⁻¹ = Rat.divInt b a

full_name: Rat.inv_mkRat
code: @[simp] lemma inv_mkRat (a : ℤ) (b : ℕ) : (mkRat a b)⁻¹ = b /. a 
goal: (mkRat a b)⁻¹ = Rat.divInt (↑b) a

full_name: Rat.inv_def'
code: lemma inv_def' (q : ℚ) : q⁻¹ = q.den /. q.num 
goal: q⁻¹ = Rat.divInt (↑q.den) q.num

full_name: Rat.divInt_div_divInt
code: @[simp] lemma divInt_div_divInt (n₁ d₁ n₂ d₂) :
    (n₁ /. d₁) / (n₂ /. d₂) = (n₁ * d₂) /. (d₁ * n₂) 
goal: Rat.divInt n₁ d₁ / Rat.divInt n₂ d₂ = Rat.divInt (n₁ * d₂) (d₁ * n₂)

full_name: Rat.div_def'
code: lemma div_def' (q r : ℚ) : q / r = (q.num * r.den) /. (q.den * r.num) 
goal: q / r = Rat.divInt (q.num * ↑r.den) (↑q.den * r.num)

full_name: Rat.add_zero
code: protected lemma add_zero : a + 0 = a 
goal: a + 0 = a

full_name: Rat.zero_add
code: protected lemma zero_add : 0 + a = a 
goal: 0 + a = a

full_name: Rat.add_comm
code: protected lemma add_comm : a + b = b + a 
goal: a + b = b + a

full_name: Rat.add_assoc
code: protected theorem add_assoc : a + b + c = a + (b + c) 
goal: a + b + c = a + (b + c)

full_name: Rat.add_left_neg
code: protected lemma add_left_neg : -a + a = 0 
goal: -a + a = 0

full_name: Rat.divInt_zero_one
code: @[deprecated zero_divInt (since := "2024-03-18")]
lemma divInt_zero_one : 0 /. 1 = 0 
goal: Rat.divInt 0 1 = 0

full_name: Rat.divInt_one
code: @[simp] lemma divInt_one (n : ℤ) : n /. 1 = n 
goal: Rat.divInt n 1 = ↑n

full_name: Rat.mkRat_one
code: @[simp] lemma mkRat_one (n : ℤ) : mkRat n 1 = n 
goal: mkRat n 1 = ↑n

full_name: Rat.divInt_one_one
code: lemma divInt_one_one : 1 /. 1 = 1 
goal: Rat.divInt 1 1 = 1

full_name: Rat.divInt_neg_one_one
code: @[deprecated divInt_one (since := "2024-03-18")]
lemma divInt_neg_one_one : -1 /. 1 = -1 
goal: Rat.divInt (-1) 1 = -1

full_name: Rat.mul_assoc
code: protected theorem mul_assoc : a * b * c = a * (b * c) 
goal: a * b * c = a * (b * c)

full_name: Rat.add_mul
code: protected theorem add_mul : (a + b) * c = a * c + b * c 
goal: (a + b) * c = a * c + b * c

full_name: Rat.mul_add
code: protected theorem mul_add : a * (b + c) = a * b + a * c 
goal: a * (b + c) = a * b + a * c

full_name: Rat.zero_ne_one
code: protected theorem zero_ne_one : 0 ≠ (1 : ℚ) 
goal: 0 ≠ 1

full_name: Rat.mul_inv_cancel
code: protected theorem mul_inv_cancel : a ≠ 0 → a * a⁻¹ = 1 
goal: a ≠ 0 → a * a⁻¹ = 1

full_name: Rat.inv_mul_cancel
code: protected theorem inv_mul_cancel (h : a ≠ 0) : a⁻¹ * a = 1 
goal: a⁻¹ * a = 1

full_name: Rat.nontrivial
code: instance nontrivial : Nontrivial ℚ 
goal: Nontrivial ℚ

full_name: Rat.addCommGroup
code: instance addCommGroup : AddCommGroup ℚ 
goal: AddCommGroup ℚ

full_name: Rat.addGroup
code: instance addGroup : AddGroup ℚ 
goal: AddGroup ℚ

full_name: Rat.addCommMonoid
code: instance addCommMonoid : AddCommMonoid ℚ 
goal: AddCommMonoid ℚ

full_name: Rat.addMonoid
code: instance addMonoid : AddMonoid ℚ 
goal: AddMonoid ℚ

full_name: Rat.addLeftCancelSemigroup
code: instance addLeftCancelSemigroup : AddLeftCancelSemigroup ℚ 
goal: AddLeftCancelSemigroup ℚ

full_name: Rat.addRightCancelSemigroup
code: instance addRightCancelSemigroup : AddRightCancelSemigroup ℚ 
goal: AddRightCancelSemigroup ℚ

full_name: Rat.addCommSemigroup
code: instance addCommSemigroup : AddCommSemigroup ℚ 
goal: AddCommSemigroup ℚ

full_name: Rat.addSemigroup
code: instance addSemigroup : AddSemigroup ℚ 
goal: AddSemigroup ℚ

full_name: Rat.commMonoid
code: instance commMonoid : CommMonoid ℚ 
goal: CommMonoid ℚ

full_name: Rat.monoid
code: instance monoid : Monoid ℚ 
goal: Monoid ℚ

full_name: Rat.commSemigroup
code: instance commSemigroup : CommSemigroup ℚ 
goal: CommSemigroup ℚ

full_name: Rat.semigroup
code: instance semigroup : Semigroup ℚ 
goal: Semigroup ℚ

full_name: Rat.eq_iff_mul_eq_mul
code: theorem eq_iff_mul_eq_mul {p q : ℚ} : p = q ↔ p.num * q.den = q.num * p.den 
goal: p = q ↔ p.num * ↑q.den = q.num * ↑p.den

full_name: Rat.den_neg_eq_den
code: @[simp]
theorem den_neg_eq_den (q : ℚ) : (-q).den = q.den 
goal: (-q).den = q.den

full_name: Rat.num_neg_eq_neg_num
code: @[simp]
theorem num_neg_eq_neg_num (q : ℚ) : (-q).num = -q.num 
goal: (-q).num = -q.num

full_name: Rat.num_zero
code: @[simp]
theorem num_zero : Rat.num 0 = 0 
goal: Rat.num 0 = 0

full_name: Rat.den_zero
code: @[simp]
theorem den_zero : Rat.den 0 = 1 
goal: Rat.den 0 = 1

full_name: Rat.zero_of_num_zero
code: lemma zero_of_num_zero {q : ℚ} (hq : q.num = 0) : q = 0 
goal: q = 0

full_name: Rat.zero_iff_num_zero
code: theorem zero_iff_num_zero {q : ℚ} : q = 0 ↔ q.num = 0 
goal: q = 0 ↔ q.num = 0

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

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

full_name: Rat.mk_num_ne_zero_of_ne_zero
code: theorem mk_num_ne_zero_of_ne_zero {q : ℚ} {n d : ℤ} (hq : q ≠ 0) (hqnd : q = n /. d) : n ≠ 0 
goal: n ≠ 0

full_name: Rat.mk_denom_ne_zero_of_ne_zero
code: theorem mk_denom_ne_zero_of_ne_zero {q : ℚ} {n d : ℤ} (hq : q ≠ 0) (hqnd : q = n /. d) : d ≠ 0 
goal: d ≠ 0

full_name: Rat.divInt_ne_zero_of_ne_zero
code: theorem divInt_ne_zero_of_ne_zero {n d : ℤ} (h : n ≠ 0) (hd : d ≠ 0) : n /. d ≠ 0 
goal: Rat.divInt n d ≠ 0

full_name: Rat.nonneg_antisymm
code: protected lemma nonneg_antisymm : 0 ≤ q → 0 ≤ -q → q = 0 
goal: 0 ≤ q → 0 ≤ -q → q = 0

full_name: Rat.nonneg_total
code: protected lemma nonneg_total (a : ℚ) : 0 ≤ a ∨ 0 ≤ -a 
goal: 0 ≤ a ∨ 0 ≤ -a

full_name: Rat.add_divInt
code: protected theorem add_divInt (a b c : ℤ) : (a + b) /. c = a /. c + b /. c 
goal: Rat.divInt (a + b) c = Rat.divInt a c + Rat.divInt b c

full_name: Rat.divInt_eq_div
code: theorem divInt_eq_div (n d : ℤ) : n /. d = (n : ℚ) / d 
goal: Rat.divInt n d = ↑n / ↑d

full_name: Rat.intCast_div_eq_divInt
code: lemma intCast_div_eq_divInt (n d : ℤ) : (n : ℚ) / (d) = n /. d 
goal: ↑n / ↑d = Rat.divInt n d

full_name: Rat.natCast_div_eq_divInt
code: theorem natCast_div_eq_divInt (n d : ℕ) : (n : ℚ) / d = n /. d 
goal: ↑n / ↑d = Rat.divInt ↑n ↑d

full_name: Rat.divInt_mul_divInt_cancel
code: theorem divInt_mul_divInt_cancel {x : ℤ} (hx : x ≠ 0) (n d : ℤ) : n /. x * (x /. d) = n /. d 
goal: Rat.divInt n x * Rat.divInt x d = Rat.divInt n d

full_name: Rat.coe_int_num_of_den_eq_one
code: theorem coe_int_num_of_den_eq_one {q : ℚ} (hq : q.den = 1) : (q.num : ℚ) = q 
goal: ↑q.num = q

full_name: Rat.eq_num_of_isInt
code: lemma eq_num_of_isInt {q : ℚ} (h : q.isInt) : q = q.num 
goal: q = ↑q.num

full_name: Rat.den_eq_one_iff
code: theorem den_eq_one_iff (r : ℚ) : r.den = 1 ↔ ↑r.num = r 
goal: r.den = 1 ↔ ↑r.num = r

full_name: Rat.canLift
code: instance canLift : CanLift ℚ ℤ (↑) fun q => q.den = 1 
goal: CanLift ℚ ℤ Int.cast fun q => q.den = 1

full_name: Rat.coe_int_inj
code: theorem coe_int_inj (m n : ℤ) : (m : ℚ) = n ↔ m = n 
goal: ↑m = ↑n ↔ m = n